使 JFreeChart 上的标准表盘范围更厚
Making Standard Dial Range on JFreeChart thicker
我使用 JFreeChart 制作了一个表盘图表。我想知道是否有可能使指标更厚。我现在用来制作它们的代码是:
StandardDialRange standarddialrange;
StandardDialRange standarddialrange2;
StandardDialRange standarddialrange3;
if(isPercentageIV==true){
standarddialrange = new StandardDialRange(90D, 100D, Color.GREEN);
standarddialrange2 = new StandardDialRange(60D, 90D, Color.orange);
standarddialrange3 = new StandardDialRange(0D, 60D, Color.RED);
}
else{
standarddialrange = new StandardDialRange(.9*goal*dialScale, goal*dialScale, Color.GREEN);
standarddialrange2 = new StandardDialRange(.6*goal*dialScale, .9*goal*dialScale, Color.orange);
standarddialrange3 = new StandardDialRange(0, .6*goal*dialScale, Color.RED);
}
// Sets the scale/radius of all the indicators.
standarddialrange.setScaleIndex(0);
standarddialrange.setInnerRadius(0.58999999999999997D);
standarddialrange.setOuterRadius(0.58999999999999997D);
dialplot.addLayer(standarddialrange);
standarddialrange2.setScaleIndex(0);
standarddialrange2.setInnerRadius(0.58999999999999997D);
standarddialrange2.setOuterRadius(0.58999999999999997D);
dialplot.addLayer(standarddialrange2);
standarddialrange3.setScaleIndex(0);
standarddialrange3.setInnerRadius(0.58999999999999997D);
standarddialrange3.setOuterRadius(0.58999999999999997D);
dialplot.addLayer(standarddialrange3);
我试着在网上看,但我不知道如何让它变厚。他们现在的样子让他们很难在远处的显示器上看到。我试着改变外半径,但它只是变成了两条细线,而不是一条又大又粗的线。
覆盖 StandardDialRange
的 draw()
方法并指定您的首选 Stroke
;我在下面的示例中使用了 4.0f
。您需要根据需要使用 public 访问器来概括现有代码。
plot.addLayer(new StandardDialRange(3 * maximumValue / 4, maximumValue, Color.red) {
@Override
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) {
…
g2.setPaint(this.getPaint());
g2.setStroke(new BasicStroke(4.0f));
g2.draw(arcInner);
g2.draw(arcOuter);
}
});
我使用 JFreeChart 制作了一个表盘图表。我想知道是否有可能使指标更厚。我现在用来制作它们的代码是:
StandardDialRange standarddialrange;
StandardDialRange standarddialrange2;
StandardDialRange standarddialrange3;
if(isPercentageIV==true){
standarddialrange = new StandardDialRange(90D, 100D, Color.GREEN);
standarddialrange2 = new StandardDialRange(60D, 90D, Color.orange);
standarddialrange3 = new StandardDialRange(0D, 60D, Color.RED);
}
else{
standarddialrange = new StandardDialRange(.9*goal*dialScale, goal*dialScale, Color.GREEN);
standarddialrange2 = new StandardDialRange(.6*goal*dialScale, .9*goal*dialScale, Color.orange);
standarddialrange3 = new StandardDialRange(0, .6*goal*dialScale, Color.RED);
}
// Sets the scale/radius of all the indicators.
standarddialrange.setScaleIndex(0);
standarddialrange.setInnerRadius(0.58999999999999997D);
standarddialrange.setOuterRadius(0.58999999999999997D);
dialplot.addLayer(standarddialrange);
standarddialrange2.setScaleIndex(0);
standarddialrange2.setInnerRadius(0.58999999999999997D);
standarddialrange2.setOuterRadius(0.58999999999999997D);
dialplot.addLayer(standarddialrange2);
standarddialrange3.setScaleIndex(0);
standarddialrange3.setInnerRadius(0.58999999999999997D);
standarddialrange3.setOuterRadius(0.58999999999999997D);
dialplot.addLayer(standarddialrange3);
我试着在网上看,但我不知道如何让它变厚。他们现在的样子让他们很难在远处的显示器上看到。我试着改变外半径,但它只是变成了两条细线,而不是一条又大又粗的线。
覆盖 StandardDialRange
的 draw()
方法并指定您的首选 Stroke
;我在下面的示例中使用了 4.0f
。您需要根据需要使用 public 访问器来概括现有代码。
plot.addLayer(new StandardDialRange(3 * maximumValue / 4, maximumValue, Color.red) {
@Override
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) {
…
g2.setPaint(this.getPaint());
g2.setStroke(new BasicStroke(4.0f));
g2.draw(arcInner);
g2.draw(arcOuter);
}
});