Skip to content

[FEATURE REQUEST] Add methods to programmatically show and hide series #261

@dennismeister93

Description

@dennismeister93

Is your feature request related to a problem? Please describe.
I need to programmatically control the visibility of series in some of the components I am using (vue-ui-xy, vue-stackbar) from a parent component. Currently, there's no way to show or hide specific series by name without manually triggering the legend click events or manipulating internal state.

Describe the solution you'd like
I would like to add two new methods to the component. (starting with vue-ui-xy, vue-stackbar): showSeries(name) and hideSeries(name). These methods would allow parent components to programmatically control series visibility by passing the series name as a parameter. The methods should:

  • Find the series by name in the dataset
  • Toggle its visibility state (show/hide)
  • Update the legend to reflect the change
  • Ensure the chart and table data are updated accordingly

Additional context
This feature would be particularly useful for:

  • Loading specific series based on URL parameters
  • Dynamic dashboards where series need to be shown/hidden based on user interactions
  • Conditional rendering based on data availability
  • Automated testing scenarios
  • Integration with external controls or filters

The methods could probably look like:

function showSeries(name) {
    const series = absoluteDataset.value.find(s => s.name === name);
    if (series && segregatedSeries.value.includes(series.id)) {
        segregate(series); 
    }
}

function hideSeries(name) {
    const series = absoluteDataset.value.find(s => s.name === name);
    if (series && !segregatedSeries.value.includes(series.id)) {
        segregate(series);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions