本文整理汇总了Java中org.jfree.chart.renderer.category.StackedBarRenderer类的典型用法代码示例。如果您正苦于以下问题:Java StackedBarRenderer类的具体用法?Java StackedBarRenderer怎么用?Java StackedBarRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StackedBarRenderer类属于org.jfree.chart.renderer.category包,在下文中一共展示了StackedBarRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enableFlatLook
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
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);
}
}
示例2: testFindRangeBounds
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
/**
* 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));
}
示例3: createStackedBarChart
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
/**
* 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;
}
示例4: setStackBarRender
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
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);
}
示例5: createStackedBarChart
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
/**
* 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;
}
示例6: testHashcode
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
/**
* 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);
}
示例7: testEquals
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
/**
* 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));
}
示例8: testHashCode
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
/**
* 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);
}
示例9: createStackedBarChart
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
/**
* 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;
}
示例10: makePlot
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
@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;
}
示例11: createStackedBarChart
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
/**
* 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;
}
示例12: createStackedBarChart
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
/**
* 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;
}
示例13: StackedBarRendererBuilder
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
/**
* Creates a new instance of StackedBarRendererBuilder
*/
public StackedBarRendererBuilder() {
try {
setBeanClass(StackedBarRenderer.class);
} catch (IntrospectionException ex) {
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
示例14: processNode
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
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);
}
}
示例15: reconfigureColorEncoding
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入依赖的package包/类
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);
}