To download NI software, including the products shown below, visit ni.com/downloads.
This example shows 2 new concepts:
When loading trend data you may want to show a long term trend such as temperature over the period of a day. The reality is that you cannot display all of this data on a screen, you only have c. 1000 pixels across. Also transmitting all this data takes time. To reduce the time to download the data we can decimate the data in the web service VI.
In the attached project I have a subVI I have created called Decimate Data.vi. When we call the load data web service we send it a requested dt. In this case my data is once per second which means dt = decimation factor. Then I pass the data through my decimation VI. What we don't want to do is just pull every 10th point as we may miss significant peaks in the data. Instead I have a basic algorithm which pulls the section to be decimated and calculates the mean, max and min. Then it will return the max or the min, whichever is furthest from the mean. This means that we should still see our spikes, even in our decimated data. There are likely more sophisticated algorithms available, but on my basic data set this worked OK.
Previously I showed an example using the google charts API. This produces a wide variety of very nice graphics but there were a couple of things I wasn't keen on:
After searching for a while I came across amCharts. These do not have the variety that google charts have but it has the basic formats, a similar level API to google charts and can be downloaded and used locally for free (bar a small link to the web site on the chart).
I worked from one of their example applications and played with the configuration options to create the script in this project called loadtrend.js. I have tried to keep it well documented so hopefully that will be the best description of what I am doing.
Steps to Implement or Execute Code
Additional Information or References
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.