Page 1 of 1

chart cursor indicator

Posted: Sat Feb 02, 2013 9:59 pm
by 10051902
Hi,

I am using a 2-pixel-wide vertical cursor in my chart.
The chart is linked to various other components like for example a table, moving the record in the table moves the cursor in the chart to the related postion.
The record in the table corresponds to a colorband in the table.
As shown in the screenshot below.
Moving to a record in the table, moves the cursor to the corresponding position in the chart, which in this case is the starting line of the colorband.
Visually, this is not always very clear if the cursor coincides with the starting line of a colorband in the chart.
So my question is, would it be possible to link the cursor to say, a marker on the bottom axis, for examle, a arrow, or small triangle so it's visually more clear where the cursor actually is ?

Image

Re: chart cursor indicator

Posted: Tue Feb 05, 2013 11:16 am
by yeray
Hi strobbekoen,

You could draw your triangle or arrow at the OnAfterDraw event. Ie:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var tmp : Integer;
begin
  with Chart1.Tools[0] as TColorLineTool do
  begin
    tmp:=Axis.CalcPosValue(Value);
    with ParentChart, ParentChart.Canvas do
      Arrow(false, Point(tmp, ChartRect.Bottom-10), Point(tmp, ChartRect.Bottom), 10, 10, 0);
  end;
end;