本文整理汇总了Java中org.jfree.chart.renderer.category.BarRenderer.setBarPainter方法的典型用法代码示例。如果您正苦于以下问题:Java BarRenderer.setBarPainter方法的具体用法?Java BarRenderer.setBarPainter怎么用?Java BarRenderer.setBarPainter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.category.BarRenderer
的用法示例。
在下文中一共展示了BarRenderer.setBarPainter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureBarRenderer
import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
private static void configureBarRenderer(BarRenderer renderer, ValueSource valueSource, PlotInstance plotInstance) {
StandardBarPainter barPainter = new StandardBarPainter();
renderer.setBarPainter(barPainter);
renderer.setGradientPaintTransformer(null);
ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
int seriesCount = valueSourceData.getSeriesCount();
DimensionConfig domainConfig = valueSource.getDomainConfig();
DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
PlotDimension.COLOR);
SeriesFormat seriesFormat = valueSource.getSeriesFormat();
// Loop all series and set series format.
// Format based on dimension configs will be set later on in initFormatDelegate().
for (int seriesIdx = 0; seriesIdx < seriesCount; ++seriesIdx) {
// configure series paint if necessary
if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, colorDimensionConfig)) {
renderer.setSeriesPaint(seriesIdx, seriesFormat.getAreaFillPaint());
}
// configure general style of the bars
renderer.setShadowVisible(false);
renderer.setSeriesOutlinePaint(seriesIdx, PlotConfiguration.DEFAULT_SERIES_OUTLINE_PAINT);
}
renderer.setDrawBarOutline(true);
}
示例2: createBarChart
import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
* Creates the histogram chart.
*
* @return
*/
private JFreeChart createBarChart() {
JFreeChart chart = ChartFactory.createBarChart(null, null, null, createBarDataset(), PlotOrientation.VERTICAL,
false, false, false);
AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
chart.setBackgroundPaint(null);
chart.setBackgroundImageAlpha(0.0f);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setRangeGridlinesVisible(false);
plot.setDomainGridlinesVisible(false);
plot.setOutlineVisible(false);
plot.setRangeZeroBaselineVisible(false);
plot.setDomainGridlinesVisible(false);
plot.setBackgroundPaint(COLOR_INVISIBLE);
plot.setBackgroundImageAlpha(0.0f);
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL));
renderer.setBarPainter(new StandardBarPainter());
renderer.setDrawBarOutline(true);
renderer.setShadowVisible(false);
return chart;
}
示例3: applyTo
import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
* Apply the chart style to the chart passed as parameter.
*
* @param chart the chart to apply the style to (is modified by the method)
* @param dataset the dataset associated with the chart
*/
public void applyTo(JFreeChart chart, final DefaultCategoryDataset dataset) {
CategoryPlot plot = (CategoryPlot) chart.getPlot();
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setBarPainter(new StandardBarPainter());
renderer.setDrawBarOutline(false);
renderer.setShadowVisible(false);
int seriesCount = dataset.getRowCount();
int coloursSize = colours.size();
int colourMod;
for (int series = 0; series < seriesCount; series++) {
colourMod = series % coloursSize;
renderer.setSeriesPaint(series, this.colours.get(colourMod));
}
}
示例4: makePlot
import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
@Override
protected Plot makePlot(final JFreeChartBuilder.PlotParameters parameters) {
final DefaultKeyedValues2DDataset tmpDataset = this.getDataset();
final CategoryAxis tmpCategoryAxis = this.makeCategoryAxis(domain);
final NumberAxis tmpValueAxis = this.makeValueAxis(range);
final BarRenderer tmpRenderer = new BarRenderer();
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;
}
示例5: applyToCategoryItemRenderer
import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
* Applies the settings of this theme to the specified renderer.
*
* @param renderer the renderer ({@code null} not permitted).
*/
protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) {
Args.nullNotPermitted(renderer, "renderer");
if (renderer instanceof AbstractRenderer) {
applyToAbstractRenderer((AbstractRenderer) renderer);
}
renderer.setDefaultItemLabelFont(this.regularFont);
renderer.setDefaultItemLabelPaint(this.itemLabelPaint);
// now we handle some special cases - yes, UGLY code alert!
// BarRenderer
if (renderer instanceof BarRenderer) {
BarRenderer br = (BarRenderer) renderer;
br.setBarPainter(this.barPainter);
br.setShadowVisible(this.shadowVisible);
br.setShadowPaint(this.shadowPaint);
}
// StatisticalBarRenderer
if (renderer instanceof StatisticalBarRenderer) {
StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer;
sbr.setErrorIndicatorPaint(this.errorIndicatorPaint);
}
// MinMaxCategoryRenderer
if (renderer instanceof MinMaxCategoryRenderer) {
MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer;
mmcr.setGroupPaint(this.errorIndicatorPaint);
}
}
示例6: setBarPlotColours
import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
public static void setBarPlotColours(JFreeChart chart, int numberOfSections, Color baseColor) {
Color color = baseColor;
BarRenderer renderer = (BarRenderer) ((CategoryPlot) chart.getPlot()).getRenderer();
renderer.setBarPainter(new StandardBarPainter());
for (int i = 0; i < numberOfSections; i++) {
renderer.setSeriesPaint(i, color);
color = darken(color);
}
}
示例7: createNominalChart
import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
private JFreeChart createNominalChart() {
JFreeChart chart;
CategoryDataset dataset = createNominalDataSet();
// create the chart...
String domainName = dataTable == null ? MODEL_DOMAIN_AXIS_NAME : dataTable.getColumnName(plotColumn);
chart = ChartFactory.createBarChart(null, // chart title
domainName, // x axis label
RANGE_AXIS_NAME, // y axis label
dataset, // data
PlotOrientation.VERTICAL, true, // include legend
true, // tooltips
false // urls
);
CategoryPlot plot = chart.getCategoryPlot();
BarRenderer renderer = new BarRenderer();
if (dataset.getRowCount() == 1) {
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesFillPaint(0, Color.RED);
} else {
for (int i = 0; i < dataset.getRowCount(); i++) {
Color color = getColorProvider(true).getPointColor((double) i / (double) (dataset.getRowCount() - 1));
renderer.setSeriesPaint(i, color);
renderer.setSeriesFillPaint(i, color);
}
}
renderer.setBarPainter(new RapidBarPainter());
renderer.setDrawBarOutline(true);
plot.setRenderer(renderer);
// rotate labels
if (isLabelRotating()) {
plot.getDomainAxis().setTickLabelsVisible(true);
plot.getDomainAxis().setCategoryLabelPositions(
CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d));
}
return chart;
}
示例8: createChart
import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return The chart.
*/
private static JFreeChart createChart(CategoryDataset dataset) {
// create the chart...
JFreeChart chart = ChartFactory.createBarChart(
"SWTBarChartDemo1", // chart title
"Category", // domain axis label
"Value", // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
true, // include legend
true, // tooltips?
false // URLs?
);
// NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
// get a reference to the plot for further customisation...
CategoryPlot plot = (CategoryPlot) chart.getPlot();
// set the range axis to display integers only...
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
// disable bar outlines...
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setDrawBarOutline(false);
// the SWTGraphics2D class doesn't handle GradientPaint well, so
// replace the gradient painter from the default theme with a
// standard painter...
renderer.setBarPainter(new StandardBarPainter());
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(
CategoryLabelPositions.createUpRotationLabelPositions(
Math.PI / 6.0));
// OPTIONAL CUSTOMISATION COMPLETED.
return chart;
}
示例9: applyToCategoryItemRenderer
import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
* Applies the settings of this theme to the specified renderer.
*
* @param renderer the renderer (<code>null</code> not permitted).
*/
protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) {
ParamChecks.nullNotPermitted(renderer, "renderer");
if (renderer instanceof AbstractRenderer) {
applyToAbstractRenderer((AbstractRenderer) renderer);
}
renderer.setBaseItemLabelFont(this.regularFont);
renderer.setBaseItemLabelPaint(this.itemLabelPaint);
// now we handle some special cases - yes, UGLY code alert!
// BarRenderer
if (renderer instanceof BarRenderer) {
BarRenderer br = (BarRenderer) renderer;
br.setBarPainter(this.barPainter);
br.setShadowVisible(this.shadowVisible);
br.setShadowPaint(this.shadowPaint);
}
// BarRenderer3D
if (renderer instanceof BarRenderer3D) {
BarRenderer3D br3d = (BarRenderer3D) renderer;
br3d.setWallPaint(this.wallPaint);
}
// LineRenderer3D
if (renderer instanceof LineRenderer3D) {
LineRenderer3D lr3d = (LineRenderer3D) renderer;
lr3d.setWallPaint(this.wallPaint);
}
// StatisticalBarRenderer
if (renderer instanceof StatisticalBarRenderer) {
StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer;
sbr.setErrorIndicatorPaint(this.errorIndicatorPaint);
}
// MinMaxCategoryRenderer
if (renderer instanceof MinMaxCategoryRenderer) {
MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer;
mmcr.setGroupPaint(this.errorIndicatorPaint);
}
}