Search code examples
delphiteechart

Teechart axis title


I have a Delphi charting application, I want the user to select the charts they want from a dropdown menu (combobox) which is fine.

I want to be able to change the chart x-axis (bottom axis) title to that of the text in the combobox, however I cant seem to get that to work.

Here is my code that I have used that is not working:

DBChart1.Axes.Bottom.Title.Text := 'Queue: ' + ComboBox1.Selected.Text;

I am using the TDBChart from TeeChart to map my data from the database to the chart.

The error messages are as follows:

[dcc32 Error] charts.pas(56): E2003 Undeclared identifier: 'Text'
[dcc32 Fatal Error] Project2.dpr(5): F2063 Could not compile used unit 'charts.pas'

Solution

  • The property that you need is named Caption rather than Text.

    DBChart1.Axes.Bottom.Title.Caption := ...
    

    Also note that the right hand side of the assignment as written in the question is also incorrect. You presumably mean to read ComboBox1.Text.