public static void enableFlatLook(final boolean flat) {
if (flat) {
BarRenderer.setDefaultBarPainter(new StandardBarPainter());
BarRenderer.setDefaultShadowsVisible(false);
XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
XYBarRenderer.setDefaultShadowsVisible(false);
StackedBarRenderer.setDefaultBarPainter(new StandardBarPainter());
StackedBarRenderer.setDefaultShadowsVisible(false);
} else {
BarRenderer.setDefaultBarPainter(new GradientBarPainter());
BarRenderer.setDefaultShadowsVisible(true);
XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
XYBarRenderer.setDefaultShadowsVisible(true);
StackedBarRenderer.setDefaultBarPainter(new GradientBarPainter());
StackedBarRenderer.setDefaultShadowsVisible(true);
}
}
java类org.jfree.chart.renderer.category.StackedBarRenderer的实例源码
ChartJFreeChartOutputHistogram.java 文件源码
项目:gama
阅读 25
收藏 0
点赞 0
评论 0
StackedBarRendererTests.java 文件源码
项目:astor
阅读 20
收藏 0
点赞 0
评论 0
/**
* Some checks for the findRangeBounds() method.
*/
public void testFindRangeBounds() {
StackedBarRenderer r = new StackedBarRenderer();
assertNull(r.findRangeBounds(null));
// an empty dataset should return a null range
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
assertNull(r.findRangeBounds(dataset));
dataset.addValue(1.0, "R1", "C1");
assertEquals(new Range(0.0, 1.0), r.findRangeBounds(dataset));
dataset.addValue(-2.0, "R1", "C2");
assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset));
dataset.addValue(null, "R1", "C3");
assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset));
dataset.addValue(2.0, "R2", "C1");
assertEquals(new Range(-2.0, 3.0), r.findRangeBounds(dataset));
dataset.addValue(null, "R2", "C2");
assertEquals(new Range(-2.0, 3.0), r.findRangeBounds(dataset));
}
ChartFactory.java 文件源码
项目:astor
阅读 21
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
* as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param domainAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param rangeAxisLabel the label for the value axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel, String rangeAxisLabel,
CategoryDataset dataset, boolean legend) {
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
renderer.setBaseToolTipGenerator(
new StandardCategoryToolTipGenerator());
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
ChartUtils.java 文件源码
项目:iveely.ml
阅读 27
收藏 0
点赞 0
评论 0
public static void setStackBarRender(CategoryPlot plot) {
plot.setNoDataMessage(NO_DATA_MSG);
plot.setInsets(new RectangleInsets(10, 10, 5, 10));
StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
plot.setRenderer(renderer);
setXAixs(plot);
setYAixs(plot);
}
ChartFactory.java 文件源码
项目:parabuild-ci
阅读 31
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings.
* <P>
* The chart object returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
* range axis, and a {@link StackedBarRenderer} as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param domainAxisLabel the label for the category axis (<code>null</code> permitted).
* @param rangeAxisLabel the label for the value axis (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation of the chart (horizontal or vertical) (<code>null</code>
* not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel,
String rangeAxisLabel,
CategoryDataset dataset,
PlotOrientation orientation,
boolean legend,
boolean tooltips,
boolean urls) {
if (orientation == null) {
throw new IllegalArgumentException("Null 'orientation' argument.");
}
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
if (tooltips) {
renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setItemURLGenerator(new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
StackedBarRendererTests.java 文件源码
项目:parabuild-ci
阅读 27
收藏 0
点赞 0
评论 0
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashcode() {
StackedBarRenderer r1 = new StackedBarRenderer();
StackedBarRenderer r2 = new StackedBarRenderer();
assertTrue(r1.equals(r2));
int h1 = r1.hashCode();
int h2 = r2.hashCode();
assertEquals(h1, h2);
}
StackedBarRendererTests.java 文件源码
项目:parabuild-ci
阅读 22
收藏 0
点赞 0
评论 0
/**
* Check that the equals() method distinguishes all fields.
*/
public void testEquals() {
StackedBarRenderer r1 = new StackedBarRenderer();
StackedBarRenderer r2 = new StackedBarRenderer();
assertTrue(r1.equals(r2));
assertTrue(r2.equals(r1));
r1.setRenderAsPercentages(true);
assertFalse(r1.equals(r2));
r2.setRenderAsPercentages(true);
assertTrue(r1.equals(r2));
}
StackedBarRendererTests.java 文件源码
项目:parabuild-ci
阅读 23
收藏 0
点赞 0
评论 0
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
StackedBarRenderer r1 = new StackedBarRenderer();
StackedBarRenderer r2 = new StackedBarRenderer();
assertTrue(r1.equals(r2));
int h1 = r1.hashCode();
int h2 = r2.hashCode();
assertEquals(h1, h2);
}
ChartFactory.java 文件源码
项目:parabuild-ci
阅读 23
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
* as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param domainAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param rangeAxisLabel the label for the value axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation of the chart (horizontal or
* vertical) (<code>null</code> not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel,
String rangeAxisLabel,
CategoryDataset dataset,
PlotOrientation orientation,
boolean legend,
boolean tooltips,
boolean urls) {
if (orientation == null) {
throw new IllegalArgumentException("Null 'orientation' argument.");
}
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
return chart;
}
StackedBarChartBuilder.java 文件源码
项目:ojAlgo-extensions
阅读 24
收藏 0
点赞 0
评论 0
@Override
protected Plot makePlot(final JFreeChartBuilder.PlotParameters parameters) {
final DefaultKeyedValues2DDataset tmpDataset = this.getDataset();
final CategoryAxis tmpCategoryAxis = this.makeCategoryAxis(domain);
final ValueAxis tmpValueAxis = this.makeValueAxis(range);
final StackedBarRenderer tmpRenderer = new StackedBarRenderer();
tmpRenderer.setBarPainter(new StandardBarPainter());
tmpRenderer.setShadowVisible(false);
if (this.isTooltips()) {
tmpRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
}
if (this.isUrls()) {
tmpRenderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
}
this.setColours(tmpRenderer, tmpDataset);
final CategoryPlot retVal = new CategoryPlot(tmpDataset, tmpCategoryAxis, tmpValueAxis, tmpRenderer);
retVal.setOrientation(parameters.getOrientation());
retVal.setBackgroundPaint(parameters.getBackground());
retVal.setOutlinePaint(parameters.getOutline());
return retVal;
}
ChartFactory.java 文件源码
项目:ccu-historian
阅读 26
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
* as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param domainAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param rangeAxisLabel the label for the value axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation of the chart (horizontal or
* vertical) (<code>null</code> not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel, String rangeAxisLabel,
CategoryDataset dataset, PlotOrientation orientation,
boolean legend, boolean tooltips, boolean urls) {
ParamChecks.nullNotPermitted(orientation, "orientation");
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
ChartFactory.java 文件源码
项目:jfreechart
阅读 25
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
* as the renderer.
*
* @param title the chart title ({@code null} permitted).
* @param domainAxisLabel the label for the category axis
* ({@code null} permitted).
* @param rangeAxisLabel the label for the value axis
* ({@code null} permitted).
* @param dataset the dataset for the chart ({@code null} permitted).
* @param orientation the orientation of the chart (horizontal or
* vertical) ({@code null} not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel, String rangeAxisLabel,
CategoryDataset dataset, PlotOrientation orientation,
boolean legend, boolean tooltips, boolean urls) {
Args.nullNotPermitted(orientation, "orientation");
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
if (tooltips) {
renderer.setDefaultToolTipGenerator(
new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setDefaultItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
ChartFactory.java 文件源码
项目:aya-lang
阅读 24
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
* as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param domainAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param rangeAxisLabel the label for the value axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation of the chart (horizontal or
* vertical) (<code>null</code> not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel, String rangeAxisLabel,
CategoryDataset dataset, PlotOrientation orientation,
boolean legend, boolean tooltips, boolean urls) {
ParamChecks.nullNotPermitted(orientation, "orientation");
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
StackedBarRendererBuilder.java 文件源码
项目:groovychart
阅读 21
收藏 0
点赞 0
评论 0
/**
* Creates a new instance of StackedBarRendererBuilder
*/
public StackedBarRendererBuilder() {
try {
setBeanClass(StackedBarRenderer.class);
} catch (IntrospectionException ex) {
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
StackedBarRendererBuilder.java 文件源码
项目:groovychart
阅读 19
收藏 0
点赞 0
评论 0
public void processNode(Object name, Map map, Object value) throws Exception {
String method = name.toString();
if(value != null && value instanceof StackedBarRenderer) {
this.renderer = (StackedBarRenderer)value;
}else if(method.equalsIgnoreCase("StackedBarRenderer")) {
this.setProperties(this.renderer, map);
}
}
LeitnerStatePanel.java 文件源码
项目:opencards
阅读 84
收藏 0
点赞 0
评论 0
private void reconfigureColorEncoding() {
StackedBarRenderer renderer = new StackedBarRenderer();
renderer.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL));
renderer.setItemMargin(0.0);
int barIndex = 0;
//blue
Paint p1 = new GradientPaint(0.0f, 0.0f, new Color(0x22, 0x22, 0xFF), 0.0f, 0.0f, new Color(0x88, 0x88, 0xFF));
renderer.setSeriesPaint(barIndex, p1);
renderer.setSeriesToolTipGenerator(barIndex, new StandardCategoryToolTipGenerator());
//green
barIndex++;
Paint p3 = new GradientPaint(0.0f, 0.0f, new Color(0x22, 0xFF, 0x22), 0.0f, 0.0f, new Color(0x88, 0xFF, 0x88));
renderer.setSeriesPaint(barIndex, p3);
renderer.setSeriesToolTipGenerator(barIndex, new StandardCategoryToolTipGenerator());
if (hightlightItem != null) {
//red
barIndex++;
Paint p2 = new GradientPaint(0.0f, 0.0f, new Color(0xFF, 0x22, 0x22), 0.0f, 0.0f, new Color(0xFF, 0x88, 0x88));
renderer.setSeriesPaint(barIndex, p2);
renderer.setSeriesToolTipGenerator(barIndex, new StandardCategoryToolTipGenerator());
}
plot.setRenderer(renderer);
}
ColorBarGraph.java 文件源码
项目:fhaes
阅读 22
收藏 0
点赞 0
评论 0
/**
* Creates the chart with the data from the given data set.
*
* @param dataset the data to plot.
* @return the chart.
*/
private static JFreeChart createChart(final CategoryDataset dataset) {
final JFreeChart chart = ChartFactory.createStackedBarChart("", "", "", dataset, PlotOrientation.VERTICAL, false, true, false);
StackedBarRenderer renderer = new StackedBarRenderer(true);
renderer.setShadowVisible(false);
renderer.setBarPainter(new StandardBarPainter()); // Remove shine
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
CategoryPlot plot = chart.getCategoryPlot();
plot.setRenderer(renderer);
plot.setBackgroundPaint(Color.WHITE);
plot.setDomainGridlinesVisible(true);
plot.setDomainGridlinePaint(new Color(192, 192, 192));
plot.getDomainAxis().setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
plot.getDomainAxis().setVisible(false);
plot.getRangeAxis().setVisible(false);
plot.getDomainAxis().setLowerMargin(.025);
plot.getDomainAxis().setUpperMargin(.025);
chart.setBackgroundPaint(new Color(214, 217, 233, 30));
return chart;
}
ColorBar.java 文件源码
项目:fhaes
阅读 21
收藏 0
点赞 0
评论 0
/**
* Creates a chart when given a data set.
*
* @param dataset to be plotted.
* @return the created chart.
*/
private static JFreeChart createChart(final CategoryDataset dataset) {
final JFreeChart chart = ChartFactory.createStackedBarChart("", "", "", dataset, PlotOrientation.HORIZONTAL, false, true, false);
chart.setPadding(RectangleInsets.ZERO_INSETS);
chart.setBorderVisible(false);
StackedBarRenderer renderer = new StackedBarRenderer();
renderer.setBarPainter(new StandardBarPainter()); // Remove shine
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
renderer.setShadowVisible(false);
CategoryPlot plot = chart.getCategoryPlot();
plot.setRenderer(renderer);
// plot.setBackgroundAlpha(0.0f);
plot.setDomainGridlinesVisible(false);
plot.setRangeGridlinesVisible(false);
plot.getRangeAxis().setVisible(false);
plot.getRangeAxis().setLowerMargin(0);
plot.getRangeAxis().setUpperMargin(0);
plot.getDomainAxis().setVisible(false);
plot.getDomainAxis().setLowerMargin(0);
plot.getDomainAxis().setUpperMargin(0);
return chart;
}
StackedBarChartDemo2.java 文件源码
项目:HTML5_WebSite
阅读 25
收藏 0
点赞 0
评论 0
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return a sample chart.
*/
protected JFreeChart createChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createStackedBarChart(
chartTitle,
domainLabel, // domain axis label
rangeLabel, // range axis label
dataset, // data
PlotOrientation.HORIZONTAL, // the plot orientation
!legendPanelOn, // include legend
true, // tooltips
false // urls
);
/* CategoryPlot plot = (CategoryPlot) chart.getPlot();
StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
renderer.setItemLabelsVisible(true);*/
CategoryPlot plot = chart.getCategoryPlot();
CategoryItemRenderer renderer = new ExtendedStackedBarRenderer();
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelGenerator(
new StandardCategoryItemLabelGenerator());
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
plot.setRenderer(renderer);
ValueAxis rangeAxis = plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setLowerMargin(0.15);
rangeAxis.setUpperMargin(0.15);
StackedBarRenderer renderer2 = (StackedBarRenderer) plot.getRenderer();
renderer2.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
setCategorySummary(dataset);
return chart;
}
StackedBarChartDemo1.java 文件源码
项目:HTML5_WebSite
阅读 24
收藏 0
点赞 0
评论 0
/**
* Creates a sample chart.
*
* @param dataset the dataset for the chart.
*
* @return a sample chart.
*/
protected JFreeChart createChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createStackedBarChart(
chartTitle, // chart title
domainLabel, // domain axis label
rangeLabel, // range axis label
dataset, // data
PlotOrientation.VERTICAL, // the plot orientation
!legendPanelOn, // legend
true, // tooltips
false // urls
);
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.white);
StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
renderer.setDrawBarOutline(false);
renderer.setBaseItemLabelsVisible(true);
renderer.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator());
renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
setCategorySummary(dataset);
return chart;
}
StackedBarChartDemo3.java 文件源码
项目:HTML5_WebSite
阅读 19
收藏 0
点赞 0
评论 0
/**
* Creates a sample chart.
*
* @param dataset the dataset for the chart.
*
* @return a sample chart.
*/
protected JFreeChart createChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createStackedBarChart(
chartTitle, // chart title
domainLabel, // domain axis label
rangeLabel, // range axis label
dataset, // data
PlotOrientation.VERTICAL, // the plot orientation
!legendPanelOn, // legend
false, // tooltips
false // urls
);
CategoryPlot plot = chart.getCategoryPlot();
CategoryItemRenderer renderer = new ExtendedStackedBarRenderer();
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelGenerator(
new StandardCategoryItemLabelGenerator());
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
plot.setRenderer(renderer);
ValueAxis rangeAxis = plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setLowerMargin(0.15);
rangeAxis.setUpperMargin(0.15);
StackedBarRenderer renderer2 = (StackedBarRenderer) plot.getRenderer();
renderer2.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
setCategorySummary(dataset);
return chart;
}
ChartFactory.java 文件源码
项目:HTML5_WebSite
阅读 25
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
* as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param domainAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param rangeAxisLabel the label for the value axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation of the chart (horizontal or
* vertical) (<code>null</code> not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel,
String rangeAxisLabel,
CategoryDataset dataset,
PlotOrientation orientation,
boolean legend,
boolean tooltips,
boolean urls) {
if (orientation == null) {
throw new IllegalArgumentException("Null 'orientation' argument.");
}
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
ChartFactory.java 文件源码
项目:populus
阅读 24
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
* as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param domainAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param rangeAxisLabel the label for the value axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation of the chart (horizontal or
* vertical) (<code>null</code> not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel, String rangeAxisLabel,
CategoryDataset dataset, PlotOrientation orientation,
boolean legend, boolean tooltips, boolean urls) {
ParamChecks.nullNotPermitted(orientation, "orientation");
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
DefaultChartService.java 文件源码
项目:AgileAlligators
阅读 21
收藏 0
点赞 0
评论 0
/**
* Returns a stacked bar renderer.
*/
private StackedBarRenderer getStackedBarRenderer()
{
StackedBarRenderer renderer = new StackedBarRenderer();
for ( int i = 0; i < COLORS.length; i++ )
{
renderer.setSeriesPaint( i, COLORS[i] );
renderer.setShadowVisible( false );
}
return renderer;
}
ChartFactory.java 文件源码
项目:PI
阅读 19
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
* as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param domainAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param rangeAxisLabel the label for the value axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation of the chart (horizontal or
* vertical) (<code>null</code> not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel,
String rangeAxisLabel,
CategoryDataset dataset,
PlotOrientation orientation,
boolean legend,
boolean tooltips,
boolean urls) {
if (orientation == null) {
throw new IllegalArgumentException("Null 'orientation' argument.");
}
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
StackedBarRendererTests.java 文件源码
项目:nabs
阅读 21
收藏 0
点赞 0
评论 0
/**
* Check that the equals() method distinguishes all fields.
*/
public void testEquals() {
StackedBarRenderer r1 = new StackedBarRenderer();
StackedBarRenderer r2 = new StackedBarRenderer();
assertTrue(r1.equals(r2));
assertTrue(r2.equals(r1));
r1.setRenderAsPercentages(true);
assertFalse(r1.equals(r2));
r2.setRenderAsPercentages(true);
assertTrue(r1.equals(r2));
}
StackedBarRendererTests.java 文件源码
项目:nabs
阅读 24
收藏 0
点赞 0
评论 0
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
StackedBarRenderer r1 = new StackedBarRenderer();
StackedBarRenderer r2 = new StackedBarRenderer();
assertTrue(r1.equals(r2));
int h1 = r1.hashCode();
int h2 = r2.hashCode();
assertEquals(h1, h2);
}
ChartFactory.java 文件源码
项目:nabs
阅读 23
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
* as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param domainAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param rangeAxisLabel the label for the value axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation of the chart (horizontal or
* vertical) (<code>null</code> not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel,
String rangeAxisLabel,
CategoryDataset dataset,
PlotOrientation orientation,
boolean legend,
boolean tooltips,
boolean urls) {
if (orientation == null) {
throw new IllegalArgumentException("Null 'orientation' argument.");
}
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
return chart;
}
BarCreater.java 文件源码
项目:cooper
阅读 21
收藏 0
点赞 0
评论 0
private static JFreeChart createChart(GraphDataItem item, CategoryDataset categorydataset) {
JFreeChart jfreechart = ChartFactory.createStackedBarChart(item.getTitle(), item.getLineXName(),
item.getLineYName(), categorydataset, PlotOrientation.VERTICAL, true, true, false);
Font font = new Font("宋体", Font.PLAIN, 13);
jfreechart.getTitle().setFont(font);
jfreechart.getLegend().setItemFont(font);
CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
categoryplot.getDomainAxis().setTickLabelFont(font);
categoryplot.getDomainAxis().setLabelFont(font);
categoryplot.getDomainAxis().setCategoryLabelPositions(
CategoryLabelPositions.createUpRotationLabelPositions(0.392D));
categoryplot.getRangeAxis().setTickLabelFont(font);
categoryplot.getRangeAxis().setLabelFont(font);
categoryplot.setBackgroundPaint(ChartColor.WHITE);
StackedBarRenderer stackedbarrenderer = (StackedBarRenderer) categoryplot.getRenderer();
stackedbarrenderer.setDrawBarOutline(false);
stackedbarrenderer.setBaseItemLabelsVisible(true);
stackedbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
// int index = 0;
// for (Object name : item.getDatas().keySet()) {
// stackedbarrenderer
// .setSeriesPaint(categorydataset.getRowIndex((String) name), COLORS[index % COLORS.length]);
// index++;
//
// }
return jfreechart;
}
ChartFactory.java 文件源码
项目:ECG-Viewer
阅读 22
收藏 0
点赞 0
评论 0
/**
* Creates a stacked bar chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
* as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param domainAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param rangeAxisLabel the label for the value axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation of the chart (horizontal or
* vertical) (<code>null</code> not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked bar chart.
*/
public static JFreeChart createStackedBarChart(String title,
String domainAxisLabel, String rangeAxisLabel,
CategoryDataset dataset, PlotOrientation orientation,
boolean legend, boolean tooltips, boolean urls) {
ParamChecks.nullNotPermitted(orientation, "orientation");
CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
StackedBarRenderer renderer = new StackedBarRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}