c# - Update Graph (chart control) on another form -
i have c# windows form application contains mainform , graphview form. main form continuously receive current , temperature values usb port , stored in structure array list<>. during these process when click button in main form, form (graphview) form chart control open , plot graph ,
x-axis : time in minute, y-axis : current in ma, y2-axis : temperature in °c,
what can do?
in mainform
    public struct record     {         public byte chanelnumber;         public uint16 serialnumber;         public byte samplenumber;         public string chanelvoltage;         public string chanelcurrent;         public string channeltemparature;     }  list<record>[] channelrecords = new list<record>[12]; channelrecords store received data usb port.
    private void btngraph_click(object sender, eventargs e)     {         g = new graphview();         g.show();         task task = new task(sendtograph);         task.start();     }      private void sendtograph()     {         while (true)         {                g.updategraph(channelrecords[0]);         }      } and in graphview form
    public void updategraph(list<mainform.record> records)     {         this.invoke((methodinvoker)delegate         {             if (records != null)                 (int j = 0; j < records.count; j++)                 {                     if ((j % 5) != 0) continue;                     var curval = float.parse(records[j].chanelcurrent);                     var tempval = float.parse(records[j].chanelcurrent);                     chart.series[0].points.addy(curval);                     chart.series[1].points.addy(tempval);                  }         });     } this way tried. graph cannot update. please help.
thanks in advance.
 
 
  
Comments
Post a Comment