List of usage examples for org.jfree.chart.plot.dial ArcDialFrame setInnerRadius
public void setInnerRadius(double radius)
From source file:it.eng.spagobi.engines.kpi.bo.charttypes.dialcharts.SimpleDial.java
/** * Creates the chart .//from w w w .ja v a2 s . co m * * @return A Simple Dial chart . */ public JFreeChart createChart() { logger.debug("IN"); if (dataset == null) { logger.debug("The dataset to be represented is null"); return null; } DialPlot plot = new DialPlot(); plot.setDataset((ValueDataset) dataset); logger.debug("Created the new Dial Plot"); ArcDialFrame dialFrame = null; plot.setView(0.21, 0.0, 0.58, 0.30); dialFrame = new ArcDialFrame(60.0, 60.0); dialFrame.setInnerRadius(0.65); dialFrame.setOuterRadius(0.90); dialFrame.setForegroundPaint(Color.darkGray); dialFrame.setStroke(new BasicStroke(3.0f)); plot.setDialFrame(dialFrame); GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(240, 240, 240)); DialBackground sdb = new DialBackground(gp); GradientPaintTransformType gradientPaintTransformType = GradientPaintTransformType.HORIZONTAL; sdb.setGradientPaintTransformer(new StandardGradientPaintTransformer(gradientPaintTransformType)); plot.addLayer(sdb); increment = (upper - lower) / 4; StandardDialScale scale = null; scale = new StandardDialScale(lower, upper, 115.0, -50.0, increment, minorTickCount); // sets intervals for (Iterator iterator = intervals.iterator(); iterator.hasNext();) { KpiInterval interval = (KpiInterval) iterator.next(); StandardDialRange range = new StandardDialRange(interval.getMin(), interval.getMax(), interval.getColor()); range.setInnerRadius(0.70); range.setOuterRadius(0.75); plot.addLayer(range); } scale.setTickRadius(0.88); scale.setTickLabelOffset(0.07); Font f = new Font("Arial", Font.PLAIN, 11); scale.setTickLabelFont(f); //scale.setMajorTickIncrement(25.0); plot.addScale(0, scale); DialPointer needle = new DialPointer.Pin(); needle.setRadius(0.82); plot.addLayer(needle); JFreeChart chart1 = new JFreeChart(plot); logger.debug("Created the chart"); chart1.setBackgroundPaint(color); logger.debug("Setted background color of the chart"); TextTitle title = setStyleTitle(name, styleTitle); chart1.setTitle(title); logger.debug("Setted the title of the chart"); if (subName != null && !subName.equals("")) { TextTitle subTitle = setStyleTitle(subName, styleSubTitle); chart1.addSubtitle(subTitle); logger.debug("Setted the subtitle of the chart"); } logger.debug("OUT"); return chart1; }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.dialcharts.SimpleDial.java
/** * Creates the chart ./*from w ww .jav a 2 s. c om*/ * * @param chartTitle the chart title. * @param dataset the dataset. * * @return A chart . */ public JFreeChart createChart(DatasetMap datasets) { // get data for diagrams logger.debug("IN"); Dataset dataset = (Dataset) datasets.getDatasets().get("1"); DialPlot plot = new DialPlot(); plot.setDataset((ValueDataset) dataset); ArcDialFrame dialFrame = null; if (!horizontalView) { plot.setView(0.78, 0.37, 0.22, 0.26); dialFrame = new ArcDialFrame(-10.0, 20.0); } else { plot.setView(0.21, 0.0, 0.58, 0.30); dialFrame = new ArcDialFrame(60.0, 60.0); } dialFrame.setInnerRadius(0.65); dialFrame.setOuterRadius(0.90); dialFrame.setForegroundPaint(Color.darkGray); dialFrame.setStroke(new BasicStroke(3.0f)); plot.setDialFrame(dialFrame); GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(240, 240, 240)); DialBackground sdb = new DialBackground(gp); GradientPaintTransformType gradientPaintTransformType = GradientPaintTransformType.VERTICAL; if (horizontalView) { gradientPaintTransformType = GradientPaintTransformType.HORIZONTAL; } sdb.setGradientPaintTransformer(new StandardGradientPaintTransformer(gradientPaintTransformType)); plot.addLayer(sdb); if (!(increment > 0)) { logger.warn("increment cannot be less than 0, put default to 0.1 "); increment = 0.1; } StandardDialScale scale = null; if (!horizontalView) { scale = new StandardDialScale(lower, upper, -8, 16.0, increment, minorTickCount); } else { scale = new StandardDialScale(lower, upper, 115.0, -50.0, increment, minorTickCount); } // sets intervals for (Iterator iterator = intervals.iterator(); iterator.hasNext();) { KpiInterval interval = (KpiInterval) iterator.next(); StandardDialRange range = new StandardDialRange(interval.getMin(), interval.getMax(), interval.getColor()); range.setInnerRadius(0.70); range.setOuterRadius(0.75); plot.addLayer(range); } scale.setTickRadius(0.88); scale.setTickLabelOffset(0.07); //set tick label style Font tickLabelsFont = new Font(labelsTickStyle.getFontName(), Font.PLAIN, labelsTickStyle.getSize()); scale.setTickLabelFont(tickLabelsFont); scale.setTickLabelPaint(labelsTickStyle.getColor()); //scale.setMajorTickIncrement(25.0); plot.addScale(0, scale); DialPointer needle = new DialPointer.Pin(); needle.setRadius(0.82); plot.addLayer(needle); DialValueIndicator dvi = new DialValueIndicator(0); dvi.setFont(new Font(labelsValueStyle.getFontName(), Font.PLAIN, labelsValueStyle.getSize())); dvi.setPaint(labelsValueStyle.getColor()); plot.addLayer(dvi); JFreeChart chart1 = new JFreeChart(plot); chart1.setBackgroundPaint(color); TextTitle title = setStyleTitle(name, styleTitle); chart1.setTitle(title); if (subName != null && !subName.equals("")) { TextTitle subTitle = setStyleTitle(subName, styleSubTitle); chart1.addSubtitle(subTitle); } logger.debug("OUT"); return chart1; }