List of usage examples for org.jfree.chart.plot CategoryPlot setRangeZeroBaselineVisible
public void setRangeZeroBaselineVisible(boolean visible)
From source file:net.nosleep.superanalyzer.analysis.views.TimeView.java
private void createChart() { // create the chart... _chart = ChartFactory.createLineChart(Misc.getString("LISTENING_TIMES"), // chart // title Misc.getString("HOUR_OF_DAY"), // domain axis label Misc.getString("SONG_COUNT"), // range axis label _dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // urls );//from w w w .jav a 2 s . co m CategoryPlot plot = (CategoryPlot) _chart.getPlot(); plot.setRangePannable(true); plot.setRangeZeroBaselineVisible(false); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45); _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("LISTENING_TIMES_TOOLTIP"))); ChartUtilities.applyCurrentTheme(_chart); // format the renderer after applying the theme LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setBaseFillPaint(Color.white); renderer.setSeriesStroke(0, new BasicStroke(3.0f)); renderer.setSeriesOutlineStroke(0, new BasicStroke(2.0f)); renderer.setSeriesShape(0, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0)); // get rid of the little line above/next to the axis // plot.setRangeZeroBaselinePaint(Color.white); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(true); Misc.formatChart(plot); renderer.setSeriesPaint(0, Theme.getColorSet()[1]); }
From source file:com.rapidminer.gui.viewer.metadata.model.NominalAttributeStatisticsModel.java
/** * Creates the histogram chart./*from w w w. j ava 2 s .co m*/ * * @return */ private JFreeChart createBarChart() { JFreeChart chart = ChartFactory.createBarChart(null, null, null, createBarDataset(), PlotOrientation.VERTICAL, false, false, false); AbstractAttributeStatisticsModel.setDefaultChartFonts(chart); chart.setBackgroundPaint(null); chart.setBackgroundImageAlpha(0.0f); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setOutlineVisible(false); plot.setRangeZeroBaselineVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(COLOR_INVISIBLE); plot.setBackgroundImageAlpha(0.0f); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL)); renderer.setBarPainter(new StandardBarPainter()); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); return chart; }
From source file:userInterface.SystemAdmin.PovertyAnalysisJPanel.java
private JFreeChart createChart(DefaultCategoryDataset crimeDataset) { JFreeChart jfreechart = ChartFactory.createBarChart("Poverty Rate vs Crime Chart", "Network Values", "Value", crimeDataset, PlotOrientation.HORIZONTAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setDomainGridlinesVisible(true); categoryplot.setRangePannable(true); categoryplot.setRangeZeroBaselineVisible(true); categoryplot.configureRangeAxes();/*from w ww. j av a 2 s . c o m*/ NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LayeredBarRenderer layeredbarrenderer = new LayeredBarRenderer(); layeredbarrenderer.setDrawBarOutline(false); categoryplot.setRenderer(layeredbarrenderer); return jfreechart; }
From source file:de.dekarlab.moneybuilder.view.AnalyticsView.java
/** * Create pie chart.//w ww.java 2 s.com * * @param dataset * @param title * @return */ protected JFreeChart createBarChart(final CategoryDataset dataset, final String title) { final JFreeChart chart = ChartFactory.createBarChart("", // chart title App.getGuiProp("report.period.lbl"), // domain axis label App.getGuiProp("report.value.lbl"), // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // urls ); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setNoDataMessage(App.getGuiProp("report.nodata.msg")); plot.setBackgroundPaint(Color.white); ((NumberAxis) plot.getRangeAxis()).setAutoRangeIncludesZero(false); ((CategoryAxis) plot.getDomainAxis()).setMaximumCategoryLabelLines(10); ((CategoryAxis) plot.getDomainAxis()).setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setRangeGridlinesVisible(true); plot.setRangeZeroBaselinePaint(Color.black); plot.setRangeZeroBaselineVisible(true); int color = 0; ((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter()); CategoryItemRenderer renderer = plot.getRenderer(); for (int ser = 0; ser < dataset.getColumnCount(); ser++) { renderer.setSeriesPaint(ser, COLORS[color]); renderer.setSeriesItemLabelGenerator(ser, new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getInstance(Locale.GERMAN))); renderer.setSeriesItemLabelsVisible(ser, true); color++; if (COLORS.length == color) { color = 0; } } return chart; }
From source file:de.dekarlab.moneybuilder.view.AnalyticsView.java
/** * Create pie chart.//w ww. jav a 2 s . c o m * * @param dataset * @param title * @return */ protected JFreeChart createLineChart(final CategoryDataset dataset, final String title) { final JFreeChart chart = ChartFactory.createLineChart("", // chart title App.getGuiProp("report.period.lbl"), // domain axis label App.getGuiProp("report.value.lbl"), // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setNoDataMessage(App.getGuiProp("report.nodata.msg")); plot.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.white); ((NumberAxis) plot.getRangeAxis()).setAutoRangeIncludesZero(false); ((CategoryAxis) plot.getDomainAxis()).setMaximumCategoryLabelLines(10); ((CategoryAxis) plot.getDomainAxis()).setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setRangeGridlinesVisible(true); plot.setRangeZeroBaselinePaint(Color.black); plot.setRangeZeroBaselineVisible(true); int color = 0; CategoryItemRenderer renderer = plot.getRenderer(); for (int ser = 0; ser < dataset.getColumnCount(); ser++) { renderer.setSeriesPaint(ser, COLORS[color]); renderer.setSeriesStroke(ser, new BasicStroke(4)); StandardCategoryItemLabelGenerator gen = new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getInstance(Locale.GERMAN)) { private static final long serialVersionUID = 1L; public String generateLabel(CategoryDataset dataset, int series, int item) { if (item % 3 == 0) { return super.generateLabelString(dataset, series, item); } else { return null; } } }; renderer.setSeriesItemLabelGenerator(ser, gen); renderer.setSeriesItemLabelsVisible(ser, true); color++; if (COLORS.length == color) { color = 0; } } return chart; }