List of usage examples for org.jfree.chart ChartFactory getChartTheme
public static ChartTheme getChartTheme()
From source file:org.csa.rstb.dat.toolviews.HaAlphaPlotPanel.java
private void createUI() { plot = new XYImagePlot(); plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); domainAxis.setAutoRangeIncludesZero(false); rangeAxis.setAutoRangeIncludesZero(false); domainAxis.setUpperMargin(0);// w ww . j a v a 2 s . co m domainAxis.setLowerMargin(0); rangeAxis.setUpperMargin(0); rangeAxis.setLowerMargin(0); plot.setNoDataMessage(NO_DATA_MESSAGE); plot.getRenderer().setBaseToolTipGenerator(new XYPlotToolTipGenerator()); JFreeChart chart = new JFreeChart(CHART_TITLE, plot); ChartFactory.getChartTheme().apply(chart); chart.removeLegend(); createUI(createChartPanel(chart), createOptionsPanel(), bindingContext); updateUIState(); }
From source file:com.appnativa.rare.ui.chart.jfreechart.ChartHandler.java
@Override public iPlatformComponent createChart(iPlatformComponent chartComponent, final ChartDefinition cd) { ChartInfo ci = (ChartInfo) cd.getChartHandlerInfo(); if (ci != null) { ci.dispose();/*from w w w . j a v a 2s. c o m*/ } ci = new ChartInfo(); cd.setChartHandlerInfo(ci); ChartPanelEx chartPanel = (ChartPanelEx) ((chartComponent == null) ? null : chartComponent.getView()); if (chartPanel == null) { chartPanel = createChartPanel(null, cd); chartComponent = new Container(chartPanel); if (chartForeground != null) { chartComponent.setForeground(chartForeground); } if (chartFont != null) { chartComponent.setFont(chartFont); } if (chartBackground != null) { chartComponent.setBackground(chartBackground); } } ci.popularSeriesDataAndCaluclateRanges(this, cd); JFreeChart chart = createCharts(chartPanel, cd); chartPanel.setChart(chart); chart.setAntiAlias(true); chart.setBackgroundPaint(null); chart.setBorderVisible(false); if (!cd.isAllowZooming()) { chartPanel.setRangeZoomable(false); chartPanel.setDomainZoomable(false); } ci.chart = chart; ChartHelper.setChartTitle(chart, cd.getTitle()); if (cd.isShowLegends()) { LegendTitle l = new LegendTitle(chart.getPlot()); l.setItemPaint(cd.getTextColor(legendLabelColor)); l.setItemFont(cd.getTextFont(legendLabelFont)); switch (cd.getLegendSide()) { case TOP: l.setPosition(RectangleEdge.TOP); break; case BOTTOM: l.setPosition(RectangleEdge.BOTTOM); break; case LEFT: l.setPosition(RectangleEdge.LEFT); break; default: l.setPosition(RectangleEdge.RIGHT); break; } chart.addSubtitle(l); } ChartFactory.getChartTheme().apply(chart); ((ChartInfo) cd.getChartHandlerInfo()).chartPanel = chartPanel; if ((cd.getSeriesCount() > 0) && (chartPanel.getHeight() > 0)) { chartPanel.updateTickmarks(chartPanel.getWidth(), chartPanel.getHeight()); } return chartComponent; }
From source file:org.jajuk.ui.views.StatView.java
/** * Creates the bar chart3 d.//from www. j a va 2 s . c om * * * @param title * @param categoryAxisLabel * @param valueAxisLabel * @param dataset * @param orientation * @param legend * @param tooltips * @param urls * @param format * * @return the j free chart */ public static JFreeChart createBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls, String format) { if (orientation == null) throw new IllegalArgumentException("Null 'orientation' argument."); CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); BarRenderer3D renderer = new BarRenderer3D(); if (tooltips) renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator(format, NumberFormat.getInstance())); if (urls) renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()); CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { plot.setRowRenderingOrder(SortOrder.DESCENDING); plot.setColumnRenderingOrder(SortOrder.DESCENDING); } plot.setForegroundAlpha(0.75F); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); ChartFactory.getChartTheme().apply(chart); return chart; }
From source file:org.gumtree.vis.awt.PlotFactory.java
/** * Creates and returns a time series chart. A time series chart is an * {@link XYPlot} with a {@link DateAxis} for the x-axis and a * {@link NumberAxis} for the y-axis. The default renderer is an * {@link XYLineAndShapeRenderer}.//from w w w . j a va 2s . c o m * <P> * A convenient dataset to use with this chart is a * {@link org.jfree.data.time.TimeSeriesCollection}. * * @param title the chart title (<code>null</code> permitted). * @param timeAxisLabel a label for the time axis (<code>null</code> * permitted). * @param valueAxisLabel a label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A time series chart. */ public static JFreeChart createTimeSeriesChart(String title, String timeAxisLabel, String valueAxisLabel, XYDataset dataset, boolean legend, boolean tooltips, boolean urls) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); timeAxis.setLowerMargin(0.02); // reduce the default margins timeAxis.setUpperMargin(0.02); // NumberAxis valueAxis = new NumberAxis(valueAxisLabel); LogAxis valueAxis = new LogAxis(valueAxisLabel); // valueAxis.setAutoRangeIncludesZero(false); // override default XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null); XYToolTipGenerator toolTipGenerator = null; if (tooltips) { toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance(); } XYURLGenerator urlGenerator = null; if (urls) { urlGenerator = new StandardXYURLGenerator(); } XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); renderer.setBaseToolTipGenerator(toolTipGenerator); renderer.setURLGenerator(urlGenerator); plot.setRenderer(renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); ChartFactory.getChartTheme().apply(chart); return chart; }