|
|
@ -213,23 +213,21 @@ export class ChartwerkBarPod extends ChartwerkPod<BarTimeSerie, BarOptions> { |
|
|
|
if(this.series === undefined || this.series.length === 0) { |
|
|
|
if(this.series === undefined || this.series.length === 0) { |
|
|
|
return undefined; |
|
|
|
return undefined; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const mouseDate = Math.ceil(this.xScale.invert(eventX)); |
|
|
|
|
|
|
|
|
|
|
|
const bisectDate = this.d3.bisector((d: [number, number]) => d[1]).left; |
|
|
|
const zippedData = this.getZippedDataForRender(this.visibleSeries); |
|
|
|
const mouseDate = this.xScale.invert(eventX); |
|
|
|
// get the nearest RowValues element for mouseDate
|
|
|
|
|
|
|
|
const keys = _.map(zippedData, 'key').sort((a, b) => (a - mouseDate) - (mouseDate - b)); |
|
|
|
let idx = bisectDate(this.series[0].datapoints, mouseDate) - 1; |
|
|
|
const idx = _.findIndex(zippedData, (a) => a.key == keys[0]); |
|
|
|
|
|
|
|
|
|
|
|
const series: any[] = []; |
|
|
|
const series: any[] = []; |
|
|
|
for(let i = 0; i < this.series.length; i++) { |
|
|
|
|
|
|
|
if(this.series[i].visible === false || this.series[i].datapoints.length < idx + 1) { |
|
|
|
for(let i = 0; i < zippedData[idx].values.length; i++) { |
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
series.push({ |
|
|
|
series.push({ |
|
|
|
value: this.series[i].datapoints[idx][0], |
|
|
|
value: zippedData[idx].key, |
|
|
|
xval: this.series[i].datapoints[idx][1], |
|
|
|
xval: zippedData[idx].values[i], |
|
|
|
color: this.getBarColor(this.series[i]), |
|
|
|
color: zippedData[idx].colors[i], |
|
|
|
label: this.series[i].alias || this.series[i].target |
|
|
|
label: zippedData[idx].serieTarget[i] |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
return series; |
|
|
|
return series; |
|
|
|