Author Topic: ChartBySampling (version 3.98r or later)  (Read 10817 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
ChartBySampling (version 3.98r or later)
« on: June 18, 2015, 08:22:45 PM »
This new control will plot a line (or lines) based on samples a register/tag/variable.

- Add a driver instance to the form and set the PollRateOverride to the desired sample rate
- Add a ChartBySampling
- Set the MaximumActivePoints to the number of points that will stay on the chart
- Add PLC addresses to PLCAddressItems. Each item added will be another series/line
- By default the first series is a bar chart. This can be changed by going to Series property and changing ChartType

mcameron0980

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: ChartBySampling (version 3.98r or later)
« Reply #1 on: August 17, 2015, 02:20:39 AM »
Hi Archie,
Great app - thx for all your hard work!
Is there a way to make the X axis show the date/time that the sample was taken?
Thank you,
mcameron0980

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: ChartBySampling (version 3.98r or later)
« Reply #2 on: August 20, 2015, 08:41:55 PM »
You can go to Series (Collection), select Series1 or some other and set its XValueType to DateTime.

mcameron0980

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: ChartBySampling (version 3.98r or later)
« Reply #3 on: August 23, 2015, 05:55:12 PM »
Thank you for looking into this Godra. Pls see attached for my output - not sure why I get the date offset and no time...

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: ChartBySampling (version 3.98r or later)
« Reply #4 on: August 23, 2015, 07:03:25 PM »
In addition to Godra's suggestionm you will need to edit AdvancedHMIControls\Controls\ChartBySampling.vb

Go to line 198 and change to this:

        MyBase.Series(index).Points.AddXY(Now, CDbl(m_PLCAddressItems(index).GetScaledValue(e.PLCComEventArgs.Values(0))))


Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: ChartBySampling (version 3.98r or later)
« Reply #5 on: August 24, 2015, 12:57:57 AM »
If you prefer a specific format then you could modify Archie's code to:

Code: [Select]
        MyBase.Series(index).Points.AddXY(Now.ToString("dd-MMM-yy HH:mm:ss"), CDbl(m_PLCAddressItems(index).GetScaledValue(e.PLCComEventArgs.Values(0))))

or some other format as specified here:

https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.71).aspx

DEG

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: ChartBySampling (version 3.98r or later)
« Reply #6 on: August 25, 2015, 04:59:31 PM »
Hi,
Is there a way to configure the Y axis show the decimal

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: ChartBySampling (version 3.98r or later)
« Reply #7 on: August 25, 2015, 06:43:38 PM »
ChartBySampling1 -> ChartAreas -> Axes -> Y (Value) axis -> Label Style -> Format

Set to something like 0.00

DEG

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: ChartBySampling (version 3.98r or later)
« Reply #8 on: August 25, 2015, 08:39:33 PM »
My problem is this?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: ChartBySampling (version 3.98r or later)
« Reply #9 on: August 25, 2015, 09:11:13 PM »
ChartBySampling1 -> PLCAddressItems -> select your item -> ScaleFactor -> 0.01

DEG

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: ChartBySampling (version 3.98r or later)
« Reply #10 on: August 25, 2015, 09:54:56 PM »
Here's my problem.

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: ChartBySampling (version 3.98r or later)
« Reply #11 on: August 25, 2015, 11:53:32 PM »
I just tried this, v3.98t with 40004 Modbus address and RSSim simulator, and it worked for me.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: ChartBySampling (version 3.98r or later)
« Reply #12 on: August 26, 2015, 04:45:08 AM »
I can't seem to reproduce this in 3.98r ot 3.98t. Are you possibly on another localized language where it needs to be 0,01 instead of 0.01 (comma versus decimal)?

DEG

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: ChartBySampling (version 3.98r or later)
« Reply #13 on: August 26, 2015, 10:15:52 PM »
Thank you, Thank you, Thank you....

DEG

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: ChartBySampling (version 3.98r or later)
« Reply #14 on: August 26, 2015, 11:01:28 PM »
 :)