|
|
|
@ -130,7 +130,7 @@ export class ChartwerkScatterPod extends ChartwerkPod<ScatterData, ScatterOption
|
|
|
|
|
.filter((d: number[]) => this.series[_.last(d)].pointType !== PointType.RECTANGLE) |
|
|
|
|
.attr('class', (d, i: number) => `metric-element metric-circle point-${i}`) |
|
|
|
|
.attr('r', (d: number[]) => this.series[_.last(d)].pointSize || DEFAULT_POINT_SIZE) |
|
|
|
|
.style('fill', (d: number[]) => this.getSerieColor(_.last(d))) |
|
|
|
|
.style('fill', (d: number[], i: number) => this.getSeriesColorFromDataRow(d, i)) |
|
|
|
|
.style('pointer-events', 'none') |
|
|
|
|
.attr('cx', (d: any[]) => this.xScale(d[0])) |
|
|
|
|
.attr('cy', (d: any[]) => this.getYScale(this.series[_.last(d)].yOrientation)(d[1])); |
|
|
|
@ -150,6 +150,14 @@ export class ChartwerkScatterPod extends ChartwerkPod<ScatterData, ScatterOption
|
|
|
|
|
.attr('height', (d: number[]) => this.series[_.last(d)].pointSize || DEFAULT_POINT_SIZE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getSeriesColorFromDataRow(values: number[], rowIdx: number): string { |
|
|
|
|
const seriesIdx = _.last(values); |
|
|
|
|
if(this.series[seriesIdx].colorFormatter) { |
|
|
|
|
return this.series[seriesIdx].colorFormatter(values, rowIdx); |
|
|
|
|
} |
|
|
|
|
return this.getSerieColor(seriesIdx); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onPanningEnd(): void { |
|
|
|
|
this.isPanning = false; |
|
|
|
|
this.onMouseOut(); |
|
|
|
@ -176,13 +184,12 @@ export class ChartwerkScatterPod extends ChartwerkPod<ScatterData, ScatterOption
|
|
|
|
|
const serieIdx = _.last(datapoint); |
|
|
|
|
const serieOrientation = this.series[serieIdx].yOrientation; |
|
|
|
|
const size = this.getCrosshairCircleBackgroundSize(serieIdx); |
|
|
|
|
const colorFormatter = this.series[serieIdx].colorFormatter; |
|
|
|
|
this.crosshair.selectAll(`.crosshair-point-${serieIdx}`) |
|
|
|
|
.attr('cx', this.xScale(datapoint[0])) |
|
|
|
|
.attr('cy', this.getYScale(serieOrientation)(datapoint[1])) |
|
|
|
|
.attr('x', this.xScale(datapoint[0]) - size / 2) |
|
|
|
|
.attr('y', this.getYScale(serieOrientation)(datapoint[1]) - size / 2) |
|
|
|
|
.attr('fill', colorFormatter !== undefined ? colorFormatter(datapoint) : this.series[serieIdx].color) |
|
|
|
|
.attr('fill', this.getSeriesColorFromDataRow(datapoint, pointIdx)) |
|
|
|
|
.style('display', null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|