public JFreeChart getChart(JSONObject jsonData, boolean legendBit, boolean tooltipBit) { DefaultPieDataset dataset = new DefaultPieDataset(); Iterator iter = jsonData.keys(); while (iter.hasNext()) { String keyData = (String)iter.next(); Float value = Float.parseFloat(jsonData.getString(keyData)); dataset.setValue(keyData, value); } boolean legend = legendBit; boolean tooltips = tooltipBit; boolean urls = false; JFreeChart chart = ChartFactory.createPieChart("Loklak Visualizes - PieChart", dataset, legend, tooltips, urls); chart.setBorderPaint(Color.BLACK); chart.setBorderStroke(new BasicStroke(5.0f)); chart.setBorderVisible(true); return chart; } }
public CBarGraph(String title, int seriesNum, Color background) { super("", SwingConstants.CENTER); this.chartData = new BarData(title); this.chart = chartData.makeChart(); this.background = background == null ? DEFAULT_BACKGROUND : background; this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); ImageIcon icon = new ImageIcon(chart.createBufferedImage(150, 100)); this.setLayout(null); this.setIcon(icon); this.setBounds(0, 0, 170, 130); }
public CLineGraph(String title, int seriesNum, Color background) { super("", SwingConstants.CENTER); this.chartData = new LineData(title, true, 0.0, 30.0, 0.0, 100.0, seriesNum); this.chart = chartData.makeChart(); this.background = background == null ? DEFAULT_BACKGROUND : background; this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); ImageIcon icon = new ImageIcon(chart.createBufferedImage(150, 100)); this.setLayout(null); this.setIcon(icon); this.setBounds(0, 0, 170, 130); }
legend.setPosition(RectangleEdge.RIGHT); legend.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0, 4, 0, 4)); chart.setBorderPaint(Color.black); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white);
legend.setPosition(RectangleEdge.RIGHT); legend.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0, 4, 0, 4)); chart.setBorderPaint(Color.black); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white);
chart.setBorderPaint (parseColor ("#cccccc"));
private byte[] generateBoxAndWhiskerChart (BoxAndWhiskerCategoryDataset dataset, int width, int height) { JFreeChart chart = ChartFactory.createBoxAndWhiskerChart (null, null, null, dataset, false); // set background chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); // set chart border chart.setPadding (new RectangleInsets (10, 5, 5, 5)); chart.setBorderVisible (true); chart.setBorderPaint (parseColor ("#cccccc")); // set anti alias chart.setAntiAlias (true); CategoryPlot plot = (CategoryPlot) chart.getPlot (); plot.setDomainGridlinePaint (Color.white); plot.setDomainGridlinesVisible (true); plot.setRangeGridlinePaint (Color.white); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis (); rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); domainAxis.setLowerMargin (0.0); domainAxis.setUpperMargin (0.0); BufferedImage img = chart.createBufferedImage (width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ ImageIO.write(img, "png", out); }catch(IOException e){ log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
chart.setBorderPaint(parseColor("#cccccc"));
chart.setBorderPaint(parseColor("#cccccc"));
public void clearChart() { if (!lock) { this.chart = chartData.makeChart(); this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
public void clearChart() { if (!lock) { this.chart = chartData.makeChart(); this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
public void updateDomain(String title, int seriesNum, Color background) { if (!lock) { this.chart = chartData.makeChart(); this.background = background == null ? DEFAULT_BACKGROUND : background; this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
/** * Creates a pie chart with 3D effect. * * @return A pie chart. */ private static JFreeChart createPieChart3D() { JFreeChart chart = ChartFactory.createPieChart3D(null, null, false, true, false); chart.setBackgroundPaint(Color.white); chart.setBorderPaint(Color.white); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setBackgroundPaint(null); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setDarkerSides(true); plot.setBaseSectionOutlinePaint(new Color(0,0,0,0)); plot.setStartAngle(0.0); plot.setInteriorGap(0.10); plot.setLabelGenerator(null); plot.setOutlineVisible(false); plot.setLabelBackgroundPaint(Color.white); plot.setLabelOutlinePaint(null); plot.setLabelShadowPaint(null); plot.setLabelPadding(RectangleInsets.ZERO_INSETS); plot.setLabelFont(new Font("Dialog", Font.PLAIN, 12)); plot.setLabelPaint(Color.gray); plot.setToolTipGenerator(new StandardPieToolTipGenerator("{2}")); return chart; }
chart.setBorderPaint (parseColor ("#cccccc"));
public void updateDomain(String title, int seriesNum, Color background) { if (!lock) { this.chartData.setSeriesNum(seriesNum); this.chart = chartData.makeChart(); this.background = background == null ? DEFAULT_BACKGROUND : background; this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
chart.setBorderPaint(findColor(getBorderPaint()));
chart.setBorderPaint (parseColor ("#cccccc"));
chart.setBorderPaint (parseColor ("#cccccc"));
jfchart.setBorderPaint(params.getColor(ChartParams.BORDER_COLOR));
chart.setBackgroundImage( chartDefinition.getChartBackgroundImage() ); chart.setBorderVisible( chartDefinition.isBorderVisible() ); chart.setBorderPaint( chartDefinition.getBorderPaint() ); if ( chart.getTitle() != null ) { chart.getTitle().setPosition( chartDefinition.getTitlePosition() );