Recent

Author Topic: TColorGridSeries from TeeChart  (Read 3751 times)

antekg

  • Newbie
  • Posts: 6
TColorGridSeries from TeeChart
« on: September 06, 2018, 04:37:33 pm »
How to substitute?
Here is the description from TeeSurfa unit:
http://www.teechart.net/docs/teechart/vclfmx/lib/html/TColorGridSeries.html
The TColorGridSeries is a descendant of TChartSeries. We have TChartSeries in TAChart of Lazarus.
On the other hand, we have TColorMapSeries in TAFuncSeries unit.
How to combine TColorMapSeries behaviour with various methods and properties of TChartSeries? I need such properties of TColorGridSeries as YValues:TChartValueList, ... and methods BeginUpdate, CreateDefaultPalette, ... 
« Last Edit: September 06, 2018, 09:31:07 pm by antekg »

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: TColorGridSeries from TeeChart
« Reply #1 on: September 07, 2018, 12:38:41 am »
Reading this description, I think that TColorGridSeries indeed is very similar to our TColorMapSeries. But after trying to find a working solution I saw that this is overkill, a TUserDrawnSeries is much simpler and very easy to understand.

Basically this series is completely drawn by the user in its OnDraw event. This is easy because the drawing routine only has to iterate through the x and y values (which are assumed to be integers in case of the TColorGridSeries), lookup the corresponding z value and interpolate the color map for it. The latter job can be done by "borrowing " a routine of TColorMapSeries, the color map itself is defined by the values and colors stored in a TListChartSource. Then a uniformly colored rectangle is drawn between x and x+1 and between y and y+1.

Just look at the attached demo. Feel free to ask further questions if you don't understand any details in the code.

Note that the y,z coordinates are exchanged here in comparison with the TeeChart description.

I cannot comment on the methods of the TColorGridSeries - I never used it. But there is not a one-to-one correspondence between TeeChart and TAChart anyway.

 

TinyPortal © 2005-2018