List of usage examples for org.jfree.chart ChartPanel setBackground
@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.") public void setBackground(Color bg)
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 ww .j a va2 s.co m 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 ww w .j ava 2 s . c o m*/ plot.setBackgroundPaint(chartBackgroundColor); return thisChart; }
From source file:UI.MainViewPanel.java
public ChartPanel getPanel3(Metric3 m3) { int totalRiskCount = m3.totalCriticalCount + m3.totalLowCount; String[][] risks = new String[totalRiskCount][3]; RingChart ringChart = new RingChart(m3.totalCriticalCount, m3.totalHighCount, m3.totalMediumCount, m3.totalLowCount, "", risks); ChartPanel thisChart = ringChart.drawRingChart(); thisChart.setBackground(Color.white); JFreeChart chart = thisChart.getChart(); chart.setBackgroundPaint(Color.white); Plot plot = chart.getPlot();//w w w. j a va 2 s .c o m plot.setBackgroundPaint(chartBackgroundColor); return thisChart; }
From source file:UI.MainViewPanel.java
public ChartPanel getPanel6(Metric6 m6) { int totalRiskCount = m6.totalCriticalCount + m6.totalHighCount + m6.totalLowCount + m6.totalMediumCount; String[][] risks = new String[totalRiskCount][3]; RingChart ringChart = new RingChart(m6.totalCriticalCount, m6.totalHighCount, m6.totalMediumCount, m6.totalLowCount, "", risks); ringChart.lowValue = ("Low (" + m6.totalLowCount + ")"); ChartPanel thisChart = ringChart.drawRingChart(); thisChart.setBackground(Color.white); JFreeChart chart = thisChart.getChart(); chart.setBackgroundPaint(new Color(0, 0, 0, 0)); Plot plot = chart.getPlot();/*from ww w.j a v a2 s .c o m*/ plot.setBackgroundPaint(chartBackgroundColor); return thisChart; }
From source file:az.kanan.batterystat.frame.MainFrame.java
private void drawStat() { jPanel2.removeAll();/* www .j av a 2 s .c o m*/ jPanel2.setLayout(new GridLayout(0, 1)); JFreeChart lineChart = ChartFactory.createLineChart("Statistic of power", "date", "percent of life", createDataset(), PlotOrientation.VERTICAL, true, true, false); lineChart.setBackgroundPaint(Color.white); ChartPanel chartPanel = new ChartPanel(lineChart); chartPanel.setBackground(Color.white); chartPanel.setPreferredSize(new java.awt.Dimension(640, 400)); jPanel2.add(chartPanel); jPanel2.revalidate(); jPanel2.repaint(); }
From source file:utilities.GraphViewer.java
private ChartPanel graphe() { JFreeChart graph = ChartFactory.createXYLineChart("Sensors Energy", "Time", "Energy", dataset, PlotOrientation.VERTICAL, true, true, false); ChartPanel cPanel = new ChartPanel(graph); cPanel.setBackground(Color.blue); cPanel.setPreferredSize(new Dimension(800, 600)); XYPlot plot = graph.getXYPlot();// ww w. j av a2 s. c o m plot.setBackgroundPaint(Color.WHITE); plot.setOutlinePaint(Color.BLACK); plot.setRangeGridlinePaint(Color.BLACK); return cPanel; }
From source file:clienteProfessor.ClickerOne_Resultados.java
public void criaGrafico() { CategoryDataset cds = createDataset(); String titulo = "Resultado da aula: " + jComboBoxAulas.getSelectedItem(); String eixoy = "Quantidade de escolhas"; String txt_legenda = "Legenda:"; boolean legenda = true; boolean tooltips = true; boolean urls = true; JFreeChart graf = ChartFactory.createBarChart3D(titulo, txt_legenda, eixoy, cds, PlotOrientation.VERTICAL, legenda, tooltips, urls);//from ww w . ja v a 2s . c o m //JFreeChart graf = ChartFactory.createBarChart3D(titulo, txt_legenda, eixoy, cds, PlotOrientation.VERTICAL, legenda, tooltips, urls); ChartPanel myChartPanel = new ChartPanel(graf, true); myChartPanel.setSize(jPanel1.getWidth(), jPanel1.getHeight()); myChartPanel.setVisible(true); myChartPanel.setFont(new Font("Arial", Font.PLAIN, 25)); myChartPanel.setBackground(this.getBackground()); jPanel1.removeAll(); jPanel1.add(myChartPanel); jPanel1.revalidate(); jPanel1.repaint(); }
From source file:com.jeco.ui.view.GraficoPeso.java
public void drawGrafico(Ovino ovino) { if (ovino == null) { ovino = new Ovino(); ovino.setCodigo("00"); }/*w w w. ja v a2 s. c o m*/ DefaultCategoryDataset ds = new DefaultCategoryDataset(); for (Pesagem pesagem : ovino.getHistoricoPesos()) { ds.addValue(pesagem.getPeso(), "Peso", pesagem.getData()); } //cria o grafico.. JFreeChart data = ChartFactory.createBarChart("", "Data", "Peso do Ovino " + ovino.getCodigo(), ds, PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(data); this.chartPanel = chartPanel; chartPanel.setPreferredSize(new java.awt.Dimension(378, 260)); this.setBackground(new java.awt.Color(255, 255, 255)); this.remove(chartPanel); this.repaint(); this.add(chartPanel); chartPanel.setBackground(new java.awt.Color(255, 255, 255)); this.repaint(); }
From source file:project16.Home16.java
void RenderChart() { CategoryDataset ds = createDataset(); JFreeChart chart = ChartFactory.createStackedAreaChart("", "", "", ds); chart.setBackgroundPaint(new Color(54, 63, 73)); chart.setBorderVisible(false);//w ww .j av a2s . c o m chart.setBorderPaint(new Color(54, 63, 73)); chart.getCategoryPlot().setBackgroundPaint(new Color(54, 63, 73)); chart.getCategoryPlot().setDomainGridlinePaint(new Color(54, 63, 73)); chart.getCategoryPlot().setDomainGridlinesVisible(false); chart.getCategoryPlot().setOutlinePaint(new Color(54, 63, 73)); ChartPanel cp = new ChartPanel(chart); cp.setBackground(new Color(54, 63, 73)); pnl_chart.add(cp, BorderLayout.CENTER); pnl_chart.validate(); }
From source file:com.jd.survey.web.statistics.StatisticsController.java
@Secured({ "ROLE_ADMIN", "ROLE_SURVEY_ADMIN" }) private JFreeChart createChart(PieDataset pieDataset, String title) { try {/*from w w w. j a v a2 s. com*/ JFreeChart chart = ChartFactory.createPieChart(title, pieDataset, false, true, false); chart.setBackgroundPaint(null);//this line necessary for transparency of background final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setOpaque(false); //this line necessary for transparency of background chartPanel.setBackground(new Color(0, 0, 0, 0)); //this line necessary for transparency of background PiePlot plot = (PiePlot) chart.getPlot(); //Color[] colors = {new Color(170, 195, 217, 255),new Color(246, 140, 31, 255),new Color(204, 204, 204, 255),new Color(231, 238, 144, 255),new Color(51, 51, 51, 255),new Color(101, 125, 151, 255),new Color(0, 102, 255, 255)}; //PieRenderer renderer = new PieRenderer(colors); //renderer.setColor(plot, pieDataset); PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator("{0}:{1}%"); plot.setLabelGenerator(generator); plot.setStartAngle(270); plot.setDirection(Rotation.CLOCKWISE); return chart; } catch (Exception e) { log.error(e.getMessage(), e); throw (new RuntimeException(e)); } }