List of usage examples for org.jfree.chart.plot RingPlot setForegroundAlpha
public void setForegroundAlpha(float alpha)
From source file:unikn.dbis.univis.visualization.chart.RingChart.java
/** * Makes the plot.//from ww w . java 2 s. co m */ protected void plot() { RingPlot plot = (RingPlot) getChart().getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data available"); plot.setLabelGenerator(null); plot.setLegendLabelGenerator(new LabelGenerator(createTotal())); }
From source file:de.forsthaus.webui.customer.CustomerChartCtrl.java
/** * onClick button Ring Chart. <br> * /*from w w w . j a v a 2 s . com*/ * @param event * @throws IOException */ public void onClick$button_CustomerChart_RingChart(Event event) throws InterruptedException, IOException { // logger.debug(event.toString()); div_chartArea.getChildren().clear(); // get the customer ID for which we want show a chart long kunId = getCustomer().getId(); // get a list of data List<ChartData> kunAmountList = getChartService().getChartDataForCustomer(kunId); if (kunAmountList.size() > 0) { DefaultPieDataset pieDataset = new DefaultPieDataset(); for (ChartData chartData : kunAmountList) { Calendar calendar = new GregorianCalendar(); calendar.setTime(chartData.getChartKunInvoiceDate()); int month = calendar.get(Calendar.MONTH) + 1; int year = calendar.get(Calendar.YEAR); String key = String.valueOf(month) + "/" + String.valueOf(year); BigDecimal bd = chartData.getChartKunInvoiceAmount().setScale(15, 3); String amount = String.valueOf(bd.doubleValue()); // fill the data pieDataset.setValue(key + " " + amount, new Double(chartData.getChartKunInvoiceAmount().doubleValue())); } String title = "Monthly amount for year 2009"; JFreeChart chart = ChartFactory.createRingChart(title, pieDataset, true, true, true); RingPlot plot = (RingPlot) chart.getPlot(); plot.setForegroundAlpha(0.5f); BufferedImage bi = chart.createBufferedImage(chartWidth, chartHeight, BufferedImage.TRANSLUCENT, null); byte[] bytes = EncoderUtil.encode(bi, ImageFormat.PNG, true); AImage chartImage = new AImage("Ring Chart", bytes); Image img = new Image(); img.setContent(chartImage); img.setParent(this.div_chartArea); } else { div_chartArea.getChildren().clear(); final Label label = new Label(); label.setValue("This customer have no data for showing in a chart!"); label.setParent(div_chartArea); } }