Example usage for org.jfree.chart.plot Plot toString

List of usage examples for org.jfree.chart.plot Plot toString

Introduction

In this page you can find the example usage for org.jfree.chart.plot Plot toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.tiefaces.components.websheet.chart.ChartHelper.java

/**
 * Set color of series.//from   ww w .  j av  a 2 s  . c  om
 * 
 * @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());
        }
    }
}