本文整理匯總了Java中org.jfree.chart.renderer.category.StandardBarPainter類的典型用法代碼示例。如果您正苦於以下問題:Java StandardBarPainter類的具體用法?Java StandardBarPainter怎麽用?Java StandardBarPainter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StandardBarPainter類屬於org.jfree.chart.renderer.category包,在下文中一共展示了StandardBarPainter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureBarRenderer
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的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.StandardBarPainter; //導入依賴的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: setChartTheme
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的package包/類
/**
* Sets the current chart theme. This will be applied to all new charts
* created via methods in this class.
*
* @param theme the theme (<code>null</code> not permitted).
*
* @see #getChartTheme()
* @see ChartUtilities#applyCurrentTheme(JFreeChart)
*
* @since 1.0.11
*/
public static void setChartTheme(ChartTheme theme) {
ParamChecks.nullNotPermitted(theme, "theme");
currentTheme = theme;
// here we do a check to see if the user is installing the "Legacy"
// theme, and reset the bar painters in that case...
if (theme instanceof StandardChartTheme) {
StandardChartTheme sct = (StandardChartTheme) theme;
if (sct.getName().equals("Legacy")) {
BarRenderer.setDefaultBarPainter(new StandardBarPainter());
XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
}
else {
BarRenderer.setDefaultBarPainter(new GradientBarPainter());
XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
}
}
}
示例4: setChartTheme
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的package包/類
/**
* Sets the current chart theme. This will be applied to all new charts
* created via methods in this class.
*
* @param theme the theme ({@code null} not permitted).
*
* @see #getChartTheme()
* @see ChartUtils#applyCurrentTheme(JFreeChart)
*
* @since 1.0.11
*/
public static void setChartTheme(ChartTheme theme) {
Args.nullNotPermitted(theme, "theme");
currentTheme = theme;
// here we do a check to see if the user is installing the "Legacy"
// theme, and reset the bar painters in that case...
if (theme instanceof StandardChartTheme) {
StandardChartTheme sct = (StandardChartTheme) theme;
if (sct.getName().equals("Legacy")) {
BarRenderer.setDefaultBarPainter(new StandardBarPainter());
XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
}
else {
BarRenderer.setDefaultBarPainter(new GradientBarPainter());
XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
}
}
}
示例5: applyTo
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的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));
}
}
示例6: GraphData
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的package包/類
public GraphData(String printer_id, String outDir, boolean warn, String label,String yLabel, ArrayList<String> learnSpecs) {
this.outDir = outDir;
this.printer_id = printer_id;
this.warn = warn;
this.learnSpecs = learnSpecs;
graphProbs = new ArrayList<String>();
probGraphed = new LinkedList<GraphProbs>();
chart = ChartFactory.createBarChart(label, "", yLabel, new DefaultCategoryDataset(), PlotOrientation.VERTICAL, true, true, false);
applyChartTheme();
((BarRenderer) chart.getCategoryPlot().getRenderer()).setBarPainter(new StandardBarPainter());
chart.setBackgroundPaint(new java.awt.Color(238, 238, 238));
chart.getPlot().setBackgroundPaint(java.awt.Color.WHITE);
chart.getCategoryPlot().setRangeGridlinePaint(java.awt.Color.LIGHT_GRAY);
legend = chart.getLegend();
timeSeriesPlot = false;
averageOrder = null;
}
示例7: initializeTheme
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的package包/類
public static StandardChartTheme initializeTheme() {
String fontName = "Arial";
StandardChartTheme theme = (StandardChartTheme) org.jfree.chart.StandardChartTheme.createJFreeTheme();
theme.setExtraLargeFont(new Font(fontName, Font.PLAIN, 24)); // title
theme.setLargeFont(new Font(fontName, Font.PLAIN, 20)); // axis-title
theme.setRegularFont(new Font(fontName, Font.PLAIN, 16));
theme.setSmallFont(new Font(fontName, Font.PLAIN, 12));
theme.setRangeGridlinePaint(Color.decode("#C0C0C0"));
theme.setPlotBackgroundPaint(Color.white);
theme.setChartBackgroundPaint(Color.white);
theme.setGridBandPaint(Color.red);
theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
theme.setBarPainter(new StandardBarPainter());
theme.setAxisLabelPaint(Color.decode("#666666"));
return theme;
}
示例8: setChartTheme
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的package包/類
/**
* Sets the current chart theme. This will be applied to all new charts
* created via methods in this class.
*
* @param theme the theme (<code>null</code> not permitted).
*
* @see #getChartTheme()
* @see ChartUtilities#applyCurrentTheme(JFreeChart)
*
* @since 1.0.11
*/
public static void setChartTheme(ChartTheme theme) {
if (theme == null) {
throw new IllegalArgumentException("Null 'theme' argument.");
}
currentTheme = theme;
// here we do a check to see if the user is installing the "Legacy"
// theme, and reset the bar painters in that case...
if (theme instanceof StandardChartTheme) {
StandardChartTheme sct = (StandardChartTheme) theme;
if (sct.getName().equals("Legacy")) {
BarRenderer.setDefaultBarPainter(new StandardBarPainter());
XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
}
else {
BarRenderer.setDefaultBarPainter(new GradientBarPainter());
XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
}
}
}
示例9: enableFlatLook
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的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);
}
}
示例10: configureBarRenderer
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的package包/類
private void configureBarRenderer(BarRenderer barRenderer) {
barRenderer.setBarPainter(new StandardBarPainter());
barRenderer.setSeriesPaint(0, Color.black);
barRenderer.setSeriesPaint(1, Color.blue);
barRenderer.setSeriesPaint(2, Color.cyan);
barRenderer.setSeriesPaint(3, Color.darkGray);
barRenderer.setSeriesPaint(4, Color.gray);
barRenderer.setSeriesPaint(5, Color.green);
barRenderer.setSeriesPaint(6, Color.lightGray);
barRenderer.setSeriesPaint(7, Color.magenta);
barRenderer.setSeriesPaint(8, Color.orange);
barRenderer.setSeriesPaint(9, Color.red);
barRenderer.setDrawBarOutline(false);
barRenderer.setShadowVisible(false);
barRenderer.setBaseItemLabelGenerator(sectorProfileLabelGenerator);
barRenderer.setBaseItemLabelsVisible(true);
}
示例11: customizeRenderer
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的package包/類
/** Customize renderer. */
private void customizeRenderer(CategoryPlot plot) {
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setMaximumBarWidth(0.5);
renderer.setSeriesPaint(0, Color.BLACK);
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelPaint(Color.white);
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(
ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER,
0.0));
renderer.setBarPainter(new StandardBarPainter());
renderer.setShadowVisible(false);
}
示例12: createLocationFormatChart
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的package包/類
/**
* Creates chart (JFreeChart object) from dataset. Is used when Chart Type "Location-Format" or "Format-Location" is selected.
*
* @param collection Collection that provides all data that should be displayed.
* @param unit Unit: kWh or kWh/TNF
* @return Returns finished JFreeChart object.
*/
private JFreeChart createLocationFormatChart(DefaultCategoryDataset collection,String unit){
JFreeChart barChart = ChartFactory.createBarChart("Production Consumption","",
("1".equals(unit)?"Energy Consumption [kWh]":("2".equals(unit)?"Energy Consumption [kWh/TNF]":("3".equals(unit)?"Produced Pieces [TNF]":""))),
collection, PlotOrientation.VERTICAL, true, true, false);
//graphical modifications for BarChart
barChart.setBackgroundPaint(Color.white);
CategoryPlot plot = barChart.getCategoryPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
plot.setShadowGenerator(null);
//Barmodifications
BarRenderer renderer=(BarRenderer) plot.getRenderer();
renderer.setBarPainter(new StandardBarPainter());
renderer.setItemMargin(0);
renderer.setShadowVisible(false);
plot.setRenderer(renderer);
return barChart;
}
示例13: configureBarRenderer
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的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);
}
示例14: createChart
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的package包/類
public Drawable createChart(ADCDataset dataset) {
final JFreeChart chart = ChartFactory.createBarChart(
dataset.get(Attribute.TITLE),
dataset.get(Attribute.X_AXIS_LABEL),
dataset.get(Attribute.Y_AXIS_LABEL),
dataset,
PlotOrientation.VERTICAL,
true, false, false);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.lightGray);
ValueAxis raxis = plot.getRangeAxis();
raxis.setRange(0, 100.0);
CategoryAxis cAxis = plot.getDomainAxis();
cAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
BarRenderer renderer = (BarRenderer)plot.getRenderer();
renderer.setSeriesPaint(0, Colors.fromHex("#0AA1D8"));
renderer.setSeriesPaint(1, Colors.fromHex("#932832"));
renderer.setSeriesPaint(2, Colors.fromHex("#94BA4D"));
renderer.setBarPainter(new StandardBarPainter());
renderer.setItemMargin(0.01);
return new JFreeChartDrawable(chart, new Dimension(750, 500));
}
示例15: createChart
import org.jfree.chart.renderer.category.StandardBarPainter; //導入依賴的package包/類
public static Drawable createChart(ADCDataset dataset, Dimension dimension) {
final JFreeChart chart = ChartFactory.createBarChart(
dataset.get(Attribute.TITLE),// chart title
dataset.get(Attribute.X_AXIS_LABEL),// domain axis label
dataset.get(Attribute.Y_AXIS_LABEL),// range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
true, // include legend
false, // tooltips?
false // URLs?
);
chart.setBackgroundPaint(Color.white);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.lightGray);
final BarRenderer renderer = (BarRenderer)plot.getRenderer();
Colors.setSeriesPaint(renderer, dataset.get(Attribute.SERIES_COLORS));
renderer.setItemMargin(0);
renderer.setBarPainter(new StandardBarPainter());
final CategoryAxis cAxis = plot.getDomainAxis();
cAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
chart.getTitle().setFont(cAxis.getLabelFont());
chart.getLegend().setMargin(2, 60, 2, 20);
return new JFreeChartDrawable(chart, dimension);
}