How to draw Polar Series using Custom Axes

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
liuxs
Newbie
Newbie
Posts: 20
Joined: Fri Dec 15, 2017 12:00 am

How to draw Polar Series using Custom Axes

Post by liuxs » Tue Dec 19, 2017 3:22 am

I do not find any examples of Polar Series based on the Custom Axes, and I want to know how the Radius Axis and Angle Axis work. Could you help me, please?

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

Re: How to draw Polar Series using Custom Axes

Post by Yeray » Wed Dec 20, 2017 10:53 am

Hello,

The Circled don't support Custom axes.
The Vertical Axis is used to draw the Circular Grid Rings, and the Horizontal Axis is used to draw the Angle lines, Ticks, MinorTicks and Labels.
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

liuxs
Newbie
Newbie
Posts: 20
Joined: Fri Dec 15, 2017 12:00 am

Re: How to draw Polar Series using Custom Axes

Post by liuxs » Wed Dec 20, 2017 1:54 pm

When the Polar Series are drawn using the Custom Axes, How to draw the cross axes from the center of circle area? Just like the default TChart using the LeftAxis, RightAxis, TopAxis and BottomAxis. Thanks!

liuxs
Newbie
Newbie
Posts: 20
Joined: Fri Dec 15, 2017 12:00 am

Re: How to draw Polar Series using Custom Axes

Post by liuxs » Wed Dec 20, 2017 2:04 pm

Alternatively,is there an appropriate method to draw radius Labels?

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

Re: How to draw Polar Series using Custom Axes

Post by Yeray » Wed Dec 20, 2017 2:58 pm

Hello,

I'm not sure to understand you. Could you please arrange a simple example project showing what are you exactly doing and some screenshot showing what are you trying to achieve?
Thanks in advance.
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

liuxs
Newbie
Newbie
Posts: 20
Joined: Fri Dec 15, 2017 12:00 am

Re: How to draw Polar Series using Custom Axes

Post by liuxs » Wed Dec 20, 2017 11:33 pm

1. A PolarSeries Chart is drawn without radial labels (Fig.1). How to draw the titles and labels of LeftAxis, RightAxis, TopAxis and BottomAxis (Fig.2)?
2. Two PolarSeries Charts are drawn in pairs with one TeeCommander (Fig.3), and I can control one of the two Charts alternately by setting the TeeCommander.Panel. Is it possible to synchronously control both of them with one TeeCommander? I want to take the two Charts as one Chart, and zoom, copy, save them together.
Thanks.
Attachments
Fig3.jpg
Fig3.jpg (253.63 KiB) Viewed 24863 times
Fig2.jpg
Fig2.jpg (165.28 KiB) Viewed 24863 times
Fig1.jpg
Fig1.jpg (83.97 KiB) Viewed 24862 times

Marc
Site Admin
Site Admin
Posts: 1209
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: How to draw Polar Series using Custom Axes

Post by Marc » Wed Dec 27, 2017 4:15 pm

Hello,

Re 1.
The Axis Labels ... Titles, may be shown by adding the text in this way:

Code: Select all

Chart1.Axes.Left.Title.Text := 'my left axis';
The same for Top, Right and Bottom.

Re 2.
A TeeCommander can only control one Chart at a time. It can be changed at runtime by setting the teeCommander.Panel property. To copy zoom settings across charts it may be easiest to do that via the OnAfterDraw eventy of the Chart that the Commander is related to. You can use the Axes' SetMinMax method to copy new Axis Min and Max to the second Chart and can make other modifications in the same way.

To copy and save there are other techniques available, you can 'draw' charts to locations on a common canvas if you wish to drive two charts separately. Alternatively add subcharts to the first chart and the Chart Canvas will control the main chart and subcharts simultaneously for save & copy.

See the Chart Tools, SubChart tool examples in the TeeChart example demo for a visual demonstration.

Regards,
Marc Meumann
Steema Support

liuxs
Newbie
Newbie
Posts: 20
Joined: Fri Dec 15, 2017 12:00 am

Re: How to draw Polar Series using Custom Axes

Post by liuxs » Thu Dec 28, 2017 3:26 am

Thank you for your advice. I use the TSubChartTool, and it works. However, the first chart always locates at the center of the Panel, although I try to set its Width, ChartRect.SetLocation and (ChartRect.Left, ChartRect.Right).
I hope that the two charts would be horizontally arranged, do not overlap, and have the same sizes. Could you please help me?
Best Regards.
Attachments
PolarChart.zip
(6.74 KiB) Downloaded 891 times

Marc
Site Admin
Site Admin
Posts: 1209
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: How to draw Polar Series using Custom Axes

Post by Marc » Fri Dec 29, 2017 11:46 am

Hello,

You can set the ChartRect before rendering the Series. For example, using this event for the first Chart Series would move it over to the left half:

Code: Select all

procedure TForm1.Series1BeforeDrawValues(Sender: TObject);
begin
   TheChart.ChartRect:=Rect( 30, 30, 470, 470);
end;
The ChartRect has left space for labels (30 pixels each side) within the 500x500 half chart area.

The second series could be set in a subchart as you have done and positioned as discussed here: http://www.teechart.net/support/viewtop ... =3&t=16773. For my test project I added the second Polar Series to the main chart at designtime to make it easier to setup the BeforeDrawValues at designtime, then assigned the Series to the SubChart.

Designtime image with two series in chart plus subchart:
polardesigntime.png
polardesigntime.png (78.31 KiB) Viewed 24831 times
At runtime it looks like this:
polarruntime.png
polarruntime.png (254.2 KiB) Viewed 24832 times
I attach the modified project.

Regards,
Marc
Attachments
PolarChartSubChart.zip
(54.16 KiB) Downloaded 842 times
Steema Support

liuxs
Newbie
Newbie
Posts: 20
Joined: Fri Dec 15, 2017 12:00 am

Re: How to draw Polar Series using Custom Axes

Post by liuxs » Mon Jan 01, 2018 7:30 am

Yes, Your modified project works fine. However, how to use the BeforeDrawValues procedure to set the ChartRect’s properties, if the PolarSeries are dynamically created?

Marc
Site Admin
Site Admin
Posts: 1209
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: How to draw Polar Series using Custom Axes

Post by Marc » Tue Jan 02, 2018 12:28 pm

Hello,

You can assign the dynamic series' event dynamically to the existing event method if you've already created it for an existing series and it's generic (ie. how it acts upon 'sender') or to a new method of your own (with the same parameters).

eg.

Code: Select all

procedure TForm2.Button3Click(Sender: TObject);
begin
  mySeries.BeforeDrawValues := Series1BeforeDrawValues;
end;

procedure TForm2.Series1BeforeDrawValues(Sender: TObject);
begin
 //my code .. do something with Sender
end;
Regards,
Marc
Steema Support

liuxs
Newbie
Newbie
Posts: 20
Joined: Fri Dec 15, 2017 12:00 am

Re: How to draw Polar Series using Custom Axes

Post by liuxs » Thu Jan 04, 2018 12:49 pm

There are two Charts (Original Chart and TSubChartTool.Charts[0].Chart) and a TeeCommander. The TeeCommander always handles with the Original Chart. In order to move and zoom the two Charts, respectively, how to make the TeeCommander to alternately control one of the two Charts?
Attachments
PolarChart.zip
(7.35 KiB) Downloaded 826 times

Marc
Site Admin
Site Admin
Posts: 1209
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: How to draw Polar Series using Custom Axes

Post by Marc » Mon Jan 08, 2018 8:34 am

Hello,

As noted here ,http://www.teechart.net/support/viewtop ... 764#p74584, You need to direct the TeeCommander to the Chart you require to modify at the moment you wish to do so.

ie.

Code: Select all

TeeCommander1.Panel := ChartTool1.Charts[0].Chart;
You can then switch it back to the first Chart by resetting the Panel property. Alternatively, use two TeeCommanders.

Regards,
Marc
Steema Support

Post Reply