Author Topic: ChartBySampling and display time  (Read 2420 times)

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
ChartBySampling and display time
« 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.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Joe Matkowski

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: ChartBySampling and display time
« Reply #1 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

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: ChartBySampling and display time
« Reply #2 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)
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Joe Matkowski

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: ChartBySampling and display time
« Reply #3 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

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: ChartBySampling and display time
« Reply #4 on: December 10, 2015, 10:26:10 AM »
I am using VS Community 2015 & AAHMI399a
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: ChartBySampling and display time
« Reply #5 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.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: ChartBySampling and display time
« Reply #6 on: December 10, 2015, 02:50:37 PM »
Found my mistake. It needs to be AddXY
« Last Edit: December 10, 2015, 03:20:33 PM by bachphi »
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================