Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android GraphView resetData仅更新轴值,而不是图形本身_Java_Android_View_Graph_Android Graphview - Fatal编程技术网

Java Android GraphView resetData仅更新轴值,而不是图形本身

Java Android GraphView resetData仅更新轴值,而不是图形本身,java,android,view,graph,android-graphview,Java,Android,View,Graph,Android Graphview,嗨,我现在在graphview图书馆遇到了一些真正的困难。我试图通过活动中广播接收器的呼叫来更新图表。但由于某些原因,它只更新x轴和y轴上的值。但不是图表本身。任何帮助都将不胜感激 public class ComputationActivity extends Activity { private GraphViewSeries series; private GraphView graphView; @Override protected void onCreate(Bundle sav

嗨,我现在在graphview图书馆遇到了一些真正的困难。我试图通过活动中广播接收器的呼叫来更新图表。但由于某些原因,它只更新x轴和y轴上的值。但不是图表本身。任何帮助都将不胜感激

public class ComputationActivity extends Activity {

private GraphViewSeries series;
private GraphView graphView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_computation);

     series = new GraphViewSeries(new GraphViewData[]{ new GraphViewData(0,0)});


    BroadcastReceiver brodcast = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {


        double[] pressure = intent.getDoubleArrayExtra("pressure");
        double[] X = intent.getDoubleArrayExtra("X");

        int length = X.length;

        graphView = new LineGraphView(getApplicationContext(), "graphView");


        GraphViewData[] graphData = new GraphViewData[length];

        for(int i = 0; i < length; i++)
        {
            graphData[i] = new GraphViewData(X[i], pressure[i]);    
        }
        series.addGraphView(graphView);

        graphView.addSeries(series); 

        series.resetData(graphData);
        LinearLayout layout = (LinearLayout) findViewById(R.id.dynamicGraph);

        layout.addView(graphView);

        }   

    };

    registerReceiver(brodcast, new IntentFilter(VCFVS.BROADCAST_ACTION));

Intent mServiceIntent = new Intent(ComputationActivity.this, ComputationIntent.class);
ComputationActivity.this.startService(mServiceIntent);



}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.computation, menu);
    return true;
}
公共类活动扩展活动{
私有GraphViewSeries系列;
私人GraphView GraphView;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_计算);
series=新的GraphViewSeries(新的GraphViewData[]{newgraphviewdata(0,0)});
BroadcastReceiver brodcast=新的BroadcastReceiver(){
@凌驾
公共void onReceive(上下文、意图){
double[]pressure=intent.getDoubleArrayExtra(“压力”);
double[]X=intent.getDoubleArrayExtra(“X”);
int length=X.length;
graphView=新行graphView(getApplicationContext(),“graphView”);
GraphViewData[]graphData=新GraphViewData[长度];
for(int i=0;i

}

您有解决方案吗??