本文整理汇总了Java中org.jfree.chart.plot.dial.DialPlot类的典型用法代码示例。如果您正苦于以下问题:Java DialPlot类的具体用法?Java DialPlot怎么用?Java DialPlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DialPlot类属于org.jfree.chart.plot.dial包,在下文中一共展示了DialPlot类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createStandardDialChart
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
public JFreeChart createStandardDialChart(String s, String s1, ValueDataset valuedataset, double d, double d1, double d2, int i) {
DialPlot dialplot = new DialPlot();
dialplot.setDataset(valuedataset);
dialplot.setDialFrame(new StandardDialFrame());
dialplot.setBackground(new DialBackground());
DialTextAnnotation dialtextannotation = new DialTextAnnotation(s1);
dialtextannotation.setFont(new Font("Dialog", 1, 14));
dialtextannotation.setRadius(0.69999999999999996D);
dialplot.addLayer(dialtextannotation);
DialValueIndicator dialvalueindicator = new DialValueIndicator(0);
dialplot.addLayer(dialvalueindicator);
StandardDialScale standarddialscale = new StandardDialScale(d, d1, -120D, -300D, 10D, 4);
standarddialscale.setMajorTickIncrement(d2);
standarddialscale.setMinorTickCount(i);
standarddialscale.setTickRadius(0.88D);
standarddialscale.setTickLabelOffset(0.14999999999999999D);
standarddialscale.setTickLabelFont(new Font("Dialog", 0, 14));
dialplot.addScale(0, standarddialscale);
dialplot.addPointer(new org.jfree.chart.plot.dial.DialPointer.Pin());
DialCap dialcap = new DialCap();
dialplot.setCap(dialcap);
return new JFreeChart(s, dialplot);
}
开发者ID:mars-sim,项目名称:mars-sim,代码行数:24,代码来源:TemperatureDial.java
示例2: testBackgroundListener
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
/**
* Check the notification event mechanism for the dial background.
*/
public void testBackgroundListener() {
DialPlot p = new DialPlot();
DialBackground b1 = new DialBackground(Color.red);
p.setBackground(b1);
p.addChangeListener(this);
this.lastEvent = null;
b1.setPaint(Color.blue);
assertNotNull(this.lastEvent);
DialBackground b2 = new DialBackground(Color.green);
p.setBackground(b2);
this.lastEvent = null;
b1.setPaint(Color.red);
assertNull(this.lastEvent);
b2.setPaint(Color.red);
assertNotNull(this.lastEvent);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:DialPlotTests.java
示例3: testCapListener
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
/**
* Check the notification event mechanism for the dial cap.
*/
public void testCapListener() {
DialPlot p = new DialPlot();
DialCap c1 = new DialCap();
p.setCap(c1);
p.addChangeListener(this);
this.lastEvent = null;
c1.setFillPaint(Color.red);
assertNotNull(this.lastEvent);
DialCap c2 = new DialCap();
p.setCap(c2);
this.lastEvent = null;
c1.setFillPaint(Color.blue);
assertNull(this.lastEvent);
c2.setFillPaint(Color.green);
assertNotNull(this.lastEvent);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:DialPlotTests.java
示例4: testFrameListener
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
/**
* Check the notification event mechanism for the dial frame.
*/
public void testFrameListener() {
DialPlot p = new DialPlot();
ArcDialFrame f1 = new ArcDialFrame();
p.setDialFrame(f1);
p.addChangeListener(this);
this.lastEvent = null;
f1.setBackgroundPaint(Color.gray);
assertNotNull(this.lastEvent);
ArcDialFrame f2 = new ArcDialFrame();
p.setDialFrame(f2);
this.lastEvent = null;
f1.setBackgroundPaint(Color.blue);
assertNull(this.lastEvent);
f2.setBackgroundPaint(Color.green);
assertNotNull(this.lastEvent);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:DialPlotTests.java
示例5: testScaleListener
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
/**
* Check the notification event mechanism for the dial scales.
*/
public void testScaleListener() {
DialPlot p = new DialPlot();
StandardDialScale s1 = new StandardDialScale();
p.addScale(0, s1);
p.addChangeListener(this);
this.lastEvent = null;
s1.setStartAngle(22.0);
assertNotNull(this.lastEvent);
StandardDialScale s2 = new StandardDialScale();
p.addScale(0, s2);
this.lastEvent = null;
s1.setStartAngle(33.0);
assertNull(this.lastEvent);
s2.setStartAngle(33.0);
assertNotNull(this.lastEvent);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:DialPlotTests.java
示例6: testLayerListener
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
/**
* Check the notification event mechanism for a layer.
*/
public void testLayerListener() {
DialPlot p = new DialPlot();
DialBackground b1 = new DialBackground(Color.red);
p.addLayer(b1);
p.addChangeListener(this);
this.lastEvent = null;
b1.setPaint(Color.blue);
assertNotNull(this.lastEvent);
DialBackground b2 = new DialBackground(Color.green);
p.addLayer(b2);
this.lastEvent = null;
b1.setPaint(Color.red);
assertNotNull(this.lastEvent);
b2.setPaint(Color.green);
assertNotNull(this.lastEvent);
p.removeLayer(b2);
this.lastEvent = null;
b2.setPaint(Color.red);
assertNull(this.lastEvent);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:26,代码来源:DialPlotTests.java
示例7: draw
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
/**
* Draws the range.
*
* @param g2 the graphics target.
* @param plot the plot.
* @param frame the dial's reference frame (in Java2D space).
* @param view the dial's view rectangle (in Java2D space).
*/
@Override
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame,
Rectangle2D view) {
Rectangle2D arcRectInner = DialPlot.rectangleByRadius(frame,
this.getInnerRadius(), this.getInnerRadius());
Rectangle2D arcRectOuter = DialPlot.rectangleByRadius(frame,
this.getOuterRadius(), this.getOuterRadius());
DialScale scale = plot.getScale(this.getScaleIndex());
if (scale == null) {
throw new RuntimeException("No scale for scaleIndex = "
+ this.getScaleIndex());
}
double angleMin = scale.valueToAngle(this.getLowerBound());
double angleMax = scale.valueToAngle(this.getUpperBound());
Arc2D arcInner = new Arc2D.Double(arcRectInner, angleMin,
angleMax - angleMin, Arc2D.OPEN);
Arc2D arcOuter = new Arc2D.Double(arcRectOuter, angleMax,
angleMin - angleMax, Arc2D.OPEN);
g2.setPaint(this.getPaint());
g2.setStroke(new BasicStroke(this.lineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
g2.draw(arcInner);
g2.draw(arcOuter);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:36,代码来源:ScaledDialRange.java
示例8: TemperaturePanel
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
public TemperaturePanel() {
super(new BorderLayout());
dataset = new DefaultValueDataset(currentT);
JFreeChart jfreechart = createStandardDialChart("", "Temperature", dataset, -120D, 20D, 10D, 4);
DialPlot dialplot = (DialPlot)jfreechart.getPlot();
StandardDialRange standarddialrange = new StandardDialRange(-20D, 20D, Color.blue);
standarddialrange.setInnerRadius(0.52000000000000002D);
standarddialrange.setOuterRadius(0.55000000000000004D);
dialplot.addLayer(standarddialrange);
StandardDialRange standarddialrange1 = new StandardDialRange(-60D, -20D, Color.orange);
standarddialrange1.setInnerRadius(0.52000000000000002D);
standarddialrange1.setOuterRadius(0.55000000000000004D);
dialplot.addLayer(standarddialrange1);
StandardDialRange standarddialrange2 = new StandardDialRange(-120D, -60D, Color.red);
standarddialrange2.setInnerRadius(0.52000000000000002D);
standarddialrange2.setOuterRadius(0.55000000000000004D);
dialplot.addLayer(standarddialrange2);
GradientPaint gradientpaint = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(170, 170, 220));
DialBackground dialbackground = new DialBackground(gradientpaint);
dialbackground.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
dialplot.setBackground(dialbackground);
dialplot.removePointer(0);
org.jfree.chart.plot.dial.DialPointer.Pointer pointer = new org.jfree.chart.plot.dial.DialPointer.Pointer();
pointer.setFillPaint(Color.yellow);
dialplot.addPointer(pointer);
ChartPanel chartpanel = new ChartPanel(jfreechart);
//chartpanel.setPreferredSize(new Dimension(200, 200));
//chartpanel.setSize(200, 200);
chartpanel.setMinimumDrawHeight(150);
chartpanel.setMaximumDrawHeight(150);
chartpanel.setMaximumDrawWidth(150);
chartpanel.setMinimumDrawWidth(150);
//slider = new JSlider(-120, 20);
//slider.setMajorTickSpacing(10);
//slider.setPaintLabels(true);
//slider.addChangeListener(this);
add(chartpanel);
//add(slider, "South");
}
开发者ID:mars-sim,项目名称:mars-sim,代码行数:40,代码来源:TemperatureDial.java
示例9: buildDialPlot
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
private ChartPanel buildDialPlot(int minimumValue, int maximumValue,int majorTickGap) {
plot = new DialPlot(dataset);
plot.setDialFrame(new StandardDialFrame());
plot.addLayer(new DialValueIndicator());
plot.addLayer(new DialPointer.Pointer());
StandardDialScale scale = new StandardDialScale(minimumValue, maximumValue,-120, -300, majorTickGap, majorTickGap - 1);
scale.setTickRadius(0.88);
scale.setTickLabelOffset(0.20);
plot.addScale(0, scale);
return new ChartPanel(new JFreeChart(plot));
}
开发者ID:miracatici,项目名称:MakamBox,代码行数:13,代码来源:DialChart.java
示例10: testHashCode
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
DialPlot p1 = new DialPlot();
DialPlot p2 = new DialPlot();
assertTrue(p1.equals(p2));
int h1 = p1.hashCode();
int h2 = p2.hashCode();
assertEquals(h1, h2);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:DialPlotTests.java
示例11: draw
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
/**
* Draws the background to the specified graphics device. If the dial
* frame specifies a window, the clipping region will already have been
* set to this window before this method is called.
*
* @param g2 the graphics device (<code>null</code> not permitted).
* @param plot the plot (ignored here).
* @param frame the dial frame (ignored here).
* @param view the view rectangle (<code>null</code> not permitted).
*/
@Override
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame,
Rectangle2D view) {
// work out the anchor point
Rectangle2D f = DialPlot.rectangleByRadius(frame, getRadius(),
this.getRadius());
Arc2D arc = new Arc2D.Double(f, this.getAngle(), 0.0, Arc2D.OPEN);
Point2D pt = arc.getStartPoint();
// calculate the bounds of the template value
FontMetrics fm = g2.getFontMetrics(this.getFont());
String s = this.getNumberFormat().format(this.getTemplateValue());
Rectangle2D tb = TextUtilities.getTextBounds(s, g2, fm);
// align this rectangle to the frameAnchor
Rectangle2D bounds = RectangleAnchor.createRectangle(new Size2D(
tb.getWidth(), tb.getHeight()), pt.getX(), pt.getY(),
this.getFrameAnchor());
// add the insets
Rectangle2D fb = this.getInsets().createOutsetRectangle(bounds);
// draw the background
g2.setPaint(this.getBackgroundPaint());
g2.fill(fb);
// draw the border
g2.setStroke(this.getOutlineStroke());
g2.setPaint(this.getOutlinePaint());
g2.draw(fb);
// now find the text anchor point
String valueStr = this.getNumberFormat().format(ChartThemesUtilities.getScaledValue(plot.getValue(this.getDatasetIndex()), scale));
Point2D pt2 = RectangleAnchor.coordinates(bounds, this.getValueAnchor());
g2.setPaint(this.getPaint());
g2.setFont(this.getFont());
TextUtilities.drawAlignedString(valueStr, g2, (float) pt2.getX(),
(float) pt2.getY(), this.getTextAnchor());
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:53,代码来源:ScaledDialValueIndicator.java
示例12: fillChart
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
private void fillChart(String title, float value, int lowerBound, int upperBound) throws Exception {
DefaultValueDataset dataset = new DefaultValueDataset();
dataset.setValue(value);
DialPlot plot = new DialPlot();
plot.setView(0.0d, 0.0d, 1.0d, 1.0d);
plot.setDataset(0, dataset);
StandardDialFrame frame = new StandardDialFrame();
plot.setDialFrame(frame);
DialBackground dialBackground = new DialBackground();
dialBackground.setGradientPaintTransformer(
new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
plot.setBackground(dialBackground);
DialTextAnnotation textAnnotation = new DialTextAnnotation( title );
textAnnotation.setRadius(0.555555555555555555D);
plot.addLayer(textAnnotation);
DialValueIndicator valueIndicator = new DialValueIndicator(0);
plot.addLayer(valueIndicator);
StandardDialScale scale1 = new StandardDialScale();
scale1.setLowerBound( lowerBound );
scale1.setUpperBound( upperBound );
scale1.setStartAngle( -140 ); // -120
scale1.setExtent( -260D ); // -300D
scale1.setTickRadius(0.88D);
scale1.setTickLabelOffset(0.14999999999999999D);
scale1.setTickLabelFont(new Font("", Font.TRUETYPE_FONT, 14));
plot.addScale(0, scale1);
StandardDialRange standarddialrange0 = new StandardDialRange( lowerBound, (upperBound*0.6), Color.red);
standarddialrange0.setInnerRadius(0.52000000000000002D);
standarddialrange0.setOuterRadius(0.55000000000000004D);
plot.addLayer(standarddialrange0);
StandardDialRange standarddialrange1 = new StandardDialRange( (upperBound*0.6), (upperBound*0.8), Color.orange);
standarddialrange1.setInnerRadius(0.52000000000000002D);
standarddialrange1.setOuterRadius(0.55000000000000004D);
plot.addLayer(standarddialrange1);
StandardDialRange standarddialrange2 = new StandardDialRange( (upperBound*0.8), upperBound, Color.green);
standarddialrange2.setInnerRadius(0.52000000000000002D);
standarddialrange2.setOuterRadius(0.55000000000000004D);
plot.addLayer(standarddialrange2);
Pointer pointer = new Pointer(0);
pointer.setFillPaint(new Color(144, 196, 246));
plot.addPointer(pointer);
plot.mapDatasetToScale(0, 0);
DialCap dialcap = new DialCap();
dialcap.setRadius(0.0700000000000001D);
plot.setCap(dialcap);
this.chart = new JFreeChart(plot);
//this.chart.setBackgroundPaint(new Color(234, 244, 253));
this.chart.setBackgroundPaint( Color.white );
}
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:60,代码来源:CommonMeterChartAction.java
示例13: testEquals
import org.jfree.chart.plot.dial.DialPlot; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
DialPlot p1 = new DialPlot();
DialPlot p2 = new DialPlot();
assertTrue(p1.equals(p2));
// background
p1.setBackground(new DialBackground(Color.green));
assertFalse(p1.equals(p2));
p2.setBackground(new DialBackground(Color.green));
assertTrue(p1.equals(p2));
p1.setBackground(null);
assertFalse(p1.equals(p2));
p2.setBackground(null);
assertTrue(p1.equals(p2));
// dial cap
DialCap cap1 = new DialCap();
cap1.setFillPaint(Color.red);
p1.setCap(cap1);
assertFalse(p1.equals(p2));
DialCap cap2 = new DialCap();
cap2.setFillPaint(Color.red);
p2.setCap(cap2);
assertTrue(p1.equals(p2));
p1.setCap(null);
assertFalse(p1.equals(p2));
p2.setCap(null);
assertTrue(p1.equals(p2));
// frame
StandardDialFrame f1 = new StandardDialFrame();
f1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
4.0f, Color.white));
p1.setDialFrame(f1);
assertFalse(p1.equals(p2));
StandardDialFrame f2 = new StandardDialFrame();
f2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
4.0f, Color.white));
p2.setDialFrame(f2);
assertTrue(p1.equals(p2));
// view
p1.setView(0.2, 0.0, 0.8, 1.0);
assertFalse(p1.equals(p2));
p2.setView(0.2, 0.0, 0.8, 1.0);
assertTrue(p1.equals(p2));
// layer
p1.addLayer(new StandardDialScale());
assertFalse(p1.equals(p2));
p2.addLayer(new StandardDialScale());
assertTrue(p1.equals(p2));
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:59,代码来源:DialPlotTests.java
注:本文中的org.jfree.chart.plot.dial.DialPlot类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论