本文整理匯總了Java中org.jfree.chart.ChartFactory.createXYBarChart方法的典型用法代碼示例。如果您正苦於以下問題:Java ChartFactory.createXYBarChart方法的具體用法?Java ChartFactory.createXYBarChart怎麽用?Java ChartFactory.createXYBarChart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.chart.ChartFactory
的用法示例。
在下文中一共展示了ChartFactory.createXYBarChart方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addChart
import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
/**
* It creates a chart for the given dataset and adds the chart to the panel.
*
* @param dataset The dataset that will provide the values for the chart.
*/
private void addChart() {
JFreeChart chart = ChartFactory.createXYBarChart(getTitle(),
"Buckets (sec)", false, "Count",
dataset, PlotOrientation.VERTICAL, true, true, false);
chart.addProgressListener(locker);
XYPlot plot = (XYPlot) chart.getPlot();
XYItemRenderer renderer = plot.getRenderer();
renderer.setToolTipGenerator(dataset);
groupActivatingPanel = new GroupActivatingPanel(dataset, locker);
org.jfree.chart.ChartPanel chartPanel =
new org.jfree.chart.ChartPanel(chart);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
groupActivatingPanel,chartPanel);
splitPane.setDividerLocation(200);
mainPanel().add(BorderLayout.CENTER, splitPane);
}
示例2: addChart
import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
/**
* It creates a chart for the given dataset and adds the chart to the panel.
*
* @param dataset The dataset that will provide the values for the chart.
*/
private void addChart() {
JFreeChart chart = ChartFactory.createXYBarChart(getTitle(),
"Elapsed Time (sec)", false, "Time" + unitSuffix(),
dataset, PlotOrientation.VERTICAL, true, true, false);
chart.addProgressListener(locker);
XYPlot plot = (XYPlot) chart.getPlot();
XYItemRenderer renderer = plot.getRenderer();
renderer.setToolTipGenerator(dataset);
groupActivatingTable = new GroupActivatingPanel(dataset, locker);
org.jfree.chart.ChartPanel chartPanel =
new org.jfree.chart.ChartPanel(chart);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
groupActivatingTable, chartPanel);
splitPane.setDividerLocation(200);
mainPanel().add(BorderLayout.CENTER, splitPane);
}
示例3: createChart
import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return A sample chart.
*/
private JFreeChart createChart(IntervalXYDataset dataset,String s) {
final JFreeChart chart = ChartFactory.createXYBarChart(
"Histogram Plot: "+s,
"Keyword index",
false,
"frequency",
dataset,
PlotOrientation.VERTICAL,
true,
true,
false
);
XYPlot plot = (XYPlot) chart.getPlot();
final IntervalMarker target = new IntervalMarker(400.0, 700.0);
//target.setLabel("Target Range");
target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
target.setLabelAnchor(RectangleAnchor.LEFT);
target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
target.setPaint(new Color(222, 222, 255, 128));
plot.addRangeMarker(target, Layer.BACKGROUND);
return chart;
}
示例4: createChart
import org.jfree.chart.ChartFactory; //導入方法依賴的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
);
}
示例5: testFindDomainBounds
import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
/**
* Check that the renderer is calculating the domain bounds correctly.
*/
public void testFindDomainBounds() {
XYSeriesCollection dataset
= RendererXYPackageTests.createTestXYSeriesCollection();
JFreeChart chart = ChartFactory.createXYBarChart(
"Test Chart", "X", false, "Y", dataset,
PlotOrientation.VERTICAL, false, false, false
);
XYPlot plot = (XYPlot) chart.getPlot();
NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
domainAxis.setAutoRangeIncludesZero(false);
Range bounds = domainAxis.getRange();
assertFalse(bounds.contains(0.3));
assertTrue(bounds.contains(0.5));
assertTrue(bounds.contains(2.5));
assertFalse(bounds.contains(2.8));
}