2015-02-10 28 views

回答

0

你能告訴我們你的代碼? 您是否嘗試過類似

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); 
0

有這個一個bug report logged,並出現問題將在下一版本(4.0.1)。反正,我只是圍繞這一問題進行編碼,通過顯示一些文本,表明在這一點上沒有數據,例如。

// 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); 
    }