scatter plot chart using JChart api(jCharts-0.7.5.jar)

A free public discussion forum for the JFreeChart class library.

scatter plot chart using JChart api(jCharts-0.7.5.jar)

Postby mahesh_burgu » Tue Oct 09, 2007 11:24 am

i am working on chart generation and i am using JFreechart,JCommon and JChart jar files.I got some examples on scatter plot graphs but in all the examples graph points are joined(line drawn between two points).So i want the scatter plot graph without any joints between the points.....can someone plz send me some sample source code
thanks
mahesh
mahesh_burgu
 
Posts: 25
Joined: Mon Oct 08, 2007 7:16 am

Postby Taqua » Tue Oct 09, 2007 11:36 am

JCharts is not JFreeCharts. It is a different project and maybe you should ask your question regarding JCharts there:
http://sourceforge.net/projects/jcharts

The JFreeChart scatter plot does not connect the points - a scatter plot with connected points could never be a proper scatter plot, right?

Have fun,
said Thomas
Taqua
JFreeReport Project Leader
 
Posts: 698
Joined: Fri Mar 14, 2003 3:34 pm

Postby mahesh_burgu » Tue Oct 09, 2007 11:47 am

ohh sorry ...as i am new to this...i am not completely aware of the things...can u please send me some sample code for scatter plot using JFree charts or some links which will help me to go forward with my work....
thanks
mahesh
mahesh_burgu
 
Posts: 25
Joined: Mon Oct 08, 2007 7:16 am

scatter plot chart help

Postby mahesh_burgu » Wed Oct 10, 2007 7:57 am

i got some sample code for Scatter Chart .....but in this example, both the X axis and Y axis coordinate values are mandatory to be double values....so my requirement is to display the X axis coordinate values in Time Stamp for format(date format)...Is there any way to do this.....Any help is greatly appreciated........


import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;

public class ScatterPlotDemo extends ApplicationFrame {

public ScatterPlotDemo(String title) {

super(title);

XYSeriesCollection dataset = new XYSeriesCollection();

XYSeries series1 = new XYSeries("Series 1");
series1.add(1.0, 4.5);
series1.add(4.4, 3.2);
dataset.addSeries(series1);

XYSeries series2 = new XYSeries("Series 2");
series2.add(3.2, 8.5);
series2.add(4.9, 3.7);
dataset.addSeries(series2);

JFreeChart chart = ChartFactory.createScatterPlot(
"Scatter Plot Demo", // title
"X", "Y", // axis labels
dataset, // dataset
PlotOrientation.VERTICAL,
true, // legend? yes
true, // tooltips? yes
false // URLs? no
);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
setContentPane(chartPanel);

}

public static void main(String[] args) {
ScatterPlotDemo demo = new ScatterPlotDemo("Scatter Plot Demo");
demo.pack();
RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
}

}
thanks
mahesh
mahesh_burgu
 
Posts: 25
Joined: Mon Oct 08, 2007 7:16 am

Postby mahesh_burgu » Wed Oct 17, 2007 6:21 am

Is there any one to help me ??
thanks
mahesh
mahesh_burgu
 
Posts: 25
Joined: Mon Oct 08, 2007 7:16 am

Postby jwenting » Mon Oct 22, 2007 6:45 am

Either use a TimeSeries instead of an XYSeries or use the timestamp as a long as the coordinate (which will not look nice with the standard rendering of course).
jwenting
 
Posts: 157
Joined: Sat Jul 15, 2006 7:46 am

Postby mahesh_burgu » Tue Oct 23, 2007 6:52 am

Thanks a lot
Now i am able to generate the scatter plot using both TimeSeries and XYSeries

thank u very much
thanks
mahesh
mahesh_burgu
 
Posts: 25
Joined: Mon Oct 08, 2007 7:16 am


Return to JFreeChart - General

Who is online

Users browsing this forum: Bing [Bot] and 8 guests