Page 1 of 1

Can you change individual series Pointer.Style values

Posted: Fri Apr 20, 2007 1:47 am
by 9241637
In my line series chart, I want to be able to change individual pointer styles along a line. I am charting analytical results and I want to be able to let my users know when a value is an actual result, and when the value represents a detection limit.

For instance the value 100 would have a psCircle and the value 5 would get a psStar. I can check each record as it is read to see if it was detected or not, so that part is easy.

Posted: Fri Apr 20, 2007 1:10 pm
by narcis
Hi CAC,

Yes, you can do that using OnGetPointerStyle event. Here you'll find an example of this event's usage.

Posted: Sat Apr 28, 2007 10:08 pm
by 9241637
I have reviewed and implemented the code you suggested, but when I try it, the Chart always changes the pointer style for the entire series, not individual points. :?

Posted: Mon Apr 30, 2007 8:57 am
by yeray
Hi CAC,

So you should do something like this:

Code: Select all

if (Series1.YValue[ValueIndex] = 100) then
    result := psCircle //for value 100 will be psCircle
  else if (Series1.YValue[ValueIndex] = 5) then
    result := psStar  //for value 5 will be psStar
    else
      result := psRectangle; //default will be psRectangle

Posted: Fri May 04, 2007 10:09 pm
by 9241637
I think part of my problem is my lack of understanding of [ValueIndex]. My point style is determined by a string value that is not part of the XY data set. The Detected column is evaluated as the program steps through a ClientData set.

For instance:

X Values.....Y Values......Detected......Point Style
1/1/2000.......100.............Yes.............psCircle
2/1/2000..........5..............No..............psStar
3/1/2000.........25.............Yes.............psCircle

Posted: Sun May 06, 2007 7:35 am
by Marjan
Hi, CAC.

ValueIndex = point index in series point ValueList array. In your case I assume the number of points is equal to number of points in ClinetDataSet. In this case ValueIndex would be equal to record position in ClientDataSet. If this is not true you can still create an array of bookmarks and "link" point index (ValueIndex) to record bookmark. I think there is an example of this available in TC demo. But as I said, in your case I think this is not necessary i.e. a simple ValueIndex=record position mapping would do the trick. What you have to do is in OnGetPointerStyle event read point ValueIndex, locate it's match in ClientDataSet, read matched "Displayed" column value and base OnGetPointerStyle result on it's value.
An alternative and much simpler solution would be to store "Displayed" column values in series XLabels array (simply connect column to series labels source property) and then use the same event with ValueIndex and XLabels[ValueIndex] to set pointer style. In case you'll have problems implementing this, drop me an email at "marjan at steema dot com" and I'll prepare a sample application for you.