java - numetriclabz / numandroidchart how to space out the bars in a stacked bar chart / stacked percentage column chart -
i trying create 100% stacked bar chart in android using numetriclabz / numandroidchart library.
i have been able draw chart want format things make better since right looking cluttered, tried find solution no avail.
i have few questions , great if guys can me out :
- how can seperate out bars in stacked bar chart / stacked percentage column chart ?
- how can change colors of bars?
- how can draw trendline in stacked bar chart ?
- how put label inside bar?
how can remove description @ bottom if want to?
is there other chart library should use myself in this, have used mpandroidchart library dont know if has trendline required in project.
here code of mainactivity.java :
package com.example.android.testingbarchart; import android.app.activity; import android.os.bundle; import com.numetriclabz.numandroidcharts.chartdata; import com.numetriclabz.numandroidcharts.stackedbarchart; import java.util.arraylist; import java.util.list; public class mainactivity extends activity { stackedbarchart chart; list<chartdata> value; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); chart = (stackedbarchart) findviewbyid(r.id.chart); value = new arraylist<>(); float[] value1 = {2f,3f,6f }; float[] value2 = {3f,5f,7f }; value.add(new chartdata(value1, "jone")); value.add(new chartdata(value2, "joe")); list<string> h_lables = new arraylist<>(); h_lables.add("sun"); h_lables.add("mon"); h_lables.add("tue"); chart.setlabels(h_lables); chart.setpercentagestacked(true); chart.setdata(value); chart.setdescription(""); // chart.sethorizontal_label(h_lables); deprecated // list<chartdata> trendzone = new arraylist<>(); // trendzone.add(new chartdata(14f, 17f,"target range")); // chart.settrendzones(trendzone); // // chart.setdescription(""); // // chart.setgesture(false); } }
and here image while testing since not allowed post images yet posted link.
any useful.
Comments
Post a Comment