Logarithmic Axis - Ticks

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mausbull
Posts: 15
Joined: Wed Feb 22, 2006 3:36 pm
Contact:

Logarithmic Axis - Ticks

Post by mausbull » Thu Jul 05, 2007 3:38 pm

Hi,

I've a problem drawing ticks on my chart.

At the moment it looks like this:
Image

but it should look like this:
Image

Below is the code that I've tried so far:

Code: Select all

JFreeChart myLineGraph = ChartFactory.createXYLineChart(title,
        xAxis, yAxis, xyDS, PlotOrientation.VERTICAL, setLegend,
        setTooltip, false);
    
    // Adding the Tooltips
    XYPlot plot = myLineGraph.getXYPlot();
    
   
      //create logarithmic axis
      
      LogarithmicAxis rangeAxis = new LogarithmicAxis("Log(y)");

      rangeAxis.setAllowNegativesFlag(true);
      rangeAxis.setAutoRangeNextLogFlag(false);      
      rangeAxis.setAutoTickUnitSelection(false);
      
      rangeAxis.setTickLabelsVisible(true);
            
      rangeAxis.setTickUnit(new NumberTickUnit((rangeAxis.getRange().getUpperBound() - rangeAxis.getRange().getLowerBound()) / 5));
      
      
      //set axis
      plot.setRangeAxis(rangeAxis);               
    }
    
    ToolTipGenerator gen = new ToolTipGenerator();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setToolTipGenerator(gen);
    renderer.setDrawSeriesLineAsPath(true);
    renderer.setShapesFilled(false);
    renderer.setBaseShapesVisible(false);
    
    plot.setRenderer(renderer);

Hope you can help me improving my ticks (also to get more vertical lines)

regards
Stephan

Locked