|
|
@ -11,14 +11,13 @@ const CROSSHAIR_BACKGROUND_OPACITY = 0.3; |
|
|
|
|
|
|
|
|
|
|
|
export class LinePod extends ChartwerkPod<LineTimeSerie, LineOptions> { |
|
|
|
export class LinePod extends ChartwerkPod<LineTimeSerie, LineOptions> { |
|
|
|
lineGenerator = null; |
|
|
|
lineGenerator = null; |
|
|
|
metricContainer = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(_el: HTMLElement, _series: LineTimeSerie[] = [], _options: LineOptions = {}) { |
|
|
|
constructor(_el: HTMLElement, _series: LineTimeSerie[] = [], _options: LineOptions = {}) { |
|
|
|
super(d3, _el, _series, _options); |
|
|
|
super(d3, _el, _series, _options); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderMetrics(): void { |
|
|
|
renderMetrics(): void { |
|
|
|
this.d3.select('.metrics-container').remove(); |
|
|
|
this.clearAllMetrics(); |
|
|
|
|
|
|
|
|
|
|
|
this.updateCrosshair(); |
|
|
|
this.updateCrosshair(); |
|
|
|
this.initLineGenerator(); |
|
|
|
this.initLineGenerator(); |
|
|
@ -29,18 +28,6 @@ export class LinePod extends ChartwerkPod<LineTimeSerie, LineOptions> { |
|
|
|
return; |
|
|
|
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) { |
|
|
|
for(let idx = 0; idx < this.series.length; ++idx) { |
|
|
|
if(this.series[idx].visible === false) { |
|
|
|
if(this.series[idx].visible === false) { |
|
|
|
continue; |
|
|
|
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 { |
|
|
|
initLineGenerator(): void { |
|
|
|
this.lineGenerator = this.d3.line() |
|
|
|
this.lineGenerator = this.d3.line() |
|
|
|
.x(d => this.xScale(d[0])) |
|
|
|
.x(d => this.xScale(d[0])) |
|
|
|