本文整理汇总了Java中org.jfree.chart.renderer.xy.ClusteredXYBarRenderer类的典型用法代码示例。如果您正苦于以下问题:Java ClusteredXYBarRenderer类的具体用法?Java ClusteredXYBarRenderer怎么用?Java ClusteredXYBarRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClusteredXYBarRenderer类属于org.jfree.chart.renderer.xy包,在下文中一共展示了ClusteredXYBarRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
/**
* Creates a chart.
*
* @param dataset the dataset.
*
* @return a chart.
*/
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle, // chart title
"Date", // domain axis label
true,
"Y", // range axis label
dataset, // data
PlotOrientation.VERTICAL,
!legendPanelOn, // include legend
true,
false
);
// NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
// OPTIONAL CUSTOMISATION COMPLETED.
return chart;
}
示例2: createLegend
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
protected JFreeChart createLegend(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle, // chart title
"Date", // domain axis label
true,
"Y", // range axis label
dataset, // data
PlotOrientation.VERTICAL,
true, // include legend
true,
false
);
// NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
return chart;
}
示例3: createChart
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
/**
* Creates a chart.
*
* @param dataset the dataset.
*
* @return a chart.
*/
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle, // chart title
domainLabel, // domain axis label
true,
rangeLabel, // range axis label
dataset, // data
PlotOrientation.VERTICAL,
!legendPanelOn, // include legend
true,
false
);
// NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
// OPTIONAL CUSTOMISATION COMPLETED.
return chart;
}
示例4: testHashcode
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashcode() {
ClusteredXYBarRenderer r1 = new ClusteredXYBarRenderer();
ClusteredXYBarRenderer r2 = new ClusteredXYBarRenderer();
assertTrue(r1.equals(r2));
int h1 = r1.hashCode();
int h2 = r2.hashCode();
assertEquals(h1, h2);
}
示例5: init
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
/**
* Initialize all the fields of the Histogram and set some properties
*/
public void init(){
keyToSeries = new HashMap<SeriesKey, XYIntervalSeries>();
keyToGraphSeries = new HashMap<SeriesKey, SeriesSettings>();
chart = this.getChart();
plot = chart.getXYPlot();
plot.setBackgroundPaint((Paint)Color.white);
plot.setDrawingSupplier(new DefaultDrawingSupplier(
SeriesSettings.DEFAULT_PAINTS,
DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
SeriesSettings.DEFAULT_SHAPES
));
seriesCollection = (XYIntervalSeriesCollection)plot.getDataset();
maxProb = 1.0;
minProb = 0.0;
numOfBuckets = 10; // default value, can be altered
plot.setRenderer(new ClusteredXYBarRenderer());
addToolTip();
ticks = new ArrayList<Double>();
setCustomDomainAxis();
plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
}
示例6: addToolTip
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
/**
* Add custom tool tip for the Histogram to show more info
*/
public void addToolTip(){
((ClusteredXYBarRenderer)plot.getRenderer()).setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int seriesIndex, int item) {
XYIntervalSeriesCollection collection = (XYIntervalSeriesCollection)dataset;
XYIntervalSeries series = collection.getSeries(seriesIndex);
double minX = series.getXLowValue(item);
double maxX = series.getXHighValue(item);
double height = series.getYValue(item);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("<html><p style='color:#0000ff;'>Prop: '%s'</p>", dataset.getSeriesKey(seriesIndex)));
stringBuilder.append("<table style=\"width:100%\">");
stringBuilder.append("<tr><td> Min range: </td><td>" + (Math.round( minX * 10000.0 ) / 10000.0) + "</td></tr>");
stringBuilder.append("<tr><td> Max range: </td><td>" + (Math.round( maxX * 10000.0 ) / 10000.0) + "</td></tr>");
stringBuilder.append("<tr><td> Number of states: </td><td>" + height + "</td></tr></table>");
stringBuilder.append("</html>");
return stringBuilder.toString();
}
});
}
示例7: createChart
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle,
domainLabel,
false,
rangeLabel,
dataset,
PlotOrientation.VERTICAL,
// !legendPanelOn,
false, // no legend
true,
false
);
// then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
chart.setBackgroundPaint(Color.white);
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
// domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
return chart;
}
示例8: createChart
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle,
domainLabel,
true,
rangeLabel,
dataset,
PlotOrientation.VERTICAL,
false,// !legendPanelOn,
true,
false
);
// then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
chart.setBackgroundPaint(Color.white);
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator(
"{1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0")
);
renderer.setBaseToolTipGenerator(generator);
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
plot.setBackgroundPaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.white);
DateAxis axis = (DateAxis) plot.getDomainAxis();
axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
axis.setLowerMargin(0.01);
axis.setUpperMargin(0.01);
// setXSummary(dataset); X is time
return chart;
}
示例9: createChart
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle,
domainLabel,
false,
rangeLabel,
dataset,
PlotOrientation.VERTICAL,
false, //!legendPanelOn,
true,
false
);
// then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
chart.setBackgroundPaint(Color.white);
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
return chart;
}
示例10: createChart
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
protected JFreeChart createChart(IntervalXYDataset dataset) {
domainLabel= "Row_Number";
rangeLabel= "Frequency";
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle,
domainLabel,
false,
rangeLabel,
dataset,
PlotOrientation.VERTICAL,
false,//!legendPanelOn,
true,
false
);
// then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
chart.setBackgroundPaint(Color.white);
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
return chart;
}
示例11: createChart
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle,
domainLabel,
false,
rangeLabel,
dataset,
PlotOrientation.VERTICAL,
false,//!legendPanelOn,
true,
false
);
// then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
chart.setBackgroundPaint(Color.white);
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
return chart;
}
示例12: createChart
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle,
domainLabel,
true,
rangeLabel,
dataset,
PlotOrientation.VERTICAL,
!legendPanelOn,
true,
false
);
// then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
chart.setBackgroundPaint(Color.white);
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator(
"{1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0")
);
renderer.setBaseToolTipGenerator(generator);
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
plot.setBackgroundPaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.white);
DateAxis axis = (DateAxis) plot.getDomainAxis();
axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
axis.setLowerMargin(0.01);
axis.setUpperMargin(0.01);
// setXSummary(dataset); X is time
return chart;
}
示例13: createChart
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle,
domainLabel,
false,
rangeLabel,
dataset,
PlotOrientation.VERTICAL,
true,
true,
false
);
// then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
chart.setBackgroundPaint(Color.white);
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
//plot.setRenderer(new XYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
// domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
// setXSummary(dataset); //X is time
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
return chart;
}
示例14: createChart
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
/**
* Creates a chart.
*
* @param dataset the dataset.
*
* @return The chart.
*/
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle, // chart title
domainLabel, // domain axis label
true,
rangeLabel, // range axis label
dataset, // data
PlotOrientation.VERTICAL,
!legendPanelOn, // include legend
//false, // when choose no legend, the color order used in chart is different
true,
false
);
// NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
renderer.setBaseToolTipGenerator(
new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new SimpleDateFormat("d-MMM-yy"), new DecimalFormat("#,##0.00")
)
);
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
// OPTIONAL CUSTOMISATION COMPLETED.
//setXSummary(dataset); X is time
return chart;
}
示例15: createLegend
import org.jfree.chart.renderer.xy.ClusteredXYBarRenderer; //导入依赖的package包/类
protected JFreeChart createLegend(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle, // chart title
domainLabel, // domain axis label
true,
rangeLabel, // range axis label
dataset, // data
PlotOrientation.VERTICAL,
true, // include legend
true,
false
);
// NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
renderer.setBaseToolTipGenerator(
new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new SimpleDateFormat("d-MMM-yy"), new DecimalFormat("#,##0.00")
)
);
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
// OPTIONAL CUSTOMISATION COMPLETED.
//setXSummary(dataset); X is time
return chart;
}