org.jfree.chart.plot.dial.DialPointer Java Examples
The following examples show how to use
org.jfree.chart.plot.dial.DialPointer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DialPointerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ public void testEquals() { DialPointer i1 = new DialPointer.Pin(1); DialPointer i2 = new DialPointer.Pin(1); assertTrue(i1.equals(i2)); // dataset index i1 = new DialPointer.Pin(2); assertFalse(i1.equals(i2)); i2 = new DialPointer.Pin(2); assertTrue(i1.equals(i2)); // check an inherited attribute i1.setVisible(false); assertFalse(i1.equals(i2)); i2.setVisible(false); assertTrue(i1.equals(i2)); }
Example #2
Source File: DialPointerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check the equals() method for the DialPointer.Pin class. */ public void testEqualsPin() { DialPointer.Pin p1 = new DialPointer.Pin(); DialPointer.Pin p2 = new DialPointer.Pin(); assertEquals(p1, p2); p1.setPaint(Color.green); assertFalse(p1.equals(p2)); p2.setPaint(Color.green); assertTrue(p1.equals(p2)); BasicStroke s = new BasicStroke(4.4f); p1.setStroke(s); assertFalse(p1.equals(p2)); p2.setStroke(s); assertTrue(p1.equals(p2)); }
Example #3
Source File: DialPointerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check the equals() method for the DialPointer.Pointer class. */ public void testEqualsPointer() { DialPointer.Pointer p1 = new DialPointer.Pointer(); DialPointer.Pointer p2 = new DialPointer.Pointer(); assertEquals(p1, p2); p1.setFillPaint(Color.green); assertFalse(p1.equals(p2)); p2.setFillPaint(Color.green); assertTrue(p1.equals(p2)); p1.setOutlinePaint(Color.green); assertFalse(p1.equals(p2)); p2.setOutlinePaint(Color.green); assertTrue(p1.equals(p2)); }
Example #4
Source File: DialPointerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ public void testEquals() { DialPointer i1 = new DialPointer.Pin(1); DialPointer i2 = new DialPointer.Pin(1); assertTrue(i1.equals(i2)); // dataset index i1 = new DialPointer.Pin(2); assertFalse(i1.equals(i2)); i2 = new DialPointer.Pin(2); assertTrue(i1.equals(i2)); // check an inherited attribute i1.setVisible(false); assertFalse(i1.equals(i2)); i2.setVisible(false); assertTrue(i1.equals(i2)); }
Example #5
Source File: DialPointerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check the equals() method for the DialPointer.Pin class. */ public void testEqualsPin() { DialPointer.Pin p1 = new DialPointer.Pin(); DialPointer.Pin p2 = new DialPointer.Pin(); assertEquals(p1, p2); p1.setPaint(Color.green); assertFalse(p1.equals(p2)); p2.setPaint(Color.green); assertTrue(p1.equals(p2)); BasicStroke s = new BasicStroke(4.4f); p1.setStroke(s); assertFalse(p1.equals(p2)); p2.setStroke(s); assertTrue(p1.equals(p2)); }
Example #6
Source File: DialPointerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check the equals() method for the DialPointer.Pointer class. */ public void testEqualsPointer() { DialPointer.Pointer p1 = new DialPointer.Pointer(); DialPointer.Pointer p2 = new DialPointer.Pointer(); assertEquals(p1, p2); p1.setFillPaint(Color.green); assertFalse(p1.equals(p2)); p2.setFillPaint(Color.green); assertTrue(p1.equals(p2)); p1.setOutlinePaint(Color.green); assertFalse(p1.equals(p2)); p2.setOutlinePaint(Color.green); assertTrue(p1.equals(p2)); }
Example #7
Source File: DialPointerTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashCode() { DialPointer i1 = new DialPointer.Pin(1); DialPointer i2 = new DialPointer.Pin(1); assertTrue(i1.equals(i2)); int h1 = i1.hashCode(); int h2 = i2.hashCode(); assertEquals(h1, h2); }
Example #8
Source File: DialPointerTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashCode() { DialPointer i1 = new DialPointer.Pin(1); DialPointer i2 = new DialPointer.Pin(1); assertTrue(i1.equals(i2)); int h1 = i1.hashCode(); int h2 = i2.hashCode(); assertEquals(h1, h2); }
Example #9
Source File: UnitStatusPage.java From freeacs with MIT License | 4 votes |
/** * Creates a chart displaying a circular dial. * * @param chartTitle the chart title. * @param dialLabel the dial label. * @param dataset the dataset. * @param lowerBound the lower bound. * @param upperBound the upper bound. * @return A chart that displays a value as a dial. */ private JFreeChart createStatusDialChart( String chartTitle, String dialLabel, ValueDataset dataset, double lowerBound, double upperBound) { DialPlot plot = new DialPlot(); plot.setDataset(dataset); plot.setDialFrame(new StandardDialFrame()); DialTextAnnotation annotation1 = new DialTextAnnotation(dialLabel); annotation1.setFont(new Font("Dialog", Font.BOLD, 14)); annotation1.setRadius(0.7); plot.addLayer(annotation1); DialValueIndicator dvi = new DialValueIndicator(0); plot.addLayer(dvi); StandardDialScale scale = new StandardDialScale(lowerBound, upperBound, -120, -300, 1, 4); scale.setTickRadius(0.88); scale.setTickLabelOffset(0.15); scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14)); plot.addScale(0, scale); plot.addPointer(new DialPointer.Pin()); DialCap cap = new DialCap(); plot.setCap(cap); JFreeChart chart = new JFreeChart(chartTitle, plot); chart.setBackgroundPaint(Color.WHITE); StandardDialRange range = new StandardDialRange(UnitStatusInfo.DIAL_CHART_YELLOW, upperBound, Color.green); range.setInnerRadius(0.52); range.setOuterRadius(0.55); plot.addLayer(range); StandardDialRange range2 = new StandardDialRange( UnitStatusInfo.DIAL_CHART_RED, UnitStatusInfo.DIAL_CHART_YELLOW, Color.orange); range2.setInnerRadius(0.52); range2.setOuterRadius(0.55); plot.addLayer(range2); StandardDialRange range3 = new StandardDialRange(lowerBound, UnitStatusInfo.DIAL_CHART_RED, Color.red); range3.setInnerRadius(0.52); range3.setOuterRadius(0.55); plot.addLayer(range3); 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); plot.removePointer(0); DialPointer.Pointer p = new DialPointer.Pointer(); plot.addPointer(p); return chart; }
Example #10
Source File: SBISpeedometer.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
/** * Creates a chart of type speedometer. * * @param chartTitle the chart title. * @param dataset the dataset. * * @return A chart speedometer. */ public JFreeChart createChart(DatasetMap datasets) { logger.debug("IN"); Dataset dataset=(Dataset)datasets.getDatasets().get("1"); DialPlot plot = new DialPlot(); plot.setDataset((ValueDataset)dataset); plot.setDialFrame(new StandardDialFrame()); plot.setBackground(new DialBackground()); if(dialtextuse){ DialTextAnnotation annotation1 = new DialTextAnnotation(dialtext); annotation1.setFont(styleTitle.getFont()); annotation1.setRadius(0.7); plot.addLayer(annotation1); } DialValueIndicator dvi = new DialValueIndicator(0); dvi.setFont(new Font(labelsValueStyle.getFontName(), Font.PLAIN, labelsValueStyle.getSize())); dvi.setPaint(labelsValueStyle.getColor()); plot.addLayer(dvi); StandardDialScale scale = new StandardDialScale(lower, upper, -120, -300, 10.0, 4); if (!( increment > 0)){ logger.warn("increment cannot be less than 0, put default to 0.1"); increment = 0.01; } scale.setMajorTickIncrement(increment); // if (!( minorTickCount > 0)){ // logger.warn("minor tick count cannot be less than 0, put default to 1"); // minorTickCount = 1; // } scale.setMinorTickCount(minorTickCount); scale.setTickRadius(0.88); scale.setTickLabelOffset(0.15); //set tick label style Font tickLabelsFont = new Font(labelsTickStyle.getFontName(), Font.PLAIN, labelsTickStyle.getSize()); scale.setTickLabelFont(tickLabelsFont); scale.setTickLabelPaint(labelsTickStyle.getColor()); plot.addScale(0, scale); plot.addPointer(new DialPointer.Pin()); DialCap cap = new DialCap(); plot.setCap(cap); // 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.52); range.setOuterRadius(0.55); plot.addLayer(range); } 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); plot.removePointer(0); DialPointer.Pointer p = new DialPointer.Pointer(); p.setFillPaint(Color.yellow); plot.addPointer(p); logger.debug("OUT"); JFreeChart chart=new JFreeChart(name, plot); TextTitle title = setStyleTitle(name, styleTitle); chart.setTitle(title); if(subName!= null && !subName.equals("")){ TextTitle subTitle =setStyleTitle(subName, styleSubTitle); chart.addSubtitle(subTitle); } chart.setBackgroundPaint(color); return chart; }