Recent

Author Topic: TChartListbox component  (Read 8447 times)

wp

  • Hero Member
  • *****
  • Posts: 13543
TChartListbox component
« on: July 09, 2011, 07:36:01 pm »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: TChartListbox component
« Reply #1 on: July 10, 2011, 07:06:02 am »
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
« Last Edit: July 10, 2011, 08:56:48 am by Ask »

wp

  • Hero Member
  • *****
  • Posts: 13543
Re: TChartListbox component
« Reply #2 on: July 10, 2011, 11:17:33 am »
Quote
Do 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?

Quote
Why 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.

Quote
3.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.

Quote
Perhaps a single Options property instead of a set of boolean properties is preferable
Agreed.

Quote
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.
It's not intended to be so, any interaction with series visibility should be disabled when ShowCheckboxes = false --> Bug.

Quote
What should multiselect do?
A left-over from copy&paste ... Please remove.

Quote
Multi-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.

Quote
The 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

  • Hero Member
  • *****
  • Posts: 13543
Re: TChartListbox component
« Reply #3 on: July 10, 2011, 12:52:46 pm »
This is the new icon. No idea how the right lines got lost.

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: TChartListbox component
« Reply #4 on: July 10, 2011, 06:42:58 pm »
I have implemented everything we discussed in revisions up to r31668.
Please test/review.

wp

  • Hero Member
  • *****
  • Posts: 13543
Re: TChartListbox component
« Reply #5 on: July 11, 2011, 10:41:33 am »
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]; 
« Last Edit: July 11, 2011, 12:55:59 pm by wp »

 

TinyPortal © 2005-2018