hqchart 1.1.13623 → 1.1.13636

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,6 +8405,7 @@ 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)
@@ -12931,6 +12935,8 @@ function MinuteFrame()
12931
12935
  this.BeforeOpenVerticalInfo=[]; //盘前集合竞价X轴
12932
12936
  this.AfterCloseVerticalInfo=[]; //收盘集合竞价X轴
12933
12937
 
12938
+ this.NightDayConfig=CloneData(g_JSChartResource.Minute.NightDay);
12939
+
12934
12940
  this.DrawFrame=function()
12935
12941
  {
12936
12942
  if (!this.IsMinSize)
@@ -12942,6 +12948,8 @@ function MinuteFrame()
12942
12948
 
12943
12949
  if (this.BeforeDrawXYCallback) this.BeforeDrawXYCallback(this);
12944
12950
 
12951
+ this.DrawNightDayBG(); //绘制夜盘 日盘背景
12952
+
12945
12953
  this.DrawTitleBG();
12946
12954
  this.DrawHorizontal();
12947
12955
  this.DrawVertical();
@@ -13385,6 +13393,86 @@ function MinuteFrame()
13385
13393
  }
13386
13394
  }
13387
13395
 
13396
+ this.DrawNightDayBG=function()
13397
+ {
13398
+ if (this.DayCount!=1) return;
13399
+ if (!this.HQChart) return;
13400
+ if (!this.HQChart.EnableNightDayBG) return;
13401
+
13402
+ var symbol=this.HQChart.Symbol;
13403
+ if (!symbol) return;
13404
+
13405
+ var xIndex=-1;
13406
+ //获取夜盘和日期的分界线X索引位置
13407
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_MINUTE_NIGHT_DAY_X_INDEX)
13408
+ if (!event || !event.Callback) return;
13409
+
13410
+ var sendData={ Symbol:symbol, XIndex:xIndex, MinuteTimeStringData:g_MinuteTimeStringData };
13411
+ event.Callback(event,sendData,this);
13412
+ xIndex=sendData.XIndex;
13413
+ if (xIndex<0) return;
13414
+
13415
+ var border=this.ChartBorder.GetBorder();
13416
+ var x=this.GetXFromIndex(xIndex);
13417
+
13418
+ var rtNight={ Left: border.Left, Top:border.TopEx, Right:x, Bottom:border.Bottom };
13419
+ rtNight.Width=rtNight.Right-rtNight.Left;
13420
+ rtNight.Height=rtNight.Bottom-rtNight.Top;
13421
+
13422
+ this.Canvas.fillStyle = this.NightDayConfig.NightBGColor;
13423
+ this.Canvas.fillRect(rtNight.Left, rtNight.Top, rtNight.Width, rtNight.Height);
13424
+
13425
+ if (this.Identify!=0) return;
13426
+
13427
+ //显示 日盘夜盘文字
13428
+ this.Canvas.font=this.NightDayConfig.Font;
13429
+ this.Canvas.textBaseline = "bottom";
13430
+ this.Canvas.textAlign = 'left';
13431
+ var aryTitle=[{ Title:"夜盘", Position:1, Config:this.NightDayConfig.Night }, { Title:"日盘", Position:0,Config:this.NightDayConfig.Day }];
13432
+ var textHeight= this.Canvas.measureText("擎").width;
13433
+ for(var i=0;i<aryTitle.length;++i)
13434
+ {
13435
+ var item=aryTitle[i];
13436
+ var text=g_JSChartLocalization.GetText(item.Title,this.HQChart.LanguageID);
13437
+ var testWidth = this.Canvas.measureText(text).width;
13438
+ var rtItem=
13439
+ {
13440
+ Width:testWidth+item.Config.Margin.Left+item.Config.Margin.Right,
13441
+ Height:textHeight+item.Config.Margin.Top+item.Config.Margin.Bottom,
13442
+ Bottom:border.Bottom
13443
+ };
13444
+ rtItem.Top=rtItem.Bottom-rtItem.Height;
13445
+
13446
+ if (item.Position===1)
13447
+ {
13448
+ rtItem.Right=x-1;
13449
+ rtItem.Left=rtItem.Right-rtItem.Width;
13450
+ }
13451
+ else
13452
+ {
13453
+ rtItem.Left=x+1;
13454
+ rtItem.Right=rtItem.Left+rtItem.Width;
13455
+ }
13456
+
13457
+ if (item.Config.BGColor)
13458
+ {
13459
+ this.Canvas.fillStyle = item.Config.BGColor;
13460
+ this.Canvas.fillRect(rtItem.Left, rtItem.Top, rtItem.Width, rtItem.Height);
13461
+ }
13462
+
13463
+ if (item.Config.BorderColor)
13464
+ {
13465
+ this.Canvas.strokeStyle = item.Config.BorderColor;
13466
+ this.Canvas.strokeRect(ToFixedPoint(rtItem.Left), ToFixedPoint(rtItem.Top), ToFixedRect(rtItem.Width), ToFixedRect(rtItem.Height));
13467
+ }
13468
+
13469
+
13470
+ this.Canvas.fillStyle = item.Config.Color;
13471
+ this.Canvas.fillText(text, rtItem.Left+item.Config.Margin.Left, rtItem.Bottom-item.Config.Margin.Bottom );
13472
+ }
13473
+
13474
+ }
13475
+
13388
13476
  //选中的画图工具X轴坐标信息
13389
13477
  this.DrawPictureXCoordinate=function(drawPicture, range, option)
13390
13478
  {
@@ -14964,6 +15052,89 @@ function MinuteHScreenFrame()
14964
15052
  return this.GetLeftExtendYFromData(value,isLimit,obj);
14965
15053
  }
14966
15054
 
15055
+ this.DrawNightDayBG=function()
15056
+ {
15057
+ if (this.DayCount!=1) return;
15058
+ if (!this.HQChart) return;
15059
+ if (!this.HQChart.EnableNightDayBG) return;
15060
+
15061
+ var symbol=this.HQChart.Symbol;
15062
+ if (!symbol) return;
15063
+
15064
+ var xIndex=-1;
15065
+ //获取夜盘和日期的分界线X索引位置
15066
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_MINUTE_NIGHT_DAY_X_INDEX)
15067
+ if (!event || !event.Callback) return;
15068
+
15069
+ var sendData={ Symbol:symbol, XIndex:xIndex, MinuteTimeStringData:g_MinuteTimeStringData };
15070
+ event.Callback(event,sendData,this);
15071
+ xIndex=sendData.XIndex;
15072
+ if (xIndex<0) return;
15073
+
15074
+ var border=this.ChartBorder.GetHScreenBorder();
15075
+ var y=this.GetXFromIndex(xIndex);
15076
+
15077
+ var rtNight={ Left: border.Left, Top:border.Top, Right:border.RightEx, Bottom:y };
15078
+ rtNight.Width=rtNight.Right-rtNight.Left;
15079
+ rtNight.Height=rtNight.Bottom-rtNight.Top;
15080
+
15081
+ this.Canvas.fillStyle = this.NightDayConfig.NightBGColor;
15082
+ this.Canvas.fillRect(rtNight.Left, rtNight.Top, rtNight.Width, rtNight.Height);
15083
+
15084
+ if (this.Identify!=0) return;
15085
+
15086
+ //显示 日盘夜盘文字
15087
+ this.Canvas.font=this.NightDayConfig.Font;
15088
+ this.Canvas.textBaseline = "bottom";
15089
+ this.Canvas.textAlign = 'left';
15090
+ var aryTitle=[{ Title:"夜盘", Position:1, Config:this.NightDayConfig.Night }, { Title:"日盘", Position:0,Config:this.NightDayConfig.Day }];
15091
+ var textHeight= this.Canvas.measureText("擎").width;
15092
+ for(var i=0;i<aryTitle.length;++i)
15093
+ {
15094
+ var item=aryTitle[i];
15095
+ var text=g_JSChartLocalization.GetText(item.Title,this.HQChart.LanguageID);
15096
+ var testWidth = this.Canvas.measureText(text).width;
15097
+ var rtItem=
15098
+ {
15099
+ Height:testWidth+item.Config.Margin.Left+item.Config.Margin.Right,
15100
+ Width:textHeight+item.Config.Margin.Top+item.Config.Margin.Bottom,
15101
+ Left:border.Left
15102
+ };
15103
+ rtItem.Right=rtItem.Left+rtItem.Width;
15104
+
15105
+ if (item.Position===1)
15106
+ {
15107
+ rtItem.Bottom=y-1;
15108
+ rtItem.Top=rtItem.Bottom-rtItem.Height;
15109
+ }
15110
+ else
15111
+ {
15112
+ rtItem.Top=y+1;
15113
+ rtItem.Bottom=rtItem.Top+rtItem.Height;
15114
+ }
15115
+
15116
+ if (item.Config.BGColor)
15117
+ {
15118
+ this.Canvas.fillStyle = item.Config.BGColor;
15119
+ this.Canvas.fillRect(rtItem.Left, rtItem.Top, rtItem.Width, rtItem.Height);
15120
+ }
15121
+
15122
+ if (item.Config.BorderColor)
15123
+ {
15124
+ this.Canvas.strokeStyle = item.Config.BorderColor;
15125
+ this.Canvas.strokeRect(ToFixedPoint(rtItem.Left), ToFixedPoint(rtItem.Top), ToFixedRect(rtItem.Width), ToFixedRect(rtItem.Height));
15126
+ }
15127
+
15128
+ this.Canvas.fillStyle = item.Config.Color;
15129
+ var xText=rtItem.Left;
15130
+ var yText=rtItem.Top;
15131
+ this.Canvas.save();
15132
+ this.Canvas.translate(xText,yText);
15133
+ this.Canvas.rotate(90 * Math.PI / 180);
15134
+ this.Canvas.fillText(text, item.Config.Margin.Left, -item.Config.Margin.Bottom);
15135
+ this.Canvas.restore();
15136
+ }
15137
+ }
14967
15138
 
14968
15139
  }
14969
15140
 
@@ -18890,6 +19061,7 @@ function HQTradeFrame()
18890
19061
  for (var i in this.SubFrame)
18891
19062
  {
18892
19063
  var item = this.SubFrame[i];
19064
+ if (item.Height<=0) continue;
18893
19065
  if (item.Frame.DrawInsideHorizontal) item.Frame.DrawInsideHorizontal();
18894
19066
  }
18895
19067
  }
@@ -50300,7 +50472,7 @@ function ChartCorssCursor()
50300
50472
  }
50301
50473
  }
50302
50474
 
50303
- //X轴 Bottom=10 使用第1个指标框位置
50475
+ //X轴 Bottom=8 自定义X轴文字位置
50304
50476
  if ((this.ShowTextMode.Bottom===1 || this.ShowTextMode.Bottom==8) && this.StringFormatX.Operator())
50305
50477
  {
50306
50478
  var text=this.StringFormatX.Text;
@@ -66833,6 +67005,14 @@ function JSChartResource()
66833
67005
  Point:{ Color:"rgb(65,105,225)", Radius:2*GetDevicePixelRatio() },
66834
67006
  };
66835
67007
 
67008
+ this.Minute.NightDay=
67009
+ {
67010
+ NightBGColor:"rgba(0,0,0,0.2)",
67011
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
67012
+ 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 } },
67013
+ 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 } },
67014
+ }
67015
+
66836
67016
  this.DefaultTextColor="rgb(43,54,69)"; //图形中默认的字体颜色
66837
67017
  this.DefaultTextFont=14*GetDevicePixelRatio() +'px 微软雅黑'; //图形中默认的字体
66838
67018
  this.TitleFont=13*GetDevicePixelRatio() +'px 微软雅黑'; //指标显示,tooltip显示字体
@@ -68117,6 +68297,29 @@ function JSChartResource()
68117
68297
  if (item.Point.Radius) this.Minute.After.Point.Radius=item.Point.Radius;
68118
68298
  }
68119
68299
  }
68300
+
68301
+ if (style.Minute.NightDay)
68302
+ {
68303
+ var item=style.Minute.NightDay;
68304
+ if (item.NightBGColor) this.Minute.NightDay.NightBGColor=item.NightBGColor;
68305
+ if (item.Font) this.Minute.NightDay.Font=item.Font;
68306
+ if (item.Day)
68307
+ {
68308
+ var subItem=item.Day;
68309
+ if (subItem.Color) this.Minute.NightDay.Day.Color=subItem.Color;
68310
+ if (subItem.BGColor) this.Minute.NightDay.Day.BGColor=subItem.BGColor;
68311
+ if (subItem.BorderColor) this.Minute.NightDay.Day.BorderColor=subItem.BorderColor;
68312
+ CopyMarginConfig(this.Minute.NightDay.Day.Margin,subItem.Margin);
68313
+ }
68314
+ if (item.Night)
68315
+ {
68316
+ var subItem=item.Night;
68317
+ if (subItem.Color) this.Minute.NightDay.Night.Color=subItem.Color;
68318
+ if (subItem.BGColor) this.Minute.NightDay.Night.BGColor=subItem.BGColor;
68319
+ if (subItem.BorderColor) this.Minute.NightDay.Night.BorderColor=subItem.BorderColor;
68320
+ CopyMarginConfig(this.Minute.NightDay.Night.Margin,subItem.Margin);
68321
+ }
68322
+ }
68120
68323
  }
68121
68324
 
68122
68325
  if (style.DefaultTextColor) this.DefaultTextColor = style.DefaultTextColor;
@@ -69328,7 +69531,11 @@ function JSChartLocalization()
69328
69531
  ["Toolbar-"+JSCHART_BUTTON_ID.CHIP_LONG, {CN:"远期成本分布", EN:"Long chip", TC:"远期成本分布"}],
69329
69532
  ["Toolbar-"+JSCHART_BUTTON_ID.CHIP_DEFULT, {CN:"默认筹码分布", EN:"Default chip", TC:"默认筹码分布"}],
69330
69533
  ["Toolbar-"+JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE, {CN:"删除", EN:"Delete", TC:"删除"}],
69331
- ["Toolbar-"+JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING, {CN:"设置", EN:"Setting", TC:"设置"}]
69534
+ ["Toolbar-"+JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING, {CN:"设置", EN:"Setting", TC:"设置"}],
69535
+
69536
+ //日盘|夜盘
69537
+ ["日盘",{CN:'日盘', EN:'Day', TC:'日盤'}],
69538
+ ["夜盘",{CN:'夜盘', EN:'Night', TC:'夜盤'} ]
69332
69539
  ]);
69333
69540
 
69334
69541
  this.GetText=function(key,language)
@@ -77847,6 +78054,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
77847
78054
 
77848
78055
  this.ZoomStepPixel=50;
77849
78056
  this.BaselineType=0; //基准线类型 0=最新昨收盘 1=多日前昨收盘
78057
+ this.EnableNightDayBG=false; //是否启动夜盘背景色
77850
78058
 
77851
78059
  //集合竞价设置 obj={ Left:true/false, Right:true/false, MultiDay:{Left:, Right:} }
77852
78060
  this.SetCallCationDataBorder=function(obj)
@@ -79637,6 +79845,8 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
79637
79845
  frame.GlobalOption=this.GlobalOption;
79638
79846
  if (i<2) frame.ChartBorder.TitleHeight=0;
79639
79847
  frame.XPointCount=243;
79848
+ frame.HQChart=this;
79849
+ frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
79640
79850
 
79641
79851
  if (i>=2)
79642
79852
  {
@@ -79726,6 +79936,8 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
79726
79936
  frame.Identify=id; //窗口序号
79727
79937
  frame.XPointCount=243;
79728
79938
  frame.GlobalOption=this.GlobalOption;
79939
+ frame.HQChart=this;
79940
+ frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
79729
79941
 
79730
79942
 
79731
79943
  if (id>=2)
@@ -85359,6 +85571,8 @@ function MinuteChartHScreenContainer(uielement)
85359
85571
  frame.Identify=i;
85360
85572
  if (i<2) frame.ChartBorder.TitleHeight=0;
85361
85573
  frame.XPointCount=243;
85574
+ frame.HQChart=this;
85575
+ frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
85362
85576
 
85363
85577
  var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];
85364
85578
  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