Search code examples
android-graphview

Adding data to GraphViewSeries


I have a working app using Graphview in Android Studio. API 18 using com.jjoe64:graphview:3.1.3 When I try to add data that has (x(I+1) b- x(I)) < 0 the app crashes with "Unfortunately. app has stopped. Is this a bug or are negative deltaX not allowed? Here is a sample

GraphViewSeries exampleSeries = new GraphViewSeries(new GraphViewData[] {
 new GraphViewData(1, 40)
 , new GraphViewData(2, 12)
 , new GraphViewData(3, 7)
 , new GraphViewData(2, 8) //note negative delta x
 , new GraphViewData(4, 10)
        });

Solution

  • It's not allowed - that's how it's documented to work:

    values - the values must be in the correct order! x-value has to be ASC.