Programmatically toggle series visibility #261
Expose new functions to toggle series visibility:
showSeries: (name: string) => void
hideSeries: (name: string) => voidSet a ref on your chart component to call exposed methods:
<VueUiXy ref="chart" :dataset="dataset" :config="config" />Example:
const chart = ref(null); // Add this ref on the chart component
function showSeriesByName(name) {
if (!chart.value) return;
chart.value.showSeries(name);
}
function hideSeriesByName(name) {
if (!chart.value) return;
chart.value.hideSeries(name);
}Components affected:
- VueUiDonut
- VueUiDonutEvolution
- VueUiGalaxy
- VueUiHistoryPlot
- VueUiHorizontalBar
- VueUiNestedDonuts
- VueUiOnion
- VueUiParallelCoordinatePlot
- VueUiQuadrant
- VueUiRadar
- VueUiRidgeline
- VueUiRings
- VueUiScatter
- VueUiSparkStackbar
- VueUiStackbar
- VueUiTreemap
- VueUiWaffle
- VueUiXy
- VueUiXyCanvas