Best tool for plot real time graph in C#

Discussion in 'Programmer's Corner' started by embpic, Apr 29, 2014.

  1. embpic

    Thread Starter Member

    May 29, 2013
    187
    3
    which is best tool for ploting graph using C#. i tried using zedgraph tool with the help of timer tick but it is not updating
    graph as per value.
    it updates only when i scroll up or down then only it get updates.
    actually i want to plot graph of real time means it get updates as the value get updates.
     
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,387
    497
  3. embpic

    Thread Starter Member

    May 29, 2013
    187
    3
    Actually I first Google then after not satisfied results then I post the thread.
     
  4. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,387
    497
    I remember ads on tv for ms office. They claimed something about live charts or some such. Might be worth a look for you.
     
  5. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Did you invalidate the control that the graph is drawn on?

    Why not graph the data yourself?
     
    panic mode likes this.
  6. dougy83

    Member

    May 11, 2011
    11
    4
  7. embpic

    Thread Starter Member

    May 29, 2013
    187
    3
    i don't want to make chart i want to plot data coming from serial interface like real time plot. is it possible with this.
     
  8. embpic

    Thread Starter Member

    May 29, 2013
    187
    3
    like oscillosope
     
  9. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    Like tshuck says, why not draw the graph yourself? It's just a few lines and some scaling, you get a lighter weight component and much more control over it. Google "c# draw line".
     
  10. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Yes, you can do that using the chart control - you'd have to modify the collection of points in a series on the chart each time you get data (not hard).

    On the serial interface, register for the data received event and use that data to add the X and Y points for the series, then, you may need to invalidate the chart control.

    As an example, maybe something like:
    Code ( (Unknown Language)):
    1.  public serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
    2. {
    3.     int data = serialPort1.ReadByte();
    4.     // data received
    5.     chart1.Series["serial data"].Points.AddXY
    6.                         (DateTime.UtcNow, data);
    7.  
    8.     //chart1.Invalidate();
    9. }
    10.  
    You'll probably have to create the "serial data" series in the chart before this event gets called...



    ...or, you could draw it yourself, which, if you don't understand the above, would probably be faster...
     
    Last edited: Apr 30, 2014
  11. embpic

    Thread Starter Member

    May 29, 2013
    187
    3
    any one use zedgraph. bcoz after search and suggestion i saw zedgraph is having good GUI.
     
Loading...