5 Replies Latest reply on Dec 28, 2015 7:16 AM by qn RSS
    tcoufal Communicator

    Realtime chart

    Hi Guys,

    I was wondering is there any way how to visualize a live stream of data in a chart without saving them in a Value stream in a first place.

    I am looking for something like this (Flot: Attractive JavaScript plotting for jQuery). So far I have done this by using queryPropertyHistory service and TimeSerieChart. Before displaying data i set StartDateTime to Date.Now(). Needles to say, I didnt like it.

    Thanks for any advice.

      • Re: Realtime chart
        ianban Creator

        Hi

         

        You don't say how you're receiving your data, so this may not be a perfect answer.

         

        The TimeSeries Chart takes an InfoTable (or series of InfoTables, I think up to 16 of them...) as input, so you can create an infoTable from your data and display that InfoTable in your chart.

         

        Unless your mashup is pulling in the historical data for display directly from another source, you're going to need to "persist" it somewhere, this could be an InfoTable attribute on your Thing, a DataTable or even a Stream. The infoTable attribute, if not marked as persistent is only held in memory, however you need to make sure that you limit the amount of data you have there. This is especially important if you have a large number of Things.

         

        With persisted information, you can easily create services to purge the content of the Stream/ValueStream/DataTable to stop the database from growing too large.

         

        Out of interest, what's you reason for wanting to avoid Streams/ValueStreams?

         

        Regards

         

        Ian

          • Re: Realtime chart
            tcoufal Communicator

            Hi,

            I am getting my data from my Thing's properties, Mostly they are coming from OPC DA service and some REST calls triggered by timer.

            I am going to try that non-peristent InfoTable property.

            Regarding that reason:

            I have encountered some perfomence and redundancy issues with ValueStream, especialy when I have my Thing within lot of properties which they are being logged. I have lot of rows with the same Timstamp but different property values. I do lot of GET requests to 3rd party systems (REST calls). I iterate through the filed of URLs and parse the responses. Once one property value is changed it saves it into the Valuestream, but that time is another property value updated and stored, and on and it spins...

            That reminds me, is there a way how to write a query which would return only certain property and its respective values?

            What would be the performance of such a query?

            Thanks.

              • Re: Realtime chart
                ianban Creator

                Hi Tomas

                 

                Have you tried using the updatePropertyValues service? Instead of updating properties one by one, you build an InfoTable of properties and values and then only have one update event. There's an example for using it on this post in the community : UpdatePropertyValues service

                 

                Regards

                 

                Ian

                • Re: Realtime chart
                  qn Communicator

                  Hi,

                   

                  There's the "QueryNamedPropertyHistory" which return only certain property and its values. This query has a parameter "propertyNames" which is an InfoTable. It's here you can give the name of the property. Normally, a query returns the InfoTable result quite fast. Rendering on the chart takes more time.

                   

                  Regards,

                  Quang-Dung