vasturiano / timelines-chart

Timelines Chart
http://vasturiano.github.io/timelines-chart/example/categorical/
MIT License
556 stars 121 forks source link

Color legend values that are not in current view. #87

Open MariasStory opened 3 years ago

MariasStory commented 3 years ago

Hi, how to remove from color legend values that are not in current view.

vasturiano commented 3 years ago

@MariasStory thanks for reaching out.

The elements in the legend always include all the unique items found in the data passed to the component. If the user zooms in to an area, the legend intentionally doesn't change to exclude items not in view as that is potentially disorienting for the user.

In any case, you can always provide a smaller data set to the component that only includes your desired elements so that the legend updates.

nicolas-bonnel commented 3 years ago

Hi,

I want to perform a selection on a group with an external component (kind of autocomplete). When I recalculate data and update the chart, I still have elements in the legend at the top that are not in new data anymore. I'm updating the chart with the following instruction:

chart.data(data).maxHeight(height).refresh()