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