List of usage examples for java.awt Color lightGray
Color lightGray
To view the source code for java.awt Color lightGray.
Click Source Link
From source file:org.jfree.chart.demo.ImageMapDemo5.java
/** * Creates a chart.//from ww w . j a va 2 s. co m * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createAreaChart("Area Chart", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setAnchor(StandardLegend.SOUTH); chart.setBackgroundPaint(Color.white); final TextTitle subtitle = new TextTitle("An area chart demonstration. We use this subtitle " + " as an example of what happens when you get a really long title or subtitle."); subtitle.setFont(new Font("SansSerif", Font.PLAIN, 12)); subtitle.setPosition(RectangleEdge.TOP); // subtitle.setSpacer(new Spacer(Spacer.RELATIVE, 0.05, 0.05, 0.05, 0.05)); subtitle.setVerticalAlignment(VerticalAlignment.BOTTOM); chart.addSubtitle(subtitle); final CategoryPlot plot = chart.getCategoryPlot(); plot.setForegroundAlpha(0.5f); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLabelAngle(0 * Math.PI / 2.0); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:de.uniol.ui.tsv.ui.LineChartDialog.java
/** * @return the resulting chart object/*from w w w. j a va 2 s . co m*/ */ protected JFreeChart createChart() { JFreeChart chart = ChartFactory.createTimeSeriesChartFast(title, xTitle, yTitle, xy, true, false, false); chart.setBackgroundPaint(Color.white); chart.getLegend().setBackgroundPaint(new Color(224, 224, 224)); FastXYPlot plot = (FastXYPlot) chart.getPlot(); // plot.setBackgroundPaint(new Color(224, 224, 224)); plot.setBackgroundPaint(new Color(77, 77, 77)); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); StandardXYItemRendererFast r = new StandardXYItemRendererFast(StandardXYItemRendererFast.LINES, null, null); plot.setRenderer(r); for (int i : seriesStrokes.keySet()) { r.setSeriesStroke(i, seriesStrokes.get(i)); } for (int i : seriesColors.keySet()) { r.setSeriesPaint(i, seriesColors.get(i)); } DateAxis da = new DateAxis(xTitle); if (useRelativeHourFormat) { da.setDateFormatOverride(new RelativeHourFormat()); } da.setLowerMargin(0.03); plot.setDomainAxis(da); if (minRange != 0.0 && maxRange != 0.0) { ValueAxis yaxis = plot.getRangeAxis(); yaxis.setRange(new Range(minRange, maxRange)); } return chart; }
From source file:edu.wpi.cs.wpisuitetng.modules.requirementmanager.view.requirements.NewBarChartPanel.java
/** * @param dataset the data to be shown by the chart * @param title the title of the chart(either status or iteration) @return * the created bar graph//from w ww . j a va 2s .c o m */ private static JFreeChart createChart(CategoryDataset dataset, String title) { JFreeChart chart = ChartFactory.createBarChart(title, // chart title "Name", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, false); chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
From source file:org.sbml.bargraph.MainWindow.java
/** * Creates an empty bar graph./*w ww . ja v a 2s.c o m*/ * @return */ public JFreeChart createModelBarGraph() { // Initialize the style. Have to do this before creating charts. BarRenderer.setDefaultShadowsVisible(false); ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); // Create the actual chart. chartData = new DefaultCategoryDataset(); JFreeChart chart = ChartFactory.createBarChart(null, // chart title null, // domain axis label "Total count", // range axis label chartData, // data PlotOrientation.HORIZONTAL, // orientation false, // include legend false, // tooltips? false // URLs? ); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.lightGray); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, new Color(0, 101, 178)); return chart; }
From source file:org.jcryptool.visual.verifiablesecretsharing.views.ReconstructionChartComposite.java
/** * Creates a chart.//ww w. ja va 2 s . co m * * @param dataset * the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("", // chart // title "", // x axis label "", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend false, // tooltips false // urls ); // XYSplineRenderer -- show data points XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); // show no line renderer.setSeriesLinesVisible(0, false); renderer.setSeriesLinesVisible(3, false); // show no points renderer.setSeriesShapesVisible(1, false); // set range of axis NumberAxis domain = (NumberAxis) plot.getDomainAxis(); domain.setRange(-0.1, playerID[playerID.length - 1] + 0.1); domain.setTickUnit(new NumberTickUnit(1)); domain.setVerticalTickLabels(false); // display value NumberFormat format = NumberFormat.getNumberInstance(); format.setMaximumFractionDigits(0); XYItemLabelGenerator generator = new StandardXYItemLabelGenerator( StandardXYItemLabelGenerator.DEFAULT_ITEM_LABEL_FORMAT, format, format); renderer.setBaseItemLabelGenerator(generator); renderer.setBaseItemLabelsVisible(true); plot.setRenderer(renderer); return chart; }
From source file:org.n52.server.io.render.DiagramRenderer.java
/** * <pre>//from ww w. j a v a2 s.co m * dataset := associated to one range-axis; * corresponds to one observedProperty; * may contain multiple series; * series := corresponds to a time series for one foi * </pre> * * . * * @param entireCollMap * the entire coll map * @param options * the options * @param begin * the begin * @param end * the end * @param compress * @return the j free chart */ public JFreeChart renderChart(Map<String, OXFFeatureCollection> entireCollMap, DesignOptions options, Calendar begin, Calendar end, boolean compress) { DesignDescriptionList designDescriptions = buildUpDesignDescriptionList(options); /*** FIRST RUN ***/ JFreeChart chart = initializeTimeSeriesChart(); chart.setBackgroundPaint(Color.white); if (!this.isOverview) { chart.addSubtitle(new TextTitle(ConfigurationContext.COPYRIGHT, new Font(LABEL_FONT, Font.PLAIN, 9), Color.black, RectangleEdge.BOTTOM, HorizontalAlignment.RIGHT, VerticalAlignment.BOTTOM, new RectangleInsets(0, 0, 20, 20))); } XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainGridlinesVisible(options.getGrid()); plot.setRangeGridlinesVisible(options.getGrid()); // add additional datasets: DateAxis dateAxis = (DateAxis) plot.getDomainAxis(); dateAxis.setRange(begin.getTime(), end.getTime()); dateAxis.setDateFormatOverride(new SimpleDateFormat()); dateAxis.setTimeZone(end.getTimeZone()); // add all axes String[] phenomenaIds = options.getAllPhenomenIds(); // all the axis indices to map them later HashMap<String, Integer> axes = new HashMap<String, Integer>(); for (int i = 0; i < phenomenaIds.length; i++) { axes.put(phenomenaIds[i], i); plot.setRangeAxis(i, new NumberAxis(phenomenaIds[i])); } // list range markers ArrayList<ValueMarker> referenceMarkers = new ArrayList<ValueMarker>(); HashMap<String, double[]> referenceBounds = new HashMap<String, double[]>(); // create all TS collections for (int i = 0; i < options.getProperties().size(); i++) { TimeseriesProperties prop = options.getProperties().get(i); String phenomenonId = prop.getPhenomenon(); TimeSeriesCollection dataset = createDataset(entireCollMap, prop, phenomenonId, compress); dataset.setGroup(new DatasetGroup(prop.getTimeseriesId())); XYDataset additionalDataset = dataset; NumberAxis axe = (NumberAxis) plot.getRangeAxis(axes.get(phenomenonId)); if (this.isOverview) { axe.setAutoRange(true); axe.setAutoRangeIncludesZero(false); } else if (prop.getAxisUpperBound() == prop.getAxisLowerBound() || prop.isAutoScale()) { if (prop.isZeroScaled()) { axe.setAutoRangeIncludesZero(true); } else { axe.setAutoRangeIncludesZero(false); } } else { if (prop.isZeroScaled()) { if (axe.getUpperBound() < prop.getAxisUpperBound()) { axe.setUpperBound(prop.getAxisUpperBound()); } if (axe.getLowerBound() > prop.getAxisLowerBound()) { axe.setLowerBound(prop.getAxisLowerBound()); } } else { axe.setRange(prop.getAxisLowerBound(), prop.getAxisUpperBound()); axe.setAutoRangeIncludesZero(false); } } plot.setDataset(i, additionalDataset); plot.mapDatasetToRangeAxis(i, axes.get(phenomenonId)); // set bounds new for reference values if (!referenceBounds.containsKey(phenomenonId)) { double[] bounds = new double[] { axe.getLowerBound(), axe.getUpperBound() }; referenceBounds.put(phenomenonId, bounds); } else { double[] bounds = referenceBounds.get(phenomenonId); if (bounds[0] >= axe.getLowerBound()) { bounds[0] = axe.getLowerBound(); } if (bounds[1] <= axe.getUpperBound()) { bounds[1] = axe.getUpperBound(); } } double[] bounds = referenceBounds.get(phenomenonId); for (String string : prop.getReferenceValues()) { if (prop.getRefValue(string).show()) { Double value = prop.getRefValue(string).getValue(); if (value <= bounds[0]) { bounds[0] = value; } else if (value >= bounds[1]) { bounds[1] = value; } } } Axis axis = prop.getAxis(); if (axis == null) { axis = new Axis(axe.getUpperBound(), axe.getLowerBound()); } else if (prop.isAutoScale()) { axis.setLowerBound(axe.getLowerBound()); axis.setUpperBound(axe.getUpperBound()); axis.setMaxY(axis.getMaxY()); axis.setMinY(axis.getMinY()); } prop.setAxisData(axis); this.axisMapping.put(prop.getTimeseriesId(), axis); for (String string : prop.getReferenceValues()) { if (prop.getRefValue(string).show()) { referenceMarkers.add(new ValueMarker(prop.getRefValue(string).getValue(), Color.decode(prop.getRefValue(string).getColor()), new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f))); } } plot.mapDatasetToRangeAxis(i, axes.get(phenomenonId)); } for (ValueMarker valueMarker : referenceMarkers) { plot.addRangeMarker(valueMarker); } // show actual time ValueMarker nowMarker = new ValueMarker(System.currentTimeMillis(), Color.orange, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f)); plot.addDomainMarker(nowMarker); if (!this.isOverview) { Iterator<Entry<String, double[]>> iterator = referenceBounds.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, double[]> boundsEntry = iterator.next(); String phenId = boundsEntry.getKey(); NumberAxis axe = (NumberAxis) plot.getRangeAxis(axes.get(phenId)); axe.setAutoRange(true); // add a margin double marginOffset = (boundsEntry.getValue()[1] - boundsEntry.getValue()[0]) / 25; boundsEntry.getValue()[0] -= marginOffset; boundsEntry.getValue()[1] += marginOffset; axe.setRange(boundsEntry.getValue()[0], boundsEntry.getValue()[1]); } } /**** SECOND RUN ***/ // set domain axis labels: plot.getDomainAxis().setLabelFont(label); plot.getDomainAxis().setLabelPaint(LABEL_COLOR); plot.getDomainAxis().setTickLabelFont(tickLabelDomain); plot.getDomainAxis().setTickLabelPaint(LABEL_COLOR); plot.getDomainAxis().setLabel(designDescriptions.getDomainAxisLabel()); // define the design for each series: for (int datasetIndex = 0; datasetIndex < plot.getDatasetCount(); datasetIndex++) { TimeSeriesCollection dataset = (TimeSeriesCollection) plot.getDataset(datasetIndex); for (int seriesIndex = 0; seriesIndex < dataset.getSeriesCount(); seriesIndex++) { String timeseriesId = (String) dataset.getSeries(seriesIndex).getKey(); RenderingDesign dd = designDescriptions.get(timeseriesId); if (dd != null) { // LINESTYLE: String lineStyle = dd.getLineStyle(); int width = dd.getLineWidth(); if (this.isOverview) { width = width / 2; width = (width == 0) ? 1 : width; } // "1" is lineStyle "line" if (lineStyle.equalsIgnoreCase(LINE)) { XYLineAndShapeRenderer ren = new XYLineAndShapeRenderer(true, false); ren.setStroke(new BasicStroke(width)); plot.setRenderer(datasetIndex, ren); } // "2" is lineStyle "area" else if (lineStyle.equalsIgnoreCase(AREA)) { plot.setRenderer(datasetIndex, new XYAreaRenderer()); } // "3" is lineStyle "dotted" else if (lineStyle.equalsIgnoreCase(DOTTED)) { XYLineAndShapeRenderer ren = new XYLineAndShapeRenderer(false, true); ren.setShape(new Ellipse2D.Double(-width, -width, 2 * width, 2 * width)); plot.setRenderer(datasetIndex, ren); } // "4" is dashed else if (lineStyle.equalsIgnoreCase("4")) { // dashed XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); renderer.setSeriesStroke(0, new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 4.0f * width, 4.0f * width }, 0.0f)); plot.setRenderer(datasetIndex, renderer); } else if (lineStyle.equalsIgnoreCase("5")) { // lines and dots XYLineAndShapeRenderer ren = new XYLineAndShapeRenderer(true, true); int thickness = 2 * width; ren.setShape(new Ellipse2D.Double(-width, -width, thickness, thickness)); ren.setStroke(new BasicStroke(width)); plot.setRenderer(datasetIndex, ren); } else { // default is lineStyle "line" plot.setRenderer(datasetIndex, new XYLineAndShapeRenderer(true, false)); } plot.getRenderer(datasetIndex).setSeriesPaint(seriesIndex, dd.getColor()); // plot.getRenderer(datasetIndex).setShapesVisible(true); XYToolTipGenerator toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance(); XYURLGenerator urlGenerator = new MetadataInURLGenerator(designDescriptions); plot.getRenderer(datasetIndex).setBaseToolTipGenerator(toolTipGenerator); plot.getRenderer(datasetIndex).setURLGenerator(urlGenerator); // GRID: // PROBLEM: JFreeChart only allows to switch the grid on/off // for the whole XYPlot. And the // grid will always be displayed for the first series in the // plot. I'll always show the // grid. // --> plot.setDomainGridlinesVisible(visible) // RANGE AXIS LABELS: if (isOverview) { plot.getRangeAxisForDataset(datasetIndex).setTickLabelsVisible(false); plot.getRangeAxisForDataset(datasetIndex).setTickMarksVisible(false); plot.getRangeAxisForDataset(datasetIndex).setVisible(false); } else { plot.getRangeAxisForDataset(datasetIndex).setLabelFont(label); plot.getRangeAxisForDataset(datasetIndex).setLabelPaint(LABEL_COLOR); plot.getRangeAxisForDataset(datasetIndex).setTickLabelFont(tickLabelDomain); plot.getRangeAxisForDataset(datasetIndex).setTickLabelPaint(LABEL_COLOR); StringBuilder unitOfMeasure = new StringBuilder(); unitOfMeasure.append(dd.getPhenomenon().getLabel()); String uomLabel = dd.getUomLabel(); if (uomLabel != null && !uomLabel.isEmpty()) { unitOfMeasure.append(" (").append(uomLabel).append(")"); } plot.getRangeAxisForDataset(datasetIndex).setLabel(unitOfMeasure.toString()); } } } } return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.DotChart.java
/** * Creates a chart./*w ww. j a va2s. c o m*/ * * @param dataset the data for the chart. * * @return a chart. */ protected JFreeChart createChart1(XYDataset dataset) { //System.out.println("createChart1 called"); // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, // chart title "", // x axis label domain rangeLabel, // y axis label range dataset, // data PlotOrientation.HORIZONTAL, !legendPanelOn, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); // renderer.setSeriesShape(0, java.awt.Shape.round); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setBaseLinesVisible(false); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); //change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(true); rangeAxis.setUpperMargin(0.01); rangeAxis.setLowerMargin(0.01); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); //domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); domainAxis.setAutoRangeIncludesZero(true); domainAxis.setTickLabelsVisible(false); domainAxis.setTickMarksVisible(false); domainAxis.setUpperMargin(5); domainAxis.setLowerMargin(0.01); // OPTIONAL CUSTOMISATION COMPLETED. setYSummary(dataset); try { // System.out.println("setting the common RangeAxis to null"); common_rangeAxis = null; common_rangeAxis = (NumberAxis) rangeAxis.clone(); // System.out.println("creating the common RangeAxis"); } catch (CloneNotSupportedException e) { System.out.println("CloneNotSupportedException!, exception caught"); } return chart; }
From source file:net.sourceforge.subsonic.controller.FolderChartController.java
private JFreeChart createChart(CategoryDataset dataset, HttpServletRequest request) { JFreeChart chart = ChartFactory.createBarChart(null, null, null, dataset, PlotOrientation.HORIZONTAL, false, false, false);/*from ww w. j a va2 s . c om*/ CategoryPlot plot = chart.getCategoryPlot(); Paint background = new GradientPaint(0, 0, Color.lightGray, 0, IMAGE_MIN_HEIGHT, Color.white); plot.setBackgroundPaint(background); plot.setDomainGridlinePaint(Color.lightGray); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.gray); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); LogarithmicAxis rangeAxis = new LogarithmicAxis(null); rangeAxis.setStrictValuesFlag(false); rangeAxis.setAllowNegativesFlag(true); // rangeAxis.setTickUnit(new NumberTickUnit(.1, new DecimalFormat("##0%"))); plot.setRangeAxis(rangeAxis); // Disable bar outlines. BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); // Set up gradient paint for series. GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.gray, 0.0f, 0.0f, new Color(0, 0, 64)); renderer.setSeriesPaint(0, gp0); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelFont(new Font("SansSerif", Font.BOLD, 11)); renderer.setItemLabelAnchorOffset(-45.0); renderer.setSeriesItemLabelPaint(0, Color.white); renderer.setBaseItemLabelPaint(Color.white); // Rotate labels. CategoryAxis domainAxis = plot.getDomainAxis(); // domainAxis.setCategoryLabelPositions(); // domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); // Set theme-specific colors. Color bgColor = getBackground(request); Color fgColor = getForeground(request); chart.setBackgroundPaint(bgColor); domainAxis.setTickLabelPaint(fgColor); domainAxis.setTickMarkPaint(fgColor); domainAxis.setAxisLinePaint(fgColor); rangeAxis.setTickLabelPaint(fgColor); rangeAxis.setTickMarkPaint(fgColor); rangeAxis.setAxisLinePaint(fgColor); return chart; }
From source file:org.jfree.chart.demo.ItemLabelDemo2.java
/** * Creates a sample chart./* www .j a v a 2 s . c o m*/ * * @param dataset * the dataset. * @return the chart. */ private JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createBarChart("Item Label Demo 2", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation true, // include legend true, // tooltips? false // URLs? ); chart.setBackgroundPaint(Color.white); final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setUpperMargin(0.25); final CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); // use one or the other of the following lines to see the different modes for // the label generator... renderer.setLabelGenerator(new LabelGenerator(null)); // renderer.setLabelGenerator(new LabelGenerator(0)); return chart; }