Actually I am having a number of series points based on which i am doing XYLine Charts ,But i have a requirement that
in some plots will be curves rather than lines joining the data points.
How To Do It ?
Creating Curves based on Data Points
Re: Creating Curves based on Data Points
Would XYSplineRenderer help?
http://www.jfree.org/jfreechart/api/jav ... derer.html
http://www.jfree.org/jfreechart/api/jav ... derer.html
-
- Posts: 8
- Joined: Fri May 15, 2009 1:07 pm
Re: Creating Curves based on Data Points
The Problem of creating XYSpline Chart is Using CreateChartfactory, i cant have a chart Object where tool tip will be true ,So even if Using XYSplinerenderer i can draw splines but unable to enable tooltip.Can any body suggest any solution for the same.
the procedure i am following is as below
Thanks in advance
the procedure i am following is as below
Code: Select all
public static ArrayList createXYSplineChart(ServletContext ctx,String path, XYDataset dataset,String title,String xAxix,String yAxix)
{
ArrayList chartPathList=new ArrayList();
NumberAxis xAxis = new NumberAxis(xAxix);
//xAxis.setAutoRangeIncludesZero(false);
NumberAxis yAxis = new NumberAxis(yAxix);
//yAxis.setAutoRangeIncludesZero(false);
XYSplineRenderer renderer = new XYSplineRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
//plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
// create and return the chart panel...
JFreeChart chart = new JFreeChart(title,
JFreeChart.DEFAULT_TITLE_FONT, plot, true);
chart.setBackgroundPaint(Color.white);
Paint bluepaint = new Color(59, 115, 185);
Paint blackpaint = new Color(0,0,0);
Paint redpaint = new Color(255, 0, 0);
// Font lableFont = new Font("verdana", Font.BOLD, 10);
// Font itemFont = new Font("verdana", Font.PLAIN, 4);
// Font titleFont = new Font("verdana", Font.BOLD, 12);
chart.setAntiAlias(true);
chart.setBorderVisible(true);
chart.getLegend().setPosition(RectangleEdge.BOTTOM);
//
// int totalSeries=dataset.getSeriesCount();
renderer.setSeriesPaint(0, blackpaint);
renderer.setSeriesPaint(1, redpaint);
renderer.setSeriesPaint(2, redpaint);
renderer.setSeriesPaint(3, bluepaint);
try {
System.out.println("USER DiR------->"+path);
//ChartUtilities.saveChartAsPNG(new File(path),chart,700,500);
ChartUtilities.saveChartAsPNG(new File(ctx.getRealPath(path)),chart,700,500);
//File file=null;
}
catch (IOException e) {
e.printStackTrace();
}
HashMap chartMap = new HashMap();
chartMap.put("chart",chart);
chartMap.put("chartPath",path);
chartPathList.add(chartMap);
return chartPathList;