|
|
|
@ -11,14 +11,13 @@ const CROSSHAIR_BACKGROUND_OPACITY = 0.3;
|
|
|
|
|
|
|
|
|
|
export class LinePod extends ChartwerkPod<LineTimeSerie, LineOptions> { |
|
|
|
|
lineGenerator = null; |
|
|
|
|
metricContainer = null; |
|
|
|
|
|
|
|
|
|
constructor(_el: HTMLElement, _series: LineTimeSerie[] = [], _options: LineOptions = {}) { |
|
|
|
|
super(d3, _el, _series, _options); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
renderMetrics(): void { |
|
|
|
|
this.d3.select('.metrics-container').remove(); |
|
|
|
|
this.clearAllMetrics(); |
|
|
|
|
|
|
|
|
|
this.updateCrosshair(); |
|
|
|
|
this.initLineGenerator(); |
|
|
|
@ -29,18 +28,6 @@ export class LinePod extends ChartwerkPod<LineTimeSerie, LineOptions> {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// TODO: move to core, and create only one container
|
|
|
|
|
// container for clip path
|
|
|
|
|
const clipContatiner = this.chartContainer |
|
|
|
|
.append('g') |
|
|
|
|
.attr('clip-path', `url(#${this.rectClipId})`) |
|
|
|
|
.attr('class', 'metrics-container'); |
|
|
|
|
|
|
|
|
|
// container for panning
|
|
|
|
|
this.metricContainer = clipContatiner |
|
|
|
|
.append('g') |
|
|
|
|
.attr('class', 'metrics-rect') |
|
|
|
|
|
|
|
|
|
for(let idx = 0; idx < this.series.length; ++idx) { |
|
|
|
|
if(this.series[idx].visible === false) { |
|
|
|
|
continue; |
|
|
|
@ -67,6 +54,11 @@ export class LinePod extends ChartwerkPod<LineTimeSerie, LineOptions> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
clearAllMetrics(): void { |
|
|
|
|
// TODO: temporary hack before it will be implemented in core.
|
|
|
|
|
this.d3.selectAll('.metric-el').remove(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
initLineGenerator(): void { |
|
|
|
|
this.lineGenerator = this.d3.line() |
|
|
|
|
.x(d => this.xScale(d[0])) |
|
|
|
|