Getting Started with Report Charts
Report charts have a ton of functions and features that it's hard to know where to begin. You'll be amazed how simple a standard chart is to create. To start with, there are several chart types to select from, but the chart type you choose depends on the type of data you have and how that data might best be graphically displayed. Next, charts are driven by specific data keys in a data source. This page provides a quick start to getting you well on your way to creating report charts that are easy to configure and look stunning in your reports. Let's get started!
Creating a Report Chart
One of the most common charts used for historical trending is a Timeseries Chart. The Timeseries Chart plots values against a timestamp X axis.
Adding a chart to a report involves a couple of steps. In order, they are:
- The chart needs data, so we must create a data source.
- Once a data source exists, we can create the chart and assign the data source.
- Apply any additional chart configuration, such as adding an additional axis.
Now, let's create a Timeseries Chart using Tag History data.
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.
You also need a database connection that the historian can use to store Historical Tag data. This example assumes Tag History has been enabled on the Sine tags.
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 button.
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.