-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate-120.html
More file actions
104 lines (102 loc) · 3.01 KB
/
template-120.html
File metadata and controls
104 lines (102 loc) · 3.01 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<h1 id="simple-ticker-formatter">Simple Ticker Formatter</h1>
<p>This formatter creates a ticker column.</p>
<h2 id="specific-options">Specific options</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td>negativeColor</td>
<td>string</td>
<td>optional</td>
<td>Color code</td>
</tr>
<tr>
<td>positiveColor</td>
<td>string</td>
<td>optional</td>
<td>Color code</td>
</tr>
</tbody></table>
<h2 id="example">Example</h2>
<code-sandbox hash="39ff84da"><pre><code class="language-css">efx-grid {
height: 320px;
}
</code></pre>
<pre><code class="language-html"><efx-grid id="grid"></efx-grid>
</code></pre>
<pre><code class="language-javascript">import { halo } from './theme-loader.js'; // This line is only required for demo purpose. It is not relevant for your application.
await halo(); // This line is only required for demo purpose. It is not relevant for your application.
/* ---------------------------------- Note ----------------------------------
DataGenerator, Formatters and extensions are exposed to global scope
in the bundle file to make it easier to create live examples.
Importing formatters and extensions is still required in your application.
Please see the document for further information.
---------------------------------------------------------------------------*/
var fields = ["last", "changes", "percent", "tick_1"];
var records = new Array(40);
for(var i = 0; i < 40; ++i) {
var changes = i * (i % 7) - i % 13;
var last = 5 + i % 13;
var percent = (changes / last) * 100;
var tick;
if (percent > 0) {
tick = 1;
} else if (percent < 0) {
tick = -1;
} else {
tick = 0;
}
var record = records[i] = {};
record[fields[0]] = last;
record[fields[1]] = changes;
record[fields[2]] = percent.toFixed(2);
record[fields[3]] = tick;
}
var configObj = {
sorting: {
sortableColumns: true
},
columns: [
{
name: "Last",
field: fields[0],
alignment: "c"
},
{
name: "Changes",
field: fields[1],
alignment: "c",
},
{
name: "Changes %",
field: fields[2],
alignment: "c",
},
{
name: "Default",
field: fields[3],
alignment: "c",
binding: SimpleTickerFormatter.create()
},
{
name: "Custom",
field: fields[3],
alignment: "c",
binding: SimpleTickerFormatter.create({
negativeColor: "#FF6333",
positiveColor: "#607EFF",
})
}
],
staticDataRows: records
};
var grid = document.getElementById("grid");
grid.config = configObj;
</code></pre>
</code-sandbox>