List of usage examples for org.jfree.chart.plot XYPlot XYPlot
public XYPlot(XYDataset dataset, ValueAxis domainAxis, ValueAxis rangeAxis, XYItemRenderer renderer)
From source file:projects.wdlf47tuc.ProcessAllSwathcal.java
/** * Computes the luminosity function for the current boxed region and plots it in a JFrame. * Also prints out the coordinates of the selection box vertices and the luminosity function * quantities./*w w w. j a va2 s . co m*/ * * @param sources * The {@link Source}s to compute the luminosity function for. */ private void computeAndPlotLuminosityFunction(List<Source> sources) { // Print out coordinates of selection box corners System.out.println("# Coordinates of selection box corners:"); System.out.println("# (" + col1Filter + "-" + col2Filter + ")\t" + magFilter); for (double[] point : points) { System.out.println("# " + point[0] + "\t" + point[1]); } System.out.println("# Luminosity function:"); System.out.println("# Mag.\tN\tsigN"); double magBinWidth = 0.5; // Get the range of the data double mMin = Double.MAX_VALUE; double mMax = -Double.MAX_VALUE; for (Source source : sources) { double mag = source.getMag(magFilter) - mu; mMin = Math.min(mMin, mag); mMax = Math.max(mMax, mag); } // Quantize this to a whole number mMin = Math.floor(mMin); mMax = Math.ceil(mMax); int nBins = (int) Math.rint((mMax - mMin) / magBinWidth); // Array to accumulate all objects in each bin int[] n = new int[nBins]; for (Source source : sources) { double mag = source.getMag(magFilter) - mu; // Bin number int bin = (int) Math.floor((mag - mMin) / magBinWidth); n[bin]++; } YIntervalSeries luminosityFunction = new YIntervalSeries("Luminosity Function"); for (int i = 0; i < nBins; i++) { // Bin centre double x = mMin + i * magBinWidth + 0.5 * magBinWidth; double y = n[i]; double yErr = n[i] > 0 ? Math.sqrt(y) : 0; luminosityFunction.add(x, y, y - yErr, y + yErr); System.out.println(x + "\t" + y + "\t" + yErr); } final YIntervalSeriesCollection data = new YIntervalSeriesCollection(); data.addSeries(luminosityFunction); XYErrorRenderer renderer = new XYErrorRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(0, true); renderer.setSeriesShape(0, new Ellipse2D.Float(-1f, -1f, 2, 2)); renderer.setSeriesPaint(0, ChartColor.BLACK); NumberAxis xAxis = new NumberAxis("Absolute Magnitude (" + magFilter.toString() + ")"); xAxis.setAutoRange(true); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis("N"); yAxis.setAutoRange(true); yAxis.setAutoRangeIncludesZero(true); // Configure plot XYPlot xyplot = new XYPlot(data, xAxis, yAxis, renderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setDomainGridlinesVisible(true); xyplot.setRangeGridlinePaint(Color.white); // Configure chart JFreeChart chart = new JFreeChart("Luminosity Function", xyplot); chart.setBackgroundPaint(Color.white); chart.setTitle("47 Tuc luminosity function"); chart.removeLegend(); final ChartPanel lfChartPanel = new ChartPanel(chart); java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame tester = new JFrame(); tester.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); tester.setLayout(new BorderLayout()); tester.add(lfChartPanel, BorderLayout.CENTER); tester.pack(); tester.setVisible(true); } }); }
From source file:charts.Chart.java
public static JFreeChart MultipleSplineLineChart(XYDataset[] datasets, String title, String x_axis_label, String y_axis_label, boolean showlegend, float maxvalue, float minvalue, boolean showchart) { ValueAxis domainAxis = new NumberAxis(x_axis_label); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ValueAxis rangeAxis = new NumberAxis(y_axis_label); rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); if (minvalue == 0 && maxvalue == 0) { rangeAxis.setAutoRange(true);/* w w w.ja v a 2s .c om*/ } else { rangeAxis.setRange(minvalue, maxvalue); } //define o grafo combinado, determinando o label do eixo x. CombinedDomainXYPlot parent = new CombinedDomainXYPlot(domainAxis); for (int i = 0; i < datasets.length; i++) { XYSplineRenderer renderer = new XYSplineRenderer(); renderer.setBaseStroke(new BasicStroke(2.0f)); renderer.setBaseSeriesVisibleInLegend(showlegend); renderer.setShapesVisible(true); XYPlot subplot = new XYPlot(datasets[i], domainAxis, rangeAxis, renderer); subplot.setBackgroundPaint(Color.white); subplot.setRangeGridlinePaint(Color.black); subplot.setDomainGridlinesVisible(true); parent.add(subplot, 1); } JFreeChart jfreechart = new JFreeChart(title, parent); JPanel jpanel = new ChartPanel(jfreechart); jpanel.setPreferredSize(new Dimension(defaultwidth, defaultheight)); if (showchart) { JFrame chartwindow = new JFrame(title); chartwindow.setContentPane(jpanel); chartwindow.pack(); RefineryUtilities.centerFrameOnScreen(chartwindow); chartwindow.setVisible(true); } return jfreechart; }
From source file:charts.Chart.java
public static JFreeChart MultipleStepChartOverlayed(XYDataset[] datasets1, XYDataset[] datasets2, String title, String x_axis_label, String y_axis_label, boolean showlegend, float maxvalue, float minvalue, boolean showchart) { ValueAxis domainAxis = new NumberAxis(x_axis_label); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ValueAxis rangeAxis = new NumberAxis(y_axis_label); rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); if (minvalue == 0 && maxvalue == 0) { rangeAxis.setAutoRange(true);// ww w . j ava2 s .c o m } else { rangeAxis.setRange(minvalue, maxvalue); } //define o grafo combinado, determinando o label do eixo x. CombinedDomainXYPlot parent = new CombinedDomainXYPlot(domainAxis); for (int i = 0; i < datasets1.length; i++) { XYItemRenderer renderer1 = new XYStepRenderer(); renderer1.setBaseStroke(new BasicStroke(2.0f)); renderer1.setBaseSeriesVisibleInLegend(showlegend); XYPlot subplot = new XYPlot(datasets1[i], domainAxis, rangeAxis, renderer1); subplot.setBackgroundPaint(Color.white); subplot.setRangeGridlinePaint(Color.black); subplot.setDomainGridlinesVisible(true); XYSplineRenderer renderer2 = new XYSplineRenderer(); renderer2.setSeriesPaint(0, Color.LIGHT_GRAY); renderer2.setBaseStroke(new BasicStroke(2.0f)); renderer2.setShapesVisible(true); renderer2.setBaseSeriesVisibleInLegend(false); subplot.setDataset(1, datasets2[i]); subplot.setRenderer(1, renderer2); parent.add(subplot, 1); } JFreeChart jfreechart = new JFreeChart(title, parent); JPanel jpanel = new ChartPanel(jfreechart); jpanel.setPreferredSize(new Dimension(defaultwidth, defaultheight)); if (showchart) { JFrame chartwindow = new JFrame(title); chartwindow.setContentPane(jpanel); chartwindow.pack(); RefineryUtilities.centerFrameOnScreen(chartwindow); chartwindow.setVisible(true); } return jfreechart; }
From source file:com.peterbochs.instrument.InstrumentPanel.java
private static JFreeChart createChart(XYZDataset dataset) { NumberAxis xAxis = new NumberAxis("address (" + jBlockSizeComboBox.getSelectedItem() + ")"); xAxis.setLowerMargin(0.0);// w ww . j a va 2s . c o m xAxis.setUpperMargin(0.0); xAxis.setAxisLinePaint(Color.cyan); xAxis.setTickMarkPaint(Color.cyan); // xAxis.setAutoTickUnitSelection(false); // xAxis.setTickUnit(new NumberTickUnit(1)); // NumberFormat nf = NumberFormat.getPercentInstance(); // xAxis.setNumberFormatOverride(nf); // xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); NumberAxis yAxis = new NumberAxis("address (" + jBlockSizeComboBox.getSelectedItem() + " KB)"); // yAxis.setAutoRangeIncludesZero(true); // yAxis.setInverted(false); yAxis.setLowerMargin(0.0); yAxis.setUpperMargin(0.0); yAxis.setAxisLinePaint(Color.pink); yAxis.setTickMarkPaint(Color.pink); // yAxis.setTickUnit(new NumberTickUnit(10)); // yAxis.setTickLabelFont(new Font("Dialog", 0, 7)); // yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); MyXYBlockRenderer renderer = new MyXYBlockRenderer(); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); // plot.setBackgroundPaint(Color.white); // plot.setDomainGridlineStroke(new BasicStroke(1)); plot.setDomainGridlinePaint(Color.white); // plot.setRangeGridlineStroke(new BasicStroke(1)); plot.setRangeGridlinePaint(Color.white); // JFreeChart chart = new JFreeChart("Memory read/write hot zone", new // Font("Serif", Font.PLAIN, 12), plot, true); JFreeChart chart = new JFreeChart("Memory read/write hot zone", plot); chart.removeLegend(); chart.setBackgroundPaint(Color.white); return chart; }
From source file:com.peterbochs.instrument.InstrumentPanel.java
private static JFreeChart createEmptyChart(XYZDataset dataset) { NumberAxis xAxis = new NumberAxis("address"); xAxis.setLowerMargin(0.0);/* www .j a v a 2s .c om*/ xAxis.setUpperMargin(0.0); NumberAxis yAxis = new NumberAxis("address"); yAxis.setAutoRangeIncludesZero(false); yAxis.setInverted(false); yAxis.setLowerMargin(0.0); yAxis.setUpperMargin(0.0); // yAxis.setAxisLinePaint(Color.pink); // yAxis.setTickMarkPaint(Color.white); yAxis.setTickLabelFont(new Font("Dialog", 0, 7)); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); MyXYBlockRenderer renderer = new MyXYBlockRenderer(); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); // plot.setBackgroundPaint(Color.white); // plot.setDomainGridlineStroke(new BasicStroke(1)); plot.setDomainGridlinePaint(Color.white); // plot.setRangeGridlineStroke(new BasicStroke(1)); plot.setRangeGridlinePaint(Color.white); JFreeChart chart = new JFreeChart("Memory read/write hot zone", new Font("Serif", Font.PLAIN, 12), plot, true); chart.removeLegend(); chart.setBackgroundPaint(Color.white); return chart; }
From source file:oscar.oscarEncounter.oscarMeasurements.pageUtil.MeasurementGraphAction2.java
JFreeChart actualLabChartRefPlusMeds(String demographicNo, String labType, String identifier, String testName, String patientName, String chartTitle, String[] drugs) { org.jfree.data.time.TimeSeriesCollection dataset = new org.jfree.data.time.TimeSeriesCollection(); ArrayList<Map<String, Serializable>> list = null; MiscUtils.getLogger().debug(//from w w w . ja v a2 s.c o m " lab type >" + labType + "< >" + labType.equals("loinc") + "<" + testName + " " + identifier); if (labType.equals("loinc")) { try { Connection conn = DbConnectionFilter.getThreadLocalDbConnection(); list = CommonLabTestValues.findValuesByLoinc2(demographicNo, identifier, conn); MiscUtils.getLogger().debug("List ->" + list.size()); conn.close(); } catch (Exception ed) { MiscUtils.getLogger().error("Error", ed); } } else { list = CommonLabTestValues.findValuesForTest(labType, demographicNo, testName, identifier); } String typeYAxisName = ""; ArrayList<OHLCDataItem> dataItems = new ArrayList<OHLCDataItem>(); String typeLegendName = "Lab Value"; typeYAxisName = "type Y"; boolean nameSet = false; TimeSeries newSeries = new TimeSeries(typeLegendName, Day.class); for (Map mdb : list) { if (!nameSet) { typeYAxisName = (String) mdb.get("units"); typeLegendName = (String) mdb.get("testName"); if (typeLegendName == null) { typeLegendName = testName; } newSeries.setKey(typeLegendName); nameSet = true; } newSeries.addOrUpdate(new Day((Date) mdb.get("collDateDate")), Double.parseDouble("" + mdb.get("result"))); log.debug("RANGE " + mdb.get("range")); if (mdb.get("range") != null) { String range = (String) mdb.get("range"); if (range.indexOf("-") != -1) { String[] sp = range.split("-"); double open = Double.parseDouble(sp[0]); double high = Double.parseDouble(sp[1]); double low = Double.parseDouble(sp[0]); double close = Double.parseDouble(sp[1]); double volume = 1045; dataItems.add(new OHLCDataItem(new Day((Date) mdb.get("collDateDate")).getStart(), open, high, low, close, volume)); } } } dataset.addSeries(newSeries); JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, "Days", typeYAxisName, dataset, true, true, true); XYPlot plot = chart.getXYPlot(); plot.getDomainAxis().setAutoRange(true); log.debug("LEN " + plot.getDomainAxis().getLowerBound() + " ddd " + plot.getDomainAxis().getUpperMargin() + " eee " + plot.getDomainAxis().getLowerMargin()); plot.getDomainAxis().setUpperMargin(plot.getDomainAxis().getUpperMargin() * 6); plot.getDomainAxis().setLowerMargin(plot.getDomainAxis().getLowerMargin() * 6); plot.getRangeAxis().setUpperMargin(plot.getRangeAxis().getUpperMargin() * 1.7); plot.getDomainAxis().setUpperMargin(0.9); plot.getDomainAxis().setLowerMargin(0.9); plot.getRangeAxis().setUpperMargin(plot.getRangeAxis().getUpperMargin() * 4); ValueAxis va = plot.getRangeAxis(); va.setAutoRange(true); XYItemRenderer renderer = plot.getRenderer(); //DateFormat.getInstance() XYItemLabelGenerator generator = new StandardXYItemLabelGenerator("{1} \n {2}", new SimpleDateFormat("yyyy.MM.dd"), new DecimalFormat("0.00")); renderer.setSeriesItemLabelGenerator(0, generator);//setLabelGenerator(generator); renderer.setBaseItemLabelsVisible(true); plot.setBackgroundPaint(Color.WHITE); plot.setDomainCrosshairPaint(Color.GRAY); if (renderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer rend = (XYLineAndShapeRenderer) renderer; rend.setBaseShapesVisible(true); rend.setBaseShapesFilled(true); } plot.setRenderer(renderer); if (dataItems != null && dataItems.size() > 0) { OHLCDataItem[] ohlc = dataItems.toArray(new OHLCDataItem[dataItems.size()]); XYDataset referenceRangeDataset = new DefaultOHLCDataset("Normal Reference Range", ohlc); plot.setDataset(1, referenceRangeDataset); plot.mapDatasetToRangeAxis(1, 0); plot.setRenderer(1, new HighLowRenderer()); } XYTaskDataset drugDataset = getDrugDataSet(demographicNo, drugs); //DateAxis xAxis = new DateAxis("Date/Time"); //DateAxis xAxis = plot.getRangeAxis(); SymbolAxis yAxis = new SymbolAxis("Meds", getDrugSymbol(demographicNo, drugs)); yAxis.setGridBandsVisible(false); XYBarRenderer xyrenderer = new XYBarRenderer(); xyrenderer.setUseYInterval(true); xyrenderer.setBarPainter(new StandardXYBarPainter()); //XYPlot xyplot = new XYPlot(drugDataset, xAxis, yAxis, xyrenderer); XYPlot xyplot = new XYPlot(drugDataset, plot.getDomainAxis(), yAxis, xyrenderer); xyplot.getDomainAxis().setUpperMargin(0.9); xyplot.getDomainAxis().setLowerMargin(0.9); CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(new DateAxis("Date/Time")); cplot.add(plot); cplot.add(xyplot); /////// chart = new JFreeChart(chartTitle, cplot); chart.setBackgroundPaint(Color.white); return chart; }
From source file:com.jtstand.swing.StatsPanel.java
public JFreeChart getChartValues(Iterator<TestStepInstance> values) { if (values == null || !values.hasNext()) { return null; }/* w w w. j av a 2s. c o m*/ XYSeriesCollection dataset = new XYSeriesCollection(); int count = 0; TreeMap<String, XYSeries> map = new TreeMap<String, XYSeries>(); while (values.hasNext()) { TestStepInstance step = values.next(); Number num = getNumber(step); if (num != null) { String groupName = getGroupName(step); XYSeries pop = map.get(groupName); if (pop == null) { pop = new XYSeries(groupName); map.put(groupName, pop); } pop.add(++count, num.doubleValue()); } } for (Iterator<XYSeries> it = map.values().iterator(); it.hasNext();) { dataset.addSeries(it.next()); } // NumberAxis xAxis = new NumberAxis("#"); NumberAxis xAxis = new NumberAxis(); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis(getValueString()); yAxis.setAutoRangeIncludesZero(false); XYLineAndShapeRenderer renderer6 = new XYLineAndShapeRenderer(); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer6); plot.setOrientation(PlotOrientation.VERTICAL); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairVisible(true); renderer6.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); renderer6.setBaseSeriesVisibleInLegend(false); // StandardXYItemLabelGenerator itemlabels=new StandardXYItemLabelGenerator(); // renderer.setBaseItemLabelGenerator(itemlabels); // renderer.setBaseItemLabelsVisible(true); JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, isGrouping()); //chart.setTitle(title); placeLimitMarkers(plot, true); /* coloring */ if (isCategorization()) { // TreeMap<String, Color> cmap = new TreeMap<String, Color>(); int i = 0; for (Iterator<String> it = catstats.keySet().iterator(); it.hasNext(); i++) { String groupName = it.next(); Color c = ChartCategories.getColor(i); for (int j = 0; j < dataset.getSeriesCount(); j++) { XYSeries s = dataset.getSeries(j); if (s.getKey().equals(groupName)) { renderer6.setSeriesPaint(j, c); } } } } else { renderer6.setSeriesPaint(0, ChartCategories.getColor(0)); } chart.setTextAntiAlias(false); return chart; }
From source file:org.ramadda.data.services.PointFormHandler.java
/** * create jfree chart// w w w. java 2 s . co m * * @param request the request * @param entry The entry * @param dataset the dataset * @param backgroundImage background image * * @return the chart */ public static JFreeChart createTimeseriesChart(Request request, Entry entry, XYDataset dataset, Image backgroundImage) { JFreeChart chart = ChartFactory.createXYLineChart("", // chart title "", // x axis label "Height", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); DateAxis timeAxis = new DateAxis("Time", request.getRepository().TIMEZONE_UTC); NumberAxis valueAxis = new NumberAxis("Data"); valueAxis.setAutoRangeIncludesZero(true); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null); chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(Color.white); if (backgroundImage != null) { plot.setBackgroundImage(backgroundImage); plot.setBackgroundImageAlignment(org.jfree.ui.Align.TOP_LEFT); } plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setInsets(new RectangleInsets(0, 0, 0, 0)); plot.setAxisOffset(new RectangleInsets(5, 0, 5, 0)); return chart; }
From source file:no.met.jtimeseries.chart.ChartPlotter.java
/** * Add arrow symobl to the chart. Specify height to follow value curve. * Plot in the middle of chart if height is null. * //from w w w. j av a2 s . c om * @param direction * The direction of arrow * @param height * The followed height * @param offset * The offset value to follow the height, value is between * [-1,1] */ public void addArrowDirectionPlot(NumberPhenomenon direction, NumberPhenomenon height, double offset, PlotStyle plotStyle) { XYArrowRenderer arrowRender = new XYArrowRenderer(); arrowRender.setSeriesVisibleInLegend(0, false); arrowRender.setSeriesPaint(0, plotStyle.getSeriesColor()); ArrowDataset dataset = Utility.toChartArrowDataset(direction, height, offset); XYPlot arrowPlot = new XYPlot(dataset, plot.getDomainAxis(0), plotStyle.getNumberAxis(), arrowRender); arrowPlot.setRangeGridlinesVisible(false); arrowPlot.setOutlineVisible(false); plot.mapDatasetToRangeAxis(plotIndex, rangeAxisIndex); plot.setDataset(plotIndex, dataset); plot.setRenderer(plotIndex, arrowRender); plotIndex++; rangeAxisIndex++; }
From source file:com.jtstand.swing.StatsPanel.java
public JFreeChart getChartDistribution(boolean horizontal) { // System.out.println("Min: " + minValue()); // System.out.println("Max: " + maxValue()); XYIntervalSeriesCollection datasetDistribution = createIntervalXYDatasetDistribution(horizontal); XYSeriesCollection dataset2 = createXYDatasetGauss(horizontal); // create the chart... NumberAxis xAxis = new NumberAxis(getValueString()); xAxis.setAutoRangeIncludesZero(false); // NumberAxis yAxis = new NumberAxis("Distribution"); NumberAxis yAxis = new NumberAxis(); yAxis.setAutoRangeIncludesZero(true); //XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer = new MyBarRenderer(); XYPlot plot = new XYPlot(datasetDistribution, xAxis, yAxis, renderer); plot.setOrientation(horizontal ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL); renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, isGrouping()); chart.setBackgroundPaint((Paint) UIManager.get("Panel.background")); // plot.setBackgroundPaint(Color.white); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); StandardXYItemLabelGenerator itemlabels = new StandardXYItemLabelGenerator(); renderer.setBaseItemLabelGenerator(itemlabels); renderer.setBaseItemLabelsVisible(true); plot.setDataset(1, dataset2);// w ww. ja v a 2 s.co m plot.mapDatasetToRangeAxis(1, 1); // ValueAxis domainAxis = plot.getDomainAxis(); //domainAxis.setCategoryLabelPositions(horizontal?CategoryLabelPositions.STANDARD:CategoryLabelPositions.UP_90); ValueAxis axis2 = new NumberAxis("Gaussian"); plot.setRangeAxis(1, axis2); axis2.setVisible(false); final XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(); //renderer2.setShapesVisible(false); //renderer2.setSeriesVisibleInLegend(false); renderer2.setBaseSeriesVisibleInLegend(false); //renderer2.setToolTipGenerator(new StandardCategoryToolTipGenerator()); plot.setRenderer(1, renderer2); renderer.setUseYInterval(true); renderer.setBaseSeriesVisibleInLegend(false); /* coloring */ Color c; if (isMultipleCategorization()) { // TreeMap<String, Color> cmap = new TreeMap<String, Color>(); int i = 0; for (Iterator<String> it = catstats.keySet().iterator(); it.hasNext(); i++) { String groupName = it.next(); c = ChartCategories.getColor(i); for (int j = 0; j < datasetDistribution.getSeriesCount(); j++) { XYIntervalSeries s = datasetDistribution.getSeries(j); if (s.getKey().equals(groupName)) { GradientPaint gp = new GradientPaint(0.0f, 0.0f, c, 0.0f, 0.0f, c.darker().darker()); renderer.setSeriesPaint(j, gp); } } for (int j = 0; j < dataset2.getSeriesCount(); j++) { XYSeries s = dataset2.getSeries(j); if (s.getKey().equals(groupName)) { renderer2.setSeriesPaint(j, c); renderer2.setSeriesShapesVisible(j, false); renderer2.setSeriesStroke(j, myStroke); } } } c = Color.black; } else { c = ChartCategories.getColor(0); GradientPaint gp = new GradientPaint(0.0f, 0.0f, c, 0.0f, 0.0f, c.darker().darker()); renderer.setSeriesPaint(0, gp); } renderer2.setSeriesPaint(0, c); renderer2.setSeriesShapesVisible(0, false); renderer2.setSeriesStroke(0, myStroke); placeLimitMarkers(plot, false); // renderer.setAutoPopulateSeriesOutlinePaint(true); // renderer.setBaseOutlinePaint(Color.black); // renderer.setSeriesOutlinePaint(0, Color.black, true); // renderer.setDrawBarOutline(true); renderer.setHighlightedItem(0, 0); yAxis.setAutoRange(false); yAxis.setAutoRange(true); xAxis.setRange(leftValue(0), rightValue(numberOfCategories - 1)); chart.setTextAntiAlias(false); return chart; }