List of usage examples for org.jfree.chart ChartPanel getChart
public JFreeChart getChart()
From source file:com.googlecode.logVisualizer.chart.QuestTurnsBarChart.java
@Override protected ChartPanel createChartPanel() { final ChartPanel panel = super.createChartPanel(); final JFreeChart chart = panel.getChart(); final CategoryDataset dataset = ((CategoryPlot) chart.getPlot()).getDataset(); final NumberAxis numberAxis = (NumberAxis) ((CategoryPlot) chart.getPlot()).getRangeAxis(); int maxTurncount = 0; for (int i = 0; i < dataset.getColumnCount(); i++) if (dataset.getValue(0, i).intValue() > maxTurncount) maxTurncount = dataset.getValue(0, i).intValue(); // Use hard ranges to make comparison between different logs easier, but // don't cut off the bars if some are too long. numberAxis.setAutoRange(false);/*from w w w . j av a 2 s. co m*/ numberAxis.setLowerBound(0); numberAxis.setUpperBound(maxTurncount <= 125 ? 125 : maxTurncount + 10); return panel; }
From source file:techtonic.Onview.java
public static void setDisplayArea(ChartPanel cp) { displayArea1.removeAll();/* ww w . j a v a 2 s. c o m*/ displayArea1.setLayout(new java.awt.BorderLayout()); cp.getChart().getXYPlot().getRangeAxis().setInverted(true); displayArea1.add(cp, BorderLayout.CENTER); displayArea1.validate(); displayArea1.repaint(); }
From source file:examples.gp.monalisa.gui.GeneticDrawingView.java
public JFreeChart getChart() { ChartPanel cp = (ChartPanel) chartPanel; return cp.getChart(); }
From source file:org.jfree.chart.demo.selection.SelectionDemo4.java
/** * Creates a new demo.//from w w w .j a v a 2 s .c o m * * @param title the frame title. */ public SelectionDemo4(String title) { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); this.dataset = (HistogramDataset) plot.getDataset(); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(chartPanel); this.model = new DefaultTableModel(new String[] { "Item:", "Bin Start:", "Bin End:", "Value:" }, 0); this.table = new JTable(this.model); JPanel p = new JPanel(new BorderLayout()); JScrollPane scroller = new JScrollPane(this.table); p.add(scroller); p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "), new EmptyBorder(4, 4, 4, 4))); split.add(p); setContentPane(split); }
From source file:UI.MainViewPanel.java
public ChartPanel getPanel5(Metric5 m5) { int totalRiskCount = m5.totalCriticalCount + m5.totalHighCount + m5.totalLowCount + m5.totalMediumCount; String[][] risks = new String[totalRiskCount][3]; BarChart barChart = new BarChart(m5.totalCriticalCount, m5.totalHighCount, m5.totalMediumCount, m5.totalLowCount, 0, "", risks); ChartPanel thisChart = barChart.drawBarChart(); thisChart.setBackground(Color.white); JFreeChart chart = thisChart.getChart(); chart.setBackgroundPaint(new Color(0, 0, 0, 0)); Plot plot = chart.getPlot();/* w w w . j av a 2 s . com*/ plot.setBackgroundPaint(chartBackgroundColor); return thisChart; }
From source file:UI.MainViewPanel.java
public ChartPanel getPanel1(Metric1 m1) { int totalRiskCount = m1.totalCriticalCount + m1.totalHighCount + m1.totalLowCount + m1.totalMediumCount; String[][] risks = new String[totalRiskCount][3]; PieChart pieChart = new PieChart(m1.totalCriticalCount, m1.totalHighCount, m1.totalMediumCount, m1.totalLowCount, "", risks, true); ChartPanel thisChart = pieChart.drawPieChart(); thisChart.setBackground(Color.white); JFreeChart chart = thisChart.getChart(); chart.setBackgroundPaint(new Color(0, 0, 0, 0)); Plot plot = chart.getPlot();// www. j a v a 2 s. co m plot.setBackgroundPaint(chartBackgroundColor); return thisChart; }
From source file:UI.MainViewPanel.java
public ChartPanel getPanel4(Metric4 m4) { int totalRiskCount = m4.totalCriticalCount + m4.totalHighCount + m4.totalLowCount + m4.totalMediumCount; String[][] risks = new String[totalRiskCount][3]; PieChart pieChart = new PieChart(m4.totalCriticalCount, m4.totalHighCount, m4.totalMediumCount, m4.totalLowCount, "", risks, true); ChartPanel thisChart = pieChart.drawPieChart(); thisChart.setBackground(Color.white); JFreeChart chart = thisChart.getChart(); chart.setBackgroundPaint(new Color(0, 0, 0, 0)); Plot plot = chart.getPlot();//from ww w .ja v a 2 s .c o m plot.setBackgroundPaint(chartBackgroundColor); return thisChart; }
From source file:UI.MainViewPanel.java
public ChartPanel getPanel2(Metric2 m2) { int totalRiskCount = m2.totalCriticalCount + m2.totalHighCount + m2.totalLowCount + m2.totalMediumCount; String[][] risks = new String[totalRiskCount][3]; BarChart barChart = new BarChart(m2.totalCriticalCount, m2.totalHighCount, m2.totalMediumCount, m2.totalLowCount, 0, "", risks); ChartPanel thisChart = barChart.drawBarChart(); thisChart.setBackground(Color.white); JFreeChart chart = thisChart.getChart(); chart.setBackgroundPaint(new Color(0, 0, 0, 0)); Plot plot = chart.getPlot();//from w w w . j a v a 2 s .c om plot.setBackgroundPaint(chartBackgroundColor); return thisChart; }
From source file:UI.MainViewPanel.java
public ChartPanel getPanel8(Metric8 m8) { int totalRiskCount = m8.totalCriticalCount + m8.totalHighCount + m8.totalLowCount + m8.totalMediumCount; String[][] risks = new String[totalRiskCount][3]; BarChart barChart = new BarChart(m8.totalCriticalCount, m8.totalHighCount, m8.totalMediumCount, m8.totalLowCount, m8.totalOtherCount, "", risks); ChartPanel thisChart = barChart.drawBarChart(); thisChart.setBackground(Color.white); JFreeChart chart = thisChart.getChart(); chart.setBackgroundPaint(new Color(0, 0, 0, 0)); Plot plot = chart.getPlot();//from w ww. ja v a2 s .c o m plot.setBackgroundPaint(chartBackgroundColor); return thisChart; }
From source file:org.jfree.expdemo.SelectionDemo4.java
/** * Creates a new demo.//w ww. j ava 2 s. c o m * * @param title * the frame title. */ public SelectionDemo4(String title) { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); this.dataset = (SimpleHistogramDataset) plot.getDataset(); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(chartPanel); this.model = new DefaultTableModel(new String[] { "Item:", "Bin Start::", "Bin End:", "Value:" }, 0); this.table = new JTable(this.model); JPanel p = new JPanel(new BorderLayout()); JScrollPane scroller = new JScrollPane(this.table); p.add(scroller); p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "), new EmptyBorder(4, 4, 4, 4))); split.add(p); setContentPane(split); }