hqchart 1.1.14104 → 1.1.14115

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.
@@ -14,12 +14,17 @@
14
14
  function JSPopMinuteChart()
15
15
  {
16
16
  this.DivDialog=null;
17
- this.DivInfoText=null;
17
+ this.TitleBox=null; //{ DivTitle, DivName, DivName }
18
18
  this.HQChart=null;
19
19
  this.DragTitle=null;
20
20
  this.Date=null;
21
21
  this.ID=Guid();
22
22
 
23
+ this.TitleColor=g_JSChartResource.PopMinuteChart.TitleColor;
24
+ this.TitleBGColor=g_JSChartResource.PopMinuteChart.TitleBGColor;
25
+ this.BGColor=g_JSChartResource.PopMinuteChart.BGColor;
26
+ this.BorderColor=g_JSChartResource.PopMinuteChart.BorderColor;
27
+
23
28
  this.Minute=
24
29
  {
25
30
  Option:JSPopMinuteChart.GetMinuteOption(),
@@ -27,9 +32,18 @@ function JSPopMinuteChart()
27
32
  Date:null,
28
33
  }
29
34
 
30
- this.Inital=function(hqchart)
35
+ this.Inital=function(hqchart, option)
31
36
  {
32
37
  this.HQChart=hqchart;
38
+
39
+ if (option)
40
+ {
41
+ if (IFrameSplitOperator.IsObject(option.Option))
42
+ {
43
+ var item=CloneData(option.Option); //复制一份出来
44
+ this.Minute.Option=Object.assign(this.Minute.Option,item);
45
+ }
46
+ }
33
47
  }
34
48
 
35
49
  this.Create=function()
@@ -37,8 +51,6 @@ function JSPopMinuteChart()
37
51
  var divDom=document.createElement('div');
38
52
  divDom.className='jchart_pop_minute_dailog';
39
53
  divDom.id=this.ID;
40
- divDom.style["background-color"]=g_JSChartResource.PopMinuteChart.BGColor;
41
- divDom.style["border-color"]=g_JSChartResource.PopMinuteChart.BorderColor;
42
54
 
43
55
  var divTitle=document.createElement("div");
44
56
  divTitle.className='jschart_pop_minute_chart_Title_Div';
@@ -62,6 +74,7 @@ function JSPopMinuteChart()
62
74
  divChart.className='jschart_pop_minute_chart';
63
75
  divDom.appendChild(divChart);
64
76
 
77
+ this.TitleBox={ DivTitle:divTitle, DivName:divInfoText, DivColor:divClose };
65
78
  this.DivDialog=divDom;
66
79
 
67
80
  var chart=JSChart.Init(divChart);
@@ -73,6 +86,19 @@ function JSPopMinuteChart()
73
86
  chart.SetOption(this.Minute.Option); //设置K线配置
74
87
 
75
88
  document.body.appendChild(divDom);
89
+
90
+ this.UpdateStyle();
91
+ }
92
+
93
+ this.UpdateStyle=function()
94
+ {
95
+ if (!this.DivDialog) return;
96
+
97
+ if (this.BGColor) this.DivDialog.style['background-color']=this.BGColor;
98
+ if (this.BorderColor) this.DivDialog.style['border-color']=this.BorderColor;
99
+
100
+ if (this.TitleBGColor) this.TitleBox.DivTitle.style['background-color']=this.TitleBGColor;
101
+ if (this.TitleColor) this.TitleBox.DivName.style['color']=this.TitleColor;
76
102
  }
77
103
 
78
104
  this.NetworkFilter=function(data, callback)
@@ -100,7 +126,7 @@ function JSPopMinuteChart()
100
126
  {
101
127
  if (this.DivDialog) document.body.removeChild(this.DivDialog);
102
128
  this.DivDialog=null;
103
- this.DivInfoText=null;
129
+ this.TitleBox=null;
104
130
  this.Minute.JSChart=null;
105
131
  }
106
132
 
@@ -120,7 +146,7 @@ function JSPopMinuteChart()
120
146
  var name=data.Symbol;
121
147
  if (data.Name) name=data.Name;
122
148
  var title=`${name} ${IFrameSplitOperator.FormatDateString(data.Date)} 分时图`
123
- this.DivInfoText.innerText=title;
149
+ this.TitleBox.DivName.innerText=title;
124
150
 
125
151
  if (this.Minute.JSChart)
126
152
  {
@@ -188,10 +214,14 @@ function JSPopMinuteChart()
188
214
 
189
215
  this.ReloadResource=function(option)
190
216
  {
217
+ this.TitleColor=g_JSChartResource.PopMinuteChart.TitleColor;
218
+ this.TitleBGColor=g_JSChartResource.PopMinuteChart.TitleBGColor;
219
+ this.BGColor=g_JSChartResource.PopMinuteChart.BGColor;
220
+ this.BorderColor=g_JSChartResource.PopMinuteChart.BorderColor;
221
+
191
222
  if (!this.DivDialog) return;
192
223
 
193
- this.DivDialog.style["background-color"]=g_JSChartResource.PopMinuteChart.BGColor;
194
- this.DivDialog.style["border-color"]=g_JSChartResource.PopMinuteChart.BorderColor;
224
+ this.UpdateStyle();
195
225
 
196
226
  if (this.Minute.JSChart) this.Minute.JSChart.ReloadResource(option);
197
227
  }
@@ -276,4 +306,241 @@ JSPopMinuteChart.GetMinuteOption=function()
276
306
  }
277
307
 
278
308
 
309
+ ///////////////////////////////////////////////////////
310
+ // 分时图提示信息
311
+ //
312
+ //////////////////////////////////////////////////////
313
+
314
+ function JSTooltipMinuteChart()
315
+ {
316
+ this.DivDialog=null;
317
+ this.HQChart=null;
318
+ this.ID=Guid();
319
+
320
+ this.BGColor=g_JSChartResource.PopMinuteChart.BGColor;
321
+ this.BorderColor=g_JSChartResource.PopMinuteChart.BorderColor;
322
+
323
+ this.Minute=
324
+ {
325
+ Option:JSTooltipMinuteChart.GetMinuteOption(),
326
+ JSChart:null,
327
+ Symbol:null,
328
+ Date:null,
329
+ }
330
+
331
+ this.Inital=function(hqchart, option)
332
+ {
333
+ this.HQChart=hqchart;
334
+
335
+ if (option)
336
+ {
337
+ if (IFrameSplitOperator.IsObject(option.Option))
338
+ {
339
+ var item=CloneData(option.Option); //复制一份出来
340
+ this.Minute.Option=Object.assign(this.Minute.Option,item);
341
+ }
342
+ }
343
+ }
344
+
345
+ this.Create=function()
346
+ {
347
+ var divDom=document.createElement('div');
348
+ divDom.className='UMyChart_Tooltip_Minute_Div';
349
+ divDom.id=this.ID;
350
+
351
+ var divChart=document.createElement('div');
352
+ divChart.className='UMyChart_Tooltip_Minute_Chart_Div';
353
+ divDom.appendChild(divChart);
354
+
355
+ this.DivDialog=divDom;
356
+
357
+ var chart=JSChart.Init(divChart);
358
+ this.Minute.JSChart=chart;
359
+
360
+ //语言跟主图保持一致
361
+ if (this.HQChart) this.Minute.Option.Language=g_JSChartLocalization.GetLanguageName(this.HQChart.LanguageID);
362
+ this.Minute.Option.OnCreatedCallback=(chart)=>{ this.OnCreateHQChart(chart); }
363
+ this.Minute.Option.NetworkFilter=(data, callback)=>{ this.NetworkFilter(data, callback); }
364
+ chart.SetOption(this.Minute.Option); //设置K线配置
365
+
366
+ document.body.appendChild(divDom);
367
+
368
+ this.UpdateStyle();
369
+ }
370
+
371
+ this.UpdateStyle=function()
372
+ {
373
+ if (!this.DivDialog) return;
374
+
375
+ if (this.BGColor) this.DivDialog.style['background-color']=this.BGColor;
376
+ if (this.BorderColor) this.DivDialog.style['border-color']=this.BorderColor;
377
+ }
378
+
379
+ this.NetworkFilter=function(data, callback)
380
+ {
381
+ if (!this.HQChart || !this.HQChart.NetworkFilter) return;
382
+
383
+ /*
384
+ if (data) data.PopMinuteData={ Date:this.Date }; //弹出分时图额外数据
385
+
386
+ if (data.Name== 'MinuteChartContainer::RequestMinuteData') //分时图数据对接
387
+ {
388
+ data.Request.Data.date=this.Date;
389
+ data.Name="MinuteChartContainer::RequestPopMinuteData";
390
+ data.Explain="指定日期分时数据"
391
+ };
392
+ */
393
+
394
+ this.HQChart.NetworkFilter(data, callback);
395
+ }
396
+
397
+ this.OnCreateHQChart=function(chart)
398
+ {
399
+
400
+ }
401
+
402
+ this.Destroy=function()
403
+ {
404
+ if (this.DivDialog) document.body.removeChild(this.DivDialog);
405
+ this.DivDialog=null;
406
+ this.TitleBox=null;
407
+ if (!this.Minute.JSChart) this.Minute.JSChart.ChartDestory();
408
+ this.Minute.JSChart=null;
409
+ }
410
+
411
+ this.IsShow=function()
412
+ {
413
+ if (!this.DivDialog) return false;
414
+
415
+ return this.DivDialog.style.visibility==='visible';
416
+ }
417
+
418
+ this.Show=function(data, x, y)
419
+ {
420
+ if (!this.DivDialog) this.Create();
421
+ if (!data || !data.Symbol) return;
422
+
423
+ var symbol=data.Symbol;
424
+ var date=null;
425
+ if (IFrameSplitOperator.IsPlusNumber(data.Date)) date=data.Date;
426
+
427
+ if (this.Minute.JSChart)
428
+ {
429
+ if (this.Minute.Symbol!=symbol || this.Minute.Date!=date)
430
+ {
431
+ this.Minute.Symbol=symbol;
432
+ this.Minute.Date=date;
433
+ this.Minute.JSChart.ChangeSymbol(symbol);
434
+ }
435
+ }
436
+
437
+ if (IFrameSplitOperator.IsNumberV2(x,y))
438
+ {
439
+
440
+ }
441
+ else if (data.Rect)
442
+ {
443
+ var rtCell=data.Rect;
444
+ var pixelRatio=GetDevicePixelRatio();
445
+ var rtItem={ Left:rtCell.Left/pixelRatio, Right:rtCell.Right/pixelRatio, Bottom:rtCell.Bottom/pixelRatio, Top:rtCell.Top/pixelRatio };
446
+ rtItem.Width=rtItem.Right-rtItem.Left;
447
+ rtItem.Height=rtItem.Bottom-rtItem.Top;
448
+
449
+ //超出窗口调整位置
450
+ var height=this.DivDialog.offsetHeight;
451
+ var width=this.DivDialog.offsetWidth;
452
+ var x=rtItem.Right+data.Offset.Left;
453
+ var y=rtItem.Bottom+data.Offset.Top;
454
+
455
+ var xRight=window.innerWidth-5;
456
+ var ybottom=window.innerHeight-5;
457
+ if (x+width>xRight) x=xRight-width;
458
+ if (y+height>ybottom) y=(rtItem.Top+data.Offset.Top)-height;
459
+
460
+ this.DivDialog.style.visibility='visible';
461
+ this.DivDialog.style.top = y + "px";
462
+ this.DivDialog.style.left = x + "px";
463
+ }
464
+ }
465
+
466
+ this.Hide=function()
467
+ {
468
+ if (!this.DivDialog) return;
469
+ if (this.DivDialog.style.visibility!='hidden')
470
+ this.DivDialog.style.visibility='hidden';
471
+ }
472
+
473
+ }
474
+
475
+ JSTooltipMinuteChart.GetMinuteOption=function()
476
+ {
477
+ var option=
478
+ {
479
+ Type:'分钟走势图', //创建图形类型
480
+ Windows: //窗口指标
481
+ [
482
+ //{ Index:"VOL" },
483
+ //{ Index:"RSI" }
484
+ ],
485
+
486
+ Symbol:null, // cf1909.czc
487
+ IsAutoUpdate:false, //是自动更新数据
488
+ AutoUpdateFrequency:10000, //数据更新频率
489
+ DayCount:1, //1 最新交易日数据 >1 多日走势图
490
+ IsShowRightMenu:false, //是否显示右键菜单
491
+
492
+ EnableSelectRect:true,
493
+ EnableZoomIndexWindow:true,
494
+ EnableResize:true,
495
+
496
+ //BeforeOpen:{IsShow:true, Width:120, IsShowMultiDay:true, MulitiDayWidth:100, },
497
+ //AfterClose:{IsShow:true, Width:100, IsShowMultiDay:true, MulitiDayWidth:50, ShareVol:2 }, //ShareVol:0=盘后成交量独立坐标, 1==盘后成交量主图共用 2==盘后成交量盘前共用
498
+
499
+ CorssCursorInfo:{ Left:2, Right:1, Bottom:1 },
500
+
501
+ MinuteLine:
502
+ {
503
+
504
+ },
505
+
506
+ MinuteTitle:
507
+ {
508
+ IsShowTime:true,
509
+ IsShowName:true,
510
+ IsShowDate:true,
511
+ IsShowVolTitle:true,
512
+ //IsAlwaysShowLastData:true,
513
+ IsTitleShowLatestData:true,
514
+ },
515
+
516
+ MinuteVol:
517
+ {
518
+ BarColorType:1,
519
+ },
520
+
521
+ //Language:'EN',
522
+
523
+ Border: //边框
524
+ {
525
+ Left:20, //左边间距
526
+ Right:120, //右边间距
527
+ Top:25,
528
+ Bottom:25,
529
+
530
+ AutoLeft:{ Blank:10, MinWidth:40 },
531
+ AutoRight:{ Blank:10, MinWidth:40 },
532
+ },
533
+
534
+ Frame: //子框架设置
535
+ [
536
+ { SplitCount:5 },
537
+ { SplitCount:3 },
538
+ { SplitCount:3 },
539
+ ],
540
+ }
541
+
542
+ return option;
543
+ }
544
+
545
+
279
546
 
@@ -10022,7 +10022,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10022
10022
  if (srcParam)
10023
10023
  {
10024
10024
  this.DestroyPopMinuteChart();
10025
- this.InitalPopMinuteChart( {KLine:{KLineDoubleClick:true}} );
10025
+ this.InitalPopMinuteChart( { PopMinuteChart:{ Enable:true }} );
10026
10026
  }
10027
10027
  else
10028
10028
  {
@@ -68749,6 +68749,9 @@ function JSChartResource()
68749
68749
  {
68750
68750
  BGColor:"rgba(250,250,250,0.95)",
68751
68751
  BorderColor:"rgb(0,0,0)",
68752
+
68753
+ TitleColor:'rgb(250,250,250)', //标题颜色
68754
+ TitleBGColor:"rgb(200, 66, 69)", //标题背景颜色
68752
68755
  }
68753
68756
 
68754
68757
  this.SelectRectBGColor="rgba(1,130,212,0.06)"; //背景色
@@ -70250,6 +70253,8 @@ function JSChartResource()
70250
70253
  var item=style.PopMinuteChart;
70251
70254
  if (item.BGColor) this.PopMinuteChart.BGColor=item.BGColor;
70252
70255
  if (item.BorderColor) this.PopMinuteChart.BorderColor=item.BorderColor;
70256
+ if (item.TitleColor) this.DialogSearchIndex.TitleColor=item.TitleColor;
70257
+ if (item.TitleBGColor) this.DialogSearchIndex.TitleBGColor=item.TitleBGColor;
70253
70258
  }
70254
70259
 
70255
70260
  if (style.DefaultTextColor) this.DefaultTextColor = style.DefaultTextColor;
@@ -73421,9 +73426,16 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73421
73426
 
73422
73427
  this.InitalPopMinuteChart=function(option)
73423
73428
  {
73424
- if (!option || !option.KLine) return false;
73425
- var item=option.KLine;
73426
- if (item.KLineDoubleClick===true)
73429
+ if (!option) return false;
73430
+
73431
+ if (option.PopMinuteChart && option.PopMinuteChart.Enable) //新的配置格式
73432
+ {
73433
+ var item=option.PopMinuteChart;
73434
+ this.PopMinuteChart=new JSPopMinuteChart();
73435
+ this.PopMinuteChart.Inital(this, item);
73436
+ return true;
73437
+ }
73438
+ else if (option.KLine && option.KLine.KLineDoubleClick===true) //旧的格式 不要使用了
73427
73439
  {
73428
73440
  this.PopMinuteChart=new JSPopMinuteChart();
73429
73441
  this.PopMinuteChart.Inital(this);