Hello,
I am trying to force the tchart to always have an equal length X and Y axis, irrespective of the size of the TChart.BoundsRect.
I have tried the following change to Procedure TCustomAxisPanel.InternalDraw. (look for "// dn changes")
Begin
Old:=AutoRepaint;
AutoRepaint:=False;
CalcInvertedRotation;
tmp:=UserRectangle;
if not InternalCanvas.SupportsFullRotation then
PanelPaint(tmp);
BroadcastToolEvent(cteBeforeDraw); // 5.02
DoOnBeforeDrawChart;
for t:=0 to SeriesCount-1 do
With Series[t] do if Active then DoBeforeDrawChart;
if not InternalCanvas.SupportsFullRotation then
DrawTitlesAndLegend(True);
SetSeriesZOrder;
CalcWallsRect;
tmp:=ChartRect;
CalcAxisRect;
// dn changes - adjust the chart rect to have equal axes
minAx:=minIntValue([chartWidth,chartHeight]);
chartRect.right:=chartRect.left+minAx;
chartRect.Bottom:=chartRect.top+minAx;
recalcWidthHeight;
... everything the same after here.
This seems to work quite well, except that the X axis text is drawn on the bottom of the plot. (not sure why the image is not coming up)
The bottom axis X position of the text is correct, but the Y position is not. Is there a way to "pin" the text to be relative to the chartRect.bottom instead of just the bottom of the plot?
square axes
-
- Newbie
- Posts: 71
- Joined: Fri Jul 02, 2004 4:00 am
- Location: Culver City
- Contact:
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi David,
You can do something like what's done in the "Isometric Axis" example at TeeChart features demo. You'll find that demo at the TeeChart program group. The example is under "What's New?\New in Axis".
You can do something like what's done in the "Isometric Axis" example at TeeChart features demo. You'll find that demo at the TeeChart program group. The example is under "What's New?\New in Axis".
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: 71
- Joined: Fri Jul 02, 2004 4:00 am
- Location: Culver City
- Contact:
David,
Am I correct in thinking that you would like to be able to place a corner of the chart area, and determine the axis dimensions? That would give the programmer complete control of the chart placement, at the risk of problems in the surrounding display area.
As it is, we are only allowed to set the dimensions of the tchart control, and the margins, then guess how big the chart area will be after the axis labels, legend, etc are drawn.
If I understand your question correctly, I am very interested in the answer! Sorry I don't have one. I can see why you'd want it for FACS data.
-- Stuart
Am I correct in thinking that you would like to be able to place a corner of the chart area, and determine the axis dimensions? That would give the programmer complete control of the chart placement, at the risk of problems in the surrounding display area.
As it is, we are only allowed to set the dimensions of the tchart control, and the margins, then guess how big the chart area will be after the axis labels, legend, etc are drawn.
If I understand your question correctly, I am very interested in the answer! Sorry I don't have one. I can see why you'd want it for FACS data.
-- Stuart
-
- Newbie
- Posts: 71
- Joined: Fri Jul 02, 2004 4:00 am
- Location: Culver City
- Contact:
Hi,
Good eye spotting the FACS data.
The tchart code that actually calculates the size of the different parts of the plot (legend, titles etc) is so completely entangled with the code that draws the different parts that I despair of ever trying to do anything fancy in this regard.
I thought I had it figured out, and changed the chartRect just after the axis positions had been determined. However, the X axis labels do not care about the position of the chartRect, they just draw themselves at the bottom of the chart no matter what.
This area of the code needs a lot of refactoring to be able to do things like
a) figure out how big the chart rect will be given a certain boundaries
b) manipuate the position of the chartrect to a custom position
Instead of drawing and figuring out the chartRect at the same time, they need to
1) query each part of the chart for its dimensions
2) allow us to modify different dimesions (at risk of creating wierd charts)
3) use the new dimensions (or unmodified ones) to actually draw the chart.
However, I think this will be a lot of work and doubt it is high on the Steema priority iist.
Good eye spotting the FACS data.
The tchart code that actually calculates the size of the different parts of the plot (legend, titles etc) is so completely entangled with the code that draws the different parts that I despair of ever trying to do anything fancy in this regard.
I thought I had it figured out, and changed the chartRect just after the axis positions had been determined. However, the X axis labels do not care about the position of the chartRect, they just draw themselves at the bottom of the chart no matter what.
This area of the code needs a lot of refactoring to be able to do things like
a) figure out how big the chart rect will be given a certain boundaries
b) manipuate the position of the chartrect to a custom position
Instead of drawing and figuring out the chartRect at the same time, they need to
1) query each part of the chart for its dimensions
2) allow us to modify different dimesions (at risk of creating wierd charts)
3) use the new dimensions (or unmodified ones) to actually draw the chart.
However, I think this will be a lot of work and doubt it is high on the Steema priority iist.