hqchart 1.1.13623 → 1.1.13638

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.
@@ -860,6 +860,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
860
860
  if (IFrameSplitOperator.IsBool(option.EnableNewIndex)) chart.EnableNewIndex=option.EnableNewIndex;
861
861
  if (IFrameSplitOperator.IsBool(option.EnableIndexChartDrag)) chart.EnableIndexChartDrag=option.EnableIndexChartDrag;
862
862
  if (IFrameSplitOperator.IsBool(option.EnableVerifyRecvData)) chart.EnableVerifyRecvData=option.EnableVerifyRecvData;
863
+ if (IFrameSplitOperator.IsBool(option.EnableNightDayBG)) chart.EnableNightDayBG=option.EnableNightDayBG;
863
864
 
864
865
  if (option.GlobalOption)
865
866
  {
@@ -2614,6 +2615,8 @@ var JSCHART_EVENT_ID=
2614
2615
 
2615
2616
  ON_FORMAT_KLINE_HIGH_LOW_TITLE:154, //K线最高最低价格式化内容
2616
2617
  ON_CUSTOM_CORSSCURSOR_POSITION:155, //自定义十字光标X轴的输出的位置
2618
+
2619
+ ON_CUSTOM_MINUTE_NIGHT_DAY_X_INDEX:156, //日盘夜盘的分界线
2617
2620
  }
2618
2621
 
2619
2622
  var JSCHART_OPERATOR_ID=
@@ -8402,11 +8405,18 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8402
8405
  if (IFrameSplitOperator.IsBool(windowItem.IsShowIndexName)) frame.IsShowIndexName=windowItem.IsShowIndexName;
8403
8406
  if (IFrameSplitOperator.IsNumber(windowItem.IndexParamSpace)) frame.IndexParamSpace=windowItem.IndexParamSpace;
8404
8407
  if (IFrameSplitOperator.IsNumber(windowItem.IndexTitleSpace)) frame.IndexTitleSpace=windowItem.IndexTitleSpace;
8408
+ if (!IFrameSplitOperator.IsUndefined(windowItem.HorizontalReserved)) frame.HorizontalReserved=windowItem.HorizontalReserved; //Y轴上下预留
8405
8409
  }
8406
8410
 
8407
8411
  if (frameItem)
8408
8412
  {
8409
8413
  if (frameItem.SplitCount) frame.YSplitOperator.SplitCount=frameItem.SplitCount;
8414
+ if (IFrameSplitOperator.IsNumber(frameItem.SplitType))
8415
+ {
8416
+ frame.YSplitOperator.SplitType=frameItem.SplitType;
8417
+ frame.YSplitOperator.DefaultSplitType=frameItem.SplitType;
8418
+ }
8419
+
8410
8420
  if (IFrameSplitOperator.IsBool(frameItem.IsShowXLine)) frame.IsShowXLine=frameItem.IsShowXLine;
8411
8421
  if (IFrameSplitOperator.IsBool(frameItem.IsShowYLine)) frame.IsShowYLine=frameItem.IsShowYLine;
8412
8422
 
@@ -12931,6 +12941,8 @@ function MinuteFrame()
12931
12941
  this.BeforeOpenVerticalInfo=[]; //盘前集合竞价X轴
12932
12942
  this.AfterCloseVerticalInfo=[]; //收盘集合竞价X轴
12933
12943
 
12944
+ this.NightDayConfig=CloneData(g_JSChartResource.Minute.NightDay);
12945
+
12934
12946
  this.DrawFrame=function()
12935
12947
  {
12936
12948
  if (!this.IsMinSize)
@@ -12942,6 +12954,8 @@ function MinuteFrame()
12942
12954
 
12943
12955
  if (this.BeforeDrawXYCallback) this.BeforeDrawXYCallback(this);
12944
12956
 
12957
+ this.DrawNightDayBG(); //绘制夜盘 日盘背景
12958
+
12945
12959
  this.DrawTitleBG();
12946
12960
  this.DrawHorizontal();
12947
12961
  this.DrawVertical();
@@ -13385,6 +13399,86 @@ function MinuteFrame()
13385
13399
  }
13386
13400
  }
13387
13401
 
13402
+ this.DrawNightDayBG=function()
13403
+ {
13404
+ if (this.DayCount!=1) return;
13405
+ if (!this.HQChart) return;
13406
+ if (!this.HQChart.EnableNightDayBG) return;
13407
+
13408
+ var symbol=this.HQChart.Symbol;
13409
+ if (!symbol) return;
13410
+
13411
+ var xIndex=-1;
13412
+ //获取夜盘和日期的分界线X索引位置
13413
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_MINUTE_NIGHT_DAY_X_INDEX)
13414
+ if (!event || !event.Callback) return;
13415
+
13416
+ var sendData={ Symbol:symbol, XIndex:xIndex, MinuteTimeStringData:g_MinuteTimeStringData };
13417
+ event.Callback(event,sendData,this);
13418
+ xIndex=sendData.XIndex;
13419
+ if (xIndex<0) return;
13420
+
13421
+ var border=this.ChartBorder.GetBorder();
13422
+ var x=this.GetXFromIndex(xIndex);
13423
+
13424
+ var rtNight={ Left: border.Left, Top:border.TopEx, Right:x, Bottom:border.Bottom };
13425
+ rtNight.Width=rtNight.Right-rtNight.Left;
13426
+ rtNight.Height=rtNight.Bottom-rtNight.Top;
13427
+
13428
+ this.Canvas.fillStyle = this.NightDayConfig.NightBGColor;
13429
+ this.Canvas.fillRect(rtNight.Left, rtNight.Top, rtNight.Width, rtNight.Height);
13430
+
13431
+ if (this.Identify!=0) return;
13432
+
13433
+ //显示 日盘夜盘文字
13434
+ this.Canvas.font=this.NightDayConfig.Font;
13435
+ this.Canvas.textBaseline = "bottom";
13436
+ this.Canvas.textAlign = 'left';
13437
+ var aryTitle=[{ Title:"夜盘", Position:1, Config:this.NightDayConfig.Night }, { Title:"日盘", Position:0,Config:this.NightDayConfig.Day }];
13438
+ var textHeight= this.Canvas.measureText("擎").width;
13439
+ for(var i=0;i<aryTitle.length;++i)
13440
+ {
13441
+ var item=aryTitle[i];
13442
+ var text=g_JSChartLocalization.GetText(item.Title,this.HQChart.LanguageID);
13443
+ var testWidth = this.Canvas.measureText(text).width;
13444
+ var rtItem=
13445
+ {
13446
+ Width:testWidth+item.Config.Margin.Left+item.Config.Margin.Right,
13447
+ Height:textHeight+item.Config.Margin.Top+item.Config.Margin.Bottom,
13448
+ Bottom:border.Bottom
13449
+ };
13450
+ rtItem.Top=rtItem.Bottom-rtItem.Height;
13451
+
13452
+ if (item.Position===1)
13453
+ {
13454
+ rtItem.Right=x-1;
13455
+ rtItem.Left=rtItem.Right-rtItem.Width;
13456
+ }
13457
+ else
13458
+ {
13459
+ rtItem.Left=x+1;
13460
+ rtItem.Right=rtItem.Left+rtItem.Width;
13461
+ }
13462
+
13463
+ if (item.Config.BGColor)
13464
+ {
13465
+ this.Canvas.fillStyle = item.Config.BGColor;
13466
+ this.Canvas.fillRect(rtItem.Left, rtItem.Top, rtItem.Width, rtItem.Height);
13467
+ }
13468
+
13469
+ if (item.Config.BorderColor)
13470
+ {
13471
+ this.Canvas.strokeStyle = item.Config.BorderColor;
13472
+ this.Canvas.strokeRect(ToFixedPoint(rtItem.Left), ToFixedPoint(rtItem.Top), ToFixedRect(rtItem.Width), ToFixedRect(rtItem.Height));
13473
+ }
13474
+
13475
+
13476
+ this.Canvas.fillStyle = item.Config.Color;
13477
+ this.Canvas.fillText(text, rtItem.Left+item.Config.Margin.Left, rtItem.Bottom-item.Config.Margin.Bottom );
13478
+ }
13479
+
13480
+ }
13481
+
13388
13482
  //选中的画图工具X轴坐标信息
13389
13483
  this.DrawPictureXCoordinate=function(drawPicture, range, option)
13390
13484
  {
@@ -14964,6 +15058,89 @@ function MinuteHScreenFrame()
14964
15058
  return this.GetLeftExtendYFromData(value,isLimit,obj);
14965
15059
  }
14966
15060
 
15061
+ this.DrawNightDayBG=function()
15062
+ {
15063
+ if (this.DayCount!=1) return;
15064
+ if (!this.HQChart) return;
15065
+ if (!this.HQChart.EnableNightDayBG) return;
15066
+
15067
+ var symbol=this.HQChart.Symbol;
15068
+ if (!symbol) return;
15069
+
15070
+ var xIndex=-1;
15071
+ //获取夜盘和日期的分界线X索引位置
15072
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_MINUTE_NIGHT_DAY_X_INDEX)
15073
+ if (!event || !event.Callback) return;
15074
+
15075
+ var sendData={ Symbol:symbol, XIndex:xIndex, MinuteTimeStringData:g_MinuteTimeStringData };
15076
+ event.Callback(event,sendData,this);
15077
+ xIndex=sendData.XIndex;
15078
+ if (xIndex<0) return;
15079
+
15080
+ var border=this.ChartBorder.GetHScreenBorder();
15081
+ var y=this.GetXFromIndex(xIndex);
15082
+
15083
+ var rtNight={ Left: border.Left, Top:border.Top, Right:border.RightEx, Bottom:y };
15084
+ rtNight.Width=rtNight.Right-rtNight.Left;
15085
+ rtNight.Height=rtNight.Bottom-rtNight.Top;
15086
+
15087
+ this.Canvas.fillStyle = this.NightDayConfig.NightBGColor;
15088
+ this.Canvas.fillRect(rtNight.Left, rtNight.Top, rtNight.Width, rtNight.Height);
15089
+
15090
+ if (this.Identify!=0) return;
15091
+
15092
+ //显示 日盘夜盘文字
15093
+ this.Canvas.font=this.NightDayConfig.Font;
15094
+ this.Canvas.textBaseline = "bottom";
15095
+ this.Canvas.textAlign = 'left';
15096
+ var aryTitle=[{ Title:"夜盘", Position:1, Config:this.NightDayConfig.Night }, { Title:"日盘", Position:0,Config:this.NightDayConfig.Day }];
15097
+ var textHeight= this.Canvas.measureText("擎").width;
15098
+ for(var i=0;i<aryTitle.length;++i)
15099
+ {
15100
+ var item=aryTitle[i];
15101
+ var text=g_JSChartLocalization.GetText(item.Title,this.HQChart.LanguageID);
15102
+ var testWidth = this.Canvas.measureText(text).width;
15103
+ var rtItem=
15104
+ {
15105
+ Height:testWidth+item.Config.Margin.Left+item.Config.Margin.Right,
15106
+ Width:textHeight+item.Config.Margin.Top+item.Config.Margin.Bottom,
15107
+ Left:border.Left
15108
+ };
15109
+ rtItem.Right=rtItem.Left+rtItem.Width;
15110
+
15111
+ if (item.Position===1)
15112
+ {
15113
+ rtItem.Bottom=y-1;
15114
+ rtItem.Top=rtItem.Bottom-rtItem.Height;
15115
+ }
15116
+ else
15117
+ {
15118
+ rtItem.Top=y+1;
15119
+ rtItem.Bottom=rtItem.Top+rtItem.Height;
15120
+ }
15121
+
15122
+ if (item.Config.BGColor)
15123
+ {
15124
+ this.Canvas.fillStyle = item.Config.BGColor;
15125
+ this.Canvas.fillRect(rtItem.Left, rtItem.Top, rtItem.Width, rtItem.Height);
15126
+ }
15127
+
15128
+ if (item.Config.BorderColor)
15129
+ {
15130
+ this.Canvas.strokeStyle = item.Config.BorderColor;
15131
+ this.Canvas.strokeRect(ToFixedPoint(rtItem.Left), ToFixedPoint(rtItem.Top), ToFixedRect(rtItem.Width), ToFixedRect(rtItem.Height));
15132
+ }
15133
+
15134
+ this.Canvas.fillStyle = item.Config.Color;
15135
+ var xText=rtItem.Left;
15136
+ var yText=rtItem.Top;
15137
+ this.Canvas.save();
15138
+ this.Canvas.translate(xText,yText);
15139
+ this.Canvas.rotate(90 * Math.PI / 180);
15140
+ this.Canvas.fillText(text, item.Config.Margin.Left, -item.Config.Margin.Bottom);
15141
+ this.Canvas.restore();
15142
+ }
15143
+ }
14967
15144
 
14968
15145
  }
14969
15146
 
@@ -18890,6 +19067,7 @@ function HQTradeFrame()
18890
19067
  for (var i in this.SubFrame)
18891
19068
  {
18892
19069
  var item = this.SubFrame[i];
19070
+ if (item.Height<=0) continue;
18893
19071
  if (item.Frame.DrawInsideHorizontal) item.Frame.DrawInsideHorizontal();
18894
19072
  }
18895
19073
  }
@@ -50300,7 +50478,7 @@ function ChartCorssCursor()
50300
50478
  }
50301
50479
  }
50302
50480
 
50303
- //X轴 Bottom=10 使用第1个指标框位置
50481
+ //X轴 Bottom=8 自定义X轴文字位置
50304
50482
  if ((this.ShowTextMode.Bottom===1 || this.ShowTextMode.Bottom==8) && this.StringFormatX.Operator())
50305
50483
  {
50306
50484
  var text=this.StringFormatX.Text;
@@ -66833,6 +67011,14 @@ function JSChartResource()
66833
67011
  Point:{ Color:"rgb(65,105,225)", Radius:2*GetDevicePixelRatio() },
66834
67012
  };
66835
67013
 
67014
+ this.Minute.NightDay=
67015
+ {
67016
+ NightBGColor:"rgba(0,0,0,0.2)",
67017
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
67018
+ Day: { Color:"rgb(0,0,0)", BGColor:"rgb(179,179,179)", BorderColor:"rgb(179,179,179)", Margin:{ Left:5, Top:2, Bottom:2, Right:5 } },
67019
+ Night: { Color:"rgb(0,0,0)", BGColor:"rgb(179,179,179)", BorderColor:"rgb(179,179,179)", Margin:{ Left:5, Top:2, Bottom:2, Right:5 } },
67020
+ }
67021
+
66836
67022
  this.DefaultTextColor="rgb(43,54,69)"; //图形中默认的字体颜色
66837
67023
  this.DefaultTextFont=14*GetDevicePixelRatio() +'px 微软雅黑'; //图形中默认的字体
66838
67024
  this.TitleFont=13*GetDevicePixelRatio() +'px 微软雅黑'; //指标显示,tooltip显示字体
@@ -68117,6 +68303,29 @@ function JSChartResource()
68117
68303
  if (item.Point.Radius) this.Minute.After.Point.Radius=item.Point.Radius;
68118
68304
  }
68119
68305
  }
68306
+
68307
+ if (style.Minute.NightDay)
68308
+ {
68309
+ var item=style.Minute.NightDay;
68310
+ if (item.NightBGColor) this.Minute.NightDay.NightBGColor=item.NightBGColor;
68311
+ if (item.Font) this.Minute.NightDay.Font=item.Font;
68312
+ if (item.Day)
68313
+ {
68314
+ var subItem=item.Day;
68315
+ if (subItem.Color) this.Minute.NightDay.Day.Color=subItem.Color;
68316
+ if (subItem.BGColor) this.Minute.NightDay.Day.BGColor=subItem.BGColor;
68317
+ if (subItem.BorderColor) this.Minute.NightDay.Day.BorderColor=subItem.BorderColor;
68318
+ CopyMarginConfig(this.Minute.NightDay.Day.Margin,subItem.Margin);
68319
+ }
68320
+ if (item.Night)
68321
+ {
68322
+ var subItem=item.Night;
68323
+ if (subItem.Color) this.Minute.NightDay.Night.Color=subItem.Color;
68324
+ if (subItem.BGColor) this.Minute.NightDay.Night.BGColor=subItem.BGColor;
68325
+ if (subItem.BorderColor) this.Minute.NightDay.Night.BorderColor=subItem.BorderColor;
68326
+ CopyMarginConfig(this.Minute.NightDay.Night.Margin,subItem.Margin);
68327
+ }
68328
+ }
68120
68329
  }
68121
68330
 
68122
68331
  if (style.DefaultTextColor) this.DefaultTextColor = style.DefaultTextColor;
@@ -69328,7 +69537,11 @@ function JSChartLocalization()
69328
69537
  ["Toolbar-"+JSCHART_BUTTON_ID.CHIP_LONG, {CN:"远期成本分布", EN:"Long chip", TC:"远期成本分布"}],
69329
69538
  ["Toolbar-"+JSCHART_BUTTON_ID.CHIP_DEFULT, {CN:"默认筹码分布", EN:"Default chip", TC:"默认筹码分布"}],
69330
69539
  ["Toolbar-"+JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE, {CN:"删除", EN:"Delete", TC:"删除"}],
69331
- ["Toolbar-"+JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING, {CN:"设置", EN:"Setting", TC:"设置"}]
69540
+ ["Toolbar-"+JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING, {CN:"设置", EN:"Setting", TC:"设置"}],
69541
+
69542
+ //日盘|夜盘
69543
+ ["日盘",{CN:'日盘', EN:'Day', TC:'日盤'}],
69544
+ ["夜盘",{CN:'夜盘', EN:'Night', TC:'夜盤'} ]
69332
69545
  ]);
69333
69546
 
69334
69547
  this.GetText=function(key,language)
@@ -77847,6 +78060,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
77847
78060
 
77848
78061
  this.ZoomStepPixel=50;
77849
78062
  this.BaselineType=0; //基准线类型 0=最新昨收盘 1=多日前昨收盘
78063
+ this.EnableNightDayBG=false; //是否启动夜盘背景色
77850
78064
 
77851
78065
  //集合竞价设置 obj={ Left:true/false, Right:true/false, MultiDay:{Left:, Right:} }
77852
78066
  this.SetCallCationDataBorder=function(obj)
@@ -79637,6 +79851,8 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
79637
79851
  frame.GlobalOption=this.GlobalOption;
79638
79852
  if (i<2) frame.ChartBorder.TitleHeight=0;
79639
79853
  frame.XPointCount=243;
79854
+ frame.HQChart=this;
79855
+ frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
79640
79856
 
79641
79857
  if (i>=2)
79642
79858
  {
@@ -79726,6 +79942,8 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
79726
79942
  frame.Identify=id; //窗口序号
79727
79943
  frame.XPointCount=243;
79728
79944
  frame.GlobalOption=this.GlobalOption;
79945
+ frame.HQChart=this;
79946
+ frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
79729
79947
 
79730
79948
 
79731
79949
  if (id>=2)
@@ -85359,6 +85577,8 @@ function MinuteChartHScreenContainer(uielement)
85359
85577
  frame.Identify=i;
85360
85578
  if (i<2) frame.ChartBorder.TitleHeight=0;
85361
85579
  frame.XPointCount=243;
85580
+ frame.HQChart=this;
85581
+ frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
85362
85582
 
85363
85583
  var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];
85364
85584
  frame.HorizontalMax=DEFAULT_HORIZONTAL[0];
@@ -81,6 +81,13 @@ function GetBlackStyle()
81
81
  {
82
82
  BGColor:"rgba(105,105,105,0.5)",
83
83
  AvPriceColor:'rgb(248,248,255)' //均线
84
+ },
85
+ NightDay:
86
+ {
87
+ NightBGColor:"rgb(22,22,22)",
88
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
89
+ Day: { Color:"rgb(153,153,153)", BGColor:"rgb(51,51,51)", BorderColor:"rgb(51,51,51)", Margin:{ Left:5, Top:2, Bottom:2, Right:5 } },
90
+ Night: { Color:"rgb(153,153,153)", BGColor:"rgb(51,51,51)", BorderColor:"rgb(51,51,51)", Margin:{ Left:5, Top:2, Bottom:2, Right:5 } },
84
91
  }
85
92
  },
86
93