本文整理匯總了Java中org.jfree.chart.renderer.xy.XYBarRenderer類的典型用法代碼示例。如果您正苦於以下問題:Java XYBarRenderer類的具體用法?Java XYBarRenderer怎麽用?Java XYBarRenderer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
XYBarRenderer類屬於org.jfree.chart.renderer.xy包,在下文中一共展示了XYBarRenderer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setTimeSeriesBarRender
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入依賴的package包/類
public static void setTimeSeriesBarRender(Plot plot, boolean isShowDataLabels) {
XYPlot xyplot = (XYPlot) plot;
xyplot.setNoDataMessage(NO_DATA_MSG);
XYBarRenderer xyRenderer = new XYBarRenderer(0.1D);
xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
if (isShowDataLabels) {
xyRenderer.setBaseItemLabelsVisible(true);
xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
}
StandardXYToolTipGenerator xyTooltipGenerator = new StandardXYToolTipGenerator("{1}:{2}", new SimpleDateFormat("yyyy-MM-dd"), new DecimalFormat("0"));
xyRenderer.setBaseToolTipGenerator(xyTooltipGenerator);
setXY_XAixs(xyplot);
setXY_YAixs(xyplot);
}
示例2: 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;
}
示例3: 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;
}
示例4: testCloning2
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入依賴的package包/類
/**
* Tests cloning for a more complex plot.
*/
@Test
public void testCloning2() throws CloneNotSupportedException {
XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
new NumberAxis("Range Axis"), new StandardXYItemRenderer());
p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
List axisIndices = Arrays.asList(new Integer[] {new Integer(0),
new Integer(1)});
p1.mapDatasetToDomainAxes(0, axisIndices);
p1.mapDatasetToRangeAxes(0, axisIndices);
p1.setRenderer(1, new XYBarRenderer());
XYPlot p2 = (XYPlot) p1.clone();
assertTrue(p1 != p2);
assertTrue(p1.getClass() == p2.getClass());
assertTrue(p1.equals(p2));
}
示例5: setChartTheme
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入依賴的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());
}
}
}
示例6: setChartTheme
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入依賴的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());
}
}
}
示例7: 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;
}
示例8: 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;
}
示例9: initComponents
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入依賴的package包/類
protected void initComponents() {
setLayout(new BorderLayout());
// create chart
theDataset = new DefaultXYDataset();
theIsotopesDataset = new DefaultXYDataset();
theChart = org.jfree.chart.ChartFactory.createScatterPlot("PeakList", "m/z ratio", "Intensity", new XYBarDataset(theDataset,0.001), org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false);
thePlot = (XYPlot)theChart.getPlot();
thePlot.setRenderer(new XYBarRenderer());
thePlot.setDataset(1, theIsotopesDataset);
thePlot.setRenderer(1,new StandardXYItemRenderer(StandardXYItemRenderer.LINES));
theChartPanel = new ChartPanel(theChart);
theChartPanel.setDomainZoomable(false);
theChartPanel.setRangeZoomable(false);
theChartPanel.setPopupMenu(null);
add(theChartPanel,BorderLayout.CENTER);
// create toolbar
theToolBar = createToolBar();
add(theToolBar,BorderLayout.SOUTH);
}
示例10: 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);
}
}
示例11: resetUI
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入依賴的package包/類
/**
* Resets the display.
*/
@Override
void resetUI() {
super.resetUI();
XYPlot xyPlot = mChart.getXYPlot();
AbstractXYItemRenderer br = new XYBarRenderer();
mDatasetsSyncHist = new TimePeriodValues[NUM_AUTHS+1];
@SuppressWarnings("unchecked")
Map<SimpleTimePeriod, Integer> mTimePeriodMapTmp[] = new HashMap[NUM_AUTHS + 1];
mTimePeriodMap = mTimePeriodMapTmp;
TimePeriodValuesCollection tpvc = new TimePeriodValuesCollection();
xyPlot.setDataset(tpvc);
xyPlot.setRenderer(br);
for (int i = 0; i < NUM_AUTHS + 1; i++) {
br.setSeriesPaint(i, AUTH_COLORS[i]);
mDatasetsSyncHist[i] = new TimePeriodValues(AUTH_NAMES[i]);
tpvc.addSeries(mDatasetsSyncHist[i]);
mTimePeriodMap[i] = new HashMap<SimpleTimePeriod, Integer>();
}
}
示例12: createXYBarChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入依賴的package包/類
private JFreeChart createXYBarChart(ReportChart reportChart, ChartValue[] values, boolean displayInline)
{
XYDataset dataset = createXYDataset(values);
NumberAxis xAxis = new NumberAxis(reportChart.getXAxisLabel());
NumberAxis yAxis = new NumberAxis(reportChart.getYAxisLabel());
XYBarRenderer renderer = new XYBarRenderer();
renderer.setToolTipGenerator(new StandardXYToolTipGenerator());
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
plot.setOrientation(PlotOrientation.VERTICAL);
if (reportChart.getPlotOrientation() == ReportChart.HORIZONTAL)
{
plot.setOrientation(PlotOrientation.HORIZONTAL);
}
return new JFreeChart(reportChart.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());
}
示例13: createTimeBarChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入依賴的package包/類
private JFreeChart createTimeBarChart(ReportChart reportChart, ChartValue[] values, boolean displayInline)
{
JFreeChart chart = null;
XYDataset dataset = createTimeDataset(values);
ValueAxis timeAxis = new DateAxis(reportChart.getXAxisLabel());
NumberAxis valueAxis = new NumberAxis(reportChart.getYAxisLabel());
XYItemRenderer renderer = new XYBarRenderer();
renderer.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance());
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
plot.setOrientation(PlotOrientation.VERTICAL);
if (reportChart.getPlotOrientation() == ReportChart.HORIZONTAL)
{
plot.setOrientation(PlotOrientation.HORIZONTAL);
}
chart = new JFreeChart(reportChart.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());
return chart;
}
示例14: createChartPanel
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入依賴的package包/類
/**
* Creates and initializes the chart panel.
*/
public ChartPanel createChartPanel() {
XYBarDataset barDataset = new XYBarDataset(dataset, BAR_WIDTH);
NumberAxis xaxis = new NumberAxis(I18n.get("statistic.queryTimeHistoryPanel.time"));
NumberAxis yaxis = new NumberAxis(I18n.get("statistic.queryTimeHistoryPanel.averageQueryTime"));
xaxis.setStandardTickUnits(new ChartUtils.LowerBoundedTickUnitSource(xaxis.getStandardTickUnits(), LOWER_TICK_UNIT));
XYPlot plot = new XYPlot(barDataset, xaxis, yaxis, new XYBarRenderer());
JFreeChart chart = new JFreeChart(I18n.get("statistic.queryTimeHistoryPanel.queryHistory"),
null, plot, false);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setBorder(CHART_BORDER);
chartPanel.setMinimumDrawHeight(0);
chartPanel.setMinimumDrawWidth(0);
chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
return chartPanel;
}
示例15: createChartPanel
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入依賴的package包/類
private Component createChartPanel() {
XYBarDataset xyBarDataset = new XYBarDataset(xyDataset, BAR_WIDTH);
NumberAxis xaxis = new NumberAxis(I18n.get("statistic.histogramChartPanel.time"));
NumberAxis yaxis = new NumberAxis(I18n.get("statistic.histogramChartPanel.numberOfQueries"));
xaxis.setStandardTickUnits(new ChartUtils.LowerBoundedTickUnitSource(xaxis.getStandardTickUnits(), LOWER_TICK_UNIT));
XYPlot plot = new XYPlot(xyBarDataset, xaxis, yaxis, new XYBarRenderer());
JFreeChart chart = new JFreeChart(I18n.get(
"statistic.histogramChartPanel.title"),
null, plot, false);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setBorder(CHART_BORDER);
chartPanel.setMinimumDrawHeight(0);
chartPanel.setMinimumDrawWidth(0);
chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
return chartPanel;
}