I am using a ListView to display a group of charts that get the data from a hosted server. I am using the MPAndroidChart library, and have successfully used all the charts except the CombinedChart and the PieChart. I tried looking for documentation on both, but still was unable to understand these chart implementations. Can anyone please explain to me the working of these two charts : 1) CombinedChart 2) PieChart. Also in combined chart we can pass line and bar data, but how do I add these two datasets to the chart. As per my understanding, I can do it by creating a CombinedChartData object. But I am not able to do it as the application is crashing causing a NullPointerException. I have shown my code below for reference :
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity2);
combinedChart=(CombinedChart)findViewById(R.id.combined_chart);
ArrayList<String> labels = getLabels();
ArrayList<Entry> entries = new ArrayList<>(getEntries());
ArrayList<BarEntry> entries1 = new ArrayList<>(getEntries1());
LineDataSet lineDataSet = new LineDataSet(entries,"Line Data");
BarDataSet barDataSet = new BarDataSet(entries1,"Bar Data");
barDataSet.setColor(0);
CombinedData combinedData = new CombinedData(labels);
combinedData.addDataSet(lineDataSet);
combinedData.addDataSet(barDataSet);
combinedChart.setData(combinedData);
combinedChart.invalidate();