truncation - JFreeChart last X-axis label cut off -


i've got nice, pretty jfreechart-generated line chart, 1 exception - last value on x axis getting truncated, so:

        |       |       |_________|________|__________|_________|_________|     100 hz    1 khz    10 khz    100 khz    1 mhz    10 mh  

(note z in mhz cut off).

i've looked solution here:
jfreechart tick label cut off

but because i'm manually specifying range in logaxis appears javadoc setting margin has no effect.
javadoc

this code i'm using generate x-axis:

        final logaxis domainaxis = new logaxis(frequencyaxislabel);       domainaxis.setstandardtickunits(logaxis.createlogtickunits(locale.english));       domainaxis.setrange(100, 10000000); //100hz 10mhz       domainaxis.setuppermargin(.05);  //has no effect       domainaxis.setnumberformatoverride(new unitnumberformat(unitvalue.hertz));       plot.setdomainaxis(domainaxis);  

if helps, i'm writing .svg file using following:

            // domimplementation , create xml document       domimplementation domimpl = genericdomimplementation.getdomimplementation();       document document = domimpl.createdocument(null, "svg", null);        // create instance of svg generator       svggraphics2d svggenerator = new svggraphics2d(document);       svggenerator.setsvgcanvassize(new dimension(720, 470));        // draw chart in svg generator       rectangle bounds = new rectangle(10, 10, 700, 450);       chart.draw(svggenerator, bounds);        // write svg file       outputstream outputstream = new fileoutputstream(new file("somepath));       writer out = new outputstreamwriter(outputstream, "utf-8");       svggenerator.stream(out, true /* use css */);       outputstream.flush();       outputstream.close();  

given setuppermargin() method not going have effect, how go making sure label has enough space print? i'm open rotating tick labels well, though haven't figured out how either, how rotate axis label.

ok, found 1 solution works.

i used

chart.setpadding(new rectangleinsets(10, 10, 10, 10)); 

obviously mileage may vary, seems work purposes.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

node.js - Bad Request - node js ajax post -

uitableview - Create and use custom prototype table cells in xamarin ios using storyboard -