TChartListbox component lazarus / 55-TAChart ---------------------------------------------------------------------- wp · 2011-07-09 17:36 Acknowledging the great work that has been put into the TAChart package all over time, I decided to donate my new TChartListbox component to the project (thanks to the answers to various questions asked in the Lazarus forum). It is a listbox showing all the series of a chart. Using checkboxes it is possible to turn on/off individual series. A radiobutton behavior to show only a single series has been implemented as well. Just see the enclosed demo project. It needs the current svn version of TAChart, but can be compiled without installing the ChartListbox. Alexander, could you please add the component to the TAChart package? A palette image is included. ---------------------------------------------------------------------- Ask · 2011-07-10 05:06 Thanks. Added in r31630-31639, please review and test. If you have further modifications, please post them as patches. Besides minor style changes and bugfixes, I have a few questions: 1) Do you want to take Legend.Order property into account?   If yes, you should call FChart.Legend.SortItemsByOrder, otherwise   there is no need to fill Order property of legend items.   Alternatively, you can order series by ZPosition, as they are ordered on chart. 2) Why OnSeriesIconClick is actiaved by *double* click? I think it should be either renamed   or changed into a single click. 3) Controlling series in the listbox by OnPopulate/RemoveSeries seems   convoluted to me. I suggest the following independent alternatives:   3.1) Take Series.Legend.Visible into account, at least optionally   3.2) Create OnAddSeries(TChartListBox, TCustomSeries, var ASkip: Boolean) event 4) Perhaps a single Options property instead of a set of boolean properties is   preferable -- currently there are just two of them, but I just suggested one more... 5) Radiobutton style enforces single active series even if ShowCheckboxes = false,   I am not quite sure, but I'm inclined to say this is a bug. 6) What should multiselect do? 7) Multi-column drawing is not quite correct, but it is not your fault, I should add TextRect   capability ti the IChartDrawer interface... 8 ) The icon you provided seems to display with the right edge cut off ---------------------------------------------------------------------- wp · 2011-07-10 09:17 QuoteDo you want to take Legend.Order property into account? If yes, you should call FChart.Legend.SortItemsByOrder. Oh, I missed this one - could you add the call? QuoteWhy OnSeriesIconClick is actiaved by *double* click? I think it should be either renamed or changed into a single click. Initially, I had a single click, but later found it confusing after inicidentally clicking the icon instead of the caption. Feel free to rename it. Quote3.1) Take Series.Legend.Visible into account, at least optionally 3.2) Create OnAddSeries(TChartListBox, TCustomSeries, var ASkip: Boolean) event I'd prefer the event. QuotePerhaps a single Options property instead of a set of boolean properties is preferable Agreed. QuoteRadiobutton style enforces single active series even if ShowCheckboxes = false, I am not quite sure, but I'm inclined to say this is a bug. It's not intended to be so, any interaction with series visibility should be disabled when ShowCheckboxes = false --> Bug. QuoteWhat should multiselect do? A left-over from copy&paste ... Please remove. QuoteMulti-column drawing is not quite correct, but it is not your fault, I should add TextRect capability ti the IChartDrawer interface... You'll see the multi-column effect in the demo only after sufficiently many series have been added. To me it seemed to work fine then. QuoteThe icon you provided seems to display with the right edge cut off Let me check and submit a corrected one. One thing I am not quite happy with is that the listbox is repopulated each time a new data point is added to the series. I did not find a good solution for that. Do you have an idea? ---------------------------------------------------------------------- wp · 2011-07-10 10:52 This is the new icon. No idea how the right lines got lost. ---------------------------------------------------------------------- Ask · 2011-07-10 16:42 I have implemented everything we discussed in revisions up to r31668. Please test/review. ---------------------------------------------------------------------- wp · 2011-07-11 08:41 Everythiny ok, just perfect. Thank you. [Edit] Maybe just one minor thing: the identifier SHOW_ALL might cause unnecessary confusion if the same name is used in another package or in the project. Why don't we use the "clo" prefix? Code: [Select]const   cloSHOW_ALL = [cloShowCheckboxes, cloShowIcons];