25 Replies Latest reply on Mar 25, 2015 6:17 PM by gachen

    Datetime on x-axis of xy plot


      Hello All,

      I am working on a requirement where I need to show data on PI XY Plot from SQL database table. SQL data table has a date time column and other columns contain data. As per requirement I need to plot Date time on x-axis while data from other data columns on y-axis. Everything is good and working except that date time is shown in exponential notation form as below


      I tried changing x-axis format to general, system but it is not working. Is there anyway we can display date time in proper format on x-axis of XY Plot?


      Thanks in advance.




        • Re: Datetime on x-axis of xy plot

          As far as the default settings are concerned, there is currently no option for viewing this in XY Plot's x-axis as timestamps.


          You may be able to alter this using VBA. I'm transferring this thread to PI Developer's Club, PI Visualization Development where they are knowledgeable about VBA and would be able to help with that aspect.

          • Re: Datetime on x-axis of xy plot



            There are many trending objects available that will properly display the date format on the x-axis. Even Excel charts properly handle the a data on the x-axis even though the units leave something to be desired...That is once you remember to select XY plot instead of a line chart...


            What is the driver to use the PI XY plot?

            Is this rendering in ProcessBook? Coresight?



            • Re: Datetime on x-axis of xy plot
              Eugene Lee

              It seems that your time is coming in as UTCSeconds. In this case, you will need to change your SQL query to format the time so that it is displayed correctly. Also, what do you mean by 'proper' format? Here is an example:


              select dateAdd(ss,1.41e9,'1/1/1970')


              where 1.41e9 is the value that you saw on the x-axis. so in your case, try


              select dateAdd(ss,datetime_column_name,'1/1/1970')

              • Re: Datetime on x-axis of xy plot

                Unfortunately, I do not believe XY plots support altering the format of the X-axis values. Please see enhancement request 12908OSI8. My guess is that XY plots were not originally designed to display timestamps, since there is already the trend object to do this, so XY plots do not convert/cast the UTC seconds to a readable timestamp. Therefore, we'll probably need to try to find an alternative workaround.


                What happens if you trend the data set in a regular trend object? To remove the traces and just display data points, open the trend configuration and choose "Markers" under Display Format, then "<None>" for the Line Style in the Trace Format.