RotatedAxisLabels

violstar
2005-04-07
2013-01-13
  • violstar
    violstar
    2005-04-07

    I had the exact same problem and spent lots of time to debug the library.  The solution was as easy as the following.  In the chartpostprocessor tag try the following:

    <cewolf:chartpostprocessor id="labelRotation">
    <cewolf:param name="rotate_at" value='<%= new Integer(90) %>'></cewolf:param>
    </cewolf:chartpostprocessor>

    As simple as that and it fixed my problem.

     
  • It didnt quite fix my problem I had a line chart and had to set the number equal or less to the number of lines in my chart else it wont rotate.
    It looks like an error in the code to me.

     
  • worker1983
    worker1983
    2005-08-09

    Hi all,

    i have exactly the same problem. I want to rotate the X-Axis, so the labels are vertical.

    I try it on the way like Jon, and use the tip from violstar. But nothing happen.

    Also i try to use the code from Kristina, but its throw an error:
    cannot resolve symbol symbol : class ValueAxis location: class
    cannot resolve symbol symbol : variable plot location: class

    It's seems to be a misconfiguration problem on my JSP site.

    Can anyone tell us how we can rotat the labels? Thx.

    --sorry about my english :)  --

     
    • andychief
      andychief
      2005-10-28

      Hello All
      <%@page import="org.jfree.chart.axis.CategoryAxis"%>
      <%@page import="org.jfree.chart.axis.CategoryLabelPositions"%>

      <%
      ChartPostProcessor axisRange = new ChartPostProcessor() {
      public void processChart(Object chart, Map params) {
                CategoryPlot plot = (CategoryPlot) ((JFreeChart) chart).getPlot();
                NumberAxis valueAxis = (NumberAxis) plot.getRangeAxis();
                    valueAxis.setAutoRangeIncludesZero(false);
                  valueAxis.setAutoRangeMinimumSize(10000);
                CategoryAxis domainAxis = plot.getDomainAxis();
              // Set label orientation
              domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
           }
        };
        pageContext.setAttribute("axisRange", axisRange);

      %>

      <cewolf:chartpostprocessor id="axisRange">
           </cewolf:chartpostprocessor>

      Here are the three pieces you need and let me know if you still have problems.

      thanks

       
  • DonM
    DonM
    2006-01-30

    There seems to be confusion about the purpose of the rotate_at parameter.  When you supply a value of 90, it does not mean rotate 90 degrees. It means that if your Dataset contains at least 90 categories, the label will be rotated.  If you want the label always rotated, supply a value of zero. Please review the source for the RotatedAxisLabels class and you will see what it was intended to do.  If you want to rotate the labels other than UP_90 or STANDARD, you will need to write your own ChartPostProcessor.