本文整理汇总了Java中org.jfree.chart.renderer.xy.XYBarRenderer.setDrawBarOutline方法的典型用法代码示例。如果您正苦于以下问题:Java XYBarRenderer.setDrawBarOutline方法的具体用法?Java XYBarRenderer.setDrawBarOutline怎么用?Java XYBarRenderer.setDrawBarOutline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.xy.XYBarRenderer
的用法示例。
在下文中一共展示了XYBarRenderer.setDrawBarOutline方法的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: 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);
}
示例4: 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;
}
示例5: 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);
}
示例6: 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);
}
示例7: 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;
}
示例8: createChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //导入方法依赖的package包/类
public JFreeChart createChart(IntervalXYDataset dataset){
JFreeChart chart=ChartFactory.createHistogram("", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
XYPlot xyplot=(XYPlot)chart.getPlot();
xyplot.setBackgroundAlpha(0.85f);
xyplot.setDomainPannable(true);
xyplot.setRangePannable(true);
NumberAxis numberaxis=(NumberAxis)xyplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
XYBarRenderer xybarrenderer=(XYBarRenderer)xyplot.getRenderer();
xybarrenderer.setDrawBarOutline(false);
return chart;
}
示例9: 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);
}
示例10: 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;
}
示例11: 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();
}
示例12: 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);
}
示例13: 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;
}
示例14: testEquals
import org.jfree.chart.renderer.xy.XYBarRenderer; //导入方法依赖的package包/类
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
// default instances
XYBarRenderer r1 = new XYBarRenderer();
XYBarRenderer r2 = new XYBarRenderer();
assertTrue(r1.equals(r2));
assertTrue(r2.equals(r1));
// setBase()
r1.setBase(1.0);
assertFalse(r1.equals(r2));
r2.setBase(1.0);
assertTrue(r1.equals(r2));
// setUseYInterval
r1.setUseYInterval(!r1.getUseYInterval());
assertFalse(r1.equals(r2));
r2.setUseYInterval(!r2.getUseYInterval());
assertTrue(r1.equals(r2));
// setMargin()
r1.setMargin(0.10);
assertFalse(r1.equals(r2));
r2.setMargin(0.10);
assertTrue(r1.equals(r2));
// setDrawBarOutline()
r1.setDrawBarOutline(!r1.isDrawBarOutline());
assertFalse(r1.equals(r2));
r2.setDrawBarOutline(!r2.isDrawBarOutline());
assertTrue(r1.equals(r2));
// setGradientPaintTransformer()
r1.setGradientPaintTransformer(
new StandardGradientPaintTransformer(
GradientPaintTransformType.CENTER_HORIZONTAL
)
);
assertFalse(r1.equals(r2));
r2.setGradientPaintTransformer(
new StandardGradientPaintTransformer(
GradientPaintTransformType.CENTER_HORIZONTAL
)
);
assertTrue(r1.equals(r2));
}
示例15: testEquals
import org.jfree.chart.renderer.xy.XYBarRenderer; //导入方法依赖的package包/类
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
// default instances
XYBarRenderer r1 = new XYBarRenderer();
XYBarRenderer r2 = new XYBarRenderer();
assertTrue(r1.equals(r2));
assertTrue(r2.equals(r1));
// setBase()
r1.setBase(1.0);
assertFalse(r1.equals(r2));
r2.setBase(1.0);
assertTrue(r1.equals(r2));
// setUseYInterval
r1.setUseYInterval(!r1.getUseYInterval());
assertFalse(r1.equals(r2));
r2.setUseYInterval(!r2.getUseYInterval());
assertTrue(r1.equals(r2));
// setMargin()
r1.setMargin(0.10);
assertFalse(r1.equals(r2));
r2.setMargin(0.10);
assertTrue(r1.equals(r2));
// setDrawBarOutline()
r1.setDrawBarOutline(!r1.isDrawBarOutline());
assertFalse(r1.equals(r2));
r2.setDrawBarOutline(!r2.isDrawBarOutline());
assertTrue(r1.equals(r2));
// setGradientPaintTransformer()
r1.setGradientPaintTransformer(new StandardGradientPaintTransformer(
GradientPaintTransformType.CENTER_HORIZONTAL));
assertFalse(r1.equals(r2));
r2.setGradientPaintTransformer(new StandardGradientPaintTransformer(
GradientPaintTransformType.CENTER_HORIZONTAL));
assertTrue(r1.equals(r2));
// legendBar
r1.setLegendBar(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertFalse(r1.equals(r2));
r2.setLegendBar(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertTrue(r1.equals(r2));
// positiveItemLabelFallbackPosition
r1.setPositiveItemLabelPositionFallback(new ItemLabelPosition());
assertFalse(r1.equals(r2));
r2.setPositiveItemLabelPositionFallback(new ItemLabelPosition());
assertTrue(r1.equals(r2));
// negativeItemLabelFallbackPosition
r1.setNegativeItemLabelPositionFallback(new ItemLabelPosition());
assertFalse(r1.equals(r2));
r2.setNegativeItemLabelPositionFallback(new ItemLabelPosition());
assertTrue(r1.equals(r2));
}