axis white space

TeeChart for PHP
Post Reply
ISVA7655
Newbie
Newbie
Posts: 16
Joined: Tue Aug 23, 2011 12:00 am

axis white space

Post by ISVA7655 » Thu Oct 20, 2011 7:13 pm

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 ?

Yeray
Site Admin
Site Admin
Posts: 9509
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: axis white space

Post by Yeray » Fri Oct 28, 2011 9:27 am

Hello,

Excuse us for the delay here. We haven't forgotten you.
We are investigating if it's possible to remove this internal margins.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 9509
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: axis white space

Post by Yeray » Mon Oct 31, 2011 10:20 am

Hello,

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);
    
    $tChart1->getChart()->getAxes()->getLeft()->setVisible(true);
    $tChart1->getChart()->getAxes()->getRight()->setVisible(true);
    $tChart1->getChart()->getAxes()->getTop()->setVisible(true);
    $tChart1->getChart()->getAxes()->getBottom()->setVisible(true);
   
    $tChart1->getChart()->getAxes()->getLeft()->getLabels()->setVisible(false);
    $tChart1->getChart()->getAxes()->getRight()->getLabels()->setVisible(false);
    $tChart1->getChart()->getAxes()->getTop()->getLabels()->setVisible(false);
    $tChart1->getChart()->getAxes()->getBottom()->getLabels()->setVisible(false);
    
    $tChart1->getChart()->getAxes()->getLeft()->getTicks()->setVisible(false);
    $tChart1->getChart()->getAxes()->getRight()->getTicks()->setVisible(false);
    $tChart1->getChart()->getAxes()->getTop()->getTicks()->setVisible(false);
    $tChart1->getChart()->getAxes()->getBottom()->getTicks()->setVisible(false);
    
    $tChart1->getChart()->getAxes()->getLeft()->getTicksInner()->setVisible(false);
    $tChart1->getChart()->getAxes()->getRight()->getTicksInner()->setVisible(false);
    $tChart1->getChart()->getAxes()->getTop()->getTicksInner()->setVisible(false);
    $tChart1->getChart()->getAxes()->getBottom()->getTicksInner()->setVisible(false);
    
    $tChart1->getChart()->getAxes()->getLeft()->getMinorTicks()->setVisible(false);
    $tChart1->getChart()->getAxes()->getRight()->getMinorTicks()->setVisible(false);
    $tChart1->getChart()->getAxes()->getTop()->getMinorTicks()->setVisible(false);
    $tChart1->getChart()->getAxes()->getBottom()->getMinorTicks()->setVisible(false);
    
    $tChart1->getChart()->getAspect()->setView3D(false);
   
    $tChart1->getPanel()->setMarginUnits(PanelMarginUnits::$PIXELS);
    $tChart1->getPanel()->setMarginLeft(0);
    $tChart1->getPanel()->setMarginRight(0);
    $tChart1->getPanel()->setMarginTop(0);
    $tChart1->getPanel()->setMarginBottom(0);
   
    $tChart1->getChart()->getHeader()->setVisible(false);
    $tChart1->getChart()->getFooter()->setVisible(false); 
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

ISVA7655
Newbie
Newbie
Posts: 16
Joined: Tue Aug 23, 2011 12:00 am

Re: axis white space

Post by ISVA7655 » Mon Oct 31, 2011 6:53 pm

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 ?

ISVA7655
Newbie
Newbie
Posts: 16
Joined: Tue Aug 23, 2011 12:00 am

Re: axis white space

Post by ISVA7655 » Mon Oct 31, 2011 9:06 pm

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.

Yeray
Site Admin
Site Admin
Posts: 9509
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: axis white space

Post by Yeray » Wed Nov 02, 2011 1:22 pm

Hello,

You might be interested on looking at the discussions here:
http://www.teechart.net/support/viewtop ... =3&t=10620
http://www.teechart.net/support/viewtop ... =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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply