Scatterplot fixes (#11041)

This commit is contained in:
marthasharkey 2024-09-11 15:03:40 +01:00 committed by GitHub
parent a33376c8d7
commit 4ac59827df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -541,7 +541,7 @@ watchPostEffect(() => {
.duration(animationDuration.value)
.attr(
'd',
symbol.type(matchShape).size((d) => (d.size ?? 1.0) * SIZE_SCALE_MULTIPLER),
symbol.type(matchShape).size((d) => (d.size ?? 0.15) * SIZE_SCALE_MULTIPLER),
)
.style('fill', (d) => colorScale(d.series || ''))
.attr('transform', (d) => `translate(${xScale_(d.x)}, ${yScale_(d.y)})`)
@ -556,6 +556,9 @@ watchPostEffect(() => {
.attr('x', (d) => xScale_(d.x) + POINT_LABEL_PADDING_X_PX)
.attr('y', (d) => yScale_(d.y) + POINT_LABEL_PADDING_Y_PX)
}
})
watchPostEffect(() => {
if (data.value.is_multi_series) {
const seriesLabels = Object.keys(data.value.axis)
.filter((s) => s != 'x')
@ -571,9 +574,10 @@ watchPostEffect(() => {
.range(d3.schemeCategory10)
.domain(seriesLabels)
const legend = d3Legend.value
d3Legend.value.selectAll('circle').remove()
d3Legend.value.selectAll('text').remove()
legend
d3Legend.value
.selectAll('dots')
.data(seriesLabels)
.enter()
@ -585,7 +589,7 @@ watchPostEffect(() => {
.attr('r', 6)
.style('fill', (d) => color(d) || DEFAULT_FILL_COLOR)
legend
d3Legend.value
.selectAll('labels')
.data(seriesLabels)
.enter()
@ -664,7 +668,7 @@ useEvent(document, 'keydown', bindings.handler({ zoomToSelected: () => zoomToSel
<VisualizationContainer :belowToolbar="true">
<template #toolbar>
<SvgButton
name="add"
name="select"
title="Enable Selection"
@click="selectionEnabled = !selectionEnabled"
/>