hqchart 1.1.15382 → 1.1.15428

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.
@@ -0,0 +1,1192 @@
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
+ 股票买卖5档 (H5版本)
11
+ 不提供内置测试数据
12
+ */
13
+
14
+ function JSStockInfoChart(divElement)
15
+ {
16
+ this.DivElement=divElement;
17
+ this.JSChartContainer; //表格控件
18
+ this.ResizeListener; //大小变动监听
19
+
20
+ //h5 canvas
21
+ this.CanvasElement=document.createElement("canvas");
22
+ this.CanvasElement.className='jsstockinfo-drawing';
23
+ this.CanvasElement.id=Guid();
24
+ this.CanvasElement.setAttribute("tabindex",0);
25
+ if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
26
+ if(divElement.hasChildNodes())
27
+ {
28
+ JSConsole.Chart.Log("[JSStockInfoChart::JSStockInfoChart] divElement hasChildNodes", divElement.childNodes);
29
+ }
30
+ divElement.appendChild(this.CanvasElement);
31
+
32
+
33
+ this.OnSize=function()
34
+ {
35
+ //画布大小通过div获取 如果有style里的大小 使用style里的
36
+ var height=this.DivElement.offsetHeight;
37
+ var width=this.DivElement.offsetWidth;
38
+ if (this.DivElement.style.height && this.DivElement.style.width)
39
+ {
40
+ if (this.DivElement.style.height.includes("px"))
41
+ height=parseInt(this.DivElement.style.height.replace("px",""));
42
+ if (this.DivElement.style.width.includes("px"))
43
+ width=parseInt(this.DivElement.style.width.replace("px",""));
44
+ }
45
+
46
+ this.CanvasElement.height=height;
47
+ this.CanvasElement.width=width;
48
+ this.CanvasElement.style.width=this.CanvasElement.width+'px';
49
+ this.CanvasElement.style.height=this.CanvasElement.height+'px';
50
+
51
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
52
+ this.CanvasElement.height*=pixelTatio;
53
+ this.CanvasElement.width*=pixelTatio;
54
+
55
+ JSConsole.Chart.Log(`[JSStockInfoChart::OnSize] devicePixelRatio=${window.devicePixelRatio}, height=${this.CanvasElement.height}, width=${this.CanvasElement.width}`);
56
+
57
+ if (this.JSChartContainer && this.JSChartContainer.OnSize)
58
+ {
59
+ this.JSChartContainer.OnSize();
60
+ }
61
+ }
62
+
63
+ this.SetOption=function(option)
64
+ {
65
+ var chart=this.CreateJSStockInfoChartContainer(option);
66
+
67
+ if (!chart) return false;
68
+
69
+ if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
70
+
71
+ this.JSChartContainer=chart;
72
+ this.DivElement.JSChart=this; //div中保存一份
73
+
74
+ if (option.EnableResize==true) this.CreateResizeListener();
75
+
76
+ if (option.Symbol)
77
+ {
78
+ chart.ChangeSymbol(option.Symbol); //下载列表码表
79
+ }
80
+ else
81
+ {
82
+ chart.Draw();
83
+ }
84
+ }
85
+
86
+ this.CreateResizeListener=function()
87
+ {
88
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
89
+ this.ResizeListener.observe(this.DivElement);
90
+ }
91
+
92
+ this.OnDivResize=function(entries)
93
+ {
94
+ JSConsole.Chart.Log("[JSStockInfoChart::OnDivResize] entries=", entries);
95
+
96
+ this.OnSize();
97
+ }
98
+
99
+ //切换股票代码接口
100
+ this.ChangeSymbol=function(symbol, option)
101
+ {
102
+ if (this.JSChartContainer) this.JSChartContainer.ChangeSymbol(symbol,option);
103
+ }
104
+
105
+ this.CreateJSStockInfoChartContainer=function(option)
106
+ {
107
+ var chart=new JSStockInfoChartContainer(this.CanvasElement);
108
+ chart.Create(option);
109
+
110
+ this.SetChartBorder(chart, option);
111
+
112
+ if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) chart.SetColumn(option.Column);
113
+ if (IFrameSplitOperator.IsNonEmptyArray(option.HeaderColumn)) chart.SetHeaderColumn(option.HeaderColumn);
114
+ //是否自动更新
115
+ if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
116
+
117
+ if (option.IsAutoUpdate!=null) chart.IsAutoUpdate=option.IsAutoUpdate;
118
+ if (option.AutoUpdateFrequency>0) chart.AutoUpdateFrequency=option.AutoUpdateFrequency;
119
+
120
+ //注册事件
121
+ if (option.EventCallback)
122
+ {
123
+ for(var i=0;i<option.EventCallback.length;++i)
124
+ {
125
+ var item=option.EventCallback[i];
126
+ chart.AddEventCallback(item);
127
+ }
128
+ }
129
+
130
+ return chart;
131
+ }
132
+
133
+ this.SetChartBorder=function(chart, option)
134
+ {
135
+ if (!option.Border) return;
136
+
137
+ var item=option.Border;
138
+ if (IFrameSplitOperator.IsNumber(option.Border.Left)) chart.Frame.ChartBorder.Left=option.Border.Left;
139
+ if (IFrameSplitOperator.IsNumber(option.Border.Right)) chart.Frame.ChartBorder.Right=option.Border.Right;
140
+ if (IFrameSplitOperator.IsNumber(option.Border.Top)) chart.Frame.ChartBorder.Top=option.Border.Top;
141
+ if (IFrameSplitOperator.IsNumber(option.Border.Bottom)) chart.Frame.ChartBorder.Bottom=option.Border.Bottom;
142
+
143
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
144
+ chart.Frame.ChartBorder.Left*=pixelTatio;
145
+ chart.Frame.ChartBorder.Right*=pixelTatio;
146
+ chart.Frame.ChartBorder.Top*=pixelTatio;
147
+ chart.Frame.ChartBorder.Bottom*=pixelTatio;
148
+ }
149
+
150
+ //事件回调
151
+ this.AddEventCallback=function(obj)
152
+ {
153
+ if(this.JSChartContainer && typeof(this.JSChartContainer.AddEventCallback)=='function')
154
+ {
155
+ JSConsole.Chart.Log('[JSStockInfoChart:AddEventCallback] obj=', obj);
156
+ this.JSChartContainer.AddEventCallback(obj);
157
+ }
158
+ }
159
+
160
+ //重新加载配置
161
+ this.ReloadResource=function(option)
162
+ {
163
+ if(this.JSChartContainer && typeof(this.JSChartContainer.ReloadResource)=='function')
164
+ {
165
+ JSConsole.Chart.Log('[JSStockInfoChart:ReloadResource] ');
166
+ this.JSChartContainer.ReloadResource(option);
167
+ }
168
+ }
169
+
170
+ this.ChartDestroy=function()
171
+ {
172
+ if (this.JSChartContainer && typeof (this.JSChartContainer.ChartDestroy) == 'function')
173
+ {
174
+ this.JSChartContainer.ChartDestroy();
175
+ }
176
+ }
177
+
178
+ this.Draw=function()
179
+ {
180
+ if(this.JSChartContainer && typeof(this.JSChartContainer.Draw)=='function')
181
+ {
182
+ JSConsole.Chart.Log('[JSStockInfoChart:Draw] ');
183
+ this.JSChartContainer.Draw();
184
+ }
185
+ }
186
+ }
187
+
188
+ JSStockInfoChart.Init=function(divElement)
189
+ {
190
+ var jsChartControl=new JSStockInfoChart(divElement);
191
+ jsChartControl.OnSize();
192
+
193
+ return jsChartControl;
194
+ }
195
+
196
+ //自定义风格
197
+ JSStockInfoChart.SetStyle=function(option)
198
+ {
199
+ if (option) g_JSChartResource.SetStyle(option);
200
+ }
201
+
202
+ //获取颜色配置 (JSStockInfoChart.Init()之前)
203
+ JSStockInfoChart.GetResource=function()
204
+ {
205
+ return g_JSChartResource;
206
+ }
207
+
208
+ JSStockInfoChart.GetfloatPrecision=function(symbol)
209
+ {
210
+ return GetfloatPrecision(symbol);
211
+ }
212
+
213
+
214
+ function JSStockInfoChartContainer(uielement)
215
+ {
216
+ this.ClassName='JSStockInfoChartContainer';
217
+ this.Frame; //框架画法
218
+ this.ChartPaint=[]; //图形画法
219
+ this.ChartSplashPaint=null; //等待提示
220
+ this.LoadDataSplashTitle="数据加载中"; //下载数据提示信息
221
+
222
+ this.Canvas=uielement.getContext("2d"); //画布
223
+
224
+ this.Symbol; //代码
225
+ this.NetworkFilter; //数据回调接口
226
+ this.Data=
227
+ {
228
+ Name:null,
229
+ YClose:null, //昨收盘
230
+ Symbol:null,
231
+
232
+ Buys:
233
+ [
234
+ { Name:"买一", Price:null, Vol:null, Amount:null },
235
+ { Name:"买二", Price:null, Vol:null, Amount:null },
236
+ { Name:"买三", Price:null, Vol:null, Amount:null },
237
+ { Name:"买四", Price:null, Vol:null, Amount:null },
238
+ { Name:"买五", Price:null, Vol:null, Amount:null },
239
+ { Name:"买六", Price:null, Vol:null, Amount:null },
240
+ { Name:"买七", Price:null, Vol:null, Amount:null },
241
+ { Name:"买八", Price:null, Vol:null, Amount:null },
242
+ { Name:"买九", Price:null, Vol:null, Amount:null },
243
+ { Name:"买十", Price:null, Vol:null, Amount:null },
244
+ ],
245
+
246
+ Sells:
247
+ [
248
+ { Name:"卖一", Price:null, Vol:null, Amount:null },
249
+ { Name:"卖二", Price:null, Vol:null, Amount:null },
250
+ { Name:"卖三", Price:null, Vol:null, Amount:null },
251
+ { Name:"卖四", Price:null, Vol:null, Amount:null },
252
+ { Name:"卖五", Price:null, Vol:null, Amount:null },
253
+ { Name:"卖六", Price:null, Vol:null, Amount:null },
254
+ { Name:"卖七", Price:null, Vol:null, Amount:null },
255
+ { Name:"卖八", Price:null, Vol:null, Amount:null },
256
+ { Name:"卖九", Price:null, Vol:null, Amount:null },
257
+ { Name:"卖十", Price:null, Vol:null, Amount:null },
258
+ ],
259
+
260
+ MapData:new Map(), //key=, { Value:, Text:, }
261
+ };
262
+ //股票数据
263
+ this.BorderData={ MapData:null }; //key=Field Value:[null, {ExePrice} ,{ExePrice} ]
264
+
265
+ this.MapStockData;
266
+
267
+ //事件回调
268
+ this.mapEvent=new Map(); //通知外部调用 key:JSCHART_EVENT_ID value:{Callback:回调,}
269
+
270
+ this.AutoUpdateTimer=null;
271
+ this.AutoUpdateFrequency=15000; //15秒更新一次数据
272
+
273
+ this.UIElement=uielement;
274
+
275
+ this.IsDestroy=false; //是否已经销毁了
276
+
277
+ this.ChartDestroy=function() //销毁
278
+ {
279
+ this.IsDestroy=true;
280
+ this.StopAutoUpdate();
281
+ }
282
+
283
+ //设置事件回调
284
+ //{event:事件id, callback:回调函数}
285
+ this.AddEventCallback=function(object)
286
+ {
287
+ if (!object || !object.event || !object.callback) return;
288
+
289
+ var data={Callback:object.callback, Source:object};
290
+ this.mapEvent.set(object.event,data);
291
+ }
292
+
293
+ this.ClearData=function()
294
+ {
295
+ this.Data.Name=null;
296
+ this.Data.YClose=null;
297
+
298
+ this.Data.Buys=
299
+ [
300
+ { Name:"买一", Price:null, Vol:null, Amount:null },
301
+ { Name:"买二", Price:null, Vol:null, Amount:null },
302
+ { Name:"买三", Price:null, Vol:null, Amount:null },
303
+ { Name:"买四", Price:null, Vol:null, Amount:null },
304
+ { Name:"买五", Price:null, Vol:null, Amount:null },
305
+ { Name:"买六", Price:null, Vol:null, Amount:null },
306
+ { Name:"买七", Price:null, Vol:null, Amount:null },
307
+ { Name:"买八", Price:null, Vol:null, Amount:null },
308
+ { Name:"买九", Price:null, Vol:null, Amount:null },
309
+ { Name:"买十", Price:null, Vol:null, Amount:null },
310
+ ];
311
+
312
+ this.Data.Sells=
313
+ [
314
+ { Name:"卖一", Price:null, Vol:null, Amount:null },
315
+ { Name:"卖二", Price:null, Vol:null, Amount:null },
316
+ { Name:"卖三", Price:null, Vol:null, Amount:null },
317
+ { Name:"卖四", Price:null, Vol:null, Amount:null },
318
+ { Name:"卖五", Price:null, Vol:null, Amount:null },
319
+ { Name:"卖六", Price:null, Vol:null, Amount:null },
320
+ { Name:"卖七", Price:null, Vol:null, Amount:null },
321
+ { Name:"卖八", Price:null, Vol:null, Amount:null },
322
+ { Name:"卖九", Price:null, Vol:null, Amount:null },
323
+ { Name:"卖十", Price:null, Vol:null, Amount:null },
324
+ ];
325
+
326
+ this.Data.MapData=new Map();
327
+ }
328
+
329
+ this.ChangeSymbol=function(symbol, option)
330
+ {
331
+ this.CancelAutoUpdate();
332
+ this.ClearData();
333
+ this.Symbol=symbol;
334
+ this.Data.Symbol=symbol;
335
+
336
+ if (option)
337
+ {
338
+ if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) this.SetColumn(option.Column);
339
+ if (IFrameSplitOperator.IsNumber(option.BuySellCount)) this.SetBuySellCount(option.BuySellCount);
340
+ }
341
+
342
+ this.Draw();
343
+ this.RequestStockData();
344
+
345
+ if (this.IsAutoUpdate)
346
+ {
347
+ var frequency=this.AutoUpdateFrequency;
348
+ setInterval(()=>
349
+ {
350
+ var marketStatus=MARKET_SUFFIX_NAME.GetMarketStatus(this.Symbol);
351
+ if (marketStatus==0 || marketStatus==3) //闭市,盘后
352
+ return;
353
+
354
+ this.RequestStockData();
355
+ }, frequency)
356
+ }
357
+ }
358
+
359
+ this.CancelAutoUpdate=function() //关闭停止更新
360
+ {
361
+ if (this.AutoUpdateTimer)
362
+ {
363
+ clearInterval(this.AutoUpdateTimer);
364
+ this.AutoUpdateTimer = null;
365
+ }
366
+ }
367
+
368
+ this.StopAutoUpdate=function()
369
+ {
370
+ this.CancelAutoUpdate();
371
+ if (!this.IsAutoUpdate) return;
372
+ this.IsAutoUpdate=false;
373
+ }
374
+
375
+ this.RequestStockData=function()
376
+ {
377
+ if (this.NetworkFilter)
378
+ {
379
+ var obj=
380
+ {
381
+ Name:'JSStockInfoChartContainer::RequestStockData', //类名::函数名
382
+ Explain:'股票5档实时数据',
383
+ Request: { Data:{symbol:this.Symbol} },
384
+ Self:this,
385
+ PreventDefault:false
386
+ };
387
+
388
+ this.NetworkFilter(obj, (data)=>
389
+ {
390
+ this.RecvStockData(data);
391
+ });
392
+
393
+ if (obj.PreventDefault==true) return; //已被上层替换,不调用默认的网络请求
394
+ }
395
+ }
396
+
397
+ this.RecvStockData=function(recv)
398
+ {
399
+ if (!recv) return;
400
+
401
+ if (recv.name) this.Data.Name=recv.Name;
402
+ if (IFrameSplitOperator.IsNumber(recv.yclose)) this.Data.YClose=recv.yclose;
403
+ if (recv.name) this.Data.Name=recv.name;
404
+
405
+ if (IFrameSplitOperator.IsNonEmptyArray(recv.data))
406
+ {
407
+ for(var i=0;i<recv.data.length;++i)
408
+ {
409
+ var item=recv.data[i];
410
+ if (item.Name=="Buys")
411
+ {
412
+ if (IFrameSplitOperator.IsNonEmptyArray(item.Value))
413
+ {
414
+ for(var j=0;j<item.Value.length && j<this.Data.Buys.length;++j)
415
+ {
416
+ var srcItem=item.Value[j];
417
+ var destItem=this.Data.Buys[j];
418
+ destItem.Price=srcItem.Price;
419
+ destItem.Vol=srcItem.Vol;
420
+ }
421
+ }
422
+ }
423
+ else if (item.Name=="Sells")
424
+ {
425
+ if (IFrameSplitOperator.IsNonEmptyArray(item.Value))
426
+ {
427
+ for(var j=0;j<item.Value.length && j<this.Data.Sells.length;++j)
428
+ {
429
+ var srcItem=item.Value[j];
430
+ var destItem=this.Data.Sells[j];
431
+ destItem.Price=srcItem.Price;
432
+ destItem.Vol=srcItem.Vol;
433
+ }
434
+ }
435
+ }
436
+ else if (item.Name=="Symbol")
437
+ {
438
+ this.Data.Symbol=item.Value.Text;
439
+ }
440
+ else
441
+ {
442
+ this.Data.MapData.set(item.Name, item.Value);
443
+ }
444
+ }
445
+ }
446
+
447
+ this.Draw();
448
+ }
449
+
450
+ //创建
451
+ this.Create=function(option)
452
+ {
453
+ this.UIElement.JSChartContainer=this;
454
+
455
+ //创建框架
456
+ this.Frame=new JSStockInfoFrame();
457
+ this.Frame.ChartBorder=new ChartBorder();
458
+ this.Frame.ChartBorder.UIElement=this.UIElement;
459
+ this.Frame.ChartBorder.Top=30;
460
+ this.Frame.ChartBorder.Left=5;
461
+ this.Frame.ChartBorder.Bottom=20;
462
+ this.Frame.Canvas=this.Canvas;
463
+
464
+ //创建表格
465
+ var chart=new ChartStockData();
466
+ chart.Frame=this.Frame;
467
+ chart.ChartBorder=this.Frame.ChartBorder;
468
+ chart.Canvas=this.Canvas;
469
+ chart.UIElement=this.UIElement;
470
+ chart.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
471
+ chart.Data=this.Data;
472
+ chart.BorderData=this.BorderData;
473
+ chart.GlobalOption=this.GlobalOption;
474
+ chart.FixedRowData=this.FixedRowData;
475
+ chart.SortInfo=this.SortInfo;
476
+ this.ChartPaint[0]=chart;
477
+
478
+
479
+ if (option)
480
+ {
481
+
482
+ }
483
+
484
+
485
+
486
+ /*
487
+ this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
488
+ this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
489
+ this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
490
+ this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
491
+ this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
492
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
493
+ */
494
+ }
495
+
496
+ this.Draw=function()
497
+ {
498
+ if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
499
+
500
+ this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);
501
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
502
+ this.Canvas.lineWidth=pixelTatio; //手机端需要根据分辨率比调整线段宽度
503
+
504
+ this.Frame.Draw();
505
+ this.Frame.DrawLogo();
506
+
507
+ //框架内图形
508
+ for(var i=0;i<this.ChartPaint.length;++i)
509
+ {
510
+ var item=this.ChartPaint[i];
511
+ item.Draw();
512
+ }
513
+
514
+ for(var i=0; i<this.ChartPaint.length; ++i)
515
+ {
516
+ var item=this.ChartPaint[i];
517
+ item.Draw();
518
+ }
519
+ }
520
+
521
+ this.OnSize=function()
522
+ {
523
+ if (!this.Frame) return;
524
+
525
+ this.SetSizeChange(true);
526
+ this.Draw();
527
+ }
528
+
529
+ this.SetSizeChange=function(bChanged)
530
+ {
531
+ for(var i=0;i<this.ChartPaint.length;++i)
532
+ {
533
+ var chart=this.ChartPaint[i];
534
+ if (chart) chart.SizeChange=bChanged;
535
+ }
536
+ }
537
+
538
+ this.ReloadResource=function(option)
539
+ {
540
+ this.Frame.ReloadResource(option);
541
+
542
+ for(var i=0;i<this.ChartPaint.length;++i)
543
+ {
544
+ var item=this.ChartPaint[i];
545
+ if (item.ReloadResource) item.ReloadResource(option);
546
+ }
547
+
548
+ if (option && (option.Redraw || option.Draw))
549
+ {
550
+ this.SetSizeChange(true);
551
+ this.Draw();
552
+ }
553
+ }
554
+
555
+ this.SetColumn=function(aryColunm, option)
556
+ {
557
+ var chart=this.ChartPaint[0];
558
+ if (!chart) return;
559
+
560
+ chart.SetColumn(aryColunm);
561
+ chart.SizeChange=true;
562
+
563
+ if (option && option.Redraw) this.Draw();
564
+ }
565
+
566
+ this.SetHeaderColumn=function(aryColunm, option)
567
+ {
568
+ var chart=this.ChartPaint[0];
569
+ if (!chart) return;
570
+
571
+ chart.SetHeaderColumn(aryColunm);
572
+ chart.SizeChange=true;
573
+
574
+ if (option && option.Redraw) this.Draw();
575
+ }
576
+
577
+ this.SetBuySellCount=function(count, option)
578
+ {
579
+ var chart=this.ChartPaint[0];
580
+ if (!chart) return;
581
+
582
+ chart.BuySellCount=count;
583
+ chart.SizeChange=true;
584
+
585
+ if (option && option.Redraw) this.Draw();
586
+ }
587
+ }
588
+
589
+ function JSStockInfoFrame()
590
+ {
591
+ this.ChartBorder;
592
+ this.Canvas; //画布
593
+
594
+ this.BorderLine=null; //1=上 2=下 4=左 8=右
595
+ this.ClassName="JSStockInfoFrame";
596
+
597
+ this.BorderColor=g_JSChartResource.StockInfo.BorderColor; //边框线
598
+
599
+ this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;
600
+ this.LogoTextFont=g_JSChartResource.FrameLogo.Font;
601
+
602
+ this.ReloadResource=function(resource)
603
+ {
604
+ this.BorderColor=g_JSChartResource.StockInfo.BorderColor; //边框线
605
+ this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;
606
+ this.LogoTextFont=g_JSChartResource.FrameLogo.Font;
607
+ }
608
+
609
+ this.Draw=function()
610
+ {
611
+ var left=ToFixedPoint(this.ChartBorder.GetLeft());
612
+ var top=ToFixedPoint(this.ChartBorder.GetTop());
613
+ var right=ToFixedPoint(this.ChartBorder.GetRight());
614
+ var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
615
+ var width=right-left;
616
+ var height=bottom-top;
617
+
618
+ if (!IFrameSplitOperator.IsNumber(this.BorderLine))
619
+ {
620
+ this.Canvas.strokeStyle=this.BorderColor;
621
+ this.Canvas.strokeRect(left,top,width,height);
622
+ }
623
+ else
624
+ {
625
+ this.Canvas.strokeStyle=this.BorderColor;
626
+ this.Canvas.beginPath();
627
+
628
+ if ((this.BorderLine&1)>0) //上
629
+ {
630
+ this.Canvas.moveTo(left,top);
631
+ this.Canvas.lineTo(right,top);
632
+ }
633
+
634
+ if ((this.BorderLine&2)>0) //下
635
+ {
636
+ this.Canvas.moveTo(left,bottom);
637
+ this.Canvas.lineTo(right,bottom);
638
+ }
639
+
640
+ if ((this.BorderLine&4)>0) //左
641
+ {
642
+ this.Canvas.moveTo(left,top);
643
+ this.Canvas.lineTo(left,bottom);
644
+ }
645
+
646
+ if ((this.BorderLine&8)>0) //右
647
+ {
648
+ this.Canvas.moveTo(right,top);
649
+ this.Canvas.lineTo(right,bottom);
650
+ }
651
+
652
+ this.Canvas.stroke();
653
+ }
654
+ }
655
+
656
+ this.DrawLogo=function()
657
+ {
658
+ var text=g_JSChartResource.FrameLogo.Text;
659
+ if (!IFrameSplitOperator.IsString(text)) return;
660
+
661
+ this.Canvas.fillStyle=this.LogoTextColor;
662
+ this.Canvas.font=this.LogoTextFont;
663
+ this.Canvas.textAlign = 'right';
664
+ this.Canvas.textBaseline = 'bottom';
665
+
666
+ var x=this.ChartBorder.GetRight()-30;
667
+ var y=this.ChartBorder.GetBottom()-5;
668
+ this.Canvas.fillText(text,x,y);
669
+ }
670
+ }
671
+
672
+
673
+ function ChartStockData()
674
+ {
675
+ this.Canvas; //画布
676
+ this.ChartBorder; //边框信息
677
+ this.ChartFrame; //框架画法
678
+ this.Name; //名称
679
+ this.ClassName='ChartStockData'; //类名
680
+ this.UIElement;
681
+ this.GetEventCallback; //获取事件
682
+ this.Data; //数据
683
+ this.BorderData;
684
+ this.SizeChange=true;
685
+ this.Decimal=2; //价格小数位数
686
+
687
+ this.UpColor=g_JSChartResource.StockInfo.UpTextColor;
688
+ this.DownColor=g_JSChartResource.StockInfo.DownTextColor;
689
+ this.UnchangeColor=g_JSChartResource.StockInfo.UnchangeTextColor;
690
+
691
+ this.HeaderConfig=CloneData(g_JSChartResource.StockInfo.Header);
692
+ this.HeaderColumn=
693
+ [
694
+ { Name:"现价", Key:"Price", ColorType:3, FloatPrecision:-1, DefaultText:"--.--" },
695
+ { Name:"涨幅", Key:"Increase", ColorType:1, FloatPrecision:2, StringFormat:"{Value}%", DefaultText:"--.--%" },
696
+ { Name:"涨跌", Key:"UpDown",ColorType:1, FloatPrecision:-1, DefaultText:"--.--" }
697
+ ]
698
+
699
+ //买卖5档配置
700
+ this.BuySellConfig=CloneData(g_JSChartResource.StockInfo.BuySell);
701
+ this.BuySellCount=5; //显示几档买卖盘
702
+
703
+ this.TableConfig=CloneData(g_JSChartResource.StockInfo.Table);
704
+
705
+ //显示的字段
706
+ this.Column=
707
+ [
708
+ [{ Name:"涨停价", Key:"UpLimit",ColorType:3, FloatPrecision:-1 }, { Name:"跌停价", Key:"DownLimit" , ColorType:3, FloatPrecision:-1 }],
709
+ [{ Name:"现价", Key:"Price", ColorType:3, FloatPrecision:-1 }, { Name:"今开", Key:"Open",ColorType:3, FloatPrecision:-1 }],
710
+ [{ Name:"最高", Key:"High",ColorType:3, FloatPrecision:-1 }, { Name:"最低", Key:"Low",ColorType:3, FloatPrecision:-1 }],
711
+ [{ Name:"涨幅", Key:"Increase", ColorType:1, FloatPrecision:2, StringFormat:"{Value}%" }, { Name:"涨跌", Key:"UpDown",ColorType:1, FloatPrecision:-1 }],
712
+ [{ Name:"振幅", Key:"Amplitude", FloatPrecision:2, StringFormat:"{Value}%" }, { Name:"换手率", Key:"Exchange", FloatPrecision:2, StringFormat:"{Value}%" }],
713
+
714
+ [{ Name:"总量", Key:"Vol", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }, { Name:"总额", Key:"Amount", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }],
715
+ [{ Name:"内盘", Key:"InVol", ColorType:4, FloatPrecision:0 }, { Name:"外盘", Key:"OutVol",ColorType:5, FloatPrecision:0 }],
716
+ [{ Name:"TTM", Key:"PE_TTM", FloatPrecision:2 }, { Name:"市净率", Key:"PB", FloatPrecision:2 }],
717
+ [{ Name:"流通市值", Key:"FlowMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }, { Name:"总市值", Key:"TotalMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }],
718
+ ]
719
+
720
+ this.ReloadResource=function(resource)
721
+ {
722
+ this.UpColor=g_JSChartResource.StockInfo.UpTextColor;
723
+ this.DownColor=g_JSChartResource.StockInfo.DownTextColor;
724
+ this.UnchangeColor=g_JSChartResource.StockInfo.UnchangeTextColor;
725
+
726
+ this.HeaderConfig=CloneData(g_JSChartResource.StockInfo.Header);
727
+
728
+ //买卖5档配置
729
+ this.BuySellConfig=CloneData(g_JSChartResource.StockInfo.BuySell);
730
+
731
+ this.TableConfig=CloneData(g_JSChartResource.StockInfo.Table);
732
+ }
733
+
734
+ this.SetColumn=function(aryColumn)
735
+ {
736
+ this.Column=[];
737
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryColumn)) return;
738
+
739
+ for(var i=0;i<aryColumn.length;++i)
740
+ {
741
+ var item=aryColumn[i];
742
+ if (!item) continue;
743
+ this.Column.push(CloneData(item));
744
+ }
745
+ }
746
+
747
+ this.SetHeaderColumn=function(aryColumn)
748
+ {
749
+ this.HeaderColumn=[];
750
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryColumn)) return;
751
+
752
+ for(var i=0;i<aryColumn.length;++i)
753
+ {
754
+ var item=aryColumn[i];
755
+ if (!item) continue;
756
+ this.HeaderColumn.push(CloneData(item));
757
+ }
758
+ }
759
+
760
+ this.Draw=function()
761
+ {
762
+ this.Decimal=GetfloatPrecision(this.Symbol);
763
+ var border=this.ChartBorder.GetBorder();
764
+ var position = { Left:border.Left, Right:border.Right, Top:border.Top, Width:border.Right-border.Left, Border:border };
765
+ this.DrawHeader(position);
766
+ this.DrawBuySell(position);
767
+ this.DrawTable(position);
768
+ }
769
+
770
+ this.DrawHeader=function(position)
771
+ {
772
+ var config=this.HeaderConfig;
773
+ var top=position.Top;
774
+ var left=position.Left;
775
+ var xText=left;
776
+ var yText=top;
777
+
778
+ this.Canvas.font=config.Name.Font;
779
+ var nameHeight=this.Canvas.measureText("擎").width;
780
+ nameHeight+=config.Name.Margin.Top+config.Name.Margin.Bottom;
781
+
782
+ this.Canvas.font=config.Symbol.Font;
783
+ var symbolHeight=this.Canvas.measureText("擎").width;
784
+ symbolHeight+=config.Symbol.Margin.Top+config.Symbol.Margin.Bottom;
785
+
786
+ var lineHeight=Math.max(symbolHeight, nameHeight);
787
+
788
+ this.Canvas.textAlign = 'left';
789
+ this.Canvas.textBaseline = 'bottom';
790
+ if (this.Data.Name)
791
+ {
792
+ var text=this.Data.Name;
793
+ xText+=config.Name.Margin.Left;
794
+ var yBottom=yText+lineHeight-config.Name.Margin.Bottom+config.Name.Margin.YOffset;
795
+
796
+ this.Canvas.font=config.Name.Font;
797
+ this.Canvas.fillStyle=config.Name.Color;
798
+ this.Canvas.fillText(text,xText,yBottom);
799
+ var textWidth=this.Canvas.measureText(text).width;
800
+
801
+ xText+=textWidth+config.Name.Margin.Right;
802
+ }
803
+
804
+ if (this.Data.Symbol)
805
+ {
806
+ var text=MARKET_SUFFIX_NAME.GetShortSymbol(this.Data.Symbol);
807
+ xText+=config.Symbol.Margin.Left;
808
+ var yBottom=yText+lineHeight-config.Symbol.Margin.Bottom+config.Symbol.Margin.YOffset;
809
+
810
+ this.Canvas.font=config.Symbol.Font;
811
+ this.Canvas.fillStyle=config.Symbol.Color;
812
+ this.Canvas.fillText(text,xText,yBottom);
813
+ var textWidth=this.Canvas.measureText(text).width;
814
+
815
+ xText+=textWidth+config.Symbol.Margin.Right;
816
+ }
817
+
818
+ yText+=lineHeight;
819
+
820
+ if (IFrameSplitOperator.IsNonEmptyArray(this.HeaderColumn))
821
+ {
822
+ lineHeight=0;
823
+ for(var i=0;i<this.HeaderColumn.length && i<config.AryCell.length;++i)
824
+ {
825
+ var subConfig=config.AryCell[i];
826
+ this.Canvas.font=subConfig.Font;
827
+ var textHeight=this.Canvas.measureText("擎").width;
828
+ textHeight+=subConfig.Margin.Top+subConfig.Margin.Bottom;
829
+ if (lineHeight<textHeight) lineHeight=textHeight;
830
+ }
831
+
832
+ var xText=left;
833
+ for(var i=0;i<this.HeaderColumn.length && i<config.AryCell.length;++i)
834
+ {
835
+ var item=this.HeaderColumn[i];
836
+ var text="--.--";
837
+ color=config.TextColor;
838
+ if (item.DefaultText) text=item.DefaultText;
839
+ var subConfig=config.AryCell[i];
840
+ if (this.Data.MapData && this.Data.MapData.has(item.Key))
841
+ {
842
+ var dataItem=this.Data.MapData.get(item.Key);
843
+ var text=this.FormatValue(item, dataItem);
844
+
845
+ if (item.ColorType===3 && IFrameSplitOperator.IsNumber(dataItem.Value))
846
+ color=this.GetPriceColor(dataItem.Value);
847
+ else if (item.ColorType==1 && IFrameSplitOperator.IsNumber(dataItem.Value))
848
+ color=this.GetUpDownColor(dataItem.Value,0);
849
+ else if (item.ColorType==4)
850
+ color=this.UpColor;
851
+ else if (item.ColorType==5)
852
+ color=this.DownColor;
853
+ }
854
+
855
+ if (item.TextColor) color=item.TextColor;
856
+
857
+ if (text)
858
+ {
859
+ this.Canvas.font=subConfig.Font;
860
+ var textWidth=this.Canvas.measureText(text).width;
861
+ var x=xText+subConfig.Margin.Left;
862
+ this.Canvas.fillStyle=color;
863
+ var yBottom=yText+lineHeight-subConfig.Margin.Bottom+subConfig.Margin.YOffset;
864
+ this.Canvas.fillText(text,x,yBottom);
865
+
866
+ xText+=subConfig.Margin.Left+subConfig.Margin.Right+textWidth;
867
+ }
868
+ }
869
+
870
+ yText+=lineHeight;
871
+ }
872
+
873
+ position.Top=yText;
874
+
875
+ if (config.BottomLine && config.BottomLine.Enable)
876
+ {
877
+ var xLeft=position.Border.Left, xRight=position.Border.Right;
878
+ this.Canvas.strokeStyle=config.BottomLine.Color;
879
+ this.Canvas.lineWidth=1*GetDevicePixelRatio();
880
+ this.Canvas.beginPath();
881
+ this.Canvas.moveTo(xLeft,ToFixedPoint(yText));
882
+ this.Canvas.lineTo(xRight,ToFixedPoint(yText));
883
+ this.Canvas.stroke();
884
+ }
885
+ }
886
+
887
+ //买卖5档
888
+ this.DrawBuySell=function(position)
889
+ {
890
+ if (this.BuySellCount<=0) return;
891
+
892
+ var config=this.BuySellConfig;
893
+ var top=position.Top;
894
+ var left=position.Left+config.Margin.Left;
895
+ var cellWidth=(position.Width-config.Margin.Left-config.Margin.Right)/4;
896
+
897
+ var yText=top+config.Margin.Top;
898
+ var xText=left;
899
+
900
+ this.Canvas.font=config.Font;
901
+ this.Canvas.textAlign = 'left';
902
+ this.Canvas.textBaseline = 'bottom';
903
+ var cellHeight=this.Canvas.measureText("擎").width+config.CellMargin.Top+config.CellMargin.Bottom;
904
+ var count=this.BuySellCount;
905
+ var sellVol=0, buyVol=0;
906
+ for(var i=count-1;i>=0;--i)
907
+ {
908
+ xText=left;
909
+ var item=this.Data.Sells[i];
910
+ this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
911
+ if (IFrameSplitOperator.IsNumber(item.Vol)) sellVol+=item.Vol;
912
+ yText+=cellHeight;
913
+ }
914
+
915
+ var yCenter=null;
916
+ if (config.CenterLine) //留出画线的位置
917
+ {
918
+ yCenter=yText;
919
+ var lineConfig=config.CenterLine;
920
+ var lineWidth=lineConfig.Width;
921
+ yText+=lineWidth;
922
+ }
923
+
924
+
925
+ for(var i=0;i<count && i<this.Data.Buys.length;++i)
926
+ {
927
+ xText=left;
928
+ var item=this.Data.Buys[i];
929
+ this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
930
+ if (IFrameSplitOperator.IsNumber(item.Vol)) buyVol+=item.Vol;
931
+ yText+=cellHeight;
932
+ }
933
+
934
+ position.Top=yText;
935
+
936
+ if (IFrameSplitOperator.IsNumber(yCenter) && config.CenterLine)
937
+ {
938
+ var lineConfig=config.CenterLine;
939
+ var xLeft=position.Border.Left, xRight=position.Border.Right;
940
+ var lineWidth=lineConfig.Width;
941
+ if (buyVol+sellVol>0)
942
+ {
943
+ var buyRate=buyVol/(buyVol+sellVol);
944
+ var barWidth=xRight-xLeft;
945
+ var buyWidth=barWidth*buyRate;
946
+ var xCenter=xLeft+buyWidth;
947
+ this.Canvas.lineWidth=lineWidth;
948
+ this.Canvas.strokeStyle=lineConfig.BuyColor;
949
+ this.Canvas.beginPath();
950
+ this.Canvas.moveTo(xLeft,ToFixedPoint2(lineWidth,yCenter));
951
+ this.Canvas.lineTo(xCenter,ToFixedPoint2(lineWidth,yCenter));
952
+ this.Canvas.stroke();
953
+
954
+ this.Canvas.strokeStyle=lineConfig.SellColor;
955
+ this.Canvas.beginPath();
956
+ this.Canvas.moveTo(xCenter,ToFixedPoint2(lineWidth,yCenter,));
957
+ this.Canvas.lineTo(xRight,ToFixedPoint2(lineWidth,yCenter));
958
+ this.Canvas.stroke();
959
+ }
960
+ else
961
+ {
962
+ this.Canvas.strokeStyle=lineConfig.NoneColor;
963
+ this.Canvas.lineWidth=lineWidth;
964
+ this.Canvas.beginPath();
965
+ this.Canvas.moveTo(xLeft,ToFixedPoint2(lineWidth,yCenter));
966
+ this.Canvas.lineTo(xRight,ToFixedPoint2(lineWidth,yCenter));
967
+ this.Canvas.stroke();
968
+ }
969
+ }
970
+
971
+ if (config.BottomLine && config.BottomLine.Enable)
972
+ {
973
+ var xLeft=position.Border.Left, xRight=position.Border.Right;
974
+ this.Canvas.strokeStyle=config.BottomLine.Color;
975
+ this.Canvas.lineWidth=1*GetDevicePixelRatio();
976
+ this.Canvas.beginPath();
977
+ this.Canvas.moveTo(xLeft,ToFixedPoint(yText));
978
+ this.Canvas.lineTo(xRight,ToFixedPoint(yText));
979
+ this.Canvas.stroke();
980
+ }
981
+
982
+ if (config.TopLine && config.TopLine.Enable)
983
+ {
984
+ var xLeft=position.Border.Left, xRight=position.Border.Right;
985
+ this.Canvas.strokeStyle=config.BottomLine.Color;
986
+ this.Canvas.lineWidth=1*GetDevicePixelRatio();
987
+ this.Canvas.beginPath();
988
+ this.Canvas.moveTo(xLeft,ToFixedPoint(top));
989
+ this.Canvas.lineTo(xRight,ToFixedPoint(top));
990
+ this.Canvas.stroke();
991
+ }
992
+ }
993
+
994
+ this.DrawBuySellItem=function(item, left, top, cellWidth, cellHeight)
995
+ {
996
+ var config=this.BuySellConfig;
997
+ var xText=left;
998
+ var yBottom=top+cellHeight-config.CellMargin.Bottom+config.CellMargin.YOffset;
999
+
1000
+ if (item.Name)
1001
+ {
1002
+ this.Canvas.fillStyle=config.TitleColor;
1003
+ this.Canvas.fillText(item.Name,xText+config.CellMargin.Left,yBottom);
1004
+ }
1005
+ xText+=cellWidth;
1006
+
1007
+ if (IFrameSplitOperator.IsNumber(item.Price))
1008
+ {
1009
+ var text=item.Price.toFixed(this.Decimal);
1010
+ var textWidth=this.Canvas.measureText(text).width;
1011
+ var x=xText+cellWidth-textWidth-config.CellMargin.Right;
1012
+ this.Canvas.fillStyle=this.GetPriceColor(item.Price);
1013
+ this.Canvas.fillText(text,x,yBottom);
1014
+ }
1015
+ xText+=cellWidth;
1016
+
1017
+ xText+=cellWidth;
1018
+
1019
+ if (IFrameSplitOperator.IsNumber(item.Vol))
1020
+ {
1021
+ var text=item.Vol.toFixed(0);
1022
+ var textWidth=this.Canvas.measureText(text).width;
1023
+ var x=xText+cellWidth-textWidth-config.CellMargin.Right;
1024
+ this.Canvas.fillStyle=config.VolColor;
1025
+ this.Canvas.fillText(text,x,yBottom);
1026
+ }
1027
+ }
1028
+
1029
+
1030
+ this.DrawTable=function(position)
1031
+ {
1032
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Column)) return;
1033
+
1034
+ var config=this.TableConfig;
1035
+ var top=position.Top;
1036
+ var left=position.Left+config.Margin.Left;
1037
+ var cellWidth=(position.Width-config.Margin.Left-config.Margin.Right)/4;
1038
+
1039
+ var yText=top+config.Margin.Top;
1040
+ var xText=left;
1041
+
1042
+ this.Canvas.font=config.Font;
1043
+ this.Canvas.textAlign = 'left';
1044
+ this.Canvas.textBaseline = 'bottom';
1045
+ var cellHeight=this.Canvas.measureText("擎").width+config.CellMargin.Top+config.CellMargin.Bottom;
1046
+
1047
+ for(var i=0;i<this.Column.length;++i)
1048
+ {
1049
+ xText=left;
1050
+ var item=this.Column[i];
1051
+ if (!item || !IFrameSplitOperator.IsNonEmptyArray(item)) continue;
1052
+ this.DrawRowItem(item, xText, yText, cellWidth, cellHeight);
1053
+
1054
+ yText+=cellHeight;
1055
+ }
1056
+ }
1057
+
1058
+ this.DrawRowItem=function(aryData, left, top, cellWidth, cellHeight)
1059
+ {
1060
+ var config=this.TableConfig;
1061
+ var xText=left;
1062
+ var yBottom=top+cellHeight-config.CellMargin.Bottom+config.CellMargin.YOffset;
1063
+
1064
+ for(var i=0;i<aryData.length && i<2;++i)
1065
+ {
1066
+ var item=aryData[i];
1067
+ if (item)
1068
+ {
1069
+ if (item.Name)
1070
+ {
1071
+ this.Canvas.fillStyle=config.TitleColor;
1072
+ this.Canvas.fillText(item.Name,xText+config.CellMargin.Left,yBottom);
1073
+ }
1074
+ xText+=cellWidth;
1075
+
1076
+ if (this.Data.MapData && this.Data.MapData.has(item.Key))
1077
+ {
1078
+ var dataItem=this.Data.MapData.get(item.Key);
1079
+ color=config.TextColor;
1080
+
1081
+ var text=this.FormatValue(item, dataItem);
1082
+
1083
+ if (item.ColorType===3 && IFrameSplitOperator.IsNumber(dataItem.Value))
1084
+ color=this.GetPriceColor(dataItem.Value);
1085
+ else if (item.ColorType==1 && IFrameSplitOperator.IsNumber(dataItem.Value))
1086
+ color=this.GetUpDownColor(dataItem.Value,0);
1087
+ else if (item.ColorType==4)
1088
+ color=this.UpColor;
1089
+ else if (item.ColorType==5)
1090
+ color=this.DownColor;
1091
+
1092
+ if (item.TextColor) color=item.TextColor;
1093
+
1094
+ if (text)
1095
+ {
1096
+ if (i==0 && item.ShowType==1) //整行显示
1097
+ {
1098
+ var textWidth=this.Canvas.measureText(text).width;
1099
+ var x=xText+(cellWidth*3)-textWidth-config.CellMargin.Right;
1100
+ this.Canvas.fillStyle=color;
1101
+ this.Canvas.fillText(text,x,yBottom);
1102
+ break;
1103
+ }
1104
+ else
1105
+ {
1106
+ var textWidth=this.Canvas.measureText(text).width;
1107
+ var x=xText+cellWidth-textWidth-config.CellMargin.Right;
1108
+ this.Canvas.fillStyle=color;
1109
+ this.Canvas.fillText(text,x,yBottom);
1110
+ }
1111
+
1112
+ }
1113
+ }
1114
+ xText+=cellWidth;
1115
+ }
1116
+ else
1117
+ {
1118
+ xText+=cellWidth+cellWidth;
1119
+ }
1120
+ }
1121
+
1122
+ }
1123
+
1124
+
1125
+ this.FormatValue=function(column, data)
1126
+ {
1127
+ var dec=0; //小数位数
1128
+ if (IFrameSplitOperator.IsNumber(column.FloatPrecision))
1129
+ {
1130
+ if (column.FloatPrecision===-1) dec=this.Decimal;
1131
+ else dec=column.FloatPrecision;
1132
+ }
1133
+
1134
+ var text=null;
1135
+ if (!data) return text;
1136
+
1137
+ if (data.Text)
1138
+ {
1139
+ text=data.Text;
1140
+ }
1141
+ else if (IFrameSplitOperator.IsNumber(data.Value))
1142
+ {
1143
+ var value=data.Value;
1144
+ text=value.toFixed(dec);
1145
+
1146
+ //格式化
1147
+ if (column.Format && IFrameSplitOperator.IsNumber(column.Format.Type))
1148
+ {
1149
+ var format=column.Format;
1150
+ switch(format.Type)
1151
+ {
1152
+ case 1: //原始数据
1153
+ text=value.toFixed(dec);
1154
+ break;
1155
+ case 2: //千分位分割
1156
+ text=IFrameSplitOperator.FormatValueThousandsString(value, dec);
1157
+ break;
1158
+ case 3:
1159
+ var exfloatPrecision=1;
1160
+ if (IFrameSplitOperator.IsNumber(format.ExFloatPrecision)) exfloatPrecision=format.ExFloatPrecision;
1161
+ text=IFrameSplitOperator.FormatValueStringV2(value, dec,exfloatPrecision);
1162
+ break;
1163
+ }
1164
+ }
1165
+ }
1166
+
1167
+ if (column.StringFormat && text) text=column.StringFormat.replace('{Value}',text);
1168
+
1169
+ return text;
1170
+ }
1171
+
1172
+ this.GetPriceColor=function(price)
1173
+ {
1174
+ if (!IFrameSplitOperator.IsNumber(this.Data.YClose)) return this.UnchangeColor;
1175
+
1176
+ return this.GetUpDownColor(price, this.Data.YClose);
1177
+ }
1178
+
1179
+ this.GetUpDownColor=function(price, price2)
1180
+ {
1181
+ if (price>price2) return this.UpColor;
1182
+ else if (price<price2) return this.DownColor;
1183
+ else return this.UnchagneColor;
1184
+ }
1185
+ }
1186
+
1187
+
1188
+
1189
+
1190
+
1191
+
1192
+