From: <mu...@us...> - 2007-10-24 13:26:48
|
Revision: 412 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=412&view=rev Author: mungady Date: 2007-10-24 06:26:47 -0700 (Wed, 24 Oct 2007) Log Message: ----------- Moved these demos to the JFreeChart demo collection. Removed Paths: ------------- branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo1.java branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo2.java branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo3.java branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo4.java branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo5.java Deleted: branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo1.java =================================================================== --- branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo1.java 2007-10-24 09:40:38 UTC (rev 411) +++ branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo1.java 2007-10-24 13:26:47 UTC (rev 412) @@ -1,148 +0,0 @@ -/* -------------- - * DialDemo1.java - * -------------- - * (C) Copyright 2006, by Object Refinery Limited. - */ - -package org.jfree.experimental.chart.demo; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GradientPaint; -import java.awt.Point; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JSlider; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import org.jfree.chart.ChartPanel; -import org.jfree.chart.JFreeChart; -import org.jfree.experimental.chart.plot.dial.DialPlot; -import org.jfree.experimental.chart.plot.dial.SimpleDialFrame; -import org.jfree.experimental.chart.plot.dial.DialTextAnnotation; -import org.jfree.experimental.chart.plot.dial.StandardDialRange; -import org.jfree.experimental.chart.plot.dial.StandardDialScale; -import org.jfree.experimental.chart.plot.dial.DialBackground; -import org.jfree.experimental.chart.plot.dial.DialCap; -import org.jfree.experimental.chart.plot.dial.DialPointer; -import org.jfree.experimental.chart.plot.dial.DialValueIndicator; -import org.jfree.data.general.DefaultValueDataset; -import org.jfree.ui.GradientPaintTransformType; -import org.jfree.ui.StandardGradientPaintTransformer; - -/** - * A sample application showing the use of a {@link DialPlot}. - */ -public class DialDemo1 extends JFrame implements ChangeListener { - - /** A slider to update the dataset value. */ - JSlider slider; - - /** The dataset. */ - DefaultValueDataset dataset; - - /** - * Creates a new instance. - * - * @param title the frame title. - */ - public DialDemo1(String title) { - super(title); - - this.dataset = new DefaultValueDataset(10.0); - - // get data for diagrams - DialPlot plot = new DialPlot(); - plot.setView(0.0, 0.0, 1.0, 1.0); - plot.setDataset(this.dataset); - SimpleDialFrame dialFrame = new SimpleDialFrame(); - dialFrame.setBackgroundPaint(Color.lightGray); - dialFrame.setForegroundPaint(Color.darkGray); - plot.setDialFrame(dialFrame); - - GradientPaint gp = new GradientPaint(new Point(), - new Color(255, 255, 255), new Point(), - new Color(170, 170, 220)); - DialBackground db = new DialBackground(gp); - db.setGradientPaintTransformer(new StandardGradientPaintTransformer( - GradientPaintTransformType.VERTICAL)); - plot.setBackground(db); - - DialTextAnnotation annotation1 = new DialTextAnnotation("Temperature"); - annotation1.setFont(new Font("Dialog", Font.BOLD, 14)); - annotation1.setRadius(0.7); - - plot.addLayer(annotation1); - - DialValueIndicator dvi = new DialValueIndicator(0, "c"); - plot.addLayer(dvi); - - StandardDialScale scale = new StandardDialScale(-40, 60, -120, -300); - scale.setTickRadius(0.88); - scale.setTickLabelOffset(0.15); - scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14)); - plot.addScale(0, scale); - - StandardDialRange range = new StandardDialRange(40.0, 60.0, Color.red); - range.setInnerRadius(0.52); - range.setOuterRadius(0.55); - plot.addLayer(range); - - StandardDialRange range2 = new StandardDialRange(10.0, 40.0, - Color.orange); - range2.setInnerRadius(0.52); - range2.setOuterRadius(0.55); - plot.addLayer(range2); - - StandardDialRange range3 = new StandardDialRange(-40.0, 10.0, - Color.green); - range3.setInnerRadius(0.52); - range3.setOuterRadius(0.55); - plot.addLayer(range3); - - DialPointer needle = new DialPointer.Pointer(); - plot.addLayer(needle); - - DialCap cap = new DialCap(); - cap.setRadius(0.10); - plot.setCap(cap); - - JFreeChart chart1 = new JFreeChart(plot); - chart1.setTitle("Demo Dial 1"); - ChartPanel cp1 = new ChartPanel(chart1); - cp1.setPreferredSize(new Dimension(400, 400)); - this.slider = new JSlider(-40, 60); - this.slider.setMajorTickSpacing(10); - this.slider.setPaintLabels(true); - this.slider.addChangeListener(this); - JPanel content = new JPanel(new BorderLayout()); - content.add(cp1); - content.add(this.slider, BorderLayout.SOUTH); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setContentPane(content); - } - - /** - * Handle a change in the slider by updating the dataset value. This - * automatically triggers a chart repaint. - * - * @param e the event. - */ - public void stateChanged(ChangeEvent e) { - this.dataset.setValue(new Integer(this.slider.getValue())); - } - - /** - * Starting point for the demo application. - * - * @param args ignored. - */ - public static void main(String[] args) { - DialDemo1 app = new DialDemo1("JFreeChart - Demo Dial 1"); - app.pack(); - app.setVisible(true); - } - -} Deleted: branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo2.java =================================================================== --- branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo2.java 2007-10-24 09:40:38 UTC (rev 411) +++ branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo2.java 2007-10-24 13:26:47 UTC (rev 412) @@ -1,179 +0,0 @@ -/* -------------- - * DialDemo2.java - * -------------- - * (C) Copyright 2006, by Object Refinery Limited. - */ - -package org.jfree.experimental.chart.demo; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GradientPaint; -import java.awt.GridLayout; -import java.awt.Point; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JSlider; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.jfree.chart.ChartPanel; -import org.jfree.chart.JFreeChart; -import org.jfree.data.general.DefaultValueDataset; -import org.jfree.experimental.chart.plot.dial.DialBackground; -import org.jfree.experimental.chart.plot.dial.DialCap; -import org.jfree.experimental.chart.plot.dial.DialPlot; -import org.jfree.experimental.chart.plot.dial.DialPointer; -import org.jfree.experimental.chart.plot.dial.DialTextAnnotation; -import org.jfree.experimental.chart.plot.dial.DialValueIndicator; -import org.jfree.experimental.chart.plot.dial.SimpleDialFrame; -import org.jfree.experimental.chart.plot.dial.StandardDialScale; -import org.jfree.ui.GradientPaintTransformType; -import org.jfree.ui.StandardGradientPaintTransformer; - -/** - * A sample application showing the use of a {@link DialPlot}. - */ -public class DialDemo2 extends JFrame implements ChangeListener { - - /** The first dataset. */ - DefaultValueDataset dataset1; - - /** The second dataset. */ - DefaultValueDataset dataset2; - - /** A slider to update the first dataset value. */ - JSlider slider1; - - /** A slider to update the second dataset value. */ - JSlider slider2; - - /** - * Creates a new instance. - * - * @param title the frame title. - */ - public DialDemo2(String title) { - super(title); - - this.dataset1 = new DefaultValueDataset(10.0); - this.dataset2 = new DefaultValueDataset(50.0); - - // get data for diagrams - DialPlot plot = new DialPlot(); - plot.setView(0.0, 0.0, 1.0, 1.0); - plot.setDataset(0, this.dataset1); - plot.setDataset(1, this.dataset2); - SimpleDialFrame dialFrame = new SimpleDialFrame(); - dialFrame.setBackgroundPaint(Color.lightGray); - dialFrame.setForegroundPaint(Color.darkGray); - plot.setDialFrame(dialFrame); - - GradientPaint gp = new GradientPaint(new Point(), - new Color(255, 255, 255), new Point(), - new Color(170, 170, 220)); - DialBackground db = new DialBackground(gp); - db.setGradientPaintTransformer(new StandardGradientPaintTransformer( - GradientPaintTransformType.VERTICAL)); - plot.setBackground(db); - - DialTextAnnotation annotation1 = new DialTextAnnotation("Temperature"); - annotation1.setFont(new Font("Dialog", Font.BOLD, 14)); - annotation1.setRadius(0.7); - - plot.addLayer(annotation1); - - DialValueIndicator dvi = new DialValueIndicator(0, "c"); - dvi.setFont(new Font("Dialog", Font.PLAIN, 10)); - dvi.setOutlinePaint(Color.darkGray); - dvi.setRadius(0.60); - dvi.setAngle(-103.0); - plot.addLayer(dvi); - - DialValueIndicator dvi2 = new DialValueIndicator(1, "c"); - dvi2.setFont(new Font("Dialog", Font.PLAIN, 10)); - dvi2.setOutlinePaint(Color.red); - dvi2.setRadius(0.60); - dvi2.setAngle(-77.0); - plot.addLayer(dvi2); - - StandardDialScale scale = new StandardDialScale(-40, 60, -120, -300); - scale.setTickRadius(0.88); - scale.setTickLabelOffset(0.15); - scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14)); - plot.addScale(0, scale); - - StandardDialScale scale2 = new StandardDialScale(0, 100, -120, -300); - scale2.setTickRadius(0.50); - scale2.setTickLabelOffset(0.15); - scale2.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10)); - scale2.setMajorTickPaint(Color.red); - plot.addScale(1, scale2); - plot.mapDatasetToScale(1, 1); - - DialPointer needle2 = new DialPointer.Pin(1); - needle2.setRadius(0.55); - plot.addLayer(needle2); - - DialPointer needle = new DialPointer.Pointer(0); - plot.addLayer(needle); - - DialCap cap = new DialCap(); - cap.setRadius(0.10); - plot.setCap(cap); - - JFreeChart chart1 = new JFreeChart(plot); - chart1.setTitle("Dial Demo 2"); - ChartPanel cp1 = new ChartPanel(chart1); - cp1.setPreferredSize(new Dimension(400, 400)); - - JPanel sliderPanel = new JPanel(new GridLayout(2, 2)); - sliderPanel.add(new JLabel("Outer Needle:")); - sliderPanel.add(new JLabel("Inner Needle:")); - this.slider1 = new JSlider(-40, 60); - this.slider1.setMajorTickSpacing(20); - this.slider1.setPaintTicks(true); - this.slider1.setPaintLabels(true); - this.slider1.addChangeListener(this); - sliderPanel.add(this.slider1); - sliderPanel.add(this.slider1); - this.slider2 = new JSlider(0, 100); - this.slider2.setMajorTickSpacing(20); - this.slider2.setPaintTicks(true); - this.slider2.setPaintLabels(true); - this.slider2.addChangeListener(this); - sliderPanel.add(this.slider2); - JPanel content = new JPanel(new BorderLayout()); - content.add(cp1); - content.add(sliderPanel, BorderLayout.SOUTH); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setContentPane(content); - } - - /** - * Handle a change in the slider by updating the dataset value. This - * automatically triggers a chart repaint. - * - * @param e the event. - */ - public void stateChanged(ChangeEvent e) { - this.dataset1.setValue(new Integer(this.slider1.getValue())); - this.dataset2.setValue(new Integer(this.slider2.getValue())); - } - - /** - * Starting point for the demo application. - * - * @param args ignored. - */ - public static void main(String[] args) { - DialDemo2 app = new DialDemo2("JFreeChart - Dial Demo 2"); - app.pack(); - app.setVisible(true); - } - -} Deleted: branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo3.java =================================================================== --- branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo3.java 2007-10-24 09:40:38 UTC (rev 411) +++ branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo3.java 2007-10-24 13:26:47 UTC (rev 412) @@ -1,122 +0,0 @@ -/* -------------- - * DialDemo3.java - * -------------- - * (C) Copyright 2006, by Object Refinery Limited. - */ - -package org.jfree.experimental.chart.demo; - -import java.awt.BasicStroke; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GradientPaint; -import java.awt.Point; - -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JSlider; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.jfree.chart.ChartPanel; -import org.jfree.chart.JFreeChart; -import org.jfree.data.general.DefaultValueDataset; -import org.jfree.experimental.chart.plot.dial.DialBackground; -import org.jfree.experimental.chart.plot.dial.DialPlot; -import org.jfree.experimental.chart.plot.dial.DialPointer; -import org.jfree.experimental.chart.plot.dial.StandardDialFrame; -import org.jfree.experimental.chart.plot.dial.StandardDialScale; -import org.jfree.ui.GradientPaintTransformType; -import org.jfree.ui.StandardGradientPaintTransformer; - -/** - * A sample application showing the use of a {@link DialPlot}. - */ -public class DialDemo3 extends JFrame implements ChangeListener { - - /** A slider to update the dataset value. */ - JSlider slider; - - /** The dataset. */ - DefaultValueDataset dataset; - - /** - * Creates a new instance. - * - * @param title the frame title. - */ - public DialDemo3(String title) { - super(title); - - this.dataset = new DefaultValueDataset(50); - // get data for diagrams - DialPlot plot = new DialPlot(); - plot.setView(0.21, 0.0, 0.58, 0.30); - plot.setDataset(this.dataset); - - StandardDialFrame dialFrame = new StandardDialFrame(60.0, 60.0); - dialFrame.setInnerRadius(0.60); - 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); - sdb.setGradientPaintTransformer(new StandardGradientPaintTransformer( - GradientPaintTransformType.VERTICAL)); - plot.addLayer(sdb); - - StandardDialScale scale = new StandardDialScale(0, 100, 115.0, -50.0); - scale.setTickRadius(0.88); - scale.setTickLabelOffset(0.07); - scale.setMajorTickIncrement(25.0); - scale.setTickLabelPaint(null); - plot.addScale(0, scale); - - DialPointer needle = new DialPointer.Pin(); - needle.setRadius(0.82); - plot.addLayer(needle); - JFreeChart chart1 = new JFreeChart(plot); - chart1.setTitle("Dial Demo 3"); - ChartPanel cp1 = new ChartPanel(chart1); - - cp1.setPreferredSize(new Dimension(400, 250)); - this.slider = new JSlider(0, 100); - this.slider.setMajorTickSpacing(10); - this.slider.setPaintLabels(true); - this.slider.addChangeListener(this); - JPanel content = new JPanel(new BorderLayout()); - content.add(cp1); - content.add(this.slider, BorderLayout.SOUTH); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setContentPane(content); - - } - - /** - * Handle a change in the slider by updating the dataset value. This - * automatically triggers a chart repaint. - * - * @param e the event. - */ - public void stateChanged(ChangeEvent e) { - this.dataset.setValue(new Integer(this.slider.getValue())); - } - - /** - * Starting point for the demo application. - * - * @param args ignored. - */ - public static void main(String[] args) { - - DialDemo3 app = new DialDemo3("JFreeChart - Demo Dial 3"); - app.pack(); - app.setVisible(true); - - } -} Deleted: branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo4.java =================================================================== --- branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo4.java 2007-10-24 09:40:38 UTC (rev 411) +++ branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo4.java 2007-10-24 13:26:47 UTC (rev 412) @@ -1,124 +0,0 @@ -/* -------------- - * DialDemo4.java - * -------------- - * (C) Copyright 2006, by Object Refinery Limited. - */ - -package org.jfree.experimental.chart.demo; - -import java.awt.BasicStroke; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GradientPaint; -import java.awt.Point; - -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JSlider; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.jfree.chart.ChartPanel; -import org.jfree.chart.JFreeChart; -import org.jfree.data.general.DefaultValueDataset; -import org.jfree.experimental.chart.plot.dial.DialBackground; -import org.jfree.experimental.chart.plot.dial.DialPlot; -import org.jfree.experimental.chart.plot.dial.DialPointer; -import org.jfree.experimental.chart.plot.dial.StandardDialFrame; -import org.jfree.experimental.chart.plot.dial.StandardDialScale; -import org.jfree.ui.GradientPaintTransformType; -import org.jfree.ui.StandardGradientPaintTransformer; - -/** - * A sample application showing the use of a {@link DialPlot}. - */ -public class DialDemo4 extends JFrame implements ChangeListener { - - /** A slider to update the dataset value. */ - JSlider slider; - - /** The dataset. */ - DefaultValueDataset dataset; - - /** - * Creates a new instance. - * - * @param title the frame title. - */ - public DialDemo4(String title) { - super(title); - - this.dataset = new DefaultValueDataset(50); - // get data for diagrams - DialPlot plot = new DialPlot(); - plot.setView(0.78, 0.37, 0.22, 0.26); - plot.setDataset(this.dataset); - - StandardDialFrame dialFrame = new StandardDialFrame(-10.0, 20.0); - dialFrame.setInnerRadius(0.70); - 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); - sdb.setGradientPaintTransformer(new StandardGradientPaintTransformer( - GradientPaintTransformType.VERTICAL)); - plot.addLayer(sdb); - - StandardDialScale scale = new StandardDialScale(0, 100, -8, 16.0); - scale.setTickRadius(0.82); - scale.setTickLabelOffset(-0.04); - scale.setMajorTickIncrement(25.0); - scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14)); - - plot.addScale(0, scale); - - DialPointer needle = new DialPointer.Pin(); - needle.setRadius(0.84); - plot.addLayer(needle); - JFreeChart chart1 = new JFreeChart(plot); - chart1.setTitle("Dial Demo 4"); - ChartPanel cp1 = new ChartPanel(chart1); - - cp1.setPreferredSize(new Dimension(400, 250)); - this.slider = new JSlider(0, 100); - this.slider.setMajorTickSpacing(10); - this.slider.setPaintLabels(true); - this.slider.addChangeListener(this); - JPanel content = new JPanel(new BorderLayout()); - content.add(cp1); - content.add(this.slider, BorderLayout.SOUTH); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setContentPane(content); - - } - - /** - * Handle a change in the slider by updating the dataset value. This - * automatically triggers a chart repaint. - * - * @param e the event. - */ - public void stateChanged(ChangeEvent e) { - this.dataset.setValue(new Integer(this.slider.getValue())); - } - - /** - * Starting point for the demo application. - * - * @param args ignored. - */ - public static void main(String[] args) { - - DialDemo4 app = new DialDemo4("JFreeChart - Demo Dial 4"); - app.pack(); - app.setVisible(true); - - } -} Deleted: branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo5.java =================================================================== --- branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo5.java 2007-10-24 09:40:38 UTC (rev 411) +++ branches/jfreechart-1.0.x-branch/experimental/org/jfree/experimental/chart/demo/DialDemo5.java 2007-10-24 13:26:47 UTC (rev 412) @@ -1,158 +0,0 @@ -/* -------------- - * DialDemo5.java - * -------------- - * (C) Copyright 2006, by Object Refinery Limited. - */ - -package org.jfree.experimental.chart.demo; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridLayout; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JSlider; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.jfree.chart.ChartPanel; -import org.jfree.chart.JFreeChart; -import org.jfree.data.general.DefaultValueDataset; -import org.jfree.experimental.chart.plot.dial.DialBackground; -import org.jfree.experimental.chart.plot.dial.DialCap; -import org.jfree.experimental.chart.plot.dial.DialPlot; -import org.jfree.experimental.chart.plot.dial.DialPointer; -import org.jfree.experimental.chart.plot.dial.SimpleDialFrame; -import org.jfree.experimental.chart.plot.dial.StandardDialScale; -import org.jfree.ui.GradientPaintTransformType; -import org.jfree.ui.StandardGradientPaintTransformer; - -/** - * A sample application showing the use of a {@link DialPlot}. - */ -public class DialDemo5 extends JFrame implements ChangeListener { - - /** The first dataset. */ - DefaultValueDataset hoursDataset; - - /** The second dataset. */ - DefaultValueDataset dataset2; - - /** A slider to update the first dataset value. */ - JSlider slider1; - - /** A slider to update the second dataset value. */ - JSlider slider2; - - /** - * Creates a new instance. - * - * @param title the frame title. - */ - public DialDemo5(String title) { - super(title); - - this.hoursDataset = new DefaultValueDataset(6.0); - this.dataset2 = new DefaultValueDataset(15.0); - - // get data for diagrams - DialPlot plot = new DialPlot(); - plot.setView(0.0, 0.0, 1.0, 1.0); - plot.setDataset(0, this.hoursDataset); - plot.setDataset(1, this.dataset2); - SimpleDialFrame dialFrame = new SimpleDialFrame(); - dialFrame.setBackgroundPaint(Color.lightGray); - dialFrame.setForegroundPaint(Color.darkGray); - plot.setDialFrame(dialFrame); - - DialBackground db = new DialBackground(Color.white); - db.setGradientPaintTransformer(new StandardGradientPaintTransformer( - GradientPaintTransformType.VERTICAL)); - plot.setBackground(db); - - StandardDialScale hourScale = new StandardDialScale(0, 12, 90, -360); - hourScale.setFirstTickLabelVisible(false); - hourScale.setMajorTickIncrement(1.0); - hourScale.setTickRadius(0.88); - hourScale.setTickLabelOffset(0.15); - hourScale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14)); - plot.addScale(0, hourScale); - - StandardDialScale scale2 = new StandardDialScale(0, 60, 90, -360); - scale2.setVisible(false); - scale2.setMajorTickIncrement(5.0); - scale2.setTickRadius(0.68); - scale2.setTickLabelOffset(0.15); - scale2.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14)); - - plot.addScale(1, scale2); - - DialPointer needle2 = new DialPointer.Pointer(0); - needle2.setRadius(0.55); - plot.addLayer(needle2); - - plot.mapDatasetToScale(1, 1); - - DialPointer needle = new DialPointer.Pointer(1); - plot.addLayer(needle); - - DialCap cap = new DialCap(); - cap.setRadius(0.10); - plot.setCap(cap); - - JFreeChart chart1 = new JFreeChart(plot); - chart1.setTitle("Dial Demo 5"); - ChartPanel cp1 = new ChartPanel(chart1); - cp1.setPreferredSize(new Dimension(400, 400)); - - JPanel sliderPanel = new JPanel(new GridLayout(2, 2)); - sliderPanel.add(new JLabel("Hours:")); - sliderPanel.add(new JLabel("Minutes:")); - this.slider1 = new JSlider(0, 12); - this.slider1.setMajorTickSpacing(2); - this.slider1.setPaintTicks(true); - this.slider1.setPaintLabels(true); - this.slider1.addChangeListener(this); - sliderPanel.add(this.slider1); - sliderPanel.add(this.slider1); - this.slider2 = new JSlider(0, 60); - this.slider2.setValue(15); - this.slider2.setMajorTickSpacing(10); - this.slider2.setPaintTicks(true); - this.slider2.setPaintLabels(true); - this.slider2.addChangeListener(this); - sliderPanel.add(this.slider2); - JPanel content = new JPanel(new BorderLayout()); - content.add(cp1); - content.add(sliderPanel, BorderLayout.SOUTH); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setContentPane(content); - } - - /** - * Handle a change in the slider by updating the dataset value. This - * automatically triggers a chart repaint. - * - * @param e the event. - */ - public void stateChanged(ChangeEvent e) { - this.hoursDataset.setValue(new Integer(this.slider1.getValue())); - this.dataset2.setValue(new Integer(this.slider2.getValue())); - } - - /** - * Starting point for the demo application. - * - * @param args ignored. - */ - public static void main(String[] args) { - DialDemo5 app = new DialDemo5("JFreeChart - Dial Demo 5"); - app.pack(); - app.setVisible(true); - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |