jfreechart中的java半圆环图
如何在jfreechart中绘制半干坚果图表,例如使用下面的链接https://www.highcharts.com/demo/pie-semi-circle
这是我的密码
DefaultPieDataset dataset = new DefaultPieDataset( );
dataset.setValue("Safari-32", new Long( 32) ); dataset.setValue("Chrome-44", new Long( 44) );
dataset.setValue("Apple-24", new Long( 24) );
dataset.setValue("Google-75", new Long( 75) );
dataset.setValue("Michele", new Long( 97) ); dataset.setValue("Jony", new Long( 41) );
JFreeChart chart = ChartFactory.createRingChart("Chart title", dataset, true, false, false);
chart.setBackgroundPaint(Color.WHITE);
chart.setBorderVisible(false);
RingPlot plots = (RingPlot) chart.getPlot();
Font font3 = new Font("Book Antiqua", Font.BOLD, 17);
plots.setShadowPaint(null);
plots.setBackgroundPaint(null);
plots.setOutlineVisible(false);
plots.setLabelOutlinePaint(null);
plots.setLabelBackgroundPaint(Color.WHITE);
plots.setCenterTextMode(CenterTextMode.FIXED);
String te = "334";
plots.setCenterText((String)te); plots.setCenterTextFont(font3);
plots.setLabelGenerator(null); // Remove the labels from chart area
font3 = new Font("Book Antiqua", Font.PLAIN, 10);
LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.RIGHT); legend.setItemFont(font3);
legend.setBorder(0, 0, 0, 0);
String filename = "D:\\ad\\do nut.jpg";
ChartUtilities.saveChartAsJPEG(new File(filename), chart, 250, 155);
这是我的代码,这会生成一个完整的甜甜圈图表。我需要一个起始角度为180度到0度的甜甜圈
# 1 楼答案
可以使用父^{} 方法^{} 从180°开始。可以使用透明颜色隐藏下半部分,如here所示,或者使用here所示的方法之一覆盖下半部分^{} 和透明白色如下图所示
# 2 楼答案
首字母
刷新
使用jfreechart在java中创建半/半甜甜圈非常简单。最重要的是看不见的数据集。我最喜欢的飞机是F16猎鹰,但我下面的代码没有任何军事关联。可以随意重用和/或修改源代码
描述:演示半/半甜甜圈的示例类(标记:java、osgi、jfreechart、1.0.19版、SWT、@PostConstruct、ChartComposite、Eclipse、E4、PiePlot、RingPlot、半、半、示例、背景图像、大小调整、布局)