jfreechart-1.0.9

16:37:38.680 INFO  jd.cli.Main - Decompiling jfreechart-1.0.9.jar
package org.jfree.chart;

import java.awt.Color;
import java.awt.Paint;

public class ChartColor
  extends Color
{
  public static final Color VERY_DARK_RED = new Color(128, 0, 0);
  public static final Color DARK_RED = new Color(192, 0, 0);
  public static final Color LIGHT_RED = new Color(255, 64, 64);
  public static final Color VERY_LIGHT_RED = new Color(255, 128, 128);
  public static final Color VERY_DARK_YELLOW = new Color(128, 128, 0);
  public static final Color DARK_YELLOW = new Color(192, 192, 0);
  public static final Color LIGHT_YELLOW = new Color(255, 255, 64);
  public static final Color VERY_LIGHT_YELLOW = new Color(255, 255, 128);
  public static final Color VERY_DARK_GREEN = new Color(0, 128, 0);
  public static final Color DARK_GREEN = new Color(0, 192, 0);
  public static final Color LIGHT_GREEN = new Color(64, 255, 64);
  public static final Color VERY_LIGHT_GREEN = new Color(128, 255, 128);
  public static final Color VERY_DARK_CYAN = new Color(0, 128, 128);
  public static final Color DARK_CYAN = new Color(0, 192, 192);
  public static final Color LIGHT_CYAN = new Color(64, 255, 255);
  public static final Color VERY_LIGHT_CYAN = new Color(128, 255, 255);
  public static final Color VERY_DARK_BLUE = new Color(0, 0, 128);
  public static final Color DARK_BLUE = new Color(0, 0, 192);
  public static final Color LIGHT_BLUE = new Color(64, 64, 255);
  public static final Color VERY_LIGHT_BLUE = new Color(128, 128, 255);
  public static final Color VERY_DARK_MAGENTA = new Color(128, 0, 128);
  public static final Color DARK_MAGENTA = new Color(192, 0, 192);
  public static final Color LIGHT_MAGENTA = new Color(255, 64, 255);
  public static final Color VERY_LIGHT_MAGENTA = new Color(255, 128, 255);
  
  public ChartColor(int r, int g, int b)
  {
    super(r, g, b);
  }
  
  public static Paint[] createDefaultPaintArray()
  {
    return new Paint[] { new Color(255, 85, 85), new Color(85, 85, 255), new Color(85, 255, 85), new Color(255, 255, 85), new Color(255, 85, 255), new Color(85, 255, 255), Color.pink, Color.gray, DARK_RED, DARK_BLUE, DARK_GREEN, DARK_YELLOW, DARK_MAGENTA, DARK_CYAN, Color.darkGray, LIGHT_RED, LIGHT_BLUE, LIGHT_GREEN, LIGHT_YELLOW, LIGHT_MAGENTA, LIGHT_CYAN, Color.lightGray, VERY_DARK_RED, VERY_DARK_BLUE, VERY_DARK_GREEN, VERY_DARK_YELLOW, VERY_DARK_MAGENTA, VERY_DARK_CYAN, VERY_LIGHT_RED, VERY_LIGHT_BLUE, VERY_LIGHT_GREEN, VERY_LIGHT_YELLOW, VERY_LIGHT_MAGENTA, VERY_LIGHT_CYAN };
  }
}

/* Location:
 * Qualified Name:     org.jfree.chart.ChartColor
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.chart;

import java.awt.Color;
import java.awt.Font;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.CategoryAxis3D;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.NumberAxis3D;
import org.jfree.chart.axis.Timeline;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.labels.BoxAndWhiskerToolTipGenerator;
import org.jfree.chart.labels.HighLowItemLabelGenerator;
import org.jfree.chart.labels.IntervalCategoryToolTipGenerator;
import org.jfree.chart.labels.ItemLabelAnchor;
import org.jfree.chart.labels.ItemLabelPosition;
import org.jfree.chart.labels.PieToolTipGenerator;
import org.jfree.chart.labels.StandardCategoryToolTipGenerator;
import org.jfree.chart.labels.StandardPieSectionLabelGenerator;
import org.jfree.chart.labels.StandardPieToolTipGenerator;
import org.jfree.chart.labels.StandardXYToolTipGenerator;
import org.jfree.chart.labels.StandardXYZToolTipGenerator;
import org.jfree.chart.labels.XYToolTipGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.Marker;
import org.jfree.chart.plot.MultiplePiePlot;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.PolarPlot;
import org.jfree.chart.plot.RingPlot;
import org.jfree.chart.plot.ValueMarker;
import org.jfree.chart.plot.WaferMapPlot;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.DefaultPolarItemRenderer;
import org.jfree.chart.renderer.WaferMapRenderer;
import org.jfree.chart.renderer.category.AreaRenderer;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.chart.renderer.category.BarRenderer3D;
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer;
import org.jfree.chart.renderer.category.CategoryItemRenderer;
import org.jfree.chart.renderer.category.GanttRenderer;
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
import org.jfree.chart.renderer.category.LineRenderer3D;
import org.jfree.chart.renderer.category.StackedAreaRenderer;
import org.jfree.chart.renderer.category.StackedBarRenderer;
import org.jfree.chart.renderer.category.StackedBarRenderer3D;
import org.jfree.chart.renderer.category.WaterfallBarRenderer;
import org.jfree.chart.renderer.xy.CandlestickRenderer;
import org.jfree.chart.renderer.xy.HighLowRenderer;
import org.jfree.chart.renderer.xy.StackedXYAreaRenderer2;
import org.jfree.chart.renderer.xy.WindItemRenderer;
import org.jfree.chart.renderer.xy.XYAreaRenderer;
import org.jfree.chart.renderer.xy.XYBarRenderer;
import org.jfree.chart.renderer.xy.XYBoxAndWhiskerRenderer;
import org.jfree.chart.renderer.xy.XYBubbleRenderer;
import org.jfree.chart.renderer.xy.XYItemRenderer;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.chart.renderer.xy.XYStepAreaRenderer;
import org.jfree.chart.renderer.xy.XYStepRenderer;
import org.jfree.chart.title.TextTitle;
import org.jfree.chart.urls.PieURLGenerator;
import org.jfree.chart.urls.StandardCategoryURLGenerator;
import org.jfree.chart.urls.StandardPieURLGenerator;
import org.jfree.chart.urls.StandardXYURLGenerator;
import org.jfree.chart.urls.StandardXYZURLGenerator;
import org.jfree.chart.urls.XYURLGenerator;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.IntervalCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.general.PieDataset;
import org.jfree.data.general.WaferMapDataset;
import org.jfree.data.statistics.BoxAndWhiskerCategoryDataset;
import org.jfree.data.statistics.BoxAndWhiskerXYDataset;
import org.jfree.data.xy.IntervalXYDataset;
import org.jfree.data.xy.OHLCDataset;
import org.jfree.data.xy.TableXYDataset;
import org.jfree.data.xy.WindDataset;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYZDataset;
import org.jfree.ui.Layer;
import org.jfree.ui.RectangleEdge;
import org.jfree.ui.RectangleInsets;
import org.jfree.ui.TextAnchor;
import org.jfree.util.SortOrder;
import org.jfree.util.TableOrder;

public abstract class ChartFactory
{
  public static JFreeChart createPieChart(String title, PieDataset dataset, boolean legend, boolean tooltips, Locale locale)
  {
    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
    plot.setInsets(new RectangleInsets(0.0D, 5.0D, 5.0D, 5.0D));
    if (tooltips) {
      plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
  }
  
  public static JFreeChart createPieChart(String title, PieDataset dataset, boolean legend, boolean tooltips, boolean urls)
  {
    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0D, 5.0D, 5.0D, 5.0D));
    if (tooltips) {
      plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
      plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
  }
  
  public static JFreeChart createPieChart(String title, PieDataset dataset, PieDataset previousDataset, int percentDiffForMaxScale, boolean greenForIncrease, boolean legend, boolean tooltips, Locale locale, boolean subTitle, boolean showDifference)
  {
    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
    plot.setInsets(new RectangleInsets(0.0D, 5.0D, 5.0D, 5.0D));
    if (tooltips) {
      plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
    }
    List keys = dataset.getKeys();
    DefaultPieDataset series = null;
    if (showDifference) {
      series = new DefaultPieDataset();
    }
    double colorPerPercent = 255.0D / percentDiffForMaxScale;
    for (Iterator it = keys.iterator(); it.hasNext();)
    {
      Comparable key = (Comparable)it.next();
      Number newValue = dataset.getValue(key);
      Number oldValue = previousDataset.getValue(key);
      if (oldValue == null)
      {
        if (greenForIncrease) {
          plot.setSectionPaint(key, Color.green);
        } else {
          plot.setSectionPaint(key, Color.red);
        }
        if (showDifference) {
          series.setValue(key + " (+100%)", newValue);
        }
      }
      else
      {
        double percentChange = (newValue.doubleValue() / oldValue.doubleValue() - 1.0D) * 100.0D;
        
        double shade = Math.abs(percentChange) >= percentDiffForMaxScale ? 255.0D : Math.abs(percentChange) * colorPerPercent;
        if (((greenForIncrease) && (newValue.doubleValue() > oldValue.doubleValue())) || ((!greenForIncrease) && (newValue.doubleValue() < oldValue.doubleValue()))) {
          plot.setSectionPaint(key, new Color(0, (int)shade, 0));
        } else {
          plot.setSectionPaint(key, new Color((int)shade, 0, 0));
        }
        if (showDifference) {
          series.setValue(key + " (" + (percentChange >= 0.0D ? "+" : "") + NumberFormat.getPercentInstance().format(percentChange / 100.0D) + ")", newValue);
        }
      }
    }
    if (showDifference) {
      plot.setDataset(series);
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    if (subTitle)
    {
      TextTitle subtitle = null;
      subtitle = new TextTitle("Bright " + (greenForIncrease ? "red" : "green") + "=change >=-" + percentDiffForMaxScale + "%, Bright " + (!greenForIncrease ? "red" : "green") + "=change >=+" + percentDiffForMaxScale + "%", new Font("SansSerif", 0, 10));
      
      chart.addSubtitle(subtitle);
    }
    return chart;
  }
  
  public static JFreeChart createPieChart(String title, PieDataset dataset, PieDataset previousDataset, int percentDiffForMaxScale, boolean greenForIncrease, boolean legend, boolean tooltips, boolean urls, boolean subTitle, boolean showDifference)
  {
    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0D, 5.0D, 5.0D, 5.0D));
    if (tooltips) {
      plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
      plot.setURLGenerator(new StandardPieURLGenerator());
    }
    List keys = dataset.getKeys();
    DefaultPieDataset series = null;
    if (showDifference) {
      series = new DefaultPieDataset();
    }
    double colorPerPercent = 255.0D / percentDiffForMaxScale;
    for (Iterator it = keys.iterator(); it.hasNext();)
    {
      Comparable key = (Comparable)it.next();
      Number newValue = dataset.getValue(key);
      Number oldValue = previousDataset.getValue(key);
      if (oldValue == null)
      {
        if (greenForIncrease) {
          plot.setSectionPaint(key, Color.green);
        } else {
          plot.setSectionPaint(key, Color.red);
        }
        if (showDifference) {
          series.setValue(key + " (+100%)", newValue);
        }
      }
      else
      {
        double percentChange = (newValue.doubleValue() / oldValue.doubleValue() - 1.0D) * 100.0D;
        
        double shade = Math.abs(percentChange) >= percentDiffForMaxScale ? 255.0D : Math.abs(percentChange) * colorPerPercent;
        if (((greenForIncrease) && (newValue.doubleValue() > oldValue.doubleValue())) || ((!greenForIncrease) && (newValue.doubleValue() < oldValue.doubleValue()))) {
          plot.setSectionPaint(key, new Color(0, (int)shade, 0));
        } else {
          plot.setSectionPaint(key, new Color((int)shade, 0, 0));
        }
        if (showDifference) {
          series.setValue(key + " (" + (percentChange >= 0.0D ? "+" : "") + NumberFormat.getPercentInstance().format(percentChange / 100.0D) + ")", newValue);
        }
      }
    }
    if (showDifference) {
      plot.setDataset(series);
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    if (subTitle)
    {
      TextTitle subtitle = null;
      subtitle = new TextTitle("Bright " + (greenForIncrease ? "red" : "green") + "=change >=-" + percentDiffForMaxScale + "%, Bright " + (!greenForIncrease ? "red" : "green") + "=change >=+" + percentDiffForMaxScale + "%", new Font("SansSerif", 0, 10));
      
      chart.addSubtitle(subtitle);
    }
    return chart;
  }
  
  public static JFreeChart createRingChart(String title, PieDataset dataset, boolean legend, boolean tooltips, Locale locale)
  {
    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
    plot.setInsets(new RectangleInsets(0.0D, 5.0D, 5.0D, 5.0D));
    if (tooltips) {
      plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
  }
  
  public static JFreeChart createRingChart(String title, PieDataset dataset, boolean legend, boolean tooltips, boolean urls)
  {
    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0D, 5.0D, 5.0D, 5.0D));
    if (tooltips) {
      plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
      plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
  }
  
  public static JFreeChart createMultiplePieChart(String title, CategoryDataset dataset, TableOrder order, boolean legend, boolean tooltips, boolean urls)
  {
    if (order == null) {
      throw new IllegalArgumentException("Null 'order' argument.");
    }
    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(order);
    plot.setBackgroundPaint(null);
    plot.setOutlineStroke(null);
    if (tooltips)
    {
      PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
      
      PiePlot pp = (PiePlot)plot.getPieChart().getPlot();
      pp.setToolTipGenerator(tooltipGenerator);
    }
    if (urls)
    {
      PieURLGenerator urlGenerator = new StandardPieURLGenerator();
      PiePlot pp = (PiePlot)plot.getPieChart().getPlot();
      pp.setURLGenerator(urlGenerator);
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips, Locale locale)
  {
    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0D, 5.0D, 5.0D, 5.0D));
    if (tooltips) {
      plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
  }
  
  public static JFreeChart createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips, boolean urls)
  {
    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0D, 5.0D, 5.0D, 5.0D));
    if (tooltips) {
      plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
      plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
  }
  
  public static JFreeChart createMultiplePieChart3D(String title, CategoryDataset dataset, TableOrder order, boolean legend, boolean tooltips, boolean urls)
  {
    if (order == null) {
      throw new IllegalArgumentException("Null 'order' argument.");
    }
    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(order);
    plot.setBackgroundPaint(null);
    plot.setOutlineStroke(null);
    
    JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
    TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", 1, 12));
    
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    pieChart.setTitle(seriesTitle);
    pieChart.removeLegend();
    pieChart.setBackgroundPaint(null);
    plot.setPieChart(pieChart);
    if (tooltips)
    {
      PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
      
      PiePlot pp = (PiePlot)plot.getPieChart().getPlot();
      pp.setToolTipGenerator(tooltipGenerator);
    }
    if (urls)
    {
      PieURLGenerator urlGenerator = new StandardPieURLGenerator();
      PiePlot pp = (PiePlot)plot.getPieChart().getPlot();
      pp.setURLGenerator(urlGenerator);
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createBarChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
    
    BarRenderer renderer = new BarRenderer();
    if (orientation == PlotOrientation.HORIZONTAL)
    {
      ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT);
      
      renderer.setBasePositiveItemLabelPosition(position1);
      ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT);
      
      renderer.setBaseNegativeItemLabelPosition(position2);
    }
    else if (orientation == PlotOrientation.VERTICAL)
    {
      ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
      
      renderer.setBasePositiveItemLabelPosition(position1);
      ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
      
      renderer.setBaseNegativeItemLabelPosition(position2);
    }
    if (tooltips) {
      renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
      renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createStackedBarChart(String title, String domainAxisLabel, String rangeAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
    ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
    
    StackedBarRenderer renderer = new StackedBarRenderer();
    if (tooltips) {
      renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
      renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);
    
    BarRenderer3D renderer = new BarRenderer3D();
    if (tooltips) {
      renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
      renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL)
    {
      plot.setRowRenderingOrder(SortOrder.DESCENDING);
      plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }
    plot.setForegroundAlpha(0.75F);
    
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);
    
    CategoryItemRenderer renderer = new StackedBarRenderer3D();
    if (tooltips) {
      renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
      renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL) {
      plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createAreaChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    categoryAxis.setCategoryMargin(0.0D);
    
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
    
    AreaRenderer renderer = new AreaRenderer();
    if (tooltips) {
      renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
      renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createStackedAreaChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
    
    StackedAreaRenderer renderer = new StackedAreaRenderer();
    if (tooltips) {
      renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
      renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createLineChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
    
    LineAndShapeRenderer renderer = new LineAndShapeRenderer(true, false);
    if (tooltips) {
      renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
      renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createLineChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);
    
    LineRenderer3D renderer = new LineRenderer3D();
    if (tooltips) {
      renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
      renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createGanttChart(String title, String categoryAxisLabel, String dateAxisLabel, IntervalCategoryDataset dataset, boolean legend, boolean tooltips, boolean urls)
  {
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    DateAxis dateAxis = new DateAxis(dateAxisLabel);
    
    CategoryItemRenderer renderer = new GanttRenderer();
    if (tooltips) {
      renderer.setBaseToolTipGenerator(new IntervalCategoryToolTipGenerator("{3} - {4}", DateFormat.getDateInstance()));
    }
    if (urls) {
      renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, dateAxis, renderer);
    
    plot.setOrientation(PlotOrientation.HORIZONTAL);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createWaterfallChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    categoryAxis.setCategoryMargin(0.0D);
    
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
    
    WaterfallBarRenderer renderer = new WaterfallBarRenderer();
    if (orientation == PlotOrientation.HORIZONTAL)
    {
      ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 1.5707963267948966D);
      
      renderer.setBasePositiveItemLabelPosition(position);
      renderer.setBaseNegativeItemLabelPosition(position);
    }
    else if (orientation == PlotOrientation.VERTICAL)
    {
      ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 0.0D);
      
      renderer.setBasePositiveItemLabelPosition(position);
      renderer.setBaseNegativeItemLabelPosition(position);
    }
    if (tooltips)
    {
      StandardCategoryToolTipGenerator generator = new StandardCategoryToolTipGenerator();
      
      renderer.setBaseToolTipGenerator(generator);
    }
    if (urls) {
      renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    
    plot.clearRangeMarkers();
    Marker baseline = new ValueMarker(0.0D);
    baseline.setPaint(Color.black);
    plot.addRangeMarker(baseline, Layer.FOREGROUND);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createPolarChart(String title, XYDataset dataset, boolean legend, boolean tooltips, boolean urls)
  {
    PolarPlot plot = new PolarPlot();
    plot.setDataset(dataset);
    NumberAxis rangeAxis = new NumberAxis();
    rangeAxis.setAxisLineVisible(false);
    rangeAxis.setTickMarksVisible(false);
    rangeAxis.setTickLabelInsets(new RectangleInsets(0.0D, 0.0D, 0.0D, 0.0D));
    plot.setAxis(rangeAxis);
    plot.setRenderer(new DefaultPolarItemRenderer());
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createScatterPlot(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    yAxis.setAutoRangeIncludesZero(false);
    
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    
    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips) {
      toolTipGenerator = new StandardXYToolTipGenerator();
    }
    XYURLGenerator urlGenerator = null;
    if (urls) {
      urlGenerator = new StandardXYURLGenerator();
    }
    XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true);
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    renderer.setURLGenerator(urlGenerator);
    plot.setRenderer(renderer);
    plot.setOrientation(orientation);
    
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createXYBarChart(String title, String xAxisLabel, boolean dateAxis, String yAxisLabel, IntervalXYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    ValueAxis domainAxis = null;
    if (dateAxis)
    {
      domainAxis = new DateAxis(xAxisLabel);
    }
    else
    {
      NumberAxis axis = new NumberAxis(xAxisLabel);
      axis.setAutoRangeIncludesZero(false);
      domainAxis = axis;
    }
    ValueAxis valueAxis = new NumberAxis(yAxisLabel);
    
    XYBarRenderer renderer = new XYBarRenderer();
    if (tooltips)
    {
      XYToolTipGenerator tt;
      XYToolTipGenerator tt;
      if (dateAxis) {
        tt = StandardXYToolTipGenerator.getTimeSeriesInstance();
      } else {
        tt = new StandardXYToolTipGenerator();
      }
      renderer.setBaseToolTipGenerator(tt);
    }
    if (urls) {
      renderer.setURLGenerator(new StandardXYURLGenerator());
    }
    XYPlot plot = new XYPlot(dataset, domainAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createXYAreaChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setOrientation(orientation);
    plot.setForegroundAlpha(0.5F);
    
    XYToolTipGenerator tipGenerator = null;
    if (tooltips) {
      tipGenerator = new StandardXYToolTipGenerator();
    }
    XYURLGenerator urlGenerator = null;
    if (urls) {
      urlGenerator = new StandardXYURLGenerator();
    }
    plot.setRenderer(new XYAreaRenderer(4, tipGenerator, urlGenerator));
    
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createStackedXYAreaChart(String title, String xAxisLabel, String yAxisLabel, TableXYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    xAxis.setLowerMargin(0.0D);
    xAxis.setUpperMargin(0.0D);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips) {
      toolTipGenerator = new StandardXYToolTipGenerator();
    }
    XYURLGenerator urlGenerator = null;
    if (urls) {
      urlGenerator = new StandardXYURLGenerator();
    }
    StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(toolTipGenerator, urlGenerator);
    
    renderer.setOutline(true);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    
    plot.setRangeAxis(yAxis);
    
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createXYLineChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    if (tooltips) {
      renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
      renderer.setURLGenerator(new StandardXYURLGenerator());
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createXYStepChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    DateAxis xAxis = new DateAxis(xAxisLabel);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    
    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips) {
      toolTipGenerator = new StandardXYToolTipGenerator();
    }
    XYURLGenerator urlGenerator = null;
    if (urls) {
      urlGenerator = new StandardXYURLGenerator();
    }
    XYItemRenderer renderer = new XYStepRenderer(toolTipGenerator, urlGenerator);
    
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setRenderer(renderer);
    plot.setOrientation(orientation);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createXYStepAreaChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
  {
    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    
    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips) {
      toolTipGenerator = new StandardXYToolTipGenerator();
    }
    XYURLGenerator urlGenerator = null;
    if (urls) {
      urlGenerator = new StandardXYURLGenerator();
    }
    XYItemRenderer renderer = new XYStepAreaRenderer(3, toolTipGenerator, urlGenerator);
    
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setRenderer(renderer);
    plot.setOrientation(orientation);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createTimeSeriesChart(String title, String timeAxisLabel, String valueAxisLabel, XYDataset dataset, boolean legend, boolean tooltips, boolean urls)
  {
    ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    timeAxis.setLowerMargin(0.02D);
    timeAxis.setUpperMargin(0.02D);
    NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false);
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
    
    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips) {
      toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance();
    }
    XYURLGenerator urlGenerator = null;
    if (urls) {
      urlGenerator = new StandardXYURLGenerator();
    }
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
    
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    renderer.setURLGenerator(urlGenerator);
    plot.setRenderer(renderer);
    
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createCandlestickChart(String title, String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset, boolean legend)
  {
    ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
    plot.setRenderer(new CandlestickRenderer());
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createHighLowChart(String title, String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset, boolean legend)
  {
    ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    HighLowRenderer renderer = new HighLowRenderer();
    renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    
    return chart;
  }
  
  public static JFreeChart createHighLowChart(String title, String timeAxisLabel, String valueAxisLabel, OHLCDatase
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd