-
Notifications
You must be signed in to change notification settings - Fork 43
PieCharts
Dr. Philip Wenig edited this page Aug 21, 2020
·
6 revisions
Pie charts are often used to display percentage data.
Pie Chart Doughnut Chart Multilevel Pie Chart Multilevel Doughnut Chart
public Chart createChart(Composite parent) {
double[] values = {337309, 131646, 128948, 100123, 81708, 70478, 58226, 47806, 4067, 265783};
String[] labels = {"USA", "Spain", "Italy", "Germany", "China", "France", "Iran", "UK", "India", "Other"};
Chart chart = new Chart(parent, SWT.NONE);
chart.getTitle().setText("Doughnut Chart");
ICircularSeries<?> circularSeries = (ICircularSeries<?>)chart.getSeriesSet().createSeries(SeriesType.DOUGHNUT, "pie series");
circularSeries.setSeries(labels, values);
Color color = Display.getDefault().getSystemColor(SWT.COLOR_DARK_RED);
circularSeries.setColor("India", color);
//
return chart;
}
Copyright (C) 2008-2020 Eclipse SWTChart project. Eclipse Public License 2.0 (https://www.eclipse.org/legal/epl-2.0)