Selective shapes on a line

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
IanHayes
Posts: 2
Joined: Wed Dec 07, 2011 3:50 pm
antibot: No, of course not.

Selective shapes on a line

Post by IanHayes » Wed Dec 07, 2011 4:32 pm

Hi,

I am writing a cricket scoring system for my school computing course. I am using JFreecharts to produce a few charts. On a couple of the charts, I want to put a shape on the line selectively. It is standard practice in cricket to mark charts with the fall of a wicket. for instance the cumulative run rate chart or the run rate chart need this. I have found out how to put shapes on the line, but I just get all shapes at change points on the line. Here is some of my code that I have used so far (I am using NetBeans if that is important): -

Code: Select all

        JFreeChart chart = ChartFactory.createXYLineChart("Cumulative Runs", // Title 
           "Overs", // x-axis Label 
           "Runs", // y-axis Label 
           dataset, // Dataset 
           PlotOrientation.VERTICAL, // Plot Orientation 
           true, // Show Legend 
           true, // Use tooltips 
           false // Configure chart to generate URLs? 
           ); 

        XYPlot plot = chart.getXYPlot();
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer)
        plot.getRenderer();  
        renderer.setShapesVisible(true);
        renderer.setDrawOutlines(true);
        renderer.setUseFillPaint(true);
        renderer.setFillPaint(Color.black);
        BufferedImage image = chart.createBufferedImage(600,400);
        jChartArea.setIcon(new ImageIcon(image));
        this.setSize(610, 450);


Locked