ChartGauge
The ChartGauge provides a scrolling real-time chart of the selected attribute. Chart gauges can be overlaid on top of each other to produce a chart showing multiple attributes all in the same position. Where charts are overlaid, they are drawn in the order they appear in the XML definition. You can give each chart its own colour so that the various attributes can be differentiated.
Example
<gauge>
<name>RPMGauge</name>
<type>ChartGauge</type>
<x>50</x>
<y>20</y>
<w>950</w>
<h>450</h>
<min>0</min>
<max>7000</max>
<initial>0</initial>
<attribute>rpm</attribute>
<colours>red</colours>
<visible>1</visible>
<opaque>1</opaque>
<outline>1</outline>
<showmarker>1</showmarker>
</gauge>
Attributes
Attribute | Mandatory? | Value Type | Description |
---|---|---|---|
x | Yes | Integer | The x coordinate of the bottom left of the chart |
y | Yes | Integer | The y coordinate of the bottom left of the chart |
w | Yes | Integer | The width of the chart |
h | Yes | Integer | The height of the chart |
min | Yes | Integer | The minimum value of the attribute the chart will display |
max | Yes | Integer | The maximum value of the attribute the chart will display. Min and Max are used to calculate the scale on the chart so that attribute being displayed has a discernible trace |
initial | Yes | Integer | The value to be used when there is no data for the attribute (this may be ignored, depending upon the attribute, but it is currently mandatory) |
attribute | Yes | String | The name of the data item you want to chart |
colours | Yes | String | The colour definition to use. See Colour Strings for more information |
visible | No | Integer 1 or 0 | Defines whether the gauge is initially visible or not |
opaque | No | Integer 1 or 0 | Default 0. Defines whether the chart should be drawn opaque or not. If set to 1, then the chart will be drawn with a solid black background. If 0 (default) then no background will be drawn and the chart line will appear over the top of whatever is behind it. |
outline | No | Integer 1 or 0 | Default 0. Defines whether an outline rectangle around the x,y,w,h coordinates should be drawn. If set to 1 then the outline will be drawn in the colour defined by the colours attribute. |
showmarker | No | Integer 1 or 0 | Default 0. Defines whether a vertical line should be displayed on the chart when a marker is requested using a touch action. The line will be scrolled off the screen in due course as the chart is updated. |
updaterate | No | Integer | Number of milliseconds between updates. Used to slow down a chart giving a longer term trend view. When not specified the chart is updated either every message (serial and playback datasources) or a fixed frequency (canbus datasource) |
ActiveInitial | No | Boolean | specifies whether the chart should be active when it is initially created. This setting takes effect when the power is applied and SDC is booted. |
AttributeAxis | No | String | Specifies an attribute to be used as the X axis when chart data is exported. For example, if you were charting wheelshorsepower then you would likely want to set AttributeAxis to rpm This is only relevant when the chart is in the new Threshold mode. |
AttributeControl | No | String | Specifies the control attribute to use for the Threshold values. For example, if you set this property to rpm then the Start and Stop theshold values specified will be RPM values. |
AutoResetTimeoutSecs | No | Integer | Specifies the number of seconds after which the chart will be automatically reset. This is used in cases where the chart is triggered from the Start Threshold, but never reaches the Stop Threshold. For example, you tried to do a wide open throttle pull, but had to stop at a traffic light before you reached the redline (lol). |
GroupId | No | Integer | If non-zero, this places the chart into a group (where several other charts also have the same groupid). This enables one chart to be activated via a touch action, and all other charts in the group will be deactivated. The purpose behind this is to allow performance runs in threshold mode to have multiple charts displayable at the same time from previous power runs. It is up to the user how many charts to add to the group, which is done by adding multiple chart instances to the page. |
MovingAverageCount | No | Integer | Enables any chart to be changed to a moving average. The count is the number of values to average over. This has the effect of smoothing out the chart line. The higher the number, the less peaky the chart will be, but it will take more samples for the chart to react to changes in the current value. |
StartThreshold | No | Integer | The lower value used to specify the active range of the chart. In conjunction with the AttributeControl property, the value of the attribute specified by AttributeControl must be below the StartThreshold and then move above it for the chart to be triggered into an active state. |
StopThreshold | No | Integer | The upper value used to specify the active range of the chart. The attribute specified by AttributeControl must be below and go above the StopThreshold in order for the chart to become inactive. |
TimerId | No | Integer | The timer id of the chart. This is used to address this chart for certain touch actions such as resetting it after a performance run has been completed. The TimerId does not have to be unique, but beware that certain touch actions which use a timerid as a parameter will apply to all gauges that have the same TimerId (even gauges of different types, where there is a TimerId property) |
StepSize | Integer | No | StepSize defaults to 1 to keep the behaviour the same as previous releases, but if this is changed to a number greater than 1 then each line is drawn StepSize pixels further across the screen than the previous one. This can be used to make sure the number of samples captured between the start and end thresholds fill enough of the screeen width assigned to the chart. A sensible value will require a small amount of experimentation, as the number of samples taken can vary depending upon the speed of the data source being used. |
Threshold Charts - a practical example
Imagine you want to do some wide-open throttle power runs, and you want to be able to show three power runs overlaid on top of each other. To follow this example you will need a VSS signal. A GPS based VSS will not produce very accurate results but it will work. You will also need to set up the performance section in the .ini file.
Do the following:
- Create a new page
- Add a single ChartGauge. Call it Chart1.
- Set Outline to 1 so you can see where the chart will be
- Set the size and position to wherever you want it on the screen.
- Set the Attribute property to wheelshorsepower
- Set the GroupId to 1
- Set the TimerId to 1
- Set the MaxVal to whatever your maximum rpm is. Lets say 7500 as an example.
- Set the MinVal to zero.
- Set AttributeControl to rpm
- Set StartThreshold to 2000. This will be 2000rpm as the control attribute is set to rpm.
- Set StopThreshold to 7000. This will be 7000rpm.
- Set AttributeAxis to rpm. You only need to do this if you want to export the power runs to a file.
- Set StepSize to 4. This may need to be adjusted depending on your resolution and data rates. 4 is about right for a 1024pixel screen with an update rate of around 25hz.
- Duplicate the gauge twice. Call the other two gauges Chart2 and Chart3.
- Set the colours of the three charts so they are different.
- Set ActiveInitial of Chart1 to 1. Chart2 and Chart3 should have ActiveInitial=0.
- Set the TimerId of Chart2 to 2, and Chart3 to 3
You now have three charts in the same group (1), each addressable by their individual timerid. With the setup thus far, doing a pull from below 2000rpm to above 7000rpm which takes less than 30 seconds should produce a chart of wheelhorsepower. The chart will not update after that point unless it is reset.
To use the other two charts, you need to activate them. For this you need some form of input - either a touch screen or a rotary encoder. If you have a multiple screen control system with a canbus, the touch actions are sent on the canbus.
- Add a touchgauge to the page.
- Change the Action property to ACTIVATECHART=2 (where ‘2’ is the TimerId of Chart2)
If you now invoke the TouchGauge by pressing it, then Chart2 will become active. Chart1 will retain its data and remain that way until it is reset.
Do another pull. This time Chart2 should populate and overlay against Chart1.
You can do the same for chart3. Add a TouchGauge and use ACTIVATECHART=3.
To reset the charts, you can use the touchaction of
RESETPERFTIMER=<timerid>
.
You can either add individual touch gauges for each chart, or use multiple touch actions on one TouchGauge e.g.
RESETPERFTIMER=1;RESETPERFTIMER=2;RESETPERFTIMER=3
will reset all charts. Only one chart in the group will be activated at any one time. You will need three selection buttons to be able to switch between all three charts.
Saving Chart Data
It is possible to write the raw data from a threshold chart to a file. To do this, use the TouchAction of
SAVECHARTDATA=<timerid>
with the timer id of the chart you want to save. There will be two data columns saved to the CSV file. The first will be the attribute you are charting (wheelshorsepower in the example above) and the second will be the AttributeAxis attribute (rpm in the example above). If you used a moving average, this will not be present. Only the raw values are stored.
Saved chart data can be accessed in the \rawdata folder of the SD card, or you can use the device’s web server at http://<device ip address>/rawdata
Note that the recorded data will already be in a log file if you have logging turned on, but the ability to save directly from the cahrt