Getting the Point X and Y axis value
Posted on 2006-04-14
I have a Delphi 2005 VCL application where I am creating DBCharts at runtime. I need to know the values of the point the use clicks on the series in the chart. For example, my series has dates on the X axis and numbers on the Y axis. So I would like to know that a user has clicked on the point (1/1/2005, 5) where 1/1/2005 is the X axis value and 5 is the Y axis value of the point. I am using the code below but all I am getting is the numerical value of the index and not the actual value of the point. Such that point (1/1/2005, 5) is the 3rd point displayed, I am getting the index value of 2 and not 1/1/2005 or 5. Can someone help?
procedure TMultiDBChart.DoClickSeries(Sender: TCustomChart; Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; x, y: Integer);
dbValue := Series.XValue[ValueIndex];
strValue := Series.XValueToText(dbValue);