|
|
|
@ -807,37 +807,6 @@ abstract class ChartwerkPod<T extends Serie, O extends Options> {
|
|
|
|
|
this.options.callbackZoomOut(centers); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getd3TimeRangeEvery(count: number): d3.TimeInterval { |
|
|
|
|
if(this.options.allOptions.timeInterval.timeFormat === undefined) { |
|
|
|
|
return d3.timeMinute.every(count); |
|
|
|
|
} |
|
|
|
|
switch(this.options.allOptions.timeInterval.timeFormat) { |
|
|
|
|
case TimeFormat.SECOND: |
|
|
|
|
return d3.utcSecond.every(count); |
|
|
|
|
case TimeFormat.MINUTE: |
|
|
|
|
return d3.utcMinute.every(count); |
|
|
|
|
case TimeFormat.HOUR: |
|
|
|
|
return d3.utcHour.every(count); |
|
|
|
|
case TimeFormat.DAY: |
|
|
|
|
return d3.utcDay.every(count); |
|
|
|
|
case TimeFormat.MONTH: |
|
|
|
|
return d3.utcMonth.every(count); |
|
|
|
|
case TimeFormat.YEAR: |
|
|
|
|
return d3.utcYear.every(count); |
|
|
|
|
default: |
|
|
|
|
return d3.utcMinute.every(count); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
get serieTimestampRange(): number | undefined { |
|
|
|
|
if(!this.series.isSeriesAvailable) { |
|
|
|
|
return undefined; |
|
|
|
|
} |
|
|
|
|
const startTimestamp = first(this.series.visibleSeries[0].datapoints)[0]; |
|
|
|
|
const endTimestamp = last(this.series.visibleSeries[0].datapoints)[0]; |
|
|
|
|
return (endTimestamp - startTimestamp) / 1000; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getAxisTicksFormatter(axisOptions: AxisOption): (d: any, i: number) => any { |
|
|
|
|
// TODO: ticksCount === 0 -> suspicious option
|
|
|
|
|
if(axisOptions.ticksCount === 0) { |
|
|
|
@ -868,18 +837,6 @@ abstract class ChartwerkPod<T extends Serie, O extends Options> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
get timeInterval(): number { |
|
|
|
|
if(this.series.isSeriesAvailable && this.series.visibleSeries[0].datapoints.length > 1) { |
|
|
|
|
const interval = this.series.visibleSeries[0].datapoints[1][0] - this.series.visibleSeries[0].datapoints[0][0]; |
|
|
|
|
return interval; |
|
|
|
|
} |
|
|
|
|
if(this.options.allOptions.timeInterval.count !== undefined) { |
|
|
|
|
//TODO: timeFormat to timestamp
|
|
|
|
|
return this.options.allOptions.timeInterval.count * MILISECONDS_IN_MINUTE; |
|
|
|
|
} |
|
|
|
|
return MILISECONDS_IN_MINUTE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
get width(): number { |
|
|
|
|
return this.d3Node.node().clientWidth - this.margin.left - this.margin.right; |
|
|
|
|
} |
|
|
|
|