0

I am using jjoe64 Graph View in my android application. and I am trying to show dynamic values in graph but first time it contains no values but graph is not appearing. give me solution. http://www.android-graphview.org/

https://github.com/jjoe64/GraphView

2 Answers2

0

Can you show us your code? Have you tried something like

    graph = (GraphView) findViewById(R.id.graph);

    LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>();
    graph.addSeries(series);

    graph.getViewport().setXAxisBoundsManual(true);
    graph.getViewport().setYAxisBoundsManual(true);
    graph.getViewport().setMinX(0);
    graph.getViewport().setMaxX(0);
    graph.getViewport().setMinY(0);
    graph.getViewport().setMaxY(4);
    graph.onDataChanged(true, true);
acoder
  • 126
  • 1
  • 5
0

There's a bug report logged for this one, and it appears the issue will be fixed in the next release (4.0.1).Anyway I simply coded around the issue, by displaying some text, indicating there's no data at that point eg.

    // If there is no data, let the user know, else blank the textBox.
    TextView fragmentText = (TextView) v.findViewById(R.id.history_text);
    if ( xLabels.size() < 2 ){
        fragmentText.setTextSize(24);
        fragmentText.setText(getString(R.string.history_graph_no_data));
    } else {
        // Remove the "No Data" text
        fragmentText.setText("");

        LinearLayout layout = (LinearLayout) v.findViewById(R.id.history_graph);
        addGraphToLayout(layout);
    }
arober11
  • 1,969
  • 18
  • 31