hqchart 1.1.13976 → 1.1.13981
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/umychart.vue.js +89 -77
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogSelectRect.js +864 -0
- package/src/jscommon/umychart.DialogTooltip.js +13 -12
- package/src/jscommon/umychart.PopKeyboard.js +25 -0
- package/src/jscommon/umychart.TReport.js +3 -2
- package/src/jscommon/umychart.js +199 -456
- package/src/jscommon/umychart.resource/css/tools.css +119 -0
- package/src/jscommon/umychart.style.js +13 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +213 -457
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +1119 -472
|
@@ -0,0 +1,864 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
Copyright (c) 2018 jones
|
|
4
|
+
|
|
5
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
开源项目 https://github.com/jones2000/HQChart
|
|
8
|
+
|
|
9
|
+
jones_2000@163.com
|
|
10
|
+
|
|
11
|
+
内置区间统计框 设置框
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function JSDialogSelectRect()
|
|
17
|
+
{
|
|
18
|
+
this.DivDialog=null;
|
|
19
|
+
this.DragTitle=null;
|
|
20
|
+
this.HQChart=null;
|
|
21
|
+
|
|
22
|
+
this.UpColor=g_JSChartResource.UpTextColor;
|
|
23
|
+
this.DownColor=g_JSChartResource.DownTextColor;
|
|
24
|
+
this.UnchangeColor=g_JSChartResource.UnchagneTextColor;
|
|
25
|
+
|
|
26
|
+
this.TitleColor=g_JSChartResource.DialogSelectRect.TitleColor;
|
|
27
|
+
this.TitleBGColor=g_JSChartResource.DialogSelectRect.TitleBGColor;
|
|
28
|
+
this.BGColor=g_JSChartResource.DialogSelectRect.BGColor;
|
|
29
|
+
|
|
30
|
+
this.TextColor=g_JSChartResource.DialogSelectRect.TextColor;
|
|
31
|
+
this.ValueColor=g_JSChartResource.DialogSelectRect.ValueColor;
|
|
32
|
+
|
|
33
|
+
this.VolColor=g_JSChartResource.DialogSelectRect.VolColor;
|
|
34
|
+
this.AmountColor=g_JSChartResource.DialogSelectRect.AmountColor;
|
|
35
|
+
this.TurnoverRateColor=g_JSChartResource.DialogSelectRect.TurnoverRateColor;
|
|
36
|
+
this.PositionColor=g_JSChartResource.DialogSelectRect.PositionColor;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
this.MaxRowCount=10;
|
|
40
|
+
this.AryData=[];
|
|
41
|
+
this.DateTimeBox={ Start:{ SpanText:null, SpanValue:null }, End:{ SpanText:null, SpanValue:null } };
|
|
42
|
+
this.ShowData;
|
|
43
|
+
this.SelectData;
|
|
44
|
+
|
|
45
|
+
this.Inital=function(hqchart, option)
|
|
46
|
+
{
|
|
47
|
+
this.HQChart=hqchart;
|
|
48
|
+
if (option)
|
|
49
|
+
{
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.Destroy=function()
|
|
55
|
+
{
|
|
56
|
+
this.AryData=[];
|
|
57
|
+
this.ShowData=null;
|
|
58
|
+
this.DateTimeBox={ Start:{ SpanText:null, SpanValue:null }, End:{ SpanText:null, SpanValue:null } };
|
|
59
|
+
|
|
60
|
+
if (this.DivDialog)
|
|
61
|
+
{
|
|
62
|
+
document.body.removeChild(this.DivDialog);
|
|
63
|
+
this.DivDialog=null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this.Create=function()
|
|
68
|
+
{
|
|
69
|
+
var divDom=document.createElement("div");
|
|
70
|
+
divDom.className='UMyChart_SelectRect_Dialog_Div';
|
|
71
|
+
|
|
72
|
+
var divTitle=document.createElement("div");
|
|
73
|
+
divTitle.className='UMyChart_SelectRect_Title_Div';
|
|
74
|
+
divTitle.onmousedown=(e)=>{ this.OnMouseDownTitle(e);}
|
|
75
|
+
|
|
76
|
+
var divName=document.createElement("div");
|
|
77
|
+
divName.className='UMyChart_SelectRect_Name_Div';
|
|
78
|
+
divName.innerText="区间统计";
|
|
79
|
+
divTitle.appendChild(divName);
|
|
80
|
+
|
|
81
|
+
var divClose=document.createElement("div");
|
|
82
|
+
divClose.className='UMyChart_SelectRect_Close_Div';
|
|
83
|
+
divClose.innerText="x";
|
|
84
|
+
divClose.onmousedown=(e)=>{ this.Close(e); }
|
|
85
|
+
divTitle.appendChild(divClose);
|
|
86
|
+
|
|
87
|
+
divDom.appendChild(divTitle);
|
|
88
|
+
|
|
89
|
+
var divDateTime=document.createElement("div");
|
|
90
|
+
divDateTime.className='UMyChart_SelectRect_DateTime_Div';
|
|
91
|
+
|
|
92
|
+
//起始日期
|
|
93
|
+
var divStartDate=document.createElement("div");
|
|
94
|
+
divDateTime.append(divStartDate);
|
|
95
|
+
var spanText=document.createElement("span");
|
|
96
|
+
spanText.className="UMyChart_SelectRect_DateTitle_Span";
|
|
97
|
+
spanText.innerText="开始:";
|
|
98
|
+
divStartDate.appendChild(spanText);
|
|
99
|
+
this.DateTimeBox.Start.SpanText=spanText;
|
|
100
|
+
|
|
101
|
+
var spanDate=document.createElement("span");
|
|
102
|
+
spanDate.className="UMyChart_SelectRect_DateValue_Span";
|
|
103
|
+
spanDate.innerText="--/--";
|
|
104
|
+
divStartDate.appendChild(spanDate);
|
|
105
|
+
this.DateTimeBox.Start.SpanValue=spanDate;
|
|
106
|
+
|
|
107
|
+
var spanArrow=document.createElement("span");
|
|
108
|
+
spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";
|
|
109
|
+
spanArrow.innerText="<";
|
|
110
|
+
spanArrow.onmousedown=(e)=>{ this.MoveStartDate(-1); }
|
|
111
|
+
divStartDate.appendChild(spanArrow);
|
|
112
|
+
|
|
113
|
+
var spanArrow=document.createElement("span");
|
|
114
|
+
spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";
|
|
115
|
+
spanArrow.innerText=">";
|
|
116
|
+
spanArrow.onmousedown=(e)=>{ this.MoveStartDate(1); }
|
|
117
|
+
divStartDate.appendChild(spanArrow);
|
|
118
|
+
|
|
119
|
+
//结束日期
|
|
120
|
+
var divEndDate=document.createElement("div");
|
|
121
|
+
divDateTime.append(divEndDate);
|
|
122
|
+
var spanText=document.createElement("span");
|
|
123
|
+
spanText.className="UMyChart_SelectRect_DateTitle_Span";
|
|
124
|
+
spanText.innerText="结束:";
|
|
125
|
+
divEndDate.appendChild(spanText);
|
|
126
|
+
this.DateTimeBox.End.SpanText=spanText;
|
|
127
|
+
|
|
128
|
+
var spanDate=document.createElement("span");
|
|
129
|
+
spanDate.className="UMyChart_SelectRect_DateValue_Span";
|
|
130
|
+
spanDate.innerText="--/--";
|
|
131
|
+
divEndDate.appendChild(spanDate);
|
|
132
|
+
this.DateTimeBox.SpanEnd=spanDate;
|
|
133
|
+
this.DateTimeBox.End.SpanValue=spanDate;
|
|
134
|
+
|
|
135
|
+
var spanArrow=document.createElement("span");
|
|
136
|
+
spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";
|
|
137
|
+
spanArrow.innerText="<";
|
|
138
|
+
spanArrow.onmousedown=(e)=>{ this.MoveEndDate(-1); }
|
|
139
|
+
divEndDate.appendChild(spanArrow);
|
|
140
|
+
|
|
141
|
+
var spanArrow=document.createElement("span");
|
|
142
|
+
spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";
|
|
143
|
+
spanArrow.innerText=">";
|
|
144
|
+
spanArrow.onmousedown=(e)=>{ this.MoveEndDate(1); }
|
|
145
|
+
divEndDate.appendChild(spanArrow);
|
|
146
|
+
|
|
147
|
+
divDom.appendChild(divDateTime);
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
var table=document.createElement("table");
|
|
151
|
+
table.className="UMyChart_SelectRect_Table";
|
|
152
|
+
divDom.appendChild(table);
|
|
153
|
+
|
|
154
|
+
var tbody=document.createElement("tbody");
|
|
155
|
+
tbody.className="UMyChart_SelectRect_Tbody";
|
|
156
|
+
table.appendChild(tbody);
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
for(var i=0;i<this.MaxRowCount;++i)
|
|
160
|
+
{
|
|
161
|
+
var rowItem={ Tr:null, AryItem:[] };
|
|
162
|
+
|
|
163
|
+
var trDom=document.createElement("tr");
|
|
164
|
+
trDom.className='UMyChart_SelectRect_Tr';
|
|
165
|
+
tbody.appendChild(trDom);
|
|
166
|
+
rowItem.Tr=trDom;
|
|
167
|
+
|
|
168
|
+
for(var j=0;j<3;++j)
|
|
169
|
+
{
|
|
170
|
+
var item={ Td:null, LeftSpan:null, RightSpan:null };
|
|
171
|
+
var tdDom=document.createElement("td");
|
|
172
|
+
tdDom.className="UMyChart_SelectRect_Td"; //标题+数值
|
|
173
|
+
item.Td=tdDom;
|
|
174
|
+
trDom.appendChild(tdDom);
|
|
175
|
+
|
|
176
|
+
var spanDom=document.createElement("span");
|
|
177
|
+
spanDom.className='UMyChart_SelectRect_Item_Left_Span';
|
|
178
|
+
spanDom.innerText='数值';
|
|
179
|
+
item.LeftSpan=spanDom;
|
|
180
|
+
tdDom.appendChild(spanDom);
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
var spanDom=document.createElement("span");
|
|
184
|
+
spanDom.className='UMyChart_SelectRect_Item_Right_Span';
|
|
185
|
+
spanDom.innerText='--';
|
|
186
|
+
item.RightSpan=spanDom;
|
|
187
|
+
tdDom.appendChild(spanDom);
|
|
188
|
+
|
|
189
|
+
rowItem.AryItem.push(item);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
this.AryData.push(rowItem);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
document.body.appendChild(divDom);
|
|
196
|
+
|
|
197
|
+
this.DivDialog=divDom;
|
|
198
|
+
|
|
199
|
+
this.UpdateStyle();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
this.Close=function(e)
|
|
203
|
+
{
|
|
204
|
+
if (!this.DivDialog) return;
|
|
205
|
+
|
|
206
|
+
this.DivDialog.style.visibility='hidden';
|
|
207
|
+
this.ShowData=null;
|
|
208
|
+
this.SelectData=null;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
this.MoveStartDate=function(step)
|
|
212
|
+
{
|
|
213
|
+
if (!this.DivDialog || !this.HQChart) return;
|
|
214
|
+
if (step==0) return;
|
|
215
|
+
if (!this.SelectData) return;
|
|
216
|
+
|
|
217
|
+
var selectData=this.SelectData;
|
|
218
|
+
var bUpdate=false;
|
|
219
|
+
if (step>0)
|
|
220
|
+
{
|
|
221
|
+
var index=selectData.Start;
|
|
222
|
+
var endIndex=selectData.End;
|
|
223
|
+
for(i=0; i<step && index<endIndex; ++i)
|
|
224
|
+
{
|
|
225
|
+
++index;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (selectData.Start!=index)
|
|
229
|
+
{
|
|
230
|
+
selectData.Start=index;
|
|
231
|
+
bUpdate=true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else
|
|
235
|
+
{
|
|
236
|
+
step=Math.abs(step);
|
|
237
|
+
var index=selectData.Start
|
|
238
|
+
var endIndex=selectData.End;
|
|
239
|
+
for(var i=0;i<step && index>0;++i)
|
|
240
|
+
{
|
|
241
|
+
--index;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (selectData.Start!=index)
|
|
245
|
+
{
|
|
246
|
+
selectData.Start=index;
|
|
247
|
+
bUpdate=true;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (bUpdate) this.UpdateSelectRect(selectData);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
this.MoveEndDate=function(step)
|
|
255
|
+
{
|
|
256
|
+
if (!this.DivDialog) return;
|
|
257
|
+
if (step==0) return;
|
|
258
|
+
if (!this.SelectData) return;
|
|
259
|
+
|
|
260
|
+
var selectData=this.SelectData;
|
|
261
|
+
var bUpdate=false;
|
|
262
|
+
|
|
263
|
+
if (step>0)
|
|
264
|
+
{
|
|
265
|
+
var index=selectData.End;
|
|
266
|
+
var startIndex=selectData.Start;
|
|
267
|
+
for(i=0; i<step && index<this.ShowData.DataCount; ++i)
|
|
268
|
+
{
|
|
269
|
+
++index;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (selectData.End!=index)
|
|
273
|
+
{
|
|
274
|
+
selectData.End=index;
|
|
275
|
+
bUpdate=true;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
else
|
|
279
|
+
{
|
|
280
|
+
step=Math.abs(step);
|
|
281
|
+
var index=selectData.End;
|
|
282
|
+
var startIndex=selectData.Start;
|
|
283
|
+
for(var i=0;i<step && index>startIndex;++i)
|
|
284
|
+
{
|
|
285
|
+
--index;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (selectData.End!=index)
|
|
289
|
+
{
|
|
290
|
+
selectData.End=index;
|
|
291
|
+
bUpdate=true;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (bUpdate) this.UpdateSelectRect(selectData);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
this.Show=function(x,y)
|
|
299
|
+
{
|
|
300
|
+
if (!this.DivDialog) return;
|
|
301
|
+
if (!this.HQChart) return;
|
|
302
|
+
|
|
303
|
+
/*
|
|
304
|
+
if (!this.DivDialog.style.top || !this.DivDialog.style.left) //上一次显示的位置
|
|
305
|
+
{
|
|
306
|
+
var top=this.HQChart.Frame.ChartBorder.GetTop();
|
|
307
|
+
var left=this.HQChart.Frame.ChartBorder.GetLeft();
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
var x=left+rtClient.left+5;
|
|
311
|
+
var y=top+rtClient.top+10;
|
|
312
|
+
this.DivDialog.style.top = y + "px";
|
|
313
|
+
this.DivDialog.style.left = x + "px";
|
|
314
|
+
}
|
|
315
|
+
*/
|
|
316
|
+
|
|
317
|
+
var top=this.HQChart.Frame.ChartBorder.GetTop();
|
|
318
|
+
var left=this.HQChart.Frame.ChartBorder.GetLeft();
|
|
319
|
+
var rtClient=this.HQChart.UIElement.getBoundingClientRect();
|
|
320
|
+
|
|
321
|
+
left=left+rtClient.left+5;
|
|
322
|
+
top=top+rtClient.top+10;
|
|
323
|
+
if (IFrameSplitOperator.IsNumber(x) && IFrameSplitOperator.IsNumber(y))
|
|
324
|
+
{
|
|
325
|
+
left=x;
|
|
326
|
+
top=y;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
var right=x+this.DivDialog.offsetWidth;
|
|
330
|
+
var bottom=y+ this.DivDialog.offsetHeight;
|
|
331
|
+
|
|
332
|
+
if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
|
|
333
|
+
if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
|
|
334
|
+
|
|
335
|
+
this.DivDialog.style.top = top + "px";
|
|
336
|
+
this.DivDialog.style.left = left + "px";
|
|
337
|
+
this.DivDialog.style.visibility='visible';
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
this.IsShow=function()
|
|
341
|
+
{
|
|
342
|
+
if (!this.DivDialog) return false;
|
|
343
|
+
|
|
344
|
+
return this.DivDialog.style.visibility==='visible';
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
this.OnMouseDownTitle=function(e)
|
|
348
|
+
{
|
|
349
|
+
if (!this.DivDialog) return;
|
|
350
|
+
|
|
351
|
+
var dragData={ X:e.clientX, Y:e.clientY };
|
|
352
|
+
dragData.YOffset=e.clientX - this.DivDialog.offsetLeft;
|
|
353
|
+
dragData.XOffset=e.clientY - this.DivDialog.offsetTop;
|
|
354
|
+
this.DragTitle=dragData;
|
|
355
|
+
|
|
356
|
+
document.onmousemove=(e)=>{ this.DocOnMouseMoveTitle(e); }
|
|
357
|
+
document.onmouseup=(e)=>{ this.DocOnMouseUpTitle(e); }
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
this.DocOnMouseMoveTitle=function(e)
|
|
361
|
+
{
|
|
362
|
+
if (!this.DragTitle) return;
|
|
363
|
+
|
|
364
|
+
var left = e.clientX - this.DragTitle.YOffset;
|
|
365
|
+
var top = e.clientY - this.DragTitle.XOffset;
|
|
366
|
+
|
|
367
|
+
var right=left+this.DivDialog.offsetWidth;
|
|
368
|
+
var bottom=top+ this.DivDialog.offsetHeight;
|
|
369
|
+
|
|
370
|
+
if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
|
|
371
|
+
if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
|
|
372
|
+
|
|
373
|
+
this.DivDialog.style.left = left + 'px';
|
|
374
|
+
this.DivDialog.style.top = top + 'px';
|
|
375
|
+
|
|
376
|
+
if(e.preventDefault) e.preventDefault();
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
this.DocOnMouseUpTitle=function(e)
|
|
380
|
+
{
|
|
381
|
+
this.DragTitle=null;
|
|
382
|
+
this.onmousemove = null;
|
|
383
|
+
this.onmouseup = null;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
//配色修改
|
|
388
|
+
this.ReloadResource=function(option)
|
|
389
|
+
{
|
|
390
|
+
this.UpColor=g_JSChartResource.UpTextColor;
|
|
391
|
+
this.DownColor=g_JSChartResource.DownTextColor;
|
|
392
|
+
this.UnchangeColor=g_JSChartResource.UnchagneTextColor;
|
|
393
|
+
|
|
394
|
+
this.TitleColor=g_JSChartResource.DialogSelectRect.TitleColor;
|
|
395
|
+
this.TitleBGColor=g_JSChartResource.DialogSelectRect.TitleBGColor;
|
|
396
|
+
this.BGColor=g_JSChartResource.DialogSelectRect.BGColor;
|
|
397
|
+
this.BorderColor=g_JSChartResource.DialogSelectRect.BorderColor;
|
|
398
|
+
|
|
399
|
+
this.TextColor=g_JSChartResource.DialogSelectRect.TextColor;
|
|
400
|
+
this.ValueColor=g_JSChartResource.DialogSelectRect.ValueColor;
|
|
401
|
+
|
|
402
|
+
this.VolColor=g_JSChartResource.DialogSelectRect.VolColor;
|
|
403
|
+
this.AmountColor=g_JSChartResource.DialogSelectRect.AmountColor;
|
|
404
|
+
this.TurnoverRateColor=g_JSChartResource.DialogSelectRect.TurnoverRateColor;
|
|
405
|
+
this.PositionColor=g_JSChartResource.DialogSelectRect.PositionColor;
|
|
406
|
+
|
|
407
|
+
if (!this.DivDialog) return;
|
|
408
|
+
|
|
409
|
+
this.UpdateStyle();
|
|
410
|
+
|
|
411
|
+
if (this.SelectData)
|
|
412
|
+
{
|
|
413
|
+
var selectData=this.SelectData;
|
|
414
|
+
this.HQChart.UpdateSelectRect(selectData.Start,selectData.End);
|
|
415
|
+
var showData=this.CalculateKLineData({ SelectData:selectData });
|
|
416
|
+
this.FormatKLineText(showData);
|
|
417
|
+
this.ShowData=showData;
|
|
418
|
+
this.UpdateTableDOM(showData);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
this.UpdateStyle=function()
|
|
424
|
+
{
|
|
425
|
+
if (!this.DivDialog) return;
|
|
426
|
+
|
|
427
|
+
if (this.BGColor) this.DivDialog.style['background-color']=this.BGColor;
|
|
428
|
+
if (this.BorderColor) this.DivDialog.style['border-color']=this.BorderColor;
|
|
429
|
+
|
|
430
|
+
if (this.DateTimeBox.Start)
|
|
431
|
+
{
|
|
432
|
+
var item=this.DateTimeBox.Start;
|
|
433
|
+
item.SpanText.style["color"]=this.TextColor;
|
|
434
|
+
item.SpanValue.style["color"]=this.ValueColor;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (this.DateTimeBox.End)
|
|
438
|
+
{
|
|
439
|
+
var item=this.DateTimeBox.End;
|
|
440
|
+
item.SpanText.style["color"]=this.TextColor;
|
|
441
|
+
item.SpanValue.style["color"]=this.ValueColor;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
//if (this.TitleBGColor) this.TitleBox.DivTitle.style['background-color']=this.TitleBGColor;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
this.UpdateTableDOM=function(showData)
|
|
449
|
+
{
|
|
450
|
+
var index=0;
|
|
451
|
+
for(var index=0,j=0, dataIndex=0;index<this.AryData.length && dataIndex<showData.AryText.length;++index)
|
|
452
|
+
{
|
|
453
|
+
var rowItem=this.AryData[index];
|
|
454
|
+
for(j=0;j<rowItem.AryItem.length;++j, ++dataIndex)
|
|
455
|
+
{
|
|
456
|
+
if (dataIndex>=showData.AryText.length) break;
|
|
457
|
+
|
|
458
|
+
var item=rowItem.AryItem[j]
|
|
459
|
+
var outItem=showData.AryText[dataIndex];
|
|
460
|
+
|
|
461
|
+
item.LeftSpan.innerText=outItem.Title;
|
|
462
|
+
item.LeftSpan.style.color=this.TextColor;
|
|
463
|
+
|
|
464
|
+
item.RightSpan.innerText=outItem.Text;
|
|
465
|
+
item.RightSpan.style.color=outItem.Color;
|
|
466
|
+
}
|
|
467
|
+
rowItem.Tr.style.display="";
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
for(; index<this.AryData.length;++index)
|
|
471
|
+
{
|
|
472
|
+
var rowItem=this.AryData[index];
|
|
473
|
+
rowItem.Tr.style.display="none";
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
if (this.DateTimeBox.Start.SpanValue) this.DateTimeBox.Start.SpanValue.innerText=showData.Date.Start.Text;
|
|
477
|
+
if (this.DateTimeBox.End.SpanValue) this.DateTimeBox.End.SpanValue.innerText=showData.Date.End.Text;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
this.UpdateSelectRect=function(selectData)
|
|
481
|
+
{
|
|
482
|
+
this.HQChart.UpdateSelectRect(selectData.Start,selectData.End);
|
|
483
|
+
var showData=null;
|
|
484
|
+
if (this.HQChart.ClassName=='KLineChartContainer')
|
|
485
|
+
{
|
|
486
|
+
showData=this.CalculateKLineData({ SelectData:selectData });
|
|
487
|
+
this.FormatKLineText(showData);
|
|
488
|
+
}
|
|
489
|
+
else if (this.HQChart.ClassName=='MinuteChartContainer')
|
|
490
|
+
{
|
|
491
|
+
showData=this.CalculateMinuteData({ SelectData:selectData });
|
|
492
|
+
this.FormatMinuteText(showData);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
if (showData)
|
|
496
|
+
{
|
|
497
|
+
this.ShowData=showData;
|
|
498
|
+
this.UpdateTableDOM(showData);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
this.Update=function(data)
|
|
504
|
+
{
|
|
505
|
+
if (!this.DivDialog) return;
|
|
506
|
+
|
|
507
|
+
var showData;
|
|
508
|
+
if (this.HQChart.ClassName=='KLineChartContainer')
|
|
509
|
+
{
|
|
510
|
+
showData=this.CalculateKLineData(data);
|
|
511
|
+
this.FormatKLineText(showData);
|
|
512
|
+
}
|
|
513
|
+
else if (this.HQChart.ClassName=='MinuteChartContainer')
|
|
514
|
+
{
|
|
515
|
+
showData=this.CalculateMinuteData(data);
|
|
516
|
+
this.FormatMinuteText(showData);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
if (!showData) return;
|
|
520
|
+
|
|
521
|
+
this.ShowData=showData;
|
|
522
|
+
this.SelectData=data.SelectData;
|
|
523
|
+
this.UpdateTableDOM(showData);
|
|
524
|
+
|
|
525
|
+
if (!this.IsShow()) this.Show(data.X, data.Y);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
this.CreateEmptyShowData=function()
|
|
529
|
+
{
|
|
530
|
+
var showData=
|
|
531
|
+
{
|
|
532
|
+
Open:null,Close:null,High:null,Low:null, YClose:null,
|
|
533
|
+
Vol:0, Amount:0,
|
|
534
|
+
Date:
|
|
535
|
+
{
|
|
536
|
+
Start:{ Time:null, Date:null, Text:"" },
|
|
537
|
+
End:{ Time:null, Date:null, Text:"" }
|
|
538
|
+
},
|
|
539
|
+
Count:0,
|
|
540
|
+
KLine:{ Up:0,Down:0,Unchanged:0 }, //阳线|阴线|平线
|
|
541
|
+
|
|
542
|
+
AryText:[],
|
|
543
|
+
|
|
544
|
+
DataCount:0,
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
return showData;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
this.CalculateKLineData=function(data)
|
|
551
|
+
{
|
|
552
|
+
var selectData=data.SelectData;
|
|
553
|
+
var hisData=selectData.Data;
|
|
554
|
+
var start=selectData.Start;
|
|
555
|
+
var end=selectData.End;
|
|
556
|
+
|
|
557
|
+
var showData=this.CreateEmptyShowData();
|
|
558
|
+
showData.DataCount=hisData.Data.length;
|
|
559
|
+
|
|
560
|
+
for(var i=start;i<hisData.Data.length && i<=end;++i)
|
|
561
|
+
{
|
|
562
|
+
var item=hisData.Data[i];
|
|
563
|
+
++showData.Count;
|
|
564
|
+
|
|
565
|
+
if (!IFrameSplitOperator.IsNumber(showData.Open) && IFrameSplitOperator.IsNumber(item.Open)) showData.Open=item.Open;
|
|
566
|
+
if (IFrameSplitOperator.IsNumber(item.Close)) showData.Close=item.Close;
|
|
567
|
+
|
|
568
|
+
if (IFrameSplitOperator.IsNumber(item.Vol)) showData.Vol+=item.Vol;
|
|
569
|
+
if (IFrameSplitOperator.IsNumber(item.Amount)) showData.Amount+=item.Amount;
|
|
570
|
+
|
|
571
|
+
if (IFrameSplitOperator.IsNumber(item.High))
|
|
572
|
+
{
|
|
573
|
+
if (!IFrameSplitOperator.IsNumber(showData.High) || showData.High<item.High)
|
|
574
|
+
showData.High=item.High;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
if (IFrameSplitOperator.IsNumber(item.Low))
|
|
578
|
+
{
|
|
579
|
+
if (!IFrameSplitOperator.IsNumber(showData.Low) || showData.Low>item.Low)
|
|
580
|
+
showData.Low=item.Low;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
if (IFrameSplitOperator.IsNumber(item.Open) && IFrameSplitOperator.IsNumber(item.Close))
|
|
584
|
+
{
|
|
585
|
+
if (item.Close>item.Open) ++showData.KLine.Up;
|
|
586
|
+
else if (item.Close<item.Open) ++showData.KLine.Down;
|
|
587
|
+
else ++showData.KLine.Unchanged;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
if (IFrameSplitOperator.IsNumber(item.Date))
|
|
591
|
+
{
|
|
592
|
+
showData.Date.End.Date=item.Date;
|
|
593
|
+
if (!IFrameSplitOperator.IsNumber(showData.Date.Start.Date)) showData.Date.Start.Date=item.Date;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
if (IFrameSplitOperator.IsNumber(item.Time))
|
|
597
|
+
{
|
|
598
|
+
showData.Date.End.Time=item.Time;
|
|
599
|
+
if (!IFrameSplitOperator.IsNumber(showData.Date.Start.Time)) showData.Date.Start.Time=item.Time;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
return showData;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
//格式化K线数据
|
|
607
|
+
this.FormatKLineText=function(showData)
|
|
608
|
+
{
|
|
609
|
+
if (!showData) return;
|
|
610
|
+
|
|
611
|
+
var defaultfloatPrecision=GetfloatPrecision(this.HQChart.Symbol);
|
|
612
|
+
|
|
613
|
+
if (ChartData.IsMinutePeriod(this.HQChart.Period,true))
|
|
614
|
+
{
|
|
615
|
+
showData.Date.Start.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.Start.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.Start.Time,"HH:MM")}`;
|
|
616
|
+
showData.Date.End.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.End.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.End.Time,"HH:MM")}`;
|
|
617
|
+
}
|
|
618
|
+
else if (ChartData.IsSecondPeriod(this.HQChart.Period) || ChartData.IsTickPeriod(this.HQChart.Period))
|
|
619
|
+
{
|
|
620
|
+
showData.Date.Start.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.Start.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.Start.Time,"HH:MM:SS")}`;
|
|
621
|
+
showData.Date.End.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.End.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.End.Time,"HH:MM:SS")}`;
|
|
622
|
+
}
|
|
623
|
+
else
|
|
624
|
+
{
|
|
625
|
+
showData.Date.Start.Text=IFrameSplitOperator.FormatDateString(showData.Date.Start.Date);
|
|
626
|
+
showData.Date.End.Text=IFrameSplitOperator.FormatDateString(showData.Date.End.Date);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
showData.AryText.push(this.ForamtPrice(showData.Open, showData.Open,defaultfloatPrecision, 'DialogSelectRect-StartPrice'));
|
|
630
|
+
showData.AryText.push(this.ForamtPrice(showData.Close, showData.Open,defaultfloatPrecision, 'DialogSelectRect-EndPrice'));
|
|
631
|
+
showData.AryText.push(this.FormatIncrease(showData.Close, showData.Open, 'DialogSelectRect-Increase'));
|
|
632
|
+
|
|
633
|
+
showData.AryText.push(this.ForamtPrice(showData.High, showData.Open,defaultfloatPrecision, 'DialogSelectRect-High'));
|
|
634
|
+
showData.AryText.push(this.ForamtPrice(showData.Low, showData.Open,defaultfloatPrecision, 'DialogSelectRect-Low'));
|
|
635
|
+
showData.AryText.push(this.FormatAmplitude(showData.High, showData.Low, showData.Open, 'DialogSelectRect-Amplitude'));
|
|
636
|
+
|
|
637
|
+
showData.AryText.push(this.FormatVol(showData.Vol, 'DialogSelectRect-Vol'));
|
|
638
|
+
showData.AryText.push(this.FormatAmount(showData.Amount, 'DialogSelectRect-Amount'));
|
|
639
|
+
showData.AryText.push(this.FormatNumber(showData.Count, null, 0, "DialogSelectRect-DataCount"));
|
|
640
|
+
|
|
641
|
+
showData.AryText.push(this.FormatNumber(showData.KLine.Up, this.UpColor, 0, 'DialogSelectRect-Up'));
|
|
642
|
+
showData.AryText.push(this.FormatNumber(showData.KLine.Down, this.DownColor, 0, 'DialogSelectRect-Down'));
|
|
643
|
+
showData.AryText.push(this.FormatNumber(showData.KLine.Unchanged, this.UnchangeColor, 0, 'DialogSelectRect-Unchanged'));
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
this.CalculateMinuteData=function(data)
|
|
648
|
+
{
|
|
649
|
+
var selectData=data.SelectData;
|
|
650
|
+
var hisData=selectData.Data;
|
|
651
|
+
var start=selectData.Start;
|
|
652
|
+
var end=selectData.End;
|
|
653
|
+
|
|
654
|
+
var showData=this.CreateEmptyShowData();
|
|
655
|
+
showData.DataCount=hisData.Data.length;
|
|
656
|
+
|
|
657
|
+
for(var i=start;i<hisData.Data.length && i<=end;++i)
|
|
658
|
+
{
|
|
659
|
+
var item=hisData.Data[i];
|
|
660
|
+
++showData.Count;
|
|
661
|
+
|
|
662
|
+
if (!IFrameSplitOperator.IsNumber(showData.Open) && IFrameSplitOperator.IsNumber(item.Open)) showData.Open=item.Open;
|
|
663
|
+
if (IFrameSplitOperator.IsNumber(item.Close)) showData.Close=item.Close;
|
|
664
|
+
|
|
665
|
+
if (IFrameSplitOperator.IsNumber(item.Vol)) showData.Vol+=item.Vol;
|
|
666
|
+
if (IFrameSplitOperator.IsNumber(item.Amount)) showData.Amount+=item.Amount;
|
|
667
|
+
|
|
668
|
+
if (IFrameSplitOperator.IsNumber(item.High))
|
|
669
|
+
{
|
|
670
|
+
if (!IFrameSplitOperator.IsNumber(showData.High) || showData.High<item.High)
|
|
671
|
+
showData.High=item.High;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
if (IFrameSplitOperator.IsNumber(item.Low))
|
|
675
|
+
{
|
|
676
|
+
if (!IFrameSplitOperator.IsNumber(showData.Low) || showData.Low>item.Low)
|
|
677
|
+
showData.Low=item.Low;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
if (IFrameSplitOperator.IsNumber(item.Open) && IFrameSplitOperator.IsNumber(item.Close))
|
|
681
|
+
{
|
|
682
|
+
if (item.Close>item.Open) ++showData.KLine.Up;
|
|
683
|
+
else if (item.Close<item.Open) ++showData.KLine.Down;
|
|
684
|
+
else ++showData.KLine.Unchanged;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
if (IFrameSplitOperator.IsNumber(item.Date))
|
|
688
|
+
{
|
|
689
|
+
showData.Date.End.Date=item.Date;
|
|
690
|
+
if (!IFrameSplitOperator.IsNumber(showData.Date.Start.Date)) showData.Date.Start.Date=item.Date;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
if (IFrameSplitOperator.IsNumber(item.Time))
|
|
694
|
+
{
|
|
695
|
+
showData.Date.End.Time=item.Time;
|
|
696
|
+
if (!IFrameSplitOperator.IsNumber(showData.Date.Start.Time)) showData.Date.Start.Time=item.Time;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
return showData;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
this.FormatMinuteText=function(showData)
|
|
704
|
+
{
|
|
705
|
+
if (!showData) return;
|
|
706
|
+
|
|
707
|
+
var defaultfloatPrecision=GetfloatPrecision(this.HQChart.Symbol);
|
|
708
|
+
|
|
709
|
+
showData.Date.Start.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.Start.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.Start.Time,"HH:MM")}`;
|
|
710
|
+
showData.Date.End.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.End.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.End.Time,"HH:MM")}`;
|
|
711
|
+
|
|
712
|
+
showData.AryText.push(this.ForamtPrice(showData.Open, showData.Open,defaultfloatPrecision, 'DialogSelectRect-StartPrice'));
|
|
713
|
+
showData.AryText.push(this.ForamtPrice(showData.Close, showData.Open,defaultfloatPrecision, 'DialogSelectRect-EndPrice'));
|
|
714
|
+
showData.AryText.push(this.FormatIncrease(showData.Close, showData.Open, 'DialogSelectRect-Increase'));
|
|
715
|
+
|
|
716
|
+
showData.AryText.push(this.ForamtPrice(showData.High, showData.Open,defaultfloatPrecision, 'DialogSelectRect-High'));
|
|
717
|
+
showData.AryText.push(this.ForamtPrice(showData.Low, showData.Open,defaultfloatPrecision, 'DialogSelectRect-Low'));
|
|
718
|
+
showData.AryText.push(this.FormatAmplitude(showData.High, showData.Low, showData.Open, 'DialogSelectRect-Amplitude'));
|
|
719
|
+
|
|
720
|
+
showData.AryText.push(this.FormatVol(showData.Vol, 'DialogSelectRect-Vol'));
|
|
721
|
+
showData.AryText.push(this.FormatAmount(showData.Amount, 'DialogSelectRect-Amount'));
|
|
722
|
+
showData.AryText.push(this.FormatNumber(showData.Count, null, 0, "DialogSelectRect-DataCount"));
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
this.GetColor=function(price,yClose)
|
|
727
|
+
{
|
|
728
|
+
if(price>yClose) return this.UpColor;
|
|
729
|
+
else if (price<yClose) return this.DownColor;
|
|
730
|
+
else return this.UnchangeColor;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
this.GetPriceColor=function(price, yClose)
|
|
734
|
+
{
|
|
735
|
+
var color=this.GetColor(price, yClose);
|
|
736
|
+
return color;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
this.FormatEmpty=function()
|
|
740
|
+
{
|
|
741
|
+
var item=
|
|
742
|
+
{
|
|
743
|
+
Title:"",
|
|
744
|
+
Text:"",
|
|
745
|
+
Color:this.ValueColor
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
return item;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
this.FormatNumber=function(value, color, defaultfloatPrecision, TitleID, format)
|
|
752
|
+
{
|
|
753
|
+
var item=
|
|
754
|
+
{
|
|
755
|
+
Title:g_JSChartLocalization.GetText(TitleID, this.LanguageID),
|
|
756
|
+
Text:"----",
|
|
757
|
+
Color:this.ValueColor
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
if (!IFrameSplitOperator.IsNumber(value)) return item;
|
|
761
|
+
|
|
762
|
+
item.Text=value.toFixed(defaultfloatPrecision);
|
|
763
|
+
if (color) item.Color=color;
|
|
764
|
+
|
|
765
|
+
return item;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
this.ForamtPrice=function(price, yClose, defaultfloatPrecision, TitleID)
|
|
770
|
+
{
|
|
771
|
+
var item=
|
|
772
|
+
{
|
|
773
|
+
Title:g_JSChartLocalization.GetText(TitleID, this.LanguageID),
|
|
774
|
+
Text:"--.--",
|
|
775
|
+
Color:this.ValueColor
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
if (!IFrameSplitOperator.IsNumber(price)) return item;
|
|
779
|
+
|
|
780
|
+
item.Text=price.toFixed(defaultfloatPrecision);
|
|
781
|
+
item.Color=this.GetColor(price, yClose);
|
|
782
|
+
|
|
783
|
+
return item;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
this.FormatIncrease=function(price, yClose, TitleID,)
|
|
787
|
+
{
|
|
788
|
+
//涨幅
|
|
789
|
+
var item=
|
|
790
|
+
{
|
|
791
|
+
Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
|
|
792
|
+
Text:"--.--",
|
|
793
|
+
Color:this.ValueColor
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
if (!IFrameSplitOperator.IsNumber(price) || !IFrameSplitOperator.IsNumber(yClose)) return item;
|
|
797
|
+
|
|
798
|
+
var diffValue=price-yClose;
|
|
799
|
+
var value=(diffValue)/yClose;
|
|
800
|
+
item.Text=`${(value*100).toFixed(2)}%`;
|
|
801
|
+
|
|
802
|
+
item.Color=this.GetColor(value,0);
|
|
803
|
+
|
|
804
|
+
return item;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
this.FormatAmplitude=function(high, low, yClose, TitleID)
|
|
808
|
+
{
|
|
809
|
+
//振幅
|
|
810
|
+
var item=
|
|
811
|
+
{
|
|
812
|
+
Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
|
|
813
|
+
Text:"--.--",
|
|
814
|
+
Color:this.ValueColor
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
if (!IFrameSplitOperator.IsNumber(high) || !IFrameSplitOperator.IsNumber(low) || !IFrameSplitOperator.IsNumber(yClose)) return item;
|
|
819
|
+
|
|
820
|
+
var diffValue=high-low;
|
|
821
|
+
var value=(diffValue)/yClose;
|
|
822
|
+
item.Text=`${(value*100).toFixed(2)}%`;
|
|
823
|
+
item.Color=this.GetColor(value,0);
|
|
824
|
+
|
|
825
|
+
return item;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
this.FormatVol=function(vol, TitleID)
|
|
829
|
+
{
|
|
830
|
+
var item=
|
|
831
|
+
{
|
|
832
|
+
Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
|
|
833
|
+
Text:'--',
|
|
834
|
+
Color:this.VolColor
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
if (!IFrameSplitOperator.IsNumber(vol)) return item;
|
|
838
|
+
|
|
839
|
+
item.Text=IFrameSplitOperator.FormatValueStringV2(vol,0,2,this.LanguageID);
|
|
840
|
+
|
|
841
|
+
return item;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
this.FormatAmount=function(amount, TitleID)
|
|
845
|
+
{
|
|
846
|
+
var item=
|
|
847
|
+
{
|
|
848
|
+
Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
|
|
849
|
+
Text:'--',
|
|
850
|
+
Color:this.AmountColor
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
if (!IFrameSplitOperator.IsNumber(amount)) return item;
|
|
854
|
+
|
|
855
|
+
item.Text=IFrameSplitOperator.FormatValueString(amount,2,this.LanguageID);
|
|
856
|
+
|
|
857
|
+
return item;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
|