MPAndroidChart How to represent multiple dataset object with different number of points in the same chart line

后端 未结 2 580
醉酒成梦
醉酒成梦 2020-12-20 02:58

I am using MPAndroidChart for charting. I am building a line chart which has multiple dataset objects.

From the examples provided by MPAndroidChart I can observe tha

2条回答
  •  太阳男子
    2020-12-20 03:53

    The solution is simple.

    Create an x-values array ranging from 0 to 36:

    ArrayList xvals = new ArrayList();
    
    for(int i = 0; i <= 35; i++) {
       xvals.add("Label"+i);
    }
    
    // create your entries...
    
    // add the data...
    

    In that way you can display entries with x-indices ranging from 0 to 35. Make sure you set the correct x-index for each entry you want to display.

提交回复
热议问题