XValueToText Showing the Index Value not the Text

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
McMClark
Newbie
Newbie
Posts: 50
Joined: Thu Apr 15, 2004 4:00 am

XValueToText Showing the Index Value not the Text

Post by McMClark » Tue Oct 24, 2006 10:21 pm

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Oct 25, 2006 8:19 am

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;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply