Setup charts at runtime...
Posted: Tue Sep 19, 2017 1:31 am
Hi Yeray,
I've solved now (thanks to your help) all the issues I had with porting my app from VCL to FMX using TeeChart standard. Now I'm moving on to adding some new features in my app that make better use of TeeChart (I know my users will really like this).
But I'm having trouble knowing how to hook everything up programmatically. I've looked over the help files and have found some things, but not everything, as evidenced below. If you can help me with this simple example, I believe I can extrapolate from there.
Basically, I have a simple query that returns the following result set that I would like to be able to feed into a pie chart at run-time. Here is what I get when I manually edit the chart in Delphi Berlin 10.2 FMX and attach the query to it:
Here is the result set from the query:
So in trying to replicate this in code, I have started here:
I'm obviously not doing this right because when run the above code, nothing appears on the chart.
If you could point me to the place in the help files that speaks to this, or help me by just naming the properties I need to set to get the results programmatically that are shown in the example chart above, I believe I can do other charts like this from there.
Thanks for your patient help.
John
I've solved now (thanks to your help) all the issues I had with porting my app from VCL to FMX using TeeChart standard. Now I'm moving on to adding some new features in my app that make better use of TeeChart (I know my users will really like this).
But I'm having trouble knowing how to hook everything up programmatically. I've looked over the help files and have found some things, but not everything, as evidenced below. If you can help me with this simple example, I believe I can extrapolate from there.
Basically, I have a simple query that returns the following result set that I would like to be able to feed into a pie chart at run-time. Here is what I get when I manually edit the chart in Delphi Berlin 10.2 FMX and attach the query to it:
Here is the result set from the query:
So in trying to replicate this in code, I have started here:
Code: Select all
With GenderChart do
begin
AddSeries(TPieSeries.Create(Self));
Series1.DataSource := Q; // Q is the query component
// Now I need to hook the two columns up to the pie chart. Here's where it breaks down.
Series1.XLabelsSource := 'Gender';
Series1.XValues.ValueSource := 'COUNT of ALL';
end;
If you could point me to the place in the help files that speaks to this, or help me by just naming the properties I need to set to get the results programmatically that are shown in the example chart above, I believe I can do other charts like this from there.
Thanks for your patient help.
John