TChart VCL + Delphi XE7
In a Chart, I want to draw curves on two areas (Main Chart and Sub Chart), respectively, and the Sub Chart locates at the Top-Right corner of the Main Chart. I draw the curves on the Main Chart based on the top and left Axes, and the curves on the Sub Chart based on the Custom Axes.
The Scale and Increment of Custom Horizontal Axis are the same with those of the Top Axis, and The Scale and Increment of Custom Vertical Axis are the same with those of the Left Axis. After the curves on the Main Chart are drawn, I should be able to calculate the Height and Width of the Sub Chart according to the Main Chart.
The questions are as follows:
1. It is void to get and set the values of axis’s increments. So they are different on the two Charts (I hope they are the same).
2. In the Main Chart and the Sub Chart, I want to draw the Grid Lines only based on its own horizontal and vertical Axes, respectively, without the Grid Lines of another Chart.
3. Is it possible to zoom the Sub Chart and the Main Chart changes accordingly? And to zoom the Main Chart and the Sub Chart changes accordingly? Alternatively, when zooming the Sub Chart, the Main Chart keeps intact (do not change)?
4. What is the difference between axis’s LabelsFormat.Font and LabelsFont?
Thanks!
Coordinated control of two Charts
Coordinated control of two Charts
- Attachments
-
- TestProgram.rar
- (7.35 KiB) Downloaded 1126 times
-
- fig.png (28.32 KiB) Viewed 21455 times
Re: Coordinated control of two Charts
Hello,
I've added a line of code to clear the series added at design time in your project because they were interfering with the example:
Now the example gives me this result:
Note the Increment property indicates is used to calculate the maximum number of labels to show without overlapping. If an overlappig is detected, the effective increment will be higher.
You can force the labels using custom labels if you want.
In your case, what you call a Sub Chart is actually a pair of custom axes.
I've added a line of code to clear the series added at design time in your project because they were interfering with the example:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
with TheChart do
begin
SeriesList.Clear; // Line added
I can see the Increments are correct in the editor. Top and Custom 0 axes have an increment of 500, and Left and Custom 1 axes have an increment of 200.liuxs wrote:1. It is void to get and set the values of axis’s increments. So they are different on the two Charts (I hope they are the same).
Note the Increment property indicates is used to calculate the maximum number of labels to show without overlapping. If an overlappig is detected, the effective increment will be higher.
You can force the labels using custom labels if you want.
Note there's a SubChart Tool that is probably more appropriate for this usage.liuxs wrote:2. In the Main Chart and the Sub Chart, I want to draw the Grid Lines only based on its own horizontal and vertical Axes, respectively, without the Grid Lines of another Chart.
In your case, what you call a Sub Chart is actually a pair of custom axes.
Either using Custom axes or using SubChart tool, you'll have to play with OnZoom and OnUndoZoom events to synchronize both sets of axes / charts.liuxs wrote:3. Is it possible to zoom the Sub Chart and the Main Chart changes accordingly? And to zoom the Main Chart and the Sub Chart changes accordingly? Alternatively, when zooming the Sub Chart, the Main Chart keeps intact (do not change)?
Both them return the same property so they are equivalent.liuxs wrote:4. What is the difference between axis’s LabelsFormat.Font and LabelsFont?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Coordinated control of two Charts
How to get the Increments as shown in the editor? I need the initial values of some axes. GetHorizAxis.Increment and GetHorizAxis.CalcIncrement always return zero.liuxs wrote:
1. It is void to get and set the values of axis’s increments. So they are different on the two Charts (I hope they are the same).
I can see the Increments are correct in the editor. Top and Custom 0 axes have an increment of 500, and Left and Custom 1 axes have an increment of 200.
Note the Increment property indicates is used to calculate the maximum number of labels to show without overlapping. If an overlappig is detected, the effective increment will be higher.
You can force the labels using custom labels if you want.
Re: Coordinated control of two Charts
To zoom the Sub Chart and the Main Chart, respectively, the TZoomSubChart Type is defined to record the Sub Chart Rect, Zoom Rect and whether or not clicked in the Sub Chart Rect (see MouseDown and MouseUp events). Then, I zoom the Sub Chart by SetMinMax to CustomAxes’s (see Zoom event).liuxs wrote:
3. Is it possible to zoom the Sub Chart and the Main Chart changes accordingly? And to zoom the Main Chart and the Sub Chart changes accordingly? Alternatively, when zooming the Sub Chart, the Main Chart keeps intact (do not change)?
Either using Custom axes or using SubChart tool, you'll have to play with OnZoom and OnUndoZoom events to synchronize both sets of axes / charts.
When click and zoom in the Main Chart area, it works correctly. However, when click and zoom in the Sub Chart area, the Main Chart changes accordingly (I would like the Main Chart do not change at this time). In addition, the two CustomAxes is not isometric sometimes. How to solve the two problems?
- Attachments
-
- ChartZoom.zip
- (9.29 KiB) Downloaded 1077 times
Re: Coordinated control of two Charts
Using the same codes in another program, there are two weird results:
1.Axes Labels do not have the same size (see Fig-1), although I use the same codes to set the Chart and axes properties.
2. When click and zoom in the Sub Chart area, the Curves exceed the range of the Sub Chart area or CustomAxes range (see Fig-2).
1.Axes Labels do not have the same size (see Fig-1), although I use the same codes to set the Chart and axes properties.
2. When click and zoom in the Sub Chart area, the Curves exceed the range of the Sub Chart area or CustomAxes range (see Fig-2).
- Attachments
-
- Fig-1.jpg (56.44 KiB) Viewed 21427 times
-
- Fig-2.jpg (30.59 KiB) Viewed 21428 times
Re: Coordinated control of two Charts
When the Minimum and Maximum of an Axis are equal, there is only one Label on the Axis. That is correct in general. If the horizontal Axis and vertical Axis are isometric, and more than one Labels are required, is it possible to draw a number of Labels on the one-label Axis from the Axis’s Start Position to End Position?
- Attachments
-
- TestFig.jpg (35.28 KiB) Viewed 21412 times
Re: Coordinated control of two Charts
Hello,
There's an example of Custom Labels in the main TeeChart executable demo. Follow the tree in the application to: \Axes\Labels\Custom labels
Regards,
Marc Meumann
There's an example of Custom Labels in the main TeeChart executable demo. Follow the tree in the application to: \Axes\Labels\Custom labels
Regards,
Marc Meumann
Steema Support
Re: Coordinated control of two Charts
When the Mouse moves on the chart, the ChartAxis Label’s Font changes to the Default Font by itself. Assigning LabelsFont.DefaultFont := false makes no difference. Why is that?
Re: Coordinated control of two Charts
Hello,
The problem doesn't appear for us. Could attach the code you're using because we can see where is the problem?
Thanks in advance
The problem doesn't appear for us. Could attach the code you're using because we can see where is the problem?
Thanks in advance
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |