Hi
I have an app where multiple lineseries are shown in one chart. Each series have their own vertical axis.
Normal view on screen only shows one vertical axis at a time, and the user can toggle through the axises (is that the right plural form of axis?) by clicking the vertical axis. So far everything is fine.
For special purposes such as printing, I am trying to decrease the actual chart area to make room for all the vertical axis's (whatever) side by side, but depending on the AxisValuesFormat and the actual value the axis needs more or less space.
How do I calculate this
If I haven't made myself clear, I'd be happy to apply sample code.
TIA
Søren
Calculating space for axis
-
- Newbie
- Posts: 17
- Joined: Thu Dec 07, 2006 12:00 am
- Location: Sønderborg, Denmark
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi TheRoadrunner,
My colleague Yeray made some similar examples for other customers at the forums threads below:
http://www.teechart.net/support/viewtopic.php?t=6146
http://www.teechart.net/support/viewtopic.php?t=5923
Hope this helps!
My colleague Yeray made some similar examples for other customers at the forums threads below:
http://www.teechart.net/support/viewtopic.php?t=6146
http://www.teechart.net/support/viewtopic.php?t=5923
Hope this helps!
Best Regards,
Narcís Calvet / 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 |
-
- Newbie
- Posts: 17
- Joined: Thu Dec 07, 2006 12:00 am
- Location: Sønderborg, Denmark
Thank you
Hi Narcís
Thank you for your fast and excellent support.
The key to my solution was the article:
http://www.teechart.net/support/viewtopic.php?t=5923
Especially the PlaceAxes procedure was useful.
Since my App hasn't got a linear relation between series and CustomAxes, and since I don't quite get the point of having two constants (you have to tune them in parallel anyway), I made a few improvements.
Here is my version (in case anyone is interested):
Thank you for your fast and excellent support.
The key to my solution was the article:
http://www.teechart.net/support/viewtopic.php?t=5923
Especially the PlaceAxes procedure was useful.
Since my App hasn't got a linear relation between series and CustomAxes, and since I don't quite get the point of having two constants (you have to tune them in parallel anyway), I made a few improvements.
Here is my version (in case anyone is interested):
Code: Select all
procedure TfrmGraph.PlaceAxes(nSeries: Integer=0; NextXLeft: Integer=0; NextXRight: Integer=0; MargLeft: Integer=0; MargRight: Integer=0);
const
extraPos = 18;
minMarginLeft = 15;
minMarginRight = 15;
var
ca : TChartAxis;
begin
ca := Chart.Series[nSeries].GetVertAxis;
if Chart[nSeries].Active and Assigned(ca) and ca.Visible then
begin
if ca.OtherSide then
begin
ca.PositionPercent := NextXRight;
NextXRight := NextXRight - ca.MaxLabelsWidth - ca.TickLength - extraPos;
MargRight := MargRight + ca.MaxLabelsWidth + ca.TickLength + extraPos;
end
else
begin
ca.PositionPercent := NextXLeft;
NextXLeft := NextXLeft - ca.MaxLabelsWidth - ca.TickLength - extraPos;
MargLeft := MargLeft + ca.MaxLabelsWidth + ca.TickLength + extraPos;
end;
end;
Chart.MarginLeft := Max(minMarginLeft,MargLeft);
Chart.MarginRight := Max(minMarginRight, MargRight);
nSeries := nSeries + 1;
if nSeries <= Chart.SeriesCount - 1 then
begin
PlaceAxes(nSeries, NextXLeft, NextXRight, MargLeft, MargRight);
end;
end;
Hi TheRoadrunner,
Could you please tell me what MAX() is about? Is it a Delphi function or a special function from you?
If you are interested I can send you my demo application which has some additional features.
Because this is exact the function I got from the support I´m very interestedHere is my version (in case anyone is interested):
Code: Select all
Chart.MarginLeft := Max(minMarginLeft,MargLeft);
Chart.MarginRight := Max(minMarginRight, MargRight);
If you are interested I can send you my demo application which has some additional features.
Greetz Dominik
http://www.logview.info
http://www.logview.info
-
- Newbie
- Posts: 17
- Joined: Thu Dec 07, 2006 12:00 am
- Location: Sønderborg, Denmark