|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
import { TimeSerie, Options, yAxisOrientation } from './types'; |
|
|
|
|
|
|
|
|
|
// we import only d3 types here
|
|
|
|
|
import * as d3 from 'd3'; |
|
|
|
|
|
|
|
|
|
import cloneDeep from 'lodash/cloneDeep'; |
|
|
|
@ -33,7 +32,6 @@ export class PodState<T extends TimeSerie, O extends Options> {
|
|
|
|
|
private _y1Scale: d3.ScaleLinear<number, number>; |
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
|
protected _d3: typeof d3, |
|
|
|
|
protected boxParams: { height: number, width: number }, |
|
|
|
|
protected series: T[], |
|
|
|
|
protected options: O, |
|
|
|
@ -60,14 +58,14 @@ export class PodState<T extends TimeSerie, O extends Options> {
|
|
|
|
|
if(this.options.axis.y.invert === true) { |
|
|
|
|
domain = reverse(domain); |
|
|
|
|
} |
|
|
|
|
this._yScale = this._d3.scaleLinear() |
|
|
|
|
this._yScale = d3.scaleLinear() |
|
|
|
|
.domain(domain) |
|
|
|
|
.range([this.boxParams.height, 0]); // inversed, because d3 y-axis goes from top to bottom;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected setXScale(): void { |
|
|
|
|
const domain = this._xValueRange; |
|
|
|
|
this._xScale = this._d3.scaleLinear() |
|
|
|
|
this._xScale = d3.scaleLinear() |
|
|
|
|
.domain(domain) |
|
|
|
|
.range([0, this.boxParams.width]); |
|
|
|
|
} |
|
|
|
@ -78,7 +76,7 @@ export class PodState<T extends TimeSerie, O extends Options> {
|
|
|
|
|
if(this.options.axis.y1.invert === true) { |
|
|
|
|
domain = reverse(domain); |
|
|
|
|
} |
|
|
|
|
this._y1Scale = this._d3.scaleLinear() |
|
|
|
|
this._y1Scale = d3.scaleLinear() |
|
|
|
|
.domain(domain) |
|
|
|
|
.range([this.boxParams.height, 0]); // inversed, because d3 y-axis goes from top to bottom
|
|
|
|
|
} |
|
|
|
|