android - MPAndroidChart: Bar Chart variables X entries -
i have added mpandroidchart
project code , use bar chart x-entires want enter start date , end date variables.
please how can ?
finally found solution not totaly good:
i have modify public class dayaxisvalueformatter below:
private barlinechartbase<?> chart; private string[] mvalues; private arraylist<long> mdatelist = new arraylist<long>(); private int msize; public dayaxisvalueformatter(barlinechartbase<?> chart, arraylist<long> datelist, int size) { this.chart = chart; this.mdatelist = datelist; this.msize = size; } @override public string getformattedvalue(float value, axisbase axis) { // "value" represents position of label on axis (x or y) return longtostringfortimereal(mdatelist.get( msize)); } //pour le formatage de la date public static string longtostringfortimereal(long time) { date date = new date(time); simpledateformat simpledate = new simpledateformat("yyyy/mm/dd"); return simpledate.format(date); }
and call this:
axisvalueformatter xaxisformatter = new dayaxisvalueformatter(mchart,mdatelist, mdatelist.size()); xaxis.setvalueformatter(xaxisformatter);
the issue method is: got same date on x values.
Comments
Post a Comment