Forum > TAChart

[solved] How to hide/show series in a TChartListBox?

(1/1)

Muso:
I have a chart with many series. The user should can hide/show them in the chart, but he should also be able to filter series to select them for certain purposes.

Therefore I have a TChartListBox in a dialog. When the user presses in the dialog a button, then for example only series with the name "Start_XXX" should be shown in the TChartListBox. This visibility change should only happen in the TChartListBox, not in the chart.

Is this possible and if so, how?

wp:
The chartlistbox is re-populated at a variety of occasions. Whenever this happens events OnAddSeries are fired before a series is added to the listbox. These events have a boolean parameter Skip which you can set to true if you want to avoid having this series in the listbox.

Muso:

--- Quote from: wp on February 21, 2022, 09:52:17 pm ---These events have a boolean parameter Skip which you can set to true if you want to avoid having this series in the listbox.

--- End quote ---

I use the method already. But the use case here is that OnAddSeries is not triggered. I open a dialog containing the TChartListBox and depending on the settings the user do in this dialog, the TChartListBox should display certain series. The connected chart should not be changed. Therefore I need a way to show/hide series in this particular TChartListBox without touching the chart, meaning OnAddSeries will not fire.

wp:
You can manually re-populate the listbox by calling the TChartListBox method Populate()(. See attached demo.

Muso:

--- Quote from: wp on February 22, 2022, 04:34:04 pm ---You can manually re-populate the listbox by calling the TChartListBox method Populate()(. See attached demo.

--- End quote ---

Many thanks! Populate was what I was looking for. This works fine.

Navigation

[0] Message Index

Go to full version