hqchart 1.1.13909 → 1.1.13915
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.NetworkFilterTest.vue.js +1 -1
- package/lib/umychart.vue.js +109 -40
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogTooltip.js +571 -0
- package/src/jscommon/umychart.NetworkFilterTest.js +1 -1
- package/src/jscommon/umychart.complier.js +19 -3
- package/src/jscommon/umychart.js +267 -9
- package/src/jscommon/umychart.resource/css/tools.css +77 -0
- package/src/jscommon/umychart.style.js +13 -1
- package/src/jscommon/umychart.testdata.js +1 -1
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +300 -14
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.NetworkFilterTest.vue.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +871 -15
package/package.json
CHANGED
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2018 jones
|
|
3
|
+
|
|
4
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
|
|
6
|
+
开源项目 https://github.com/jones2000/HQChart
|
|
7
|
+
|
|
8
|
+
jones_2000@163.com
|
|
9
|
+
|
|
10
|
+
内置K线提示信息
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
function JSDialogTooltip()
|
|
15
|
+
{
|
|
16
|
+
this.DivDialog=null;
|
|
17
|
+
this.DragTitle=null;
|
|
18
|
+
this.TitleBox=null; //{ DivTitle, DivName, DivName }
|
|
19
|
+
|
|
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.DialogTooltip.TitleColor;
|
|
27
|
+
this.TitleBGColor=g_JSChartResource.DialogTooltip.TitleBGColor;
|
|
28
|
+
this.BGColor=g_JSChartResource.DialogTooltip.BGColor;
|
|
29
|
+
this.BorderColor=g_JSChartResource.DialogTooltip.BorderColor;
|
|
30
|
+
|
|
31
|
+
this.VolColor=g_JSChartResource.DialogTooltip.VolColor;
|
|
32
|
+
this.AmountColor=g_JSChartResource.DialogTooltip.AmountColor;
|
|
33
|
+
this.TurnoverRateColor=g_JSChartResource.DialogTooltip.TurnoverRateColor;
|
|
34
|
+
this.PositionColor=g_JSChartResource.DialogTooltip.PositionColor;
|
|
35
|
+
this.DateTimeColor=g_JSChartResource.DialogTooltip.DateTimeColor;
|
|
36
|
+
this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;
|
|
37
|
+
this.MaxRowCount=10;
|
|
38
|
+
|
|
39
|
+
this.AryData=[];
|
|
40
|
+
this.AryText=[];
|
|
41
|
+
|
|
42
|
+
this.KItemCache=null;
|
|
43
|
+
this.KItemCacheID=null;
|
|
44
|
+
|
|
45
|
+
this.Inital=function(hqchart)
|
|
46
|
+
{
|
|
47
|
+
this.HQChart=hqchart;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
this.Destroy=function()
|
|
51
|
+
{
|
|
52
|
+
this.AryData=[];
|
|
53
|
+
this.AryText=[];
|
|
54
|
+
this.KItemCache=null;
|
|
55
|
+
this.KItemCacheID=null;
|
|
56
|
+
|
|
57
|
+
if (this.DivDialog)
|
|
58
|
+
{
|
|
59
|
+
document.body.removeChild(this.DivDialog);
|
|
60
|
+
this.DivDialog=null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this.OnClickColseButton=function(e)
|
|
65
|
+
{
|
|
66
|
+
this.Close(e);
|
|
67
|
+
|
|
68
|
+
if (this.HQChart && this.HQChart.ChartCorssCursor)
|
|
69
|
+
{
|
|
70
|
+
var chart=this.HQChart.ChartCorssCursor;
|
|
71
|
+
if (!chart.IsShowCorss) return;
|
|
72
|
+
|
|
73
|
+
chart.IsShowCorss=false;
|
|
74
|
+
this.HQChart.Draw();
|
|
75
|
+
this.HQChart.SetFocus();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this.Create=function()
|
|
80
|
+
{
|
|
81
|
+
var divDom=document.createElement("div");
|
|
82
|
+
divDom.className='UMyChart_Tooltip_Dialog_Div';
|
|
83
|
+
|
|
84
|
+
var divTitle=document.createElement("div");
|
|
85
|
+
divTitle.className='UMyChart_Tooltip_Title_Div';
|
|
86
|
+
divTitle.onmousedown=(e)=>{ this.OnMouseDownTitle(e);}
|
|
87
|
+
|
|
88
|
+
var divName=document.createElement("div");
|
|
89
|
+
divName.className='UMyChart_Tooltip_Name_Div';
|
|
90
|
+
divName.innerText="----";
|
|
91
|
+
divTitle.appendChild(divName);
|
|
92
|
+
|
|
93
|
+
var divClose=document.createElement("div");
|
|
94
|
+
divClose.className='UMyChart_Tooltip_Close_Div';
|
|
95
|
+
divClose.innerText="x";
|
|
96
|
+
divClose.onmousedown=(e)=>{ this.OnClickColseButton(e); }
|
|
97
|
+
divTitle.appendChild(divClose);
|
|
98
|
+
|
|
99
|
+
divDom.appendChild(divTitle);
|
|
100
|
+
|
|
101
|
+
var table=document.createElement("table");
|
|
102
|
+
table.className="UMyChart_Tooltip_Table";
|
|
103
|
+
divDom.appendChild(table);
|
|
104
|
+
|
|
105
|
+
var tbody=document.createElement("tbody");
|
|
106
|
+
tbody.className="UMyChart_Tooltip_Tbody";
|
|
107
|
+
table.appendChild(tbody);
|
|
108
|
+
|
|
109
|
+
this.AryData=[];
|
|
110
|
+
for(var i=0;i<this.MaxRowCount;++i)
|
|
111
|
+
{
|
|
112
|
+
var rowItem={ Tr:null, TitleSpan:null, TextSpan:null };
|
|
113
|
+
|
|
114
|
+
var trDom=document.createElement("tr");
|
|
115
|
+
trDom.className='UMyChart_Tooltip_Group_Tr';
|
|
116
|
+
tbody.appendChild(trDom);
|
|
117
|
+
rowItem.Tr=trDom;
|
|
118
|
+
|
|
119
|
+
var tdDom=document.createElement("td");
|
|
120
|
+
tdDom.className="UMyChart_Tooltip_Title_Td"; //标题
|
|
121
|
+
trDom.appendChild(tdDom);
|
|
122
|
+
|
|
123
|
+
var spanDom=document.createElement("span");
|
|
124
|
+
spanDom.className='UMyChart_Tooltip_Title_Span';
|
|
125
|
+
spanDom.innerText='标题';
|
|
126
|
+
tdDom.appendChild(spanDom);
|
|
127
|
+
rowItem.TitleSpan=spanDom;
|
|
128
|
+
|
|
129
|
+
var tdDom=document.createElement("td");
|
|
130
|
+
tdDom.className="UMyChart_Tooltip_Text_Td"; //数值
|
|
131
|
+
trDom.appendChild(tdDom);
|
|
132
|
+
|
|
133
|
+
var spanDom=document.createElement("span");
|
|
134
|
+
spanDom.className='UMyChart_Tooltip_Text_Span';
|
|
135
|
+
spanDom.innerText='数值';
|
|
136
|
+
tdDom.appendChild(spanDom);
|
|
137
|
+
rowItem.TextSpan=spanDom;
|
|
138
|
+
|
|
139
|
+
this.AryData.push(rowItem);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
document.body.appendChild(divDom);
|
|
144
|
+
|
|
145
|
+
this.DivName=divName;
|
|
146
|
+
this.DivDialog=divDom;
|
|
147
|
+
this.TitleBox={ DivTitle:divTitle, DivName:divName, DivColor:divClose };
|
|
148
|
+
|
|
149
|
+
this.UpdateStyle();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
this.Update=function(data)
|
|
153
|
+
{
|
|
154
|
+
if (!this.DivDialog || !this.TitleBox) return;
|
|
155
|
+
if ((!data.KItem && !data.MinItem) || !data.IsShowCorss || data.ClientPos<0) return;
|
|
156
|
+
|
|
157
|
+
this.LanguageID=this.HQChart.LanguageID;
|
|
158
|
+
|
|
159
|
+
if (this.HQChart.ClassName=='KLineChartContainer')
|
|
160
|
+
{
|
|
161
|
+
var strKItem=JSON.stringify(data.KItem);
|
|
162
|
+
if (this.KItemCacheID!=strKItem) //数据变动的才更新
|
|
163
|
+
{
|
|
164
|
+
this.KItemCache= JSON.parse(strKItem);
|
|
165
|
+
this.KItemCacheID=strKItem;
|
|
166
|
+
this.UpdateTableDOM();
|
|
167
|
+
}
|
|
168
|
+
else
|
|
169
|
+
{
|
|
170
|
+
//JSConsole.Chart.Log(`[JSDialogTooltip::Update] save as KItemCache and KItem`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else if (this.HQChart.ClassName=='MinuteChartContainer')
|
|
174
|
+
{
|
|
175
|
+
var strKItem=JSON.stringify(data.MinItem);
|
|
176
|
+
if (this.KItemCacheID!=strKItem) //数据变动的才更新
|
|
177
|
+
{
|
|
178
|
+
this.KItemCache= JSON.parse(strKItem);
|
|
179
|
+
this.KItemCacheID=strKItem;
|
|
180
|
+
this.UpdateTableDOM();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else
|
|
184
|
+
{
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
this.TitleBox.DivName.innerText=data.Name;
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
if (!this.IsShow()) this.Show();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
this.UpdateTableDOM=function()
|
|
195
|
+
{
|
|
196
|
+
if (!this.KItemCache) return;
|
|
197
|
+
|
|
198
|
+
if (this.HQChart.ClassName=='KLineChartContainer')
|
|
199
|
+
this.AryText=this.GetFormatKlineTooltipText(this.KItemCache);
|
|
200
|
+
else if (this.HQChart.ClassName=='MinuteChartContainer')
|
|
201
|
+
this.AryText=this.GetFormatMinuteTooltipText(this.KItemCache);
|
|
202
|
+
else
|
|
203
|
+
return;
|
|
204
|
+
|
|
205
|
+
var index=0;
|
|
206
|
+
for(index=0;index<this.AryText.length && index<this.MaxRowCount;++index)
|
|
207
|
+
{
|
|
208
|
+
var outItem=this.AryText[index];
|
|
209
|
+
var item=this.AryData[index];
|
|
210
|
+
|
|
211
|
+
item.TitleSpan.innerText=outItem.Title;
|
|
212
|
+
item.TitleSpan.style.color=this.TitleColor;
|
|
213
|
+
item.TextSpan.innerText=outItem.Text;
|
|
214
|
+
item.TextSpan.style.color=outItem.Color;
|
|
215
|
+
item.Tr.style.display="";
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
for( ; index<this.MaxRowCount; ++index)
|
|
219
|
+
{
|
|
220
|
+
var item=this.AryData[index];
|
|
221
|
+
item.Tr.style.display="none";
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
this.Close=function(e)
|
|
226
|
+
{
|
|
227
|
+
if (!this.DivDialog) return;
|
|
228
|
+
|
|
229
|
+
this.DivDialog.style.visibility='hidden';
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
this.OnMouseDownTitle=function(e)
|
|
233
|
+
{
|
|
234
|
+
if (!this.DivDialog) return;
|
|
235
|
+
|
|
236
|
+
var dragData={ X:e.clientX, Y:e.clientY };
|
|
237
|
+
dragData.YOffset=e.clientX - this.DivDialog.offsetLeft;
|
|
238
|
+
dragData.XOffset=e.clientY - this.DivDialog.offsetTop;
|
|
239
|
+
this.DragTitle=dragData;
|
|
240
|
+
|
|
241
|
+
document.onmousemove=(e)=>{ this.DocOnMouseMoveTitle(e); }
|
|
242
|
+
document.onmouseup=(e)=>{ this.DocOnMouseUpTitle(e); }
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
this.DocOnMouseMoveTitle=function(e)
|
|
246
|
+
{
|
|
247
|
+
if (!this.DragTitle) return;
|
|
248
|
+
|
|
249
|
+
var left = e.clientX - this.DragTitle.YOffset;
|
|
250
|
+
var top = e.clientY - this.DragTitle.XOffset;
|
|
251
|
+
|
|
252
|
+
var right=left+this.DivDialog.offsetWidth;
|
|
253
|
+
var bottom=top+ this.DivDialog.offsetHeight;
|
|
254
|
+
|
|
255
|
+
if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
|
|
256
|
+
if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
|
|
257
|
+
|
|
258
|
+
this.DivDialog.style.left = left + 'px';
|
|
259
|
+
this.DivDialog.style.top = top + 'px';
|
|
260
|
+
|
|
261
|
+
if(e.preventDefault) e.preventDefault();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
this.DocOnMouseUpTitle=function(e)
|
|
265
|
+
{
|
|
266
|
+
this.DragTitle=null;
|
|
267
|
+
this.onmousemove = null;
|
|
268
|
+
this.onmouseup = null;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
this.Show=function()
|
|
272
|
+
{
|
|
273
|
+
if (!this.DivDialog) return;
|
|
274
|
+
if (!this.HQChart) return;
|
|
275
|
+
|
|
276
|
+
if (!this.DivDialog.style.top || !this.DivDialog.style.left) //上一次显示的位置
|
|
277
|
+
{
|
|
278
|
+
var top=this.HQChart.Frame.ChartBorder.GetTop();
|
|
279
|
+
var left=this.HQChart.Frame.ChartBorder.GetLeft();
|
|
280
|
+
var rtClient=this.HQChart.UIElement.getBoundingClientRect();
|
|
281
|
+
|
|
282
|
+
var x=left+rtClient.left+5;
|
|
283
|
+
var y=top+rtClient.top+10;
|
|
284
|
+
this.DivDialog.style.top = y + "px";
|
|
285
|
+
this.DivDialog.style.left = x + "px";
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
this.DivDialog.style.visibility='visible';
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
this.IsShow=function()
|
|
292
|
+
{
|
|
293
|
+
if (!this.DivDialog) return false;
|
|
294
|
+
|
|
295
|
+
return this.DivDialog.style.visibility==='visible';
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
this.GetFormatKlineTooltipText=function(data)
|
|
300
|
+
{
|
|
301
|
+
var defaultfloatPrecision=GetfloatPrecision(this.HQChart.Symbol);//价格小数位数
|
|
302
|
+
|
|
303
|
+
//日期
|
|
304
|
+
var dateItem=this.ForamtDate(data.Date,"YYYY/MM/DD/W",'DialogTooltip-Date' );
|
|
305
|
+
|
|
306
|
+
//时间
|
|
307
|
+
var timeItem=null;
|
|
308
|
+
if (IFrameSplitOperator.IsNumber(data.Time)) timeItem=this.FormatTime(data.Time, this.HQChart.Period, null, 'DialogTooltip-Time');
|
|
309
|
+
|
|
310
|
+
var aryText=
|
|
311
|
+
[
|
|
312
|
+
this.ForamtPrice(data.Open,data.YClose, defaultfloatPrecision,'DialogTooltip-Open'),
|
|
313
|
+
this.ForamtPrice(data.High,data.YClose, defaultfloatPrecision,'DialogTooltip-High'),
|
|
314
|
+
this.ForamtPrice(data.Low,data.YClose, defaultfloatPrecision,'DialogTooltip-Low'),
|
|
315
|
+
this.ForamtPrice(data.Close,data.YClose, defaultfloatPrecision,'DialogTooltip-Close'),
|
|
316
|
+
this.FormatVol(data.Vol,'DialogTooltip-Vol' ),
|
|
317
|
+
this.FormatAmount(data.Amount,'DialogTooltip-Amount' ),
|
|
318
|
+
this.FormatIncrease(data.Close,data.YClose,'DialogTooltip-Increase'),
|
|
319
|
+
this.FormatAmplitude(data.High,data.Low,data.YClose,'DialogTooltip-Amplitude'),
|
|
320
|
+
];
|
|
321
|
+
|
|
322
|
+
if (timeItem) aryText.unshift(timeItem);
|
|
323
|
+
aryText.unshift(dateItem);
|
|
324
|
+
|
|
325
|
+
return aryText;
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
this.GetFormatMinuteTooltipText=function(data)
|
|
329
|
+
{
|
|
330
|
+
var defaultfloatPrecision=GetfloatPrecision(this.HQChart.Symbol);//价格小数位数
|
|
331
|
+
|
|
332
|
+
if (data.Type==0) //连续交易
|
|
333
|
+
{
|
|
334
|
+
var item=data.Data;
|
|
335
|
+
if (!item) item={ };
|
|
336
|
+
|
|
337
|
+
var aryText=
|
|
338
|
+
[
|
|
339
|
+
this.ForamtDate(item.Date,"YYYY/MM/DD/W",'DialogTooltip-Date' ),
|
|
340
|
+
this.FormatTime(item.Time, null, "HH:MM", 'DialogTooltip-Time'),
|
|
341
|
+
this.ForamtPrice(item.Close,item.YClose, defaultfloatPrecision,'DialogTooltip-Price'),
|
|
342
|
+
this.FormatRisefall(item.Close,item.YClose, defaultfloatPrecision,'DialogTooltip-Risefall'),
|
|
343
|
+
this.FormatIncrease(item.Close,item.YClose,'DialogTooltip-Increase'),
|
|
344
|
+
this.FormatVol(item.Vol,'DialogTooltip-Vol' ),
|
|
345
|
+
this.FormatAmount(item.Amount,'DialogTooltip-Amount' ),
|
|
346
|
+
];
|
|
347
|
+
|
|
348
|
+
return aryText;
|
|
349
|
+
}
|
|
350
|
+
else if (data.Type==1) //集合竞价
|
|
351
|
+
{
|
|
352
|
+
var item=data.Data.Data;
|
|
353
|
+
if (!item) item={ Vol:[] };
|
|
354
|
+
|
|
355
|
+
var timeForamt="HH:MM:SS";
|
|
356
|
+
if (item.Ver===1) timeForamt="HH:MM"
|
|
357
|
+
var aryText=
|
|
358
|
+
[
|
|
359
|
+
this.ForamtDate(item.Date,"YYYY/MM/DD/W",'DialogTooltip-Date' ),
|
|
360
|
+
this.FormatTime(item.Time, null, timeForamt, 'DialogTooltip-Time'),
|
|
361
|
+
this.ForamtPrice(item.Price,item.YClose, defaultfloatPrecision,'DialogTooltip-AC-Price'),
|
|
362
|
+
this.FormatIncrease(item.Price,item.YClose,'DialogTooltip-AC-Increase'),
|
|
363
|
+
this.FormatVol(item.Vol[0],'DialogTooltip-AC-Vol' ),
|
|
364
|
+
];
|
|
365
|
+
|
|
366
|
+
return aryText;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return [];
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
this.GetColor=function(price,yClose)
|
|
373
|
+
{
|
|
374
|
+
if(price>yClose) return this.UpColor;
|
|
375
|
+
else if (price<yClose) return this.DownColor;
|
|
376
|
+
else return this.UnchangeColor;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
this.GetPriceColor=function(price, yClose)
|
|
380
|
+
{
|
|
381
|
+
var color=this.GetColor(price, yClose);
|
|
382
|
+
return color;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
//配色修改
|
|
386
|
+
this.ReloadResource=function(option)
|
|
387
|
+
{
|
|
388
|
+
this.UpColor=g_JSChartResource.UpTextColor;
|
|
389
|
+
this.DownColor=g_JSChartResource.DownTextColor;
|
|
390
|
+
this.UnchangeColor=g_JSChartResource.UnchagneTextColor;
|
|
391
|
+
|
|
392
|
+
this.TitleColor=g_JSChartResource.DialogTooltip.TitleColor;
|
|
393
|
+
this.TitleBGColor=g_JSChartResource.DialogTooltip.TitleBGColor;
|
|
394
|
+
this.BGColor=g_JSChartResource.DialogTooltip.BGColor;
|
|
395
|
+
this.BorderColor=g_JSChartResource.DialogTooltip.BorderColor;
|
|
396
|
+
|
|
397
|
+
this.VolColor=g_JSChartResource.DialogTooltip.VolColor;
|
|
398
|
+
this.AmountColor=g_JSChartResource.DialogTooltip.AmountColor;
|
|
399
|
+
this.TurnoverRateColor=g_JSChartResource.DialogTooltip.TurnoverRateColor;
|
|
400
|
+
this.PositionColor=g_JSChartResource.DialogTooltip.PositionColor;
|
|
401
|
+
this.DateTimeColor=g_JSChartResource.DialogTooltip.DateTimeColor;
|
|
402
|
+
|
|
403
|
+
if (!this.DivDialog) return;
|
|
404
|
+
|
|
405
|
+
this.UpdateStyle();
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
this.UpdateStyle=function()
|
|
409
|
+
{
|
|
410
|
+
if (!this.DivDialog) return;
|
|
411
|
+
|
|
412
|
+
if (this.BGColor) this.DivDialog.style['background-color']=this.BGColor;
|
|
413
|
+
if (this.BorderColor) this.DivDialog.style['border-color']=this.BorderColor;
|
|
414
|
+
|
|
415
|
+
if (this.TitleBGColor) this.TitleBox.DivTitle.style['background-color']=this.TitleBGColor;
|
|
416
|
+
|
|
417
|
+
this.UpdateTableDOM();
|
|
418
|
+
},
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
422
|
+
//数据格式化
|
|
423
|
+
this.ForamtPrice=function(price, yClose, defaultfloatPrecision, TitleID)
|
|
424
|
+
{
|
|
425
|
+
var item=
|
|
426
|
+
{
|
|
427
|
+
Title:g_JSChartLocalization.GetText(TitleID, this.LanguageID),
|
|
428
|
+
Text:"--.--",
|
|
429
|
+
Color:this.TitleColor
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
if (!IFrameSplitOperator.IsNumber(price)) return item;
|
|
433
|
+
|
|
434
|
+
item.Text=price.toFixed(defaultfloatPrecision);
|
|
435
|
+
item.Color=this.GetColor(price, yClose);
|
|
436
|
+
|
|
437
|
+
return item;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
this.FormatVol=function(vol, TitleID)
|
|
441
|
+
{
|
|
442
|
+
var item=
|
|
443
|
+
{
|
|
444
|
+
Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
|
|
445
|
+
Text:'--',
|
|
446
|
+
Color:this.VolColor
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
if (!IFrameSplitOperator.IsNumber(vol)) return item;
|
|
450
|
+
|
|
451
|
+
item.Text=IFrameSplitOperator.FormatValueString(vol,2,this.LanguageID);
|
|
452
|
+
|
|
453
|
+
return item;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
this.FormatAmount=function(amount, TitleID)
|
|
457
|
+
{
|
|
458
|
+
var item=
|
|
459
|
+
{
|
|
460
|
+
Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
|
|
461
|
+
Text:'--',
|
|
462
|
+
Color:this.AmountColor
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
if (!IFrameSplitOperator.IsNumber(amount)) return item;
|
|
466
|
+
|
|
467
|
+
item.Text=IFrameSplitOperator.FormatValueString(amount,2,this.LanguageID);
|
|
468
|
+
|
|
469
|
+
return item;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
this.FormatIncrease=function(price, yClose, TitleID)
|
|
473
|
+
{
|
|
474
|
+
//涨幅
|
|
475
|
+
var item=
|
|
476
|
+
{
|
|
477
|
+
Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
|
|
478
|
+
Text:"--.--",
|
|
479
|
+
Color:this.TitleColor
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
if (!IFrameSplitOperator.IsNumber(price) || !IFrameSplitOperator.IsNumber(yClose)) return item;
|
|
483
|
+
|
|
484
|
+
var value=(price-yClose)/yClose;
|
|
485
|
+
item.Text=`${(value*100).toFixed(2)}%`;
|
|
486
|
+
item.Color=this.GetColor(value,0);
|
|
487
|
+
|
|
488
|
+
return item;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
this.FormatRisefall=function(price, yClose, defaultfloatPrecision, TitleID)
|
|
492
|
+
{
|
|
493
|
+
//涨跌
|
|
494
|
+
var item=
|
|
495
|
+
{
|
|
496
|
+
Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
|
|
497
|
+
Text:"--.--",
|
|
498
|
+
Color:this.TitleColor
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
if (!IFrameSplitOperator.IsNumber(price) || !IFrameSplitOperator.IsNumber(yClose)) return item;
|
|
502
|
+
|
|
503
|
+
var value=price-yClose;
|
|
504
|
+
item.Text=`${value.toFixed(defaultfloatPrecision)}`;
|
|
505
|
+
item.Color=this.GetColor(value,0);
|
|
506
|
+
|
|
507
|
+
return item;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
this.FormatAmplitude=function(high, low, yClose, TitleID)
|
|
511
|
+
{
|
|
512
|
+
//涨幅
|
|
513
|
+
var item=
|
|
514
|
+
{
|
|
515
|
+
Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
|
|
516
|
+
Text:"--.--",
|
|
517
|
+
Color:this.TitleColor
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
if (!IFrameSplitOperator.IsNumber(high) || !IFrameSplitOperator.IsNumber(low) || !IFrameSplitOperator.IsNumber(yClose)) return item;
|
|
522
|
+
|
|
523
|
+
var value=(high-low)/yClose;
|
|
524
|
+
item.Text=`${(value*100).toFixed(2)}%`;
|
|
525
|
+
item.Color=this.GetColor(value,0);
|
|
526
|
+
|
|
527
|
+
return item;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
this.ForamtDate=function(date, format, TitleID)
|
|
531
|
+
{
|
|
532
|
+
//日期
|
|
533
|
+
var item=
|
|
534
|
+
{
|
|
535
|
+
Title:g_JSChartLocalization.GetText('DialogTooltip-Date',this.LanguageID),
|
|
536
|
+
Text:"----/--/--",
|
|
537
|
+
Color:this.DateTimeColor
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (!IFrameSplitOperator.IsNumber(date)) return item;
|
|
541
|
+
|
|
542
|
+
item.Text=IFrameSplitOperator.FormatDateString(date,format);
|
|
543
|
+
|
|
544
|
+
return item;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
this.FormatTime=function(time, period, format, TitleID)
|
|
548
|
+
{
|
|
549
|
+
//时间
|
|
550
|
+
var item=
|
|
551
|
+
{
|
|
552
|
+
Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
|
|
553
|
+
Text:'--:--',
|
|
554
|
+
Color:this.DateTimeColor
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
if (!IFrameSplitOperator.IsNumber(time)) return item;
|
|
558
|
+
if (!format)
|
|
559
|
+
{
|
|
560
|
+
format="HH:MM";
|
|
561
|
+
if (ChartData.IsMinutePeriod(period,true)) timeFormat='HH:MM'; // 分钟周期
|
|
562
|
+
else if (ChartData.IsSecondPeriod(period)) timeFormat='HH:MM:SS';
|
|
563
|
+
else if (ChartData.IsMilliSecondPeriod(period)) timeFormat='HH:MM:SS.fff';
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
item.Text=IFrameSplitOperator.FormatTimeString(time,format);
|
|
567
|
+
|
|
568
|
+
return item;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
}
|
|
@@ -55982,7 +55982,7 @@ HQData.RequestMinuteRealtimeData=function(data,callback)
|
|
|
55982
55982
|
|
|
55983
55983
|
//生成随机测试数据
|
|
55984
55984
|
var price=kItem[5];
|
|
55985
|
-
var value=Math.ceil(Math.random()*10)/
|
|
55985
|
+
var value=Math.ceil(Math.random()*10)/5000*price;
|
|
55986
55986
|
var bUp=Math.ceil(Math.random()*10)>=5;
|
|
55987
55987
|
|
|
55988
55988
|
if (bUp) price+=value;
|
|
@@ -20889,6 +20889,7 @@ function ScriptIndex(name,script,args,option)
|
|
|
20889
20889
|
if (varItem.UpColor) chart.UpColor=varItem.UpColor;
|
|
20890
20890
|
if (varItem.DownColor) chart.DownColor=varItem.DownColor;
|
|
20891
20891
|
if (IFrameSplitOperator.IsNumber(varItem.StickType)) chart.BarType=varItem.StickType;
|
|
20892
|
+
if (IFrameSplitOperator.IsNumber(varItem.BarColorType)) chart.BarColorType=varItem.BarColorType;
|
|
20892
20893
|
if (varItem.LineWidth)
|
|
20893
20894
|
{
|
|
20894
20895
|
let width=parseInt(varItem.LineWidth.replace("LINETHICK",""));
|
|
@@ -20900,9 +20901,21 @@ function ScriptIndex(name,script,args,option)
|
|
|
20900
20901
|
chart.HistoryData=hisData;
|
|
20901
20902
|
this.ReloadChartResource(hqChart,windowIndex,chart);
|
|
20902
20903
|
|
|
20903
|
-
|
|
20904
|
-
|
|
20905
|
-
|
|
20904
|
+
if (varItem.IsShowTitle===false) //NOTEXT 不绘制标题
|
|
20905
|
+
{
|
|
20906
|
+
|
|
20907
|
+
}
|
|
20908
|
+
else if (IFrameSplitOperator.IsString(varItem.Name) && varItem.Name.indexOf("NOTEXT")==0) //标题中包含NOTEXT不绘制标题
|
|
20909
|
+
{
|
|
20910
|
+
|
|
20911
|
+
}
|
|
20912
|
+
else
|
|
20913
|
+
{
|
|
20914
|
+
var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);
|
|
20915
|
+
hqChart.TitlePaint[titleIndex].Data[id]=titleData;
|
|
20916
|
+
this.SetTitleData(titleData,chart);
|
|
20917
|
+
}
|
|
20918
|
+
|
|
20906
20919
|
this.SetChartIndexName(chart);
|
|
20907
20920
|
hqChart.ChartPaint.push(chart);
|
|
20908
20921
|
}
|
|
@@ -22848,6 +22861,7 @@ function OverlayScriptIndex(name,script,args,option)
|
|
|
22848
22861
|
if (varItem.UpColor) chart.UpColor=varItem.UpColor;
|
|
22849
22862
|
if (varItem.DownColor) chart.DownColor=varItem.DownColor;
|
|
22850
22863
|
if (IFrameSplitOperator.IsNumber(varItem.StickType)) chart.BarType=varItem.StickType;
|
|
22864
|
+
if (IFrameSplitOperator.IsNumber(varItem.BarColorType)) chart.BarColorType=varItem.BarColorType;
|
|
22851
22865
|
if (varItem.LineWidth)
|
|
22852
22866
|
{
|
|
22853
22867
|
let width=parseInt(varItem.LineWidth.replace("LINETHICK",""));
|
|
@@ -24276,6 +24290,8 @@ function APIScriptIndex(name,script,args,option, isOverlay)
|
|
|
24276
24290
|
if (IFrameSplitOperator.IsBool(item.isDotLine)) outVarItem.IsDotLine = item.isDotLine;
|
|
24277
24291
|
if (IFrameSplitOperator.IsNonEmptyArray(item.lineDash)) outVarItem.LineDash=item.lineDash;
|
|
24278
24292
|
if (IFrameSplitOperator.IsBool(item.isSingleLine)) outVarItem.IsSingleLine=item.isSingleLine;
|
|
24293
|
+
if (IFrameSplitOperator.IsNumber(item.StickType)) outVarItem.StickType=item.StickType;
|
|
24294
|
+
if (IFrameSplitOperator.IsNumber(item.BarColorType)) outVarItem.BarColorType=item.BarColorType;
|
|
24279
24295
|
|
|
24280
24296
|
result.push(outVarItem);
|
|
24281
24297
|
}
|