本文整理汇总了Java中org.jfree.chart.renderer.xy.XYBarRenderer.setSeriesPaint方法的典型用法代码示例。如果您正苦于以下问题:Java XYBarRenderer.setSeriesPaint方法的具体用法?Java XYBarRenderer.setSeriesPaint怎么用?Java XYBarRenderer.setSeriesPaint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.xy.XYBarRenderer
的用法示例。
在下文中一共展示了XYBarRenderer.setSeriesPaint方法的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: createXYBarChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //导入方法依赖的package包/类
@Override
protected JFreeChart createXYBarChart() throws JRException
{
JFreeChart jfreeChart = super.createXYBarChart();
XYPlot xyPlot = (XYPlot)jfreeChart.getPlot();
XYBarRenderer renderer = (XYBarRenderer)xyPlot.getRenderer();
renderer.setMargin(0.1);
renderer.setGradientPaintTransformer(
new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)
);
XYDataset xyDataset = xyPlot.getDataset();
if (xyDataset != null)
{
for (int i = 0; i < xyDataset.getSeriesCount(); i++)
{
renderer.setSeriesPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
}
}
return jfreeChart;
}
示例5: crearHistograma
import org.jfree.chart.renderer.xy.XYBarRenderer; //导入方法依赖的package包/类
private JFreeChart crearHistograma(IntervalXYDataset datos) {
JFreeChart jfreechart = ChartFactory.
createHistogram("Histograma", "X","Y", datos, PlotOrientation.VERTICAL, false, false, false);
//createHistogram("Histograma", "X","Y", datos, PlotOrientation.VERTICAL, false, false, false);
//createXYBarChart("Histograma", "X", false, "Y", datos, PlotOrientation.VERTICAL, false, false, false);
//jfreechart.getCategoryPlot();
jfreechart.getPlot().setOutlinePaint(Color.black);
XYPlot cp=(XYPlot)jfreechart.getPlot();
XYBarRenderer renderer=(XYBarRenderer)cp.getRenderer();
cp.setWeight(80);
renderer.setSeriesPaint(0,Color.GRAY);
jfreechart.setAntiAlias(true);
jfreechart.setBackgroundPaint(Color.white);
return jfreechart;
}
示例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: completarPlot
import org.jfree.chart.renderer.xy.XYBarRenderer; //导入方法依赖的package包/类
protected void completarPlot(final XYPlot plot, final JanelaGraficos janela) {
IntervalXYDataset dataVolume = criarVolumeDataset(janela);
XYBarRenderer volumeRenderer = new XYBarRenderer();
volumeRenderer.setSeriesPaint(0,Controle.getConfiguracoesUsuario().getCorVolume());
volumeRenderer.setDrawBarOutline(false);
volumeRenderer.setMargin((double)Controle.getConfiguracoesUsuario().getEspacColunasVolume() / 10);
volumeRenderer.setToolTipGenerator(new CandlesToolTipGenerator(janela));
plot.setDataset(indices.size(), dataVolume);
plot.setRenderer(indices.size(), volumeRenderer);
}
示例9: resetUI
import org.jfree.chart.renderer.xy.XYBarRenderer; //导入方法依赖的package包/类
/**
* Resets the display.
*/
@Override
void resetUI() {
super.resetUI();
XYPlot xyPlot = mChart.getXYPlot();
xyPlot.getRangeAxis().setVisible(false);
mTooltipGenerator = new CustomXYToolTipGenerator();
@SuppressWarnings("unchecked")
List<String>[] mTooltipsTmp = new List[NUM_SERIES];
mTooltips = mTooltipsTmp;
XYBarRenderer br = new XYBarRenderer();
br.setUseYInterval(true);
mDatasets = new TimePeriodValues[NUM_SERIES];
TimePeriodValuesCollection tpvc = new YIntervalTimePeriodValuesCollection(1);
xyPlot.setDataset(tpvc);
xyPlot.setRenderer(br);
for (int i = 0; i < NUM_SERIES; i++) {
br.setSeriesPaint(i, SERIES_COLORS[i]);
mDatasets[i] = new TimePeriodValues(SERIES_NAMES[i]);
tpvc.addSeries(mDatasets[i]);
mTooltips[i] = new ArrayList<String>();
mTooltipGenerator.addToolTipSeries(mTooltips[i]);
br.setSeriesToolTipGenerator(i, mTooltipGenerator);
}
}
示例10: setSeriesColors
import org.jfree.chart.renderer.xy.XYBarRenderer; //导入方法依赖的package包/类
/** Set series colors */
private void setSeriesColors(XYBarRenderer renderer) {
for (Entry<String, Color> entry : seriesColors.entrySet()) {
int seriesIndex = taskSeriesCollection.getRowIndex(entry.getKey());
// If a series name is not found, we silently ignore it. A missing
// series is not necessarily a configuration error, since it is
// missing if no data points for it are available.
if (seriesIndex != -1) {
renderer.setSeriesPaint(seriesIndex, entry.getValue());
}
}
}
示例11: 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;
}
示例12: 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();
}
示例13: 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);
}
示例14: createChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //导入方法依赖的package包/类
@Override
protected JFreeChart createChart(CCMovieList movielist, StatisticsTypeFilter source) {
JFreeChart chart = ChartFactory.createHistogram(
"", //$NON-NLS-1$
"", //$NON-NLS-1$
"", //$NON-NLS-1$
getDataSet(movielist, source),
PlotOrientation.VERTICAL,
false,
false,
false
);
chart.removeLegend();
XYPlot plot = chart.getXYPlot();
XYBarRenderer bar_renderer = (XYBarRenderer) plot.getRenderer();
bar_renderer.setBaseFillPaint(HISTOGRAMMCHART_COLOR);
bar_renderer.setMargin( 0.2 );
bar_renderer.setBarAlignmentFactor( 0 );
bar_renderer.setSeriesPaint(0, HISTOGRAMMCHART_COLOR);
bar_renderer.setShadowVisible(true);
bar_renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{1}: {2}", new DecimalFormat("0"), new DecimalFormat("0"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bar_renderer.setBarPainter(new StandardXYBarPainter());
plot.setBackgroundPaint(HISTOGRAMMACKGROUND_COLOR);
plot.setDomainGridlinePaint(GRIDLINECOLOR);
plot.setRangeGridlinePaint(GRIDLINECOLOR);
chart.setBackgroundPaint(null);
plot.getDomainAxis().setTickLabelPaint(TEXT_FOREGROUND);
if (plot.getDomainAxis() instanceof NumberAxis) {
((NumberAxis)plot.getDomainAxis()).setNumberFormatOverride(new DecimalFormat("0")); //$NON-NLS-1$
}
plot.getRangeAxis().setTickLabelPaint(TEXT_FOREGROUND);
return chart;
}
示例15: createCombinedChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //导入方法依赖的package包/类
/**
* Creates an overlaid chart.
*
* @return The chart.
*/
private static JFreeChart createCombinedChart() {
// create plot ...
IntervalXYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
renderer1.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
renderer1.setSeriesStroke(0, new BasicStroke(4.0f,
BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
renderer1.setSeriesPaint(0, Color.blue);
DateAxis domainAxis = new DateAxis("Year");
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.02);
ValueAxis rangeAxis = new NumberAxis("$billion");
XYPlot plot1 = new XYPlot(data1, null, rangeAxis, renderer1);
plot1.setBackgroundPaint(Color.lightGray);
plot1.setDomainGridlinePaint(Color.white);
plot1.setRangeGridlinePaint(Color.white);
// add a second dataset and renderer...
IntervalXYDataset data2 = createDataset2();
XYBarRenderer renderer2 = new XYBarRenderer() {
public Paint getItemPaint(int series, int item) {
XYDataset dataset = getPlot().getDataset();
if (dataset.getYValue(series, item) >= 0.0) {
return Color.red;
}
else {
return Color.green;
}
}
};
renderer2.setSeriesPaint(0, Color.red);
renderer2.setDrawBarOutline(false);
renderer2.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
XYPlot plot2 = new XYPlot(data2, null, new NumberAxis("$billion"),
renderer2);
plot2.setBackgroundPaint(Color.lightGray);
plot2.setDomainGridlinePaint(Color.white);
plot2.setRangeGridlinePaint(Color.white);
CombinedXYPlot cplot = new CombinedXYPlot(domainAxis, rangeAxis);
cplot.add(plot1, 3);
cplot.add(plot2, 2);
cplot.setGap(8.0);
cplot.setDomainGridlinePaint(Color.white);
cplot.setDomainGridlinesVisible(true);
// return a new chart containing the overlaid plot...
JFreeChart chart = new JFreeChart("CombinedXYPlotDemo1",
JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
chart.setBackgroundPaint(Color.white);
LegendTitle legend = new LegendTitle(cplot);
chart.addSubtitle(legend);
return chart;
}