//Setting the title Title title = chart.getTitle(0); title.setFont(new Font("Arial", Font.BOLD, 14)); title.setText("Test graph"); title.setTextColor(Color.BLACK); title.setDrawingArea(false);
Pie pie = (Pie) chart.getGalleryObj(); pie.setShadows(true); pie.setLabelsInside(false); pie.setShowLines(true);
NoClassDefFoundError: SoftwareFX/ChartFX/Map/DefaultAttributes
in Chart
Posted
Hi,
I am getting an exception while generating graph using ChartFx6.5 for java,
Exception in thread "main"
java.lang.NoClassDefFoundError: SoftwareFX/ChartFX/Map/DefaultAttributes
at
SoftwareFX.ChartFX.PointAttributesCollection.getItem(Unknown Source)
at SoftwareFX.ChartFX.ChartCore.getPoint(Unknown Source)
at com.sample.TrialGraph.main(TrialGraph.java:25)
Jars I'm using are,
and here is my code,
public class TrialGraph {
public static void main(String a[]) throws Exception {
Chart chart = new Chart();
try {
chart.setGallery(Gallery.PIE);
chart.setChart3D(false);
chart.openData(COD.VALUES, 1, 2);
chart.getValue().setItem(0, 0, 10000);
chart.getValue().setItem(0, 1, 20000);
chart.closeData(COD.VALUES);
chart.setPointLabels(true);
chart.setPointLabelMask("%l");
chart.setScheme(Scheme.SOLID);
chart.getLegend().setItem(0, "Payment");
chart.getLegend().setItem(1, "Sample");
//chart.getPoint().getItem(0, 0).setColor(new Color(255, 228, 78));
chart.getPoint(0,1).setColor(Color.CYAN);
chart.setImgQuality(100);
chart.setPointLabelColor(Color.BLACK);
chart.setPointLabelFont(new Font("Arial", Font.PLAIN, 7));
chart.setPointLabelAlign(LabelAlign.CENTER);
chart.setHeight(330);
chart.setWidth(450);
chart.getSeries(0).setColor(Color.BLACK);
chart.getSeries(1).setColor(Color.BLACK);
chart.getSeries(2).setColor(Color.BLACK);
chart.getSeries(3).setColor(Color.BLACK);
chart.setBorder(false);
chart.setDirty(false);
chart.setGaps(new Rectangle(1, 1, 1, 1));
chart.setBackColor(Color.WHITE);
//Setting the title
Title title = chart.getTitle(0);
title.setFont(new Font("Arial", Font.BOLD, 14));
title.setText("Test graph");
title.setTextColor(Color.BLACK);
title.setDrawingArea(false);
Pie pie = (Pie) chart.getGalleryObj();
pie.setShadows(true);
pie.setLabelsInside(false);
pie.setShowLines(true);
chart.exportChart(FileFormat.PNG, "D:\\outputs\\PieChart.png");
} catch (IOException e) {
e.printStackTrace();
}
}
}
Thanks in advance for support.