0
votes

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Inflate the layout for this fragment
    View rootView= inflater.inflate(R.layout.fragment_graph, container, false);
    GraphView graph = (GraphView) rootView.findViewById(R.id.graph);
    BarGraphSeries<DataPoint> series = new BarGraphSeries<>(new DataPoint[] {
            new DataPoint(0, 1),
            new DataPoint(1, 5),
            new DataPoint(2, 3),
            new DataPoint(3, 2),
            new DataPoint(4, 6)
    });
    graph.addSeries(series);
    return rootView;
}
3

3 Answers

0
votes

i have tackled that error. I just changed dependencies compile 'com.jjoe64:graphview:4.2.2' to compile 'com.jjoe64:graphview:4.0.1' in build.gradle.

0
votes

current version is 4.2.1 so you should change it to

compile 'com.jjoe64:graphview:4.2.1'

0
votes

I have resolved this problem by adding adding Graphview.3.0.0 jar . Initially i was working with Graphview.4.2.1 so same error was coming , but when I add lower version , everything was working well .