Access to subchart gauge properties

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Scott
Newbie
Newbie
Posts: 6
Joined: Wed Jan 09, 2013 12:00 am

Access to subchart gauge properties

Post by Scott » Tue Jan 22, 2013 3:58 pm

I have created a chart using the editor and added the subchart tool. Through the editor I also added a linear gauge to the subchart. I am using C++ and do not have any example code (including Delphi examples) using gauges in subcharts since the C++ examples have not been updated (a real problem for me). I have spent a lot of time digging through the documentation and still can't get to the properties I need. Can you provide a C++ example of how to programatically access gauge properties (maximum, minimum, and value in particular) when the gauge is in a subchart created through the editor?

As an aside, not having up to date C++ examples has become quite a hindrance for me. I often run into issues where I can easily change something through the editor but have a difficult time finding the same property to change the value in code. Having C++ examples would prevent me from having to ask seemingly simple questions on this forum. I like TeeChart, and it has given me a set of very helpful tools. I am an experienced programmer, and I don't like not being able to find the answer to simple questions.

Thanks,
Scott

Scott
Newbie
Newbie
Posts: 6
Joined: Wed Jan 09, 2013 12:00 am

Re: Access to subchart gauge properties

Post by Scott » Wed Jan 23, 2013 2:45 pm

After spending time combing through the documentation and experimenting with the code, I determined that I needed to typcast the series as a pointer to TLinearGauge in order to access the subchart gauge properties. This is all based on designing the subcharts using the editor and then accessing the properties through C++ code. Here is an example of what I am doing:

Code: Select all

          TLinearGauge *LinearGaugeSeries;
          LinearGaugeSeries = (TLinearGauge *) SubChartTool->Charts[0].Items[0]->Chart->Series[0];
          LinearGaugeSeries->Value = 50;
This seems to work, but I would like confirmation that this is the correct methodolgy. Also, I would still like to see some C++ examples.

The description of many of the properties in the documentation is not very clear. For example, TSubChart.Chart is described as the "parent Chart control that owns this subchart." In my opinion and experience, this is actually the Chart that was placed in the subchart and not the parent. It took me several hours to reach the relatively simple conclusion due to the poor documentation as well as a lack of documentation.

I know I could have programmatically created the subchart and added the TLinearGauge series at runtime thus having a pointer to the gauge. I like using the editor to lay out my charts and series as I can see the effect of my changes immediately. The editor saves me a lot of time in creating my plots. With that said, I have run into several settings that don't seem to stay during runtime after setting them in the editor.

Thanks,
Scott

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Access to subchart gauge properties

Post by Yeray » Thu Jan 24, 2013 3:59 pm

Hi Scott,
Scott wrote:I have created a chart using the editor and added the subchart tool. Through the editor I also added a linear gauge to the subchart. I am using C++ and do not have any example code (including Delphi examples) using gauges in subcharts since the C++ examples have not been updated (a real problem for me). I have spent a lot of time digging through the documentation and still can't get to the properties I need. Can you provide a C++ example of how to programatically access gauge properties (maximum, minimum, and value in particular) when the gauge is in a subchart created through the editor?
Scott wrote:After spending time combing through the documentation and experimenting with the code, I determined that I needed to typcast the series as a pointer to TLinearGauge in order to access the subchart gauge properties. This is all based on designing the subcharts using the editor and then accessing the properties through C++ code. Here is an example of what I am doing:

Code: Select all

              TLinearGauge *LinearGaugeSeries;
              LinearGaugeSeries = (TLinearGauge *) SubChartTool->Charts[0].Items[0]->Chart->Series[0];
              LinearGaugeSeries->Value = 50;
This seems to work, but I would like confirmation that this is the correct methodolgy. Also, I would still like to see some C++ examples.
Yes, the correct way to access the properties and methods that are particular to a series type is with a casting through the TChartSeriesList, just as you did.
Scott wrote:As an aside, not having up to date C++ examples has become quite a hindrance for me. I often run into issues where I can easily change something through the editor but have a difficult time finding the same property to change the value in code. Having C++ examples would prevent me from having to ask seemingly simple questions on this forum. I like TeeChart, and it has given me a set of very helpful tools. I am an experienced programmer, and I don't like not being able to find the answer to simple questions.
Here you have a version of the features demo project that we could compile with XE:
Tee2012BCBXE.zip
(1023.36 KiB) Downloaded 349 times
Scott wrote:The description of many of the properties in the documentation is not very clear. For example, TSubChart.Chart is described as the "parent Chart control that owns this subchart." In my opinion and experience, this is actually the Chart that was placed in the subchart and not the parent. It took me several hours to reach the relatively simple conclusion due to the poor documentation as well as a lack of documentation.
We know the documentation could be improved. And we are working on that. Please, don't hesitate to let us know about any property or method you feel that aren't explained as they should.
Regarding the TSubChart.Chart description, you are right; the Chart property of the TSubChart is actually the chart into the TSubChart. We'll try to correct it for the next maintenance release.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Scott
Newbie
Newbie
Posts: 6
Joined: Wed Jan 09, 2013 12:00 am

Re: Access to subchart gauge properties

Post by Scott » Mon Jan 28, 2013 6:03 pm

Hi Yeray,

Thanks for confirming my approach and for the examples.

Scott

Post Reply