-
Notifications
You must be signed in to change notification settings - Fork 0
/
CubeDemo.html
220 lines (174 loc) · 6.51 KB
/
CubeDemo.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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!doctype html>
<html lang="en-us">
<head>
<title>CHART.VERTEX</title>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- include third party dependencies -->
<script src="https://code.vertex-analytics.com/_third/monaco-editor-0.18.1/package/min/vs/loader.js"></script>
<link rel="stylesheet" type="text/css" href="https://code.vertex-analytics.com/_third/tooltipster-master/dist/css/tooltipster.bundle.min.css"/>
<script type="text/javascript" src="https://code.vertex-analytics.com/_third/tooltipster-master/dist/js/tooltipster.bundle.min.js"></script>
</head>
<style>
<!-- include third party fonts -->
@import url(https://fonts.googleapis.com/css?family=Roboto:400);
@import url(https://fonts.googleapis.com/css?family=Roboto:500);
@import url(https://fonts.googleapis.com/css?family=Roboto+Mono);
html
{
background-color : #000000;
border : 0 none;
margin : 0;
padding : 0;
width : 100%;
height : 100%;
overflow : hidden;
}
body
{
margin : 0px;
overflow : hidden;
}
.tooltip:active {
pointer-events: none;
}
.dg.main .close-button.close-bottom {
visibility: hidden;
}
.dg {
font: 12px 'Roboto', sans-serif;
}
.dg li.title {
background-color: #000000;
}
</style>
<body>
<!-- include vx.chart api files in order -->
<script src="https://code.vertex-analytics.com/vx-chart-1.0.0/vx-enum.js"></script>
<script src="https://code.vertex-analytics.com/vx-chart-1.0.0/vx-util.js"></script>
<script src="https://code.vertex-analytics.com/vx-chart-1.0.0/vx-main.js"></script>
<script src="https://code.vertex-analytics.com/vx-chart-1.0.0/vx-draw.js"></script>
<script src="https://code.vertex-analytics.com/vx-chart-1.0.0/vx-cube.js"></script>
<script src="https://code.vertex-analytics.com/vx-chart-1.0.0/vx-core.js"></script>
<!-- sample chart script -->
<script type="text/javascript">
//-----------------------------------------------------------------------------------------------------------=
// global classes
var gDemo;
var gCube;
//-----------------------------------------------------------------------------------------------------------=
//-----------------------------------------------------------------------------------------------------------=
// full book chart
class BookChart extends vX.cube {
constructor (pConfiguration)
{
super(pConfiguration);
}
//Called by the framework if an exception occurred during creation of the chart.
//pError = critical error description object.
onError (pError)
{
console.log ("onError Called");
console.log (pError);
}
//Called by the framework before data is read with a calls to onRead.
//pInfo = initialization object.
onOpen (pInfo)
{
console.log ("onOpen Called");
console.log (pInfo);
}
//Called by the framework to read each record of data.
//pItem = event item number, 0 to rows-1.
onRead (pItem)
{
let tEvnt = gDemo.DemoRead(pItem);
this.CubeEvnt(tEvnt);
}
//Called by the framework after all records have been read.
//pInfo = status of the book build and any errors encountered object.
onShut (pInfo)
{
console.log ("onShut Called");
console.log (pInfo);
}
}
//-----------------------------------------------------------------------------------------------------------=
//-----------------------------------------------------------------------------------------------------------=
// trades only chart
class TradeChart extends vX.cube {
//-----------------------------------------------------------------------------------------------------------=
constructor (pConfiguration)
{
super(pConfiguration);
}
//-----------------------------------------------------------------------------------------------------------=
//-----------------------------------------------------------------------------------------------------------=
onRead (pItem)
{
let tEvnt = gDemo.DemoRead(pItem);
let tValid = false;
switch (tEvnt["header.unionID"] ) {
case vX.UnionID.TradeSummary :
tValid = true;
break;
case vX.UnionID.TradeMatch :
tValid = true;
break;
}
if (!tValid) return;
gCube.CubeEvnt(tEvnt);
}
//-----------------------------------------------------------------------------------------------------------=
}
//-----------------------------------------------------------------------------------------------------------=
//-----------------------------------------------------------------------------------------------------------=
// called after the demo data is loaded
function onLoaded (pRows)
{
console.log ("onLoaded Called");
console.log ("DemoRows: " + gDemo.DemoRows());
const urlParams = new URL(window.location.toLocaleString()).searchParams;
let chart = urlParams.get('chart');
// create a chart class
if ((chart) && (chart=="trades")) {
gCube = new TradeChart({
//email : "registered_email",
//password : "registered_password",
rows : gDemo.DemoRows(),
title : "ZSN3 05/02/2023",
tickSize : 0.25,
displayType : 1,
displayTypeEx : 1
});
}
else {
gCube = new BookChart({
//email : "registered_email",
//password : "registered_password",
rows : gDemo.DemoRows(),
title : "ZSN3 05/02/2023",
tickSize : 0.25,
displayType : 1,
displayTypeEx : 1
});
}
}
//-----------------------------------------------------------------------------------------------------------=
//-----------------------------------------------------------------------------------------------------------=
// called after the api is Ready
function onReady ()
{
gDemo = new vX.demo({
file : "ZSN3_20230502",
onLoaded : onLoaded
});
}
//-----------------------------------------------------------------------------------------------------------=
//-----------------------------------------------------------------------------------------------------------=
// Assign the onReady callback
vX.onReady(onReady);
//-----------------------------------------------------------------------------------------------------------=
</script>
</body>
</html>