Hey there,
I am working on displaying some data as 3D column chart, it really looks nice and good but unfortunately, I faced an issue with the closest values and large numbers kindly check the below code snippet and a screenshot of the exported chart
is there any way to handle this, noting that I am using aspose words with license?
image.png (28.1 KB)
private static void genChart2() throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Add a column chart, and then clear its demo data series to start with a clean chart.
Shape shape = builder.insertChart(ChartType.COLUMN_3_D, 500.0, 300.0);
Chart chart = shape.getChart();
chart.getTitle().setText("Daily Attendance");
chart.getSeries().clear();
LinkedHashMap<String, HashMap<String, Double>> values = new LinkedHashMap<>();
HashMap<String, Double> periodsMap = new HashMap<>();
for(int i=1; i<9; i++){
periodsMap.put("P"+i, 12542.0);
}
values.put("Present", periodsMap);
HashMap<String, Double> periodsMap1 = new HashMap<>();
for(int i=1; i<9; i++){
periodsMap1.put("p"+i, 32542.0);
}
values.put("Absence", periodsMap1);
HashMap<String, Double> periodsMap2 = new HashMap<>();
for(int i=1; i<9; i++){
periodsMap2.put("p"+i, 22542.0);
}
values.put("Late", periodsMap2);
HashMap<String, Double> periodsMap3 = new HashMap<>();
for(int i=1; i<9; i++){
periodsMap3.put("p"+i, 82542.0);
}
values.put("Not Taken", periodsMap3);
for(Entry<String, HashMap<String, Double>> value: values.entrySet()){
Set<String> keySet = value.getValue().keySet();
LinkedList<Double> values2 = new LinkedList<Double>(value.getValue().values());
double[] periodValues = new double[values2.size()];
for(int i=0; i<values2.size(); i++){
periodValues[i]=values2.get(i);
}
String[] periods = new String[keySet.size()];
ChartSeries series = chart.getSeries().add(value.getKey(), keySet.toArray(periods), periodValues);
ChartDataLabelCollection labels = series.getDataLabels();
labels.setShowValue(true);
}
doc.save("D:\\temp\\Chart2_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".pdf");
}
Thanks