2009. 11. 15. 19:50


package JFreeChart;

import java.awt.*;
import org.jfree.chart.*;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.xy.IntervalXYDataset;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

public class HistogramChart{
 private XYSeries series = null;
 private XYDataset dataset = null;
 private JFreeChart chart = null;
 private TextTitle subTitle = null;
 
 public HistogramChart(){
  series = new XYSeries("Users");
  series.add(2000, 100.0);
  series.add(2001, 111.0);
  series.add(2002, 120.0);
  series.add(2003, 140.0);
 }
 public ChartPanel getHistogramChart_HistogramChart(){
  ChartPanel chartPanel_HistogramChart = null;
  dataset = new XYSeriesCollection(series);
  chart = ChartFactory.createXYBarChart("Response Time  Monitoring", "Var", false, "Frequence", (IntervalXYDataset) dataset, org.jfree.chart.plot.PlotOrientation.VERTICAL, true, true, false);
  subTitle = new TextTitle("Thread Test");
  chart.setBackgroundPaint(Color.WHITE);
  chart.addSubtitle(subTitle);
  chartPanel_HistogramChart = new ChartPanel(chart);
  return chartPanel_HistogramChart;
 }
}

Posted by TIMEC