Page 1 of 1

axis white space

Posted: Thu Oct 20, 2011 7:13 pm
by 15960028
Is it possible to alter (increase/decrease) the white space surrounding the chart area created by making an axis visible ?

If I create a chart that is 800x600
1) make all 4 axis visible
2) make it a 2d chart (3dview = false)
3) set all margins to zero (left right top and bottom)
4) set header and footer visible = false

5) do nothing else and then render it, I get a square surrounding a square.
The chart area is outlined in the middle of the 800x600 graph. I have a white space border presumably from each axis of about 15 pixels left and right actually 15 left 16 right.. I assume there is a rounding issue there.
I get a 25 pixel margin/border/whitespace top and bottom. If I add a title to any axis the space for it is added to the white space and the chart area becomes smaller.

I'd like to be able to use the white space from the axis being visible either selectively increasing or decreasing them so I can have a fixed chart size regardless of if there is a multi-line title top or bottom or a sub footer or whatever.

I have not been able to adjust the size of this white space.. it appears to be 3% top and bottom (3% + 1 pixel ??) and about 2% left and right.. again not exactly 2%)

Ultimately I'd like the chart area to be the same regardless of the size and number of lines used in the top and bottom titles (axis titles or header/sub header, etc) so when I produce several custom charts at 800x600 size the chart area in each is identical, currently it's whatever is left over after titles and axis margin/border/whitespace.

Can you adjust vertical alignment for a top/bottom axis title so it moves into the white space and thus closer to the chart area ? (without using the property that inserts Y pixels between the out chart edge and the border of the title .. that one also reduces chart area instead of using the existing white space)

also .. the multi-line function for titles.. appears to take an array of strings/text for the lines but throws an error when I try to use it... how does multi-line method for titles actually work ?

Re: axis white space

Posted: Fri Oct 28, 2011 9:27 am
by yeray

Excuse us for the delay here. We haven't forgotten you.
We are investigating if it's possible to remove this internal margins.

Re: axis white space

Posted: Mon Oct 31, 2011 10:20 am
by yeray

It seems to be the space for the axes Ticks and MinnorTicks. Hiding them for all the axes I reduce the margin to just one pixel in each side:

Code: Select all

    $tChart1 = new TChart(800,600);

Re: axis white space

Posted: Mon Oct 31, 2011 6:53 pm
by 15960028
Thanks very much that is helpful, I looked at the different types of tick marks but since I didn't have any I assumed they were not a factor.

Ultimately what I am looking to do is create a fixed size graph say 800x600 that will always have the same sized chart area regardless of how many lines the header and footer use (within certain limits naturally).

Each line of header/subheader footer/subfooter reduces the size of the chart area. So If I make two identical charts except (A) has header and sub header and footer and sub footer and (B)has only a single line header and footer the chart areas on the 2 graphs will be different sizes (the height of the sub header and sub footer).

I was hoping to be able to control the size of the white space reserved for axis (specifically the top and bottom axis) to achieve this end. It sounds like it's going to be either on or off for the axis white space.

Is there away to insert white space between the bottom of the header or sub header and the edge of the chart area ? and likewise on the bottom ?

Re: axis white space

Posted: Mon Oct 31, 2011 9:06 pm
by 15960028
I've been playing with the ticks and axis labels as identified in your code above and I now have my adjustable white space solution.

The ticks are helpful and they are the answer to my problem of adjustable whitespace between the plotable chart boundary and the header/footer text.
I can either change the label font size which allows for a minimum axis white space of 14 pixels up to 111+ using (100 pt font) or even better the tickLength property

$tChart1->getChart()->getAxes()->getTop()->getTicks()->setVisible(true); // adds 3 pixels by default and is not impacted by label font size
$tChart1->getAxes()->getTop()->getTicks()->setLength(5); this adds 5 pixels to the 1 default pixel margin width can be 0 or 50+

This will solve my axis white space issue. It allows for a tunable white space margin between the header/footer text and the plotable chart area frame.

The axis label font size can also do the same but has a minimum size of 14 pixels with a font size of 1pt.

Thanks for you help.

Re: axis white space

Posted: Wed Nov 02, 2011 1:22 pm
by yeray

You might be interested on looking at the discussions here: ... =3&t=10620 ... =4&t=10004

They are from the VCL and .NET forum so the code may be a little bit different but it could help you if you are tying to align two charts.
In essence, you can't remove the margins internally calculated to fit the labels and titles but you can calculate the space taken for them and adjust the margins.

If you still have problems with it, please, don't hesitate to let us know.