AdvancedHMI Software

General Category => Support Questions => Topic started by: bachphi on November 24, 2015, 10:05:02 AM

Title: ChartBySampling and display time
Post by: bachphi on November 24, 2015, 10:05:02 AM
I am using 3.99a and wanted to use Time on X axis, so I changed XValueType to Time, but it only display 12:00AM  over and over. How do I fix this? Thanks in advance.
Title: Re: ChartBySampling and display time
Post by: Joe Matkowski on November 26, 2015, 09:37:55 AM
http://advancedhmi.com/forum/index.php?topic=828.0

Here is a thread on how to get the time to display correctly, I changed the code in  the chart to this

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

Jody
Title: Re: ChartBySampling and display time
Post by: bachphi on November 30, 2015, 04:15:51 PM
Yes, I did check the thread. Did you really have it working? On my system it was line 225, it compiled w/o error , but running the app will get an exception:

************** Exception Text **************
System.FormatException: Input string was not in a correct format.
   at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
   at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)
Title: Re: ChartBySampling and display time
Post by: Joe Matkowski on December 04, 2015, 01:29:37 PM
I just commented out line 225 and copy paste which became line 226. that is the exact code I used. copied from my app what version of studio are you using I am using community 2015
jody
Title: Re: ChartBySampling and display time
Post by: bachphi on December 10, 2015, 10:26:10 AM
I am using VS Community 2015 & AAHMI399a
Title: Re: ChartBySampling and display time
Post by: bachphi on December 10, 2015, 11:15:45 AM
I setup a new AAHMI399a, add a PLC driver, add a ChartBySampling, Set the MaximumActivePoints , Add a PLC address to PLCAddressItems, tested working .
Next I goto series and set its XValueType to Time.  and open ChartBySampling.vb line 225 and change it to:
Code: [Select]
        MyBase.Series(index).Points.Add(Now.ToLongTimeString, CDbl(m_PLCAddressItems(index).GetScaledValue(e.PLCComEventArgs.Values(0))))

Run it again. Error with InvalidCastException wsa unhanldled by user code. Conversion from string "11:09:26 AM" to type 'Double' is not valid.
Title: Re: ChartBySampling and display time
Post by: bachphi on December 10, 2015, 02:50:37 PM
Found my mistake. It needs to be AddXY