Now, let's create a Timeseries Chart using Tag History data.
Before you start this example...
Ignition comes with one internal Tag Provider so you can get started right away, but first you need to connect to a device. The Simulator device driver is a great starting point if your Gateway is not currently connected to a PLC. This example assumes you are using the Generic Simulator device tags, but any tags could be used instead. This example assumes that the simulator device connection was named 'gensim', and Sine tags were created.
Creating a Data Source
- In the Data tab, under Parameters and Data Sources, click the plus
button to add a data source. Select Tag Historian Query.
- Under the Available Historical Tags column, open the folder structure until you locate your Tags. As mentioned above, we are using the device connection named 'gensim', so we will select the 'gensim' folder in this example. Here you'll find a bunch of Tags you can use immediately. Expand the Sine folder.
- Select a few of the Tags (i.,e. sine0, sine1, sine2, sine3) and drag them to the Selected Historical Tags column under Tag Path. Take a look at the properties down at the bottom. Set the Data Range property to Historical, and the Aggregation Mode to Time-weighted Average.
Adding a Chart
- Now switch over to the Design panel. Drag a Timeseries chart from the Report Design Palette into the report and expand it.
- From the Key Browser, expand the Datasources folder, and drag your datasource (i.e., tag_history) down to the Data Key under the Chart Options tab of the Property Inspector.
- Select Test1 and Test2 pens and delete them by selecting each pen individually, and then clicking the Trash Can icon .
- Once the Data Key is correct, you can assign pens to your chart. Drag in your Keys (i.e., sine0, sine1, sine3, sine4) to the Pens property table. You'll immediately notice your chart is populated with fake data, this is just a preview and does not represent the data returned by your data source.
- You can modify a selected pen by clicking the Edit
button or double clicking the pen to open the Edit Pen tab. Here you can change the name of the pen, change the pen style, color, and more. Let's change the color of the pens to make them really stand out.
- Lets start with the sine0 pen.
- Set the Color to be red.
- To return to the Chart Options tab, click the double arrow button.
- Repeat the above steps for the remaining three pens, making sine1 green, sine2 dark blue, and sine3 purple.
- Lets start with the sine0 pen.
- Go to the Preview tab to view the Timeseries Chart in the report.
Adding an Axis
Unfortunately, it is a little difficult to see the small changes in our sine1 pen because its range is much smaller than the other pens. Let's fix this by adding a new axis.
- Go back to the Design tab and select the chart. Click the Plus
button next to the Axes table to add a new axis, then click the Edit button below it to edit our new Axis.
- Give it a name of Sine 1 axis
- Give it a Label of Value for Sine1
- Change the position to right so that it shows up on the right side of the chart.
- We can leave Auto Range turned on, so that it will automatically pick the appropriate min and max for the sine1 pen.
- Return to the Chart Options tab by clicking the double arrow
- We now need to tell our sine1 pen to use that new axis. Select the sine1 pen from the pens list and click the Edit button. Change the Axis of the pen to be the pen we just created.
- Navigate to the Preview tab to view our finished chart.