List of usage examples for org.jfree.chart JFreeChart toString
public String toString()
From source file:org.tiefaces.components.websheet.chart.ChartHelper.java
/** * Set color of series./* w w w . j a va 2 s. c o m*/ * * @param chart * JFreeChart. * @param seriesIndex * Index of series to set color of (0 = first series) * @param style * One of STYLE_xxx. */ public final void setSeriesStyle(final JFreeChart chart, final int seriesIndex, final String style) { if (chart != null && style != null) { BasicStroke stroke = ChartUtility.toStroke(style); Plot plot = chart.getPlot(); if (plot instanceof CategoryPlot) { CategoryPlot categoryPlot = chart.getCategoryPlot(); CategoryItemRenderer cir = categoryPlot.getRenderer(); try { cir.setSeriesStroke(seriesIndex, stroke); // series line // style } catch (Exception e) { LOG.log(Level.SEVERE, "Error setting style '" + style + "' for series '" + Integer.toString(seriesIndex) + "' of chart '" + chart.toString() + "': " + e.getLocalizedMessage(), e); } } else if (plot instanceof XYPlot) { XYPlot xyPlot = chart.getXYPlot(); XYItemRenderer xyir = xyPlot.getRenderer(); try { xyir.setSeriesStroke(seriesIndex, stroke); // series line // style } catch (Exception e) { LOG.log(Level.SEVERE, "Error setting style '" + style + "' for series '" + Integer.toString(seriesIndex) + "' of chart '" + chart.toString() + "': " + e.getLocalizedMessage(), e); } } else { LOG.log(Level.FINE, "setSeriesColor() unsupported plot: {}", plot.toString()); } } }