13 Working with Charts
Charts can be used to visualize signals and signal-related information. Charts can be extended and configured in many ways. You can define your own charts or integrate existing chart tools.
To visualize a signal with impulse, users usually define a plot with a source signal and a diagram type (e.g. a line diagram) and some additional parameters (e.g. the 'annotate' flag). If you select "Chart" as diagram type, you will need to state which chart to use. impulse comes with a set of predefined charts, but user can re-define and extend. Each chart then comes with an additional set of parameters to configure the selected chart.
Charts vs 'normal' diagrams
- Charts have their own axis, whereas normal diagrams use the shared axis in the top row.
- Charts horizontally fill the whole screen (but can share the screen with subsequent charts), whereas normal diagrams can be zoomed.
- Charts can be extended.
- Users can define new chart types.
Steps to show a chart
On opening the preferences pages of impulse, you will find the chart settings. This is the place where all charts are defined and configured. You can use the impulse wallet to exchange charts and other configurations with your colleagues. Here are the basic steps to get a chart displayed.
- Get to chart preferences and create/ configure a chart (optional).
- Select a signal of a type that is compatible with the intended chart, or
- Prepare a signal script to set-up the chart data.
- Select the chart type in the plot configuration dialogue and fill the additional parameters.
For your first experiments with charts, you may use this wave file: charts.recJs
The only chart type supported by the core feature of impulse is the script chart.
Script charts can be seen as low-level charts, were the user has everything in hands:
- Extracting chart relevant data from the signals using the signal script API
- Painting the script frame using SWT methods
See below script chart example that you also find in the impulse preferences:
Script chart example
// gc: graphics context (https://www.eclipse.org/articles/Article-SWT-graphics/SWT_graphics.html) // x,y,width,height: geometry // color, background: Colors // readable: input of IReadableSamples (http://toem.de/index.php/projects/impulse/scripts/reference) gc.setForeground(color); var count = readable.getCount(); var first = readable.positionAt(0); var last = readable.positionAt(count-1); var value0 = readable.valueAt(0); var valueN = readable.valueAt(count-1); gc.drawText("Count: " +count,x+20,y+20); gc.drawText("From: " +first,x+20,y+40); gc.drawText("To: " +last,x+20,y+60); gc.drawText("Value: " +value0,x+20,y+80); gc.drawText("Value[N]: " +valueN,x+20,y+100); gc.setBackground(color); gc.fillRectangle(x+20,y+120,width-40,20); gc.setBackground(gc.getDevice().getSystemColor(7)); gc.fillRectangle(x+20,y+150,width-40,20); gc.setBackground(gc.getDevice().getSystemColor(15)); gc.fillRectangle(x+width - 50,y+20,20,height - 40); gc.setForeground(color); gc.setBackground(background); gc.drawText("Impulse Script Chart ",x+20,y+180);
Core chart types
[widgetkit id=385] [widgetkit id=47]
Chart types of impulse extensions
[widgetkit id=38] [widgetkit id=45]
[widgetkit id=41] [widgetkit id=46]