本文整理匯總了Java中org.jfree.chart.renderer.xy.XYBarRenderer.setBarPainter方法的典型用法代碼示例。如果您正苦於以下問題:Java XYBarRenderer.setBarPainter方法的具體用法?Java XYBarRenderer.setBarPainter怎麽用?Java XYBarRenderer.setBarPainter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.chart.renderer.xy.XYBarRenderer
的用法示例。
在下文中一共展示了XYBarRenderer.setBarPainter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createHistogramChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
* Creates the histogram chart.
*
* @param exampleSet
* @return
*/
private JFreeChart createHistogramChart(final ExampleSet exampleSet) {
JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
PlotOrientation.VERTICAL, false, false, false);
AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
chart.setBackgroundPaint(null);
chart.setBackgroundImageAlpha(0.0f);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRangeGridlinesVisible(false);
plot.setDomainGridlinesVisible(false);
plot.setOutlineVisible(false);
plot.setRangeZeroBaselineVisible(false);
plot.setDomainZeroBaselineVisible(false);
plot.getDomainAxis().setTickLabelsVisible(false);
plot.setBackgroundPaint(COLOR_INVISIBLE);
plot.setBackgroundImageAlpha(0.0f);
XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.DATE_TIME));
renderer.setBarPainter(new StandardXYBarPainter());
renderer.setDrawBarOutline(true);
renderer.setShadowVisible(false);
return chart;
}
示例2: createHistogramChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
* Creates the histogram chart.
*
* @param exampleSet
* @return
*/
private JFreeChart createHistogramChart(ExampleSet exampleSet) {
JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
PlotOrientation.VERTICAL, false, false, false);
AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
chart.setBackgroundPaint(null);
chart.setBackgroundImageAlpha(0.0f);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRangeGridlinesVisible(false);
plot.setDomainGridlinesVisible(false);
plot.setOutlineVisible(false);
plot.setRangeZeroBaselineVisible(false);
plot.setDomainZeroBaselineVisible(false);
plot.setBackgroundPaint(COLOR_INVISIBLE);
plot.setBackgroundImageAlpha(0.0f);
XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NUMERICAL));
renderer.setBarPainter(new StandardXYBarPainter());
renderer.setDrawBarOutline(true);
renderer.setShadowVisible(false);
return chart;
}
示例3: copyNumberPDF
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
@NotNull
static JFreeChart copyNumberPDF(@NotNull final List<PurpleCopyNumber> copyNumbers) {
final XYDataset dataset = ploidyPDF(copyNumbers, PurpleCopyNumber::averageTumorCopyNumber, PurpleCopyNumber::bafCount);
JFreeChart chart =
ChartFactory.createScatterPlot("Copy Number PDF", "Ploidy", "BAF Count", dataset, PlotOrientation.VERTICAL, false, false,
false);
XYBarRenderer renderer = new XYBarRenderer(0.9);
renderer.setShadowVisible(false);
renderer.setBarPainter(new StandardXYBarPainter());
renderer.setSeriesPaint(0, Color.BLUE);
XYPlot xyPlot = (XYPlot) chart.getPlot();
xyPlot.getDomainAxis().setRange(0, 10);
xyPlot.setRenderer(renderer);
return chart;
}
示例4: applyToXYItemRenderer
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
* Applies the settings of this theme to the specified renderer.
*
* @param renderer the renderer (<code>null</code> not permitted).
*/
protected void applyToXYItemRenderer(XYItemRenderer renderer) {
if (renderer == null) {
throw new IllegalArgumentException("Null 'renderer' argument.");
}
if (renderer instanceof AbstractRenderer) {
applyToAbstractRenderer((AbstractRenderer) renderer);
}
renderer.setBaseItemLabelFont(this.regularFont);
renderer.setBaseItemLabelPaint(this.itemLabelPaint);
if (renderer instanceof XYBarRenderer) {
XYBarRenderer br = (XYBarRenderer) renderer;
br.setBarPainter(this.xyBarPainter);
br.setShadowVisible(this.shadowVisible);
}
}
示例5: setTheme
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
private final void setTheme(final JFreeChart chart) {
final XYPlot plot = (XYPlot) chart.getPlot();
final XYBarRenderer r = (XYBarRenderer) plot.getRenderer();
final StandardXYBarPainter bp = new StandardXYBarPainter();
r.setBarPainter(bp);
r.setSeriesOutlinePaint(0, Color.lightGray);
r.setShadowVisible(false);
r.setDrawBarOutline(false);
setBackgroundDefault(chart);
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
// rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setTickLabelsVisible(false);
rangeAxis.setTickMarksVisible(false);
final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
domainAxis.setTickLabelsVisible(false);
domainAxis.setTickMarksVisible(false);
}
示例6: createChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
protected JFreeChart createChart( final IntervalXYDataset dataset, final String title, final String units )
{
final JFreeChart chart = ChartFactory.createXYBarChart(
title,
"Distance [" + units + "]",
false,
"Count",
dataset,
PlotOrientation.VERTICAL,
false, // legend
false,
false );
final NumberAxis range = (NumberAxis) chart.getXYPlot().getDomainAxis();
range.setRange( getMin(), getMax() );
final XYPlot plot = chart.getXYPlot();
final XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
renderer.setSeriesPaint( 0, Color.red );
renderer.setDrawBarOutline( true );
renderer.setSeriesOutlinePaint( 0, Color.black );
renderer.setBarPainter( new StandardXYBarPainter() );
return chart;
}
示例7: configureXYBarRenderer
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
private static void configureXYBarRenderer(XYBarRenderer renderer, ValueSource valueSource, PlotInstance plotInstance) {
StandardXYBarPainter barPainter = new StandardXYBarPainter();
renderer.setBarPainter(barPainter);
renderer.setGradientPaintTransformer(null);
SeriesFormat seriesFormat = valueSource.getSeriesFormat();
DimensionConfig domainConfig = valueSource.getDomainConfig();
ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
int seriesCount;
if (valueSourceData != null) {
seriesCount = valueSourceData.getSeriesCount();
} else {
seriesCount = 0;
}
DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
PlotDimension.COLOR);
// don't need shapeDimensionConfig, since the shape can't be represented for bars.
// 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);
}
示例8: applyToXYItemRenderer
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
* Applies the settings of this theme to the specified renderer.
*
* @param renderer the renderer (<code>null</code> not permitted).
*/
protected void applyToXYItemRenderer(XYItemRenderer renderer) {
ParamChecks.nullNotPermitted(renderer, "renderer");
if (renderer instanceof AbstractRenderer) {
applyToAbstractRenderer((AbstractRenderer) renderer);
}
renderer.setBaseItemLabelFont(this.regularFont);
renderer.setBaseItemLabelPaint(this.itemLabelPaint);
if (renderer instanceof XYBarRenderer) {
XYBarRenderer br = (XYBarRenderer) renderer;
br.setBarPainter(this.xyBarPainter);
br.setShadowVisible(this.shadowVisible);
}
}
示例9: applyToXYItemRenderer
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
* Applies the settings of this theme to the specified renderer.
*
* @param renderer the renderer ({@code null} not permitted).
*/
protected void applyToXYItemRenderer(XYItemRenderer renderer) {
Args.nullNotPermitted(renderer, "renderer");
if (renderer instanceof AbstractRenderer) {
applyToAbstractRenderer((AbstractRenderer) renderer);
}
renderer.setDefaultItemLabelFont(this.regularFont);
renderer.setDefaultItemLabelPaint(this.itemLabelPaint);
if (renderer instanceof XYBarRenderer) {
XYBarRenderer br = (XYBarRenderer) renderer;
br.setBarPainter(this.xyBarPainter);
br.setShadowVisible(this.shadowVisible);
}
}
示例10: init
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
@Override
public void init(ProcessContext ctx) throws Exception {
super.init(ctx);
dataset = new SimpleHistogramDataset(key);
chart = ChartFactory.createHistogram(
title,
key,
"#",
dataset,
PlotOrientation.VERTICAL,
true,
true,
false
);
chart.setBackgroundPaint(new Color(230, 230, 230));
XYPlot xyplot = (XYPlot) chart.getPlot();
if (logAxis)
xyplot.setRangeAxis(new LogarithmicAxis("#"));
chart.setTitle(title);
xyplot.setForegroundAlpha(0.7F);
xyplot.setBackgroundPaint(Color.WHITE);
xyplot.setDomainGridlinePaint(new Color(150, 150, 150));
xyplot.setRangeGridlinePaint(new Color(150, 150, 150));
XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
xybarrenderer.setShadowVisible(false);
xybarrenderer.setBarPainter(new StandardXYBarPainter());
// xybarrenderer.setDrawBarOutline(false);
final ChartPanel chartPanel = new ChartPanel(chart);
frame = new JFrame();
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(chartPanel, BorderLayout.CENTER);
frame.setSize(width, height);
frame.setVisible(true);
}
示例11: createHist
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
* Create Histogram chart.
*
* @param table
* table to use for chart
* @param column
* column from table that should be used
* @param bin
* the amount of bins to use
* @return chart
*/
public static JFreeChart createHist(final Table table, final String column,
final int bin) {
final String xName = "Plotted column: " + column;
final String yName = "";
final double margin = 0.20;
HistogramDataset dataSet = createDataset(table, column, bin);
final CategoryAxis xAxis = new CategoryAxis(xName);
xAxis.setLowerMargin(margin);
xAxis.setUpperMargin(margin);
final NumberAxis yAxis = new NumberAxis(yName);
yAxis.setAutoRangeIncludesZero(false);
JFreeChart chart = makeChart(dataSet, column);
final int gridIn = 150;
XYPlot xyplot = (XYPlot) chart.getPlot();
xyplot.setBackgroundPaint(Color.WHITE);
xyplot.setDomainGridlinePaint(new Color(gridIn, gridIn, gridIn));
xyplot.setRangeGridlinePaint(new Color(gridIn, gridIn, gridIn));
XYBarRenderer renderer = (XYBarRenderer) xyplot.getRenderer();
renderer.setDrawBarOutline(true);
renderer.setShadowVisible(false);
renderer.setBarPainter(new StandardXYBarPainter());
renderer.setShadowVisible(false);
return chart;
}
示例12: setTheme
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
static private final void setTheme(final JFreeChart chart) {
XYPlot plot = (XYPlot) chart.getPlot();
XYBarRenderer r = (XYBarRenderer) plot.getRenderer();
StandardXYBarPainter bp = new StandardXYBarPainter();
r.setBarPainter(bp);
r.setSeriesOutlinePaint(0, Color.lightGray);
r.setShadowVisible(false);
r.setDrawBarOutline(false);
setBackgroundDefault(chart);
}
示例13: getHistogramPlotPanel
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
private static ChartPanel getHistogramPlotPanel(XIntervalSeriesCollection dataset, String xAxisLabel, String yAxisLabel, Color color) {
JFreeChart chart = ChartFactory.createHistogram(
null,
xAxisLabel,
yAxisLabel,
dataset,
PlotOrientation.VERTICAL,
false, // Legend?
true, // tooltips
false // url
);
final XYPlot xyPlot = chart.getXYPlot();
//xyPlot.setForegroundAlpha(0.85f);
xyPlot.setNoDataMessage("No data");
xyPlot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));
final XYBarRenderer renderer = (XYBarRenderer) xyPlot.getRenderer();
renderer.setDrawBarOutline(false);
renderer.setShadowVisible(false);
renderer.setSeriesPaint(0, color);
StandardXYBarPainter painter = new StandardXYBarPainter();
renderer.setBarPainter(painter);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new Dimension(300, 200));
// chartPanel.getPopupMenu().add(createCopyDataToClipboardMenuItem());
return chartPanel;
}
示例14: createUI
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
private void createUI() {
dataset = new XIntervalSeriesCollection();
chart = ChartFactory.createHistogram(
CHART_TITLE,
"Values",
"Frequency in #pixels",
dataset,
PlotOrientation.VERTICAL,
false, // Legend?
true, // tooltips
false // url
);
final XYPlot xyPlot = chart.getXYPlot();
xyPlot.setDomainZeroBaselineStroke(new BasicStroke(0.2f));
final XYBarRenderer renderer = (XYBarRenderer) xyPlot.getRenderer();
renderer.setDrawBarOutline(false);
renderer.setShadowVisible(false);
renderer.setShadowYOffset(-4.0);
renderer.setBaseToolTipGenerator(new XYPlotToolTipGenerator());
renderer.setBarPainter(new StandardXYBarPainter());
renderer.setSeriesPaint(0, new Color(0, 0, 200));
createUI(createChartPanel(chart), createOptionsPanel(), bindingContext);
isInitialized = true;
final Binding minBinding = xAxisRangeControl.getBindingContext().getBinding("min");
final double min = (Double) minBinding.getPropertyValue();
final Binding maxBinding = xAxisRangeControl.getBindingContext().getBinding("max");
final double max = (Double) maxBinding.getPropertyValue();
if (!histogramComputing && min > max) {
minBinding.setPropertyValue(max);
maxBinding.setPropertyValue(min);
}
updateXAxis();
}
示例15: configureXYBarRenderer
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
private static void configureXYBarRenderer(XYBarRenderer renderer, ValueSource valueSource, PlotInstance plotInstance) {
StandardXYBarPainter barPainter = new StandardXYBarPainter();
renderer.setBarPainter(barPainter);
renderer.setGradientPaintTransformer(null);
SeriesFormat seriesFormat = valueSource.getSeriesFormat();
DimensionConfig domainConfig = valueSource.getDomainConfig();
ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
int seriesCount;
if (valueSourceData != null) {
seriesCount = valueSourceData.getSeriesCount();
} else {
seriesCount = 0;
}
DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(PlotDimension.COLOR);
// don't need shapeDimensionConfig, since the shape can't be represented for bars.
// 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);
}