AdvancedHMI Software

General Category => Tips & Tricks => Topic started by: Archie on June 18, 2015, 08:22:45 PM

Title: ChartBySampling (version 3.98r or later)
Post by: Archie 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
Title: Re: ChartBySampling (version 3.98r or later)
Post by: mcameron0980 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
Title: Re: ChartBySampling (version 3.98r or later)
Post by: Godra 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.
Title: Re: ChartBySampling (version 3.98r or later)
Post by: mcameron0980 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...
Title: Re: ChartBySampling (version 3.98r or later)
Post by: Archie 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))))

Title: Re: ChartBySampling (version 3.98r or later)
Post by: Godra 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
Title: Re: ChartBySampling (version 3.98r or later)
Post by: DEG on August 25, 2015, 04:59:31 PM
Hi,
Is there a way to configure the Y axis show the decimal
Title: Re: ChartBySampling (version 3.98r or later)
Post by: Archie on August 25, 2015, 06:43:38 PM
ChartBySampling1 -> ChartAreas -> Axes -> Y (Value) axis -> Label Style -> Format

Set to something like 0.00
Title: Re: ChartBySampling (version 3.98r or later)
Post by: DEG on August 25, 2015, 08:39:33 PM
My problem is this?
Title: Re: ChartBySampling (version 3.98r or later)
Post by: Archie on August 25, 2015, 09:11:13 PM
ChartBySampling1 -> PLCAddressItems -> select your item -> ScaleFactor -> 0.01
Title: Re: ChartBySampling (version 3.98r or later)
Post by: DEG on August 25, 2015, 09:54:56 PM
Here's my problem.
Title: Re: ChartBySampling (version 3.98r or later)
Post by: Godra 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.
Title: Re: ChartBySampling (version 3.98r or later)
Post by: Archie 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)?
Title: Re: ChartBySampling (version 3.98r or later)
Post by: DEG on August 26, 2015, 10:15:52 PM
Thank you, Thank you, Thank you....
Title: Re: ChartBySampling (version 3.98r or later)
Post by: DEG on August 26, 2015, 11:01:28 PM
 :)
Title: Re: ChartBySampling (version 3.98r or later)
Post by: DEG on September 05, 2015, 03:32:56 PM
HI,
Failed to win DICIMAL IN DATALOGGER,
 I've tried everything
Title: Re: ChartBySampling (version 3.98r or later)
Post by: Archie on September 05, 2015, 03:50:24 PM
Try this

- Open AdvancedHMIControls\Components\BasicDataLogger2.vb
- Go to line 215 and edit the StoreValue to this:
Code: [Select]
    Private Sub StoreValue()
        Try
            If Not m_PauseLogging Then
                Dim StringToWrite As String = m_Prefix
                If m_TimeStampFormat IsNot Nothing AndAlso (String.Compare(m_TimeStampFormat, "") <> 0) Then StringToWrite &= Date.Now.ToString(m_TimeStampFormat)


                For Each item In PLCAddressValueItems
                    If item.ScaleFactor = 1 Then
                        StringToWrite &= "," & item.LastValue
                    Else
                        Try
                            StringToWrite &= "," & item.LastValue * item.ScaleFactor
                        Catch ex As Exception
                            StringToWrite &= "," & "INVALID-Check scale factor"
                        End Try
                    End If
                Next
                sw.WriteLine(StringToWrite)
                sw.Flush()
            End If
        Catch ex As Exception
        End Try
    End Sub
Title: Re: ChartBySampling (version 3.98r or later)
Post by: DEG on September 05, 2015, 05:31:44 PM
THANK ARCHIE
Title: Re: ChartBySampling (version 3.98r or later)
Post by: DEG on September 05, 2015, 09:14:43 PM
I'm trying to develop software for PT100 temperature. Needed to keep temperatures taken, then release a report in XLS or PDF, but within a range of two dates and plot it.
ADVANCEDHMI, allowed to develop a part of it.
I HAVE THE GRAPHIC AND SAVED THE INFORMATION .LOG, missing TAKE information between two dates and graph it.
I would greatly appreciate develop so we can learn along the way.
Here's an example
Title: Re: ChartBySampling (version 3.98r or later)
Post by: DEG on October 25, 2015, 04:42:56 PM
Hi archi.
As I can do to make the ChartArea behave dynamically. because it is lost. Look at the picture, and I TREATY treaty and do not get it
Title: Re: ChartBySampling (version 3.98r or later)
Post by: bachphi on November 14, 2015, 03:42:31 PM
Is this 2 ChartBySamplings or just one ?
Title: Re: ChartBySampling (version 3.98r or later)
Post by: DEG on November 15, 2015, 08:47:39 AM
one
Title: Re: ChartBySampling (version 3.98r or later)
Post by: bachphi on November 19, 2015, 12:20:34 PM
I am using 3.99a and wanted to use Time , so I changed XValueType to Time, but it only display 12:00AM  over and over. I went into line 225 and changed it 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))))
App would not run with new change. How do I fix this? TIA.

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))))
Title: Re: ChartBySampling (version 3.98r or later)
Post by: pedro.ma on November 24, 2015, 01:04:58 PM
Hi good morning to all, I need some help with this control. I'm using 3.99 version. Anyone have an idea of how I can change the time of the reading of the chart? I want a read every ten minutes.
Title: Re: ChartBySampling (version 3.98r or later)
Post by: dmroeder on November 24, 2015, 03:13:59 PM
Hi good morning to all, I need some help with this control. I'm using 3.99 version. Anyone have an idea of how I can change the time of the reading of the chart? I want a read every ten minutes.

Change the communication drivers "PollRateOverride" property to 600000.  Keep in mind that any other object tied to that driver will update at 10 minutes as well.  If you have objects that need a faster update rate, then you can use separate drivers.
Title: Re: ChartBySampling (version 3.98r or later)
Post by: gvinson on March 28, 2016, 11:56:28 AM
Hi Archie thanks again for all your hard work on this project.  I am using the ChartBySampling and when I set the X axis to "Time" it only shows 12:00 A.M. on the chart in run time.  I am using the latest version of software and it appears that the fix you suggested on line 198 in the code may not be relevant in the newer version.  Any suggestions to get this part working?

Thanks!
Title: Re: ChartBySampling (version 3.98r or later)
Post by: Archie on March 28, 2016, 12:21:58 PM
I am using the ChartBySampling and when I set the X axis to "Time" it only shows 12:00 A.M. on the chart in run time.  I am using the latest version of software and it appears that the fix you suggested on line 198 in the code may not be relevant in the newer version.  Any suggestions to get this part working?
In Solution Explorer, under the AdvancedHMIControls project, expand down the controls folder and edit ChartBySampling.vb

Go to line 233 and modify it like this:

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