TChartListbox ... it crashes when assigned to a chart with stacked bars
This is actually a simple bug in the original implementation.
It crashed even with existing lmPoint multiplicity. Fixed in r37576.
Populating the chartsource of a stacked bar series would be easier if TListChartSource would have the following overloaded method
You can use AddXYList since r37580
I have a solution in mind, but it would require styles to have a property "Visible". Could you implement this? Or is there another way to hide a "sub-"bar?
Short answer is: yes, you can use TCalculatedChartSource.ReorderYList --
see multi demo since r37590.
The longer answer is quite involved ;-)
First I'd like to explain the reasoning behind TChartStyles design.
Current styles implementation is actually just a stab.
The idea was to create a mapping between series items and visual styles.
Both item selection and style description should be much more general:
for example, to highlight items based on value, apply gradients and transparency etc.
Styles can also be applied to different objects: for example,
currently axis stripes are implemented based on styles.
Another simple, although not yet implemented, application is
to assign different brushes to different slices of the pie charts.
The main roadblock for the implementation is that I was unable
to invent a suitable architecture both from API and implementation points
of view.
Thoughts and suggestions are welcome -- bonus points
for solving problems of applying visual effects on different back-ends
and backwards compatibility with the current code.
Based on the above, my thoughts are:
1) Styles do not necessarily correspond 1 to 1 with stack levels.
For example, you can use just two styles to get alternating colors
in a stacked bar of arbitrary height.
2) Nevertheless, using styles as a basis for legend makes sense,
because it quite closely corresponds to the purpose of the legend --
to identify various visual elements used in the chart.
2) Style.Visible, if implemented, should mean that the styled items are
"transparent", as if having NaN value -- which is probably not what you want.
3) Style.Enabled, if implemented, should mean that the style is skipped during
the search of applicable styles -- thus could be useful, but can be now
achieved by setting RepeatCount = 0
4) As you can see from the demo, in specific case it it rather easy to implement
hiding of a separate levels. In general case, it needs some thought.
For example, one sensible UI might be a treeview with first level nodes for
series and second level nodes for Y levels.