David
I need to use BubblePlotDemo chart, but it's using SampleXYZDataset as a sample data source. How would I avoid that? (ie, how do I include a sample data in BubblePlotDemo?). See code below:
#############################################################
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.XYZDataset;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
/**
* A bubble chart demo.
*
* @author David Gilbert
*/
public class BubblePlotDemo extends ApplicationFrame {
/**
* A demonstration application showing a bubble chart.
*
* @param title the frame title.
*/
public BubblePlotDemo(String title) {
super(title);
//size and location
setLocation(300,100);
setSize (400,300);
?????????????????????????????????????????
XYZDataset data = new SampleXYZDataset();
?????????????????????????????????????????
JFreeChart chart = createChart(data);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
chartPanel.setVerticalZoom(true);
chartPanel.setHorizontalZoom(true);
setContentPane(chartPanel);
}
/**
* Creates a chart.
*
* @param dataset the dataset.
*
* @return The chart.
*/
private JFreeChart createChart(XYZDataset dataset) {
JFreeChart chart = ChartFactory.createBubbleChart(
"Bubble Plot Demo",
"X",
"Y",
dataset,
PlotOrientation.VERTICAL,
true,
true,
false
);
XYPlot plot = chart.getXYPlot();
plot.setForegroundAlpha(0.65f);
// increase the margins to account for the fact that the auto-range doesn't take into
// account the bubble size...
NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
domainAxis.setLowerMargin(0.15);
domainAxis.setUpperMargin(0.15);
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setLowerMargin(0.15);
rangeAxis.setUpperMargin(0.15);
return chart;
}
}
#############################################################
Thanks,
Luis.
BubblePlotDemo - how to include sample data inside?
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
You need to create a class that implements the XYZDataset interface. There isn't a generic implementation in JFreeChart yet.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


BubblePlotDemo chart
David
How difficult would be to create a class that implements the XYZdataset interface? Are you thinking in implementing it any time soon?
Rgds,
Luis
How difficult would be to create a class that implements the XYZdataset interface? Are you thinking in implementing it any time soon?
Rgds,
Luis
BubbleChart
hi,
is it in the TODO list? I don't want to write 2 or more extra classes for the servlet.
is it in the TODO list? I don't want to write 2 or more extra classes for the servlet.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: BubbleChart
It is on my to-do list, but I doubt it will get done for a while...too many other things to do.guest wrote:is it in the TODO list? I don't want to write 2 or more extra classes for the servlet.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

