Using TChart and TSubChartToolD draws LineSeries (called MainChart and SubChart). The scales and increment of horizontal and vertical axes are the same, respectively, but the sizes of the two charts are different.
I can determine the Width and Height of the SubChart’s ChartRect from the MainChart.ChartWidth and ChartHeight, but assigning SubChart.Charts[0].Chart.ChartRect.Width and Height does not work. By the way, I think that it is difficult to calculate the size of the SubChart, although assigning the TSubChart.Charts[0].Height and Width works.
How to assign the Width and Height of the SubChart’s ChartRect?
Assign TSubChartTool’s ChartRect is invalid
Re: Assign TSubChartTool’s ChartRect is invalid
Hello,
I've just cross-checked size. The following settings appear correct to set the SubChart Panel size:
With respect to the ChartRect area, the size challenge is similar to that of the main Chart: depending on data the axis label size (length) may vary and automatically adjust the Chart Rect area. You can fix the Label Size to avoid that from happening.
eg.
Regards,
Marc
I've just cross-checked size. The following settings appear correct to set the SubChart Panel size:
Code: Select all
ChartTool1.Charts[0].Chart.Width := 300;
ChartTool1.Charts[0].Chart.Height := 400;
eg.
Code: Select all
ChartTool1.Charts[0].Chart.LeftAxis.LabelsSize := 30;
Marc
Steema Support
Re: Assign TSubChartTool’s ChartRect is invalid
The SubChart and the MainChart are out of proportion in size.
How to make the horizontal and vertical axes of the two charts to be the same scales, respectively?
How to make the horizontal and vertical axes of the two charts to be the same scales, respectively?
- Attachments
-
- fig.jpg (23.83 KiB) Viewed 17439 times
Re: Assign TSubChartTool’s ChartRect is invalid
Hello,
I think you can use the SubChart SetMinMax method to assign the same scale as principal Chart. The code below shows you how:
Also, I have realized you work with vertical axis in the principal Chart. Therefore, you must invert the axis in subChart. The line code below shows you how:
I think you can use the SubChart SetMinMax method to assign the same scale as principal Chart. The code below shows you how:
Code: Select all
ChartTool1.Charts[0].Chart.Axes.Bottom.SetminMax(Chart1.Axes.Bottom.Minimum, Chart1.Axes.Bottom.Maximum);
ChartTool1.Charts[0].Chart.Axes.Left.SetminMax(Chart1.Axes.Left.Minimum, Chart1.Axes.Left.Maximum);
Code: Select all
ChartTool1.Charts[0].Chart.Axes.Left.Inverted:= true;
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 |
Re: Assign TSubChartTool’s ChartRect is invalid
Thank you for your reply.
Taking the horizontal axes as an example. If both of the axes increments of the SubChart and MainChart are 400m, but their sizes are different in pixel (see Fig. above). I hope that the ratio of actual increment and screen increment of the two charts are the same.
Taking the horizontal axes as an example. If both of the axes increments of the SubChart and MainChart are 400m, but their sizes are different in pixel (see Fig. above). I hope that the ratio of actual increment and screen increment of the two charts are the same.
Re: Assign TSubChartTool’s ChartRect is invalid
Hello liuxs,
Hoping this helps you, otherwise don't hesitate to contact us.
Thanks in advance
The increment is calculated automatically according the space there is to draw labels, it depends always from size of chart, therefore if the size of chart is reduced the increment is recalculating because the labels don't overlap. In your case, a simple solution is try to reduce the SubChart Font Size, because you can show all labels. The line code below shows you how can do it:Taking the horizontal axes as an example. If both of the axes increments of the SubChart and MainChart are 400m, but their sizes are different in pixel (see Fig. above). I hope that the ratio of actual increment and screen increment of the two charts are the same.
Code: Select all
ChartTool1.Charts[0].Chart.Axes.Bottom.LabelsFont.Size := 5;
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 |