First, thanks for your continued contributions.
I decided to extract the image creation code and put it into an ImageList.
This is sensible plan.
Before applying your code I'd like to think a little about design:
1) Copying series icons as bitmaps seems a bit wasteful, I would prefer some kind of "virtual image list", where the icons are drawn directly when needed.
This would also solve the problems with non-chart images,
image storing and series updating.
Unfortunately, it seems that TCustomImageList has no provision for
such virtualization. So we are out of luck here.
2) I have minor doubts about OnPopulate event --
it is called whenever the chart broadcasts a change,
so anybody handling this event cold just subscribe to the broadcast?
3) Can you describe what behavior FirstSeriesIndex/SeriesCount are aimed to achieve?
For example, adding new image directly, then adding a new series will
move the series images to the end of the list -- is it intended?
4) Since you are contributing a lot of code, I would appreciate
if you would format it in TAChart style, in particular with spaces after, but not before the colons in variable declarations.
I am currently working on, a TChartGrid
This is great news, I did contemplate something in this direction.
However, since this component is more complex than your previous
contributions, please let's discuss the design in advance.
I see several options for implementing chart-grid connection:
1) Implement TListSourceDataset and use standard DBGrid
2) Put chart data in TSdfDataset, then use TDbChartSource for chart and standard DBGrid -- this is already possible now
3) Implement ExportToGrid/ImportFromGrid methods in chatrSource and/or chart and let the user call them when needed
4) Implement TGridChartSource and use it to get chart data from the grid
5) Implement TChartSourceLink/TChartGridLink which syncronizes data between the
chart and the grid
6) Implement TChartGrid as a descendant of TStringGrid
7) Implement the grid *inside* the chart. This may allow to synchronize the grid with the chart axis.
Maybe you plan something else?
Those methods are not mutually exclusive, but I would like to make
informed choice among them.