Author Topic: Line chart  (Read 3800 times)

StefanA

  • Newbie
  • *
  • Posts: 33
    • View Profile
Line chart
« on: October 21, 2013, 02:42:47 PM »
I would like to add a line chart to my Advanced Hmi screen. The data points on the chart would represent different Modbus holding regeisters.  Is that possible to do without being a VB expert?

// Stefan

qwideman

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Line chart
« Reply #1 on: October 23, 2013, 02:13:42 PM »
That shouldn't be too complicated, but you will need to write some code.
It doesn't take too long to learn to use a bit of VB...

First, using AdvancedHMI controls, make sure you have the correct MODBUS addresses (this took me some time - PLCs vary widely)
Basically you need to set up several datasubscribers, when there is a change you update your graph:

Private Sub DataSubscriber2_DataChanged(ByVal sender As System.Object, ByVal e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged,DataSubscriber2.DataChanged, DataSubscriber3.DataChanged, DataSubscriber4.DataChanged
'This fires an event every time your data changes. Use this space to update your graph.
End Sub

Hope this gets you started.

Quinton Wideman
Rolan Inc





Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Line chart
« Reply #2 on: October 23, 2013, 06:14:31 PM »
Following Quinton's lead, you then add a chart to your form from the ToolBox. In the event handler, add this code:

Chart1.Series(0).Points.add(e.values(0))

StefanA

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Line chart
« Reply #3 on: October 25, 2013, 09:46:31 AM »
Thanks for the info. Does anyone know about a good introduction to VB? I think I have to get some basic knowledge before I can use your code suggestions.

dmroeder

  • Administrator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Line chart
« Reply #4 on: October 25, 2013, 09:48:20 AM »
Youtube has been a good source for me.  There are a lot of people with good tutorials.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Line chart
« Reply #5 on: October 25, 2013, 11:01:58 AM »
Check the News section of the web site. There is a link to some good tutorials by Microsoft.