Page 1 of 1

square axes

Posted: Mon Jan 09, 2006 2:01 am
by 9338026

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")




if not InternalCanvas.SupportsFullRotation then

BroadcastToolEvent(cteBeforeDraw); // 5.02


for t:=0 to SeriesCount-1 do
With Series[t] do if Active then DoBeforeDrawChart;

if not InternalCanvas.SupportsFullRotation then


// dn changes - adjust the chart rect to have equal axes

... 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?

Posted: Fri Jan 13, 2006 12:01 pm
by narcis
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".

Posted: Fri Jan 13, 2006 8:12 pm
by 9338026

The isometric axis does not do exactly what I want. The isometric axis shrinks the area of the plot where the data is displayed. But it keeps large blank areas of the axes.

I need to shrink the axes so that the axes are the same length, like the image shown below:


Posted: Sun Jan 15, 2006 2:36 am
by 9340643

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

Posted: Tue Jan 17, 2006 6:37 am
by 9338026

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.