Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Line Chart: Category label

  1. #1

    Default Line Chart: Category label

    Hi,
    I've a little problem with the customizations of a chart.

    Name:  2013-08-02 12_35_41-AvepaPentaho2 [In esecuzione] - Oracle VM VirtualBox.png
Views: 72
Size:  13.7 KB

    As you can see, I changed the x-axis-label rotation, but now the text looks like right aligned.

    the problem degenerates when I choose a date range larger, because markers become more dense and the category labels are at the center of two markers
    Name:  2013-08-02 12_37_27-AvepaPentaho2 [In esecuzione] - Oracle VM VirtualBox.png
Views: 66
Size:  16.4 KB

    I wrote a lot of code (beanshell script), done by me, taken here and there, to center labels, but nothing :'(
    Some of you can help me with this problem?
    thanks

  2. #2

    Default

    Hi,

    I think that this could help you. You have to keep the x-label-rotation to 90. And you add this to the chart post-processing script :

    import org.jfree.chart.plot.CategoryPlot;
    import org.jfree.chart.axis.CategoryAxis;
    import java.awt.geom.AffineTransform;


    /// get an axis reference...
    CategoryPlot plot = chart.getCategoryPlot();


    CategoryAxis domainAxis = plot.getDomainAxis();


    AffineTransform trans = AffineTransform.getTranslateInstance(0,-10);
    domainAxis.setTickLabelFont((Font) domainAxis.getTickLabelFont().deriveFont(1, trans));

    It is not the best way way to do it but it is the only way I found to fix it.

  3. #3

    Default

    wooooow thanks ejezequel
    Please excuse me for taking so long to answer by I was on vacation.
    Your solution works perfectly. I had to simple change the "-10" to "-5" in order to center better

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.