本文整理汇总了Java中org.jfree.data.xy.XYBarDataset类的典型用法代码示例。如果您正苦于以下问题:Java XYBarDataset类的具体用法?Java XYBarDataset怎么用?Java XYBarDataset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XYBarDataset类属于org.jfree.data.xy包,在下文中一共展示了XYBarDataset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
DefaultXYDataset d1 = new DefaultXYDataset();
double[] x1 = new double[] {1.0, 2.0, 3.0};
double[] y1 = new double[] {4.0, 5.0, 6.0};
double[][] data1 = new double[][] {x1, y1};
d1.addSeries("S1", data1);
DefaultXYDataset d2 = new DefaultXYDataset();
double[] x2 = new double[] {1.0, 2.0, 3.0};
double[] y2 = new double[] {4.0, 5.0, 6.0};
double[][] data2 = new double[][] {x2, y2};
d2.addSeries("S1", data2);
XYBarDataset bd1 = new XYBarDataset(d1, 5.0);
XYBarDataset bd2 = new XYBarDataset(d2, 5.0);
assertTrue(bd1.equals(bd2));
assertTrue(bd2.equals(bd1));
}
示例2: testEquals
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
DefaultXYDataset d1 = new DefaultXYDataset();
double[] x1 = new double[] {1.0, 2.0, 3.0};
double[] y1 = new double[] {4.0, 5.0, 6.0};
double[][] data1 = new double[][] {x1, y1};
d1.addSeries("S1", data1);
DefaultXYDataset d2 = new DefaultXYDataset();
double[] x2 = new double[] {1.0, 2.0, 3.0};
double[] y2 = new double[] {4.0, 5.0, 6.0};
double[][] data2 = new double[][] {x2, y2};
d2.addSeries("S1", data2);
XYBarDataset bd1 = new XYBarDataset(d1, 5.0);
XYBarDataset bd2 = new XYBarDataset(d2, 5.0);
assertTrue(bd1.equals(bd2));
assertTrue(bd2.equals(bd1));
}
示例3: createChart
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
/**
* Create a horizontal bar chart with sample data in the range -3 to +3.
*
* @return The chart.
*/
private static JFreeChart createChart() {
// create a dataset...
XYSeries series1 = new XYSeries("Series 1");
series1.add(1.0, 1.0);
series1.add(2.0, 2.0);
series1.add(3.0, 3.0);
IntervalXYDataset dataset = new XYBarDataset(new XYSeriesCollection(
series1), 1.0);
// create the chart...
return ChartFactory.createXYBarChart(
"XY Bar Chart", // chart title
"Domain", false,
"Range",
dataset, // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
true // urls
);
}
示例4: createChart
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
/**
* Create a horizontal bar chart with sample data in the range -3 to +3.
*
* @return The chart.
*/
private static JFreeChart createChart() {
XYSeries series1 = new XYSeries("Series 1");
series1.add(1.0, 1.0);
series1.add(2.0, 2.0);
series1.add(3.0, 3.0);
IntervalXYDataset dataset = new XYBarDataset(new XYSeriesCollection(
series1), 1.0);
return ChartFactory.createXYBarChart("XY Bar Chart", "Domain", false,
"Range", dataset);
}
示例5: initComponents
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
protected void initComponents() {
setLayout(new BorderLayout());
// create chart
theDataset = new DefaultXYDataset();
theIsotopesDataset = new DefaultXYDataset();
theChart = org.jfree.chart.ChartFactory.createScatterPlot("PeakList", "m/z ratio", "Intensity", new XYBarDataset(theDataset,0.001), org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false);
thePlot = (XYPlot)theChart.getPlot();
thePlot.setRenderer(new XYBarRenderer());
thePlot.setDataset(1, theIsotopesDataset);
thePlot.setRenderer(1,new StandardXYItemRenderer(StandardXYItemRenderer.LINES));
theChartPanel = new ChartPanel(theChart);
theChartPanel.setDomainZoomable(false);
theChartPanel.setRangeZoomable(false);
theChartPanel.setPopupMenu(null);
add(theChartPanel,BorderLayout.CENTER);
// create toolbar
theToolBar = createToolBar();
add(theToolBar,BorderLayout.SOUTH);
}
示例6: createChartPanel
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
/**
* Creates and initializes the chart panel.
*/
public ChartPanel createChartPanel() {
XYBarDataset barDataset = new XYBarDataset(dataset, BAR_WIDTH);
NumberAxis xaxis = new NumberAxis(I18n.get("statistic.queryTimeHistoryPanel.time"));
NumberAxis yaxis = new NumberAxis(I18n.get("statistic.queryTimeHistoryPanel.averageQueryTime"));
xaxis.setStandardTickUnits(new ChartUtils.LowerBoundedTickUnitSource(xaxis.getStandardTickUnits(), LOWER_TICK_UNIT));
XYPlot plot = new XYPlot(barDataset, xaxis, yaxis, new XYBarRenderer());
JFreeChart chart = new JFreeChart(I18n.get("statistic.queryTimeHistoryPanel.queryHistory"),
null, plot, false);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setBorder(CHART_BORDER);
chartPanel.setMinimumDrawHeight(0);
chartPanel.setMinimumDrawWidth(0);
chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
return chartPanel;
}
示例7: createChartPanel
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
private Component createChartPanel() {
XYBarDataset xyBarDataset = new XYBarDataset(xyDataset, BAR_WIDTH);
NumberAxis xaxis = new NumberAxis(I18n.get("statistic.histogramChartPanel.time"));
NumberAxis yaxis = new NumberAxis(I18n.get("statistic.histogramChartPanel.numberOfQueries"));
xaxis.setStandardTickUnits(new ChartUtils.LowerBoundedTickUnitSource(xaxis.getStandardTickUnits(), LOWER_TICK_UNIT));
XYPlot plot = new XYPlot(xyBarDataset, xaxis, yaxis, new XYBarRenderer());
JFreeChart chart = new JFreeChart(I18n.get(
"statistic.histogramChartPanel.title"),
null, plot, false);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setBorder(CHART_BORDER);
chartPanel.setMinimumDrawHeight(0);
chartPanel.setMinimumDrawWidth(0);
chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
return chartPanel;
}
示例8: createChart
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
/**
* Create a horizontal bar chart with sample data in the range -3 to +3.
*
* @return The chart.
*/
private static JFreeChart createChart() {
// create a dataset...
XYSeries series1 = new XYSeries("Series 1");
series1.add(1.0, 1.0);
series1.add(2.0, 2.0);
series1.add(3.0, 3.0);
IntervalXYDataset dataset = new XYBarDataset(new XYSeriesCollection(
series1), 1.0);
// create the chart...
return ChartFactory.createXYBarChart("XY Bar Chart", "Domain", false,
"Range", dataset, true);
}
示例9: testGetLegendItemSeriesIndex
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
/**
* A check for the datasetIndex and seriesIndex fields in the LegendItem
* returned by the getLegendItem() method.
*/
@Test
public void testGetLegendItemSeriesIndex() {
XYSeriesCollection d1 = new XYSeriesCollection();
XYSeries s1 = new XYSeries("S1");
s1.add(1.0, 1.1);
XYSeries s2 = new XYSeries("S2");
s2.add(1.0, 1.1);
d1.addSeries(s1);
d1.addSeries(s2);
XYSeriesCollection d2 = new XYSeriesCollection();
XYSeries s3 = new XYSeries("S3");
s3.add(1.0, 1.1);
XYSeries s4 = new XYSeries("S4");
s4.add(1.0, 1.1);
XYSeries s5 = new XYSeries("S5");
s5.add(1.0, 1.1);
d2.addSeries(s3);
d2.addSeries(s4);
d2.addSeries(s5);
XYBarRenderer r = new XYBarRenderer();
XYPlot plot = new XYPlot(new XYBarDataset(d1, 1.0), new NumberAxis("x"),
new NumberAxis("y"), r);
plot.setDataset(1, new XYBarDataset(d2, 2.0));
/*JFreeChart chart =*/ new JFreeChart(plot);
LegendItem li = r.getLegendItem(1, 2);
assertEquals("S5", li.getLabel());
assertEquals(1, li.getDatasetIndex());
assertEquals(2, li.getSeriesIndex());
}
示例10: processNode
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
public void processNode(Object name, Map map, Object value) throws Exception {
if(value != null && value instanceof XYBarDataset) {
this.xyDataset = (XYBarDataset)value;
}else {
// TODO
}
}
示例11: generateTimeSeriesChart
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
public static JFreeChart generateTimeSeriesChart(String title, List<HistoryAggregateItem> history, String timespan, Calendar cal) throws ParseException {
TimeSeries series = initializeSeries(timespan, cal, history);
TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.addSeries(series);
IntervalXYDataset idataset = new XYBarDataset(dataset, 1);
JFreeChart chart = org.jfree.chart.ChartFactory.createXYBarChart(
title, // Title
"Date/time", // X-axis Label
true,
"Hits", // Y-axis Label
idataset, // Dataset
PlotOrientation.VERTICAL,
true, // Show legend
true, // Use tooltips
false // Generate URLs
);
chart.setBackgroundPaint(Color.WHITE);
chart.setBorderPaint(Color.BLACK);
XYPlot plot = (XYPlot)chart.getPlot();
plot.setBackgroundPaint(Color.LIGHT_GRAY);
plot.getRenderer().setSeriesPaint(0, Color.BLUE);
plot.setDomainGridlinePaint(Color.GRAY);
plot.setRangeGridlinePaint(Color.GRAY);
chart.removeLegend();
return chart;
}
示例12: updateChart
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
private void updateChart() {
String x_label = "m/z ratio";
String y_label = (theDocument.isShowRelativeIntensities()) ?"Intensity %" :"Intensity";
theDataset = new DefaultXYDataset();
if( theDocument.getPeakData()!=null ) {
theChart = org.jfree.chart.ChartFactory.createScatterPlot(null, x_label, y_label, theDataset, org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false);
thePlot = (XYPlot)theChart.getPlot();
thePlot.setRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.LINES));
}
else {
theChart = org.jfree.chart.ChartFactory.createScatterPlot(null, x_label, y_label, new XYBarDataset(theDataset,0.001), org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false);
thePlot = (XYPlot)theChart.getPlot();
thePlot.setRenderer(new XYBarRenderer());
}
if( theDocument.isShowRelativeIntensities() && theOptions.SHOW_MAX_INTENSITY ) {
// set second axis
ValueAxis second_axis = new NumberAxis("");
thePlot.setRangeAxis(1, second_axis);
// set dataset
maxIntensityDataset = new DefaultXYDataset();
thePlot.setDataset(1, maxIntensityDataset);
thePlot.mapDatasetToRangeAxis(1, 1);
// set invisible renderer
StandardXYItemRenderer r = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES);
r.setBaseShapesVisible(false);
thePlot.setRenderer(1,r);
}
theChart.setBackgroundPaint(Color.white);
theChart.setBorderVisible(false);
thePlot.getRenderer().setPaint(theOptions.SPECTRUM_COLOR);
thePlot.setOutlinePaint(null);
thePlot.setDomainGridlinesVisible(false);
thePlot.setRangeGridlinesVisible(false);
}
示例13: testGetLegendItemSeriesIndex
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
/**
* A check for the datasetIndex and seriesIndex fields in the LegendItem
* returned by the getLegendItem() method.
*/
public void testGetLegendItemSeriesIndex() {
XYSeriesCollection d1 = new XYSeriesCollection();
XYSeries s1 = new XYSeries("S1");
s1.add(1.0, 1.1);
XYSeries s2 = new XYSeries("S2");
s2.add(1.0, 1.1);
d1.addSeries(s1);
d1.addSeries(s2);
XYSeriesCollection d2 = new XYSeriesCollection();
XYSeries s3 = new XYSeries("S3");
s3.add(1.0, 1.1);
XYSeries s4 = new XYSeries("S4");
s4.add(1.0, 1.1);
XYSeries s5 = new XYSeries("S5");
s5.add(1.0, 1.1);
d2.addSeries(s3);
d2.addSeries(s4);
d2.addSeries(s5);
XYBarRenderer r = new XYBarRenderer();
XYPlot plot = new XYPlot(new XYBarDataset(d1, 1.0), new NumberAxis("x"),
new NumberAxis("y"), r);
plot.setDataset(1, new XYBarDataset(d2, 2.0));
/*JFreeChart chart =*/ new JFreeChart(plot);
LegendItem li = r.getLegendItem(1, 2);
assertEquals("S5", li.getLabel());
assertEquals(1, li.getDatasetIndex());
assertEquals(2, li.getSeriesIndex());
}
示例14: testPublicCloneable
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
/**
* Verify that this class implements {@link PublicCloneable}.
*/
public void testPublicCloneable() {
DefaultXYDataset d1 = new DefaultXYDataset();
double[] x1 = new double[] {1.0, 2.0, 3.0};
double[] y1 = new double[] {4.0, 5.0, 6.0};
double[][] data1 = new double[][] {x1, y1};
d1.addSeries("S1", data1);
XYBarDataset bd1 = new XYBarDataset(d1, 5.0);
assertTrue(bd1 instanceof PublicCloneable);
}
示例15: getXyDataset
import org.jfree.data.xy.XYBarDataset; //导入依赖的package包/类
/**
* Getter for property xyDataset.
* @return Value of property xyDataset.
*/
public XYBarDataset getXyDataset() {
return this.xyDataset;
}