Page 1 of 1

XValueToText Showing the Index Value not the Text

Posted: Tue Oct 24, 2006 10:21 pm
by 9337074
I have a DBChart with numbers on the Y axis and the Month and Year as a string on the X axis. I am trying to get the X and Y value when the user clicks on the series. I am using the event ClickSeries and the code strXVar := Series.XValueToText(Series.XValue[ValueIndex]). How do I get the value such as 'January 1998' that appears in the X axis?

Posted: Wed Oct 25, 2006 8:19 am
by narcis
Hi McMClark,

This works fine for me using a series with X values being DateTime and setting the bottom axis labels format as shown here:

Code: Select all

procedure TForm1.Series1Click(Sender: TChartSeries; ValueIndex: Integer;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  DBChart1.Title.Text[0]:=Series1.XValueToText(Series1.XValue[ValueIndex]);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues();
  Series1.XValues.DateTime:=true;

  DBChart1.Axes.Bottom.DateTimeFormat:='MMMM-yyyy';
end;