-
Notifications
You must be signed in to change notification settings - Fork 1
/
db2chart.html
61 lines (58 loc) · 2.6 KB
/
db2chart.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<script type="text/javascript">
RED.nodes.registerType('db2chart',{
category: 'function',
color: '#a6bbcf',
defaults: {
name: {value:""},
firstcol: {value: false}
},
icon: "font-awesome/fa-chevron-circle-right",
inputs:1,
outputs:1,
label: function() {
return this.name || "db2chart";
},
oneditprepare: function () {
$('#node-input-firstcol').prop('checked', this.firstcol);
}
});
</script>
<script type="text/html" data-template-name="db2chart">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<input type="checkbox" id="node-input-firstcol" style="display: inline-block; width: auto; vertical-align: top;" />
<label for="node-input-firstcol" style="width: auto;">Use the first column as the labels on Chart </label>
</div>
</script>
<script type="text/html" data-help-name="db2chart">
<p>node-red-db2chart is a Node-RED node to convert database data to the form that compatible to Charts on Dashboard.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">string | buffer</span>
</dt>
<p>The message payload getting from database node. It is a JSON array of rows getting from database.</p>
<p>Example</p>
<pre>[{"data1": 1, "data2": 2}, {"data1": 3, "data2": 4}, {"data1": 5, "data2": 6}, {"data1": 7, "data2": 8}]</pre>
<p>If there is only one row. The message payload is a single JSON object.</p>
<p>Example</p>
<pre>{"data1": 1, "data2": 2}</pre>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">string | buffer</span>
</dt>
<p>The output message payload sent by the db2chart node that used by Charts on Dashboard. It is a JSON array that has one object with 03 properties including arrays of series, data and labels.</p>
<p>
- series: mapping to column names </br>
- data: mapping to data rows </br>
- labels: mapping to index of the input array
</p>
<p>Example</p>
<pre>[{"series": ["data1", "data2"], "data": [[1, 3, 5, 7], [2, 4, 6, 8]], "labels": ["0", "1", "2", "3"]}]</pre>
<h3>Details</h3>
<p> By default, the label is the index of the input payload array. However, the first column can be set as labels on the setting.</p>
</script>