1

I am using Android Studio and I am trying to create a simple line chart using GraphView library. However, I am now currently facing an error called

Cannot resolve constructor "DataPoint(java.lang.String, java.lang.String) 

I created two ArrayList

ArrayList<String> oneList = new ArrayList<String>();
ArrayList<String> twoList = new ArrayList<String>();

Then I retrieve data from MySQL and populate the datapoint using for loop on the ArrayList.

for (int i = 0; i < oneList.size(); i++){

String x = oneList.get(i);
String y = twoList.get(i);

series.appendData(new DataPoint(x,y), true, oneList.size());
}

However, I faced the error mentioned earlier at the series.appendData.

I couldn't find out what's wrong and how to resolve it.. any suggestions?

Arane
  • 323
  • 4
  • 19
  • 1
    first guess would be , `x,y` should be numeric values or something – Pavneet_Singh Feb 04 '17 at 16:33
  • Android Studio offers a list of possible parameters if you put the caret inside the brackets of the method you want to call and then press "Ctrl" + "P" – Bö macht Blau Feb 04 '17 at 16:35
  • @PavneetSingh But what if my x-axis is to be `datetime`, and my y-axis is to be `temperature` ? – Arane Feb 04 '17 at 16:35
  • you have to some logic for your data type because `Datapoint` stores `double` values , this might be helpful http://stackoverflow.com/questions/10619978/using-dates-with-the-graphview-library , further more provide details about your data representation to bring clarity – Pavneet_Singh Feb 04 '17 at 16:47

0 Answers0