Jump to content
We've recently updated our Privacy Statement, available here ×

JFreeChart XYBlock chart doesn't show gridlines


prestinman

Recommended Posts

Hello.

I am creating a JasperReport with an XYBlock chart. Everything shows up fine except the gridlines on the chart. They only slightly appear if I set the foregroundAlpha(0.25f)...which makes me think that the gridlines are getting painted over. Does anyone know how to show the gridlines or move them to the front?

I am using JFreeChart 1.0.12 and jasperReports 3.7.2

 

Any suggestion is appreciated. Thanks!

Code:
    XYZDataset dataset = createDataset(sched);    NumberAxis xAxis = new NumberAxis("");    xAxis.setLowerMargin(0.0);    xAxis.setUpperMargin(0.0);    xAxis.setTickUnit(new NumberTickUnit(12.0));    xAxis.setNumberFormatOverride(new DayGraphNumberFormat());            NumberAxis yAxis = new NumberAxis("");    yAxis.setLowerMargin(0.0);    yAxis.setUpperMargin(0.0);    yAxis.setTickUnit(new NumberTickUnit(1.0));    yAxis.setNumberFormatOverride(new WeekDayNumberFormat());    yAxis.setAutoRangeIncludesZero(false);    yAxis.setInverted(true);    XYBlockRenderer renderer = new XYBlockRenderer();            LookupPaintScale paintScale = new LookupPaintScale(0.0,1.0,Color.black);    paintScale.add(0.0,new Color(216,220,166));    paintScale.add(1.0,Color.green);    renderer.setPaintScale(paintScale);    XYPlot plot = new XYPlot(dataset,yAxis,xAxis,renderer);    plot.setOrientation(PlotOrientation.HORIZONTAL);    plot.setForegroundAlpha(0.25f);    plot.setDomainGridlinePaint(Color.BLUE);    plot.setDomainGridlinesVisible(true);    plot.setDomainGridlineStroke(new BasicStroke(1.0f));            plot.setRangeGridlinePaint(Color.BLUE);    plot.setRangeGridlinesVisible(true);    plot.setRangeMinorGridlinesVisible(false);    plot.setRangeGridlineStroke(new BasicStroke(1.0f));        plot.setAxisOffset(new RectangleInsets(5,5,5,5));       JFreeChart chart = new JFreeChart("",plot);    chart.setBackgroundPaint(new Color(253,250,247));    chart.removeLegend();
Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...