hqchart 1.1.15310 → 1.1.15315

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.
@@ -1136,6 +1136,15 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1136
1136
  if (IFrameSplitOperator.IsBool(item.EnableDBClick)) chart.ChartCorssCursor.EnableDBClick=item.EnableDBClick;
1137
1137
  if (IFrameSplitOperator.IsBool(item.IsShowCorssPoint)) chart.ChartCorssCursor.CorssPointConfig.Enable=item.IsShowCorssPoint;
1138
1138
  if (IFrameSplitOperator.IsNumber(item.VLineType)) chart.ChartCorssCursor.VLineType=item.VLineType;
1139
+
1140
+ if (item.TextStyle)
1141
+ {
1142
+ if (item.TextStyle.Right) //右侧输出样式
1143
+ {
1144
+ var subItem=item.TextStyle.Right;
1145
+ if (IFrameSplitOperator.IsNumber(subItem.Type)) chart.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type=subItem.Type;
1146
+ }
1147
+ }
1139
1148
  }
1140
1149
 
1141
1150
  if (option.MinuteInfo) chart.CreateMinuteInfo(option.MinuteInfo);
@@ -3139,6 +3148,7 @@ var JSCHART_MENU_ID=
3139
3148
 
3140
3149
  CMD_CHANGE_YRIGHT_TEXT_FORMAT:62, //分时图主图 右侧刻度格式
3141
3150
  CMD_ENABLE_ZOOM_Y_ID:63, //放大缩小Y坐标 { FrameID:, Enable: , Range:{ Max:, Min: }}
3151
+ CMD_CORSS_YRIGHT_TEXT_STYLE:64, //十字光标右侧输出样式
3142
3152
 
3143
3153
 
3144
3154
  CMD_REPORT_CHANGE_BLOCK_ID:100, //报价列表 切换板块ID
@@ -11941,6 +11951,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11941
11951
  this.ResetFrameXYSplit();
11942
11952
  this.Draw();
11943
11953
  break;
11954
+ case JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE:
11955
+ if (param==null) return false;
11956
+ if (!this.ChartCorssCursor || !this.ChartCorssCursor.StringFormatY) return false;
11957
+ this.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type=param;
11958
+ break;
11944
11959
  case JSCHART_MENU_ID.CMD_ENABLE_ZOOM_Y_ID:
11945
11960
  if (!srcParam) return false;
11946
11961
  if (this.EnableZoomYCoordinate) this.EnableZoomYCoordinate(srcParam);
@@ -12757,6 +12772,25 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12757
12772
 
12758
12773
  return false;
12759
12774
  }
12775
+
12776
+ this.RecvOverlayIndex=function(identify, data)
12777
+ {
12778
+ var overlayIndex=this.GetOverlayIndexByIdentify(identify);
12779
+ if (overlayIndex==null)
12780
+ {
12781
+ console.warn(`[JSChartContainer::RecvOverlayIndex] can't find overlay index. [identify=${identify}]`);
12782
+ return;
12783
+ }
12784
+
12785
+ var script=overlayIndex.OverlayItem.Script;
12786
+ if (!script) return;
12787
+ if (typeof(script.RecvSubscribeData)!="function") return;
12788
+
12789
+ var kData=this.GetKData();
12790
+ if (!kData) return;
12791
+
12792
+ script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,kData);
12793
+ }
12760
12794
  }
12761
12795
 
12762
12796
  function GetDevicePixelRatio()
@@ -59134,8 +59168,16 @@ function ChartCorssCursor()
59134
59168
  if (IFrameSplitOperator.IsNumber(itemSize.Height)) yValue=itemSize.Height/2;
59135
59169
  }
59136
59170
 
59137
- rtBG.Top=rtBG.YCenter-yValue;
59138
- rtBG.Bottom=rtBG.Top+rtBG.Height;
59171
+ if (complexText.BaseLine=="center")
59172
+ {
59173
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
59174
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
59175
+ }
59176
+ else
59177
+ {
59178
+ rtBG.Top=rtBG.YCenter-yValue;
59179
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
59180
+ }
59139
59181
  }
59140
59182
  else
59141
59183
  {
@@ -59348,7 +59390,6 @@ function ChartCorssCursor()
59348
59390
  if (complexText.ShowType==1) showType=complexText.ShowType;
59349
59391
  if (showType==1) //多行
59350
59392
  {
59351
- var xLeft=rtBG.Left;
59352
59393
  var yTop=rtBG.Top; //顶
59353
59394
  for(var i=0; i<complexText.Text.length; ++i)
59354
59395
  {
@@ -59362,7 +59403,17 @@ function ChartCorssCursor()
59362
59403
  else this.Canvas.fillStyle=complexText.Color;
59363
59404
 
59364
59405
  var y=yTop+itemSize.Height;
59406
+ var xLeft=rtBG.Left, xRight=rtBG.Right;
59407
+ if (item.Margin)
59408
+ {
59409
+ var margin=item.Margin;
59410
+ if (IFrameSplitOperator.IsNumber(margin.Left)) xLeft+=margin.Left;
59411
+ if (IFrameSplitOperator.IsNumber(margin.Right)) xRight-=margin.Right;
59412
+ }
59413
+
59365
59414
  var x=xLeft;
59415
+ if (item.TextAlign=="right") x=xRight-itemSize.TextWidth;
59416
+ else if (item.TextAlign=="center") x=rtBG.Left+rtBG.Width/2-itemSize.TextWidth/2;
59366
59417
 
59367
59418
  if (item.TextOffset)
59368
59419
  {
@@ -59371,7 +59422,7 @@ function ChartCorssCursor()
59371
59422
  if (IFrameSplitOperator.IsNumber(textOffset.Y)) y+=textOffset.Y;
59372
59423
  }
59373
59424
 
59374
- this.Canvas.fillText(item.Text,x,y,itemSize.Width);
59425
+ this.Canvas.fillText(item.Text,x,y,itemSize.TextWidth);
59375
59426
 
59376
59427
  yTop+=itemSize.Height;
59377
59428
  }
@@ -59422,7 +59473,8 @@ function ChartCorssCursor()
59422
59473
  var item=complexText.Text[i];
59423
59474
  if (item.Font) this.Canvas.font=item.Font;
59424
59475
  else this.Canvas.font=complexText.Font;
59425
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
59476
+ var outWidth=this.Canvas.measureText(item.Text).width;
59477
+ var itemWidth=outWidth
59426
59478
  var itemHeight=this.GetFontHeight();
59427
59479
  if (item.Margin)
59428
59480
  {
@@ -59433,7 +59485,7 @@ function ChartCorssCursor()
59433
59485
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
59434
59486
  }
59435
59487
 
59436
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
59488
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
59437
59489
 
59438
59490
  if (textWidth<itemWidth) textWidth=itemWidth;
59439
59491
  textHeight+=itemHeight;
@@ -59450,8 +59502,8 @@ function ChartCorssCursor()
59450
59502
  var item=complexText.Text[i];
59451
59503
  if (item.Font) this.Canvas.font=item.Font;
59452
59504
  else this.Canvas.font=complexText.Font;
59453
-
59454
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
59505
+ var outWidth=this.Canvas.measureText(item.Text).width;
59506
+ var itemWidth=outWidth;
59455
59507
  var itemHeight=this.Canvas.measureText("擎").width;
59456
59508
  if (item.Margin)
59457
59509
  {
@@ -59462,7 +59514,7 @@ function ChartCorssCursor()
59462
59514
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
59463
59515
  }
59464
59516
 
59465
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
59517
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
59466
59518
 
59467
59519
  textWidth+=itemWidth;
59468
59520
  if (textHeight<itemHeight) textHeight=itemHeight;
@@ -60473,6 +60525,24 @@ function HQPriceStringFormat()
60473
60525
  this.Point;
60474
60526
  this.ClientPos=-1;
60475
60527
  this.HQChart;
60528
+ this.TextStyleConfig={ Right:{ Type:-1 } }; //输出文本样式 Type: -1=默认 1=价格 2=价格|涨幅 2行(分时图)
60529
+ //自定义样式模板
60530
+ this.TextStyleTemplate=
60531
+ [
60532
+ null,
60533
+ null,
60534
+ /*
60535
+ {
60536
+ ShowType:1, Space:2,
60537
+ BaseLine:"center",
60538
+ Text:
60539
+ [
60540
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } },
60541
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } }
60542
+ ]
60543
+ }
60544
+ */
60545
+ ]
60476
60546
 
60477
60547
  this.ExtendChartPaint;
60478
60548
  this.RExtendText=[];
@@ -60566,6 +60636,13 @@ function HQPriceStringFormat()
60566
60636
  }
60567
60637
  }
60568
60638
 
60639
+ this.GetTextStyleTemplate=function(type, defaultTemplate)
60640
+ {
60641
+ var template=this.TextStyleTemplate[type];
60642
+ if (!template) return defaultTemplate;
60643
+ return CloneData(template);
60644
+ }
60645
+
60569
60646
  this.Operator=function()
60570
60647
  {
60571
60648
  this.RText=null;
@@ -60584,7 +60661,41 @@ function HQPriceStringFormat()
60584
60661
  else
60585
60662
  this.Text=this.Value.toFixed(defaultfloatPrecision);
60586
60663
 
60587
- if (this.YClose>0) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
60664
+ if (this.TextStyleConfig.Right.Type==2)
60665
+ {
60666
+ if (IFrameSplitOperator.IsNumber(this.YClose))
60667
+ {
60668
+ var value=(this.Value-this.YClose)*100/this.YClose;
60669
+ var text=`${value.toFixed(2)}%`;
60670
+ if (value>=0) text=` ${value.toFixed(2)}%`;
60671
+
60672
+ var defaultTemplate=
60673
+ {
60674
+ ShowType:1, Space:2,
60675
+ BaseLine:"center",
60676
+ Text:
60677
+ [
60678
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 } },
60679
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 }}
60680
+ ]
60681
+ }
60682
+
60683
+ var complexText=this.GetTextStyleTemplate(this.TextStyleConfig.Right.Type,defaultTemplate);
60684
+
60685
+ complexText.Text[0].Text=this.Text; //价格
60686
+ complexText.Text[1].Text=text; //百分比
60687
+
60688
+ this.RComplexText=complexText;
60689
+ }
60690
+ }
60691
+ else if (this.TextStyleConfig.Right.Type==1)
60692
+ {
60693
+
60694
+ }
60695
+ else
60696
+ {
60697
+ if (IFrameSplitOperator.IsNumber(this.YClose)) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
60698
+ }
60588
60699
 
60589
60700
  this.GetExtendPaintData(defaultfloatPrecision);
60590
60701
  }
@@ -88990,25 +89101,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
88990
89101
  return null;
88991
89102
  }
88992
89103
 
88993
- this.RecvOverlayIndex=function(identify, data)
88994
- {
88995
- var overlayIndex=this.GetOverlayIndexByIdentify(identify);
88996
- if (overlayIndex==null)
88997
- {
88998
- console.warn(`[KLineChartContainer::RecvOverlayIndex] can't find overlay index. [identify=${identify}]`);
88999
- return;
89000
- }
89001
-
89002
- if (!overlayIndex.Script) return;
89003
- if (typeof(overlayIndex.RecvSubscribeData)!="function") return;
89004
-
89005
- if (!this.ChartPaint[0]) return;
89006
- var kData=this.ChartPaint[0].Data;
89007
- if (!kData) return;
89008
-
89009
- overlayIndex.Script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,kData);
89010
- }
89011
-
89012
89104
  //更新叠加指标
89013
89105
  this.UpdateOverlayIndex=function(identify)
89014
89106
  {
@@ -92753,6 +92845,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92753
92845
  var bCorssDrawVaildTime=false;
92754
92846
  var bCorssDrawPoint=false;
92755
92847
  var bCorssBCClick=false;
92848
+ var corssRightTextStyle=-1;
92756
92849
  if (this.ChartCorssCursor)
92757
92850
  {
92758
92851
  bShowCorss=this.ChartCorssCursor.IsShowCorss;
@@ -92760,6 +92853,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92760
92853
  bCorssDrawVaildTime=this.ChartCorssCursor.IsFixXLastTime;
92761
92854
  bCorssDrawPoint=this.ChartCorssCursor.CorssPointConfig.Enable;
92762
92855
  bCorssBCClick=this.ChartCorssCursor.EnableDBClick;
92856
+ if (this.ChartCorssCursor.StringFormatY) corssRightTextStyle=this.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type;
92763
92857
  }
92764
92858
 
92765
92859
  var bRButtonSelectRect=false,bLButtonSelectRect=false;
@@ -92867,6 +92961,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92867
92961
  { Name:"画在有效X轴上",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_ON_VAILD_TIME_ID, Args:[!bCorssDrawVaildTime]}, Checked:bCorssDrawVaildTime },
92868
92962
  { Name:"画圆点",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_POINT_ID, Args:[!bCorssDrawPoint]}, Checked:bCorssDrawPoint },
92869
92963
  { Name:"双击显示/隐藏", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_DBCLICK_ID, Args:[!bCorssBCClick]}, Checked:bCorssBCClick },
92964
+ {
92965
+ Name:"主图右侧文字格式",
92966
+ SubMenu:
92967
+ [
92968
+ { Name:"默认(百分比)", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE, Args:[-1]}, Checked:corssRightTextStyle===-1 },
92969
+ { Name:"价格", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE, Args:[1]}, Checked:corssRightTextStyle===1 },
92970
+ { Name:"价格|百分比(两行)", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE, Args:[2]}, Checked:corssRightTextStyle===2 },
92971
+ ]
92972
+ },
92870
92973
  ]
92871
92974
  },
92872
92975
 
@@ -96151,6 +96254,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96151
96254
  return null;
96152
96255
  }
96153
96256
 
96257
+ /*
96154
96258
  this.RecvOverlayIndex=function(identify, data)
96155
96259
  {
96156
96260
  var overlayIndex=this.GetOverlayIndexByIdentify(identify);
@@ -96160,14 +96264,16 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96160
96264
  return;
96161
96265
  }
96162
96266
 
96163
- if (!overlayIndex.Script) return;
96164
- if (typeof(overlayIndex.RecvSubscribeData)!="function") return;
96267
+ var script=overlayIndex.OverlayItem.Script;
96268
+ if (!script) return;
96269
+ if (typeof(script.RecvSubscribeData)!="function") return;
96165
96270
 
96166
96271
  var bindData=this.SourceData;
96167
96272
  if (!bindData) return;
96168
96273
 
96169
- overlayIndex.Script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,bindData);
96274
+ script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,bindData);
96170
96275
  }
96276
+ */
96171
96277
 
96172
96278
  //更新叠加指标
96173
96279
  this.UpdateOverlayIndex=function(identify)
@@ -5232,6 +5232,15 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5232
5232
  if (IFrameSplitOperator.IsBool(item.EnableDBClick)) chart.ChartCorssCursor.EnableDBClick=item.EnableDBClick;
5233
5233
  if (IFrameSplitOperator.IsBool(item.IsShowCorssPoint)) chart.ChartCorssCursor.CorssPointConfig.Enable=item.IsShowCorssPoint;
5234
5234
  if (IFrameSplitOperator.IsNumber(item.VLineType)) chart.ChartCorssCursor.VLineType=item.VLineType;
5235
+
5236
+ if (item.TextStyle)
5237
+ {
5238
+ if (item.TextStyle.Right) //右侧输出样式
5239
+ {
5240
+ var subItem=item.TextStyle.Right;
5241
+ if (IFrameSplitOperator.IsNumber(subItem.Type)) chart.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type=subItem.Type;
5242
+ }
5243
+ }
5235
5244
  }
5236
5245
 
5237
5246
  if (option.MinuteInfo) chart.CreateMinuteInfo(option.MinuteInfo);
@@ -7235,6 +7244,7 @@ var JSCHART_MENU_ID=
7235
7244
 
7236
7245
  CMD_CHANGE_YRIGHT_TEXT_FORMAT:62, //分时图主图 右侧刻度格式
7237
7246
  CMD_ENABLE_ZOOM_Y_ID:63, //放大缩小Y坐标 { FrameID:, Enable: , Range:{ Max:, Min: }}
7247
+ CMD_CORSS_YRIGHT_TEXT_STYLE:64, //十字光标右侧输出样式
7238
7248
 
7239
7249
 
7240
7250
  CMD_REPORT_CHANGE_BLOCK_ID:100, //报价列表 切换板块ID
@@ -16037,6 +16047,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
16037
16047
  this.ResetFrameXYSplit();
16038
16048
  this.Draw();
16039
16049
  break;
16050
+ case JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE:
16051
+ if (param==null) return false;
16052
+ if (!this.ChartCorssCursor || !this.ChartCorssCursor.StringFormatY) return false;
16053
+ this.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type=param;
16054
+ break;
16040
16055
  case JSCHART_MENU_ID.CMD_ENABLE_ZOOM_Y_ID:
16041
16056
  if (!srcParam) return false;
16042
16057
  if (this.EnableZoomYCoordinate) this.EnableZoomYCoordinate(srcParam);
@@ -16853,6 +16868,25 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
16853
16868
 
16854
16869
  return false;
16855
16870
  }
16871
+
16872
+ this.RecvOverlayIndex=function(identify, data)
16873
+ {
16874
+ var overlayIndex=this.GetOverlayIndexByIdentify(identify);
16875
+ if (overlayIndex==null)
16876
+ {
16877
+ console.warn(`[JSChartContainer::RecvOverlayIndex] can't find overlay index. [identify=${identify}]`);
16878
+ return;
16879
+ }
16880
+
16881
+ var script=overlayIndex.OverlayItem.Script;
16882
+ if (!script) return;
16883
+ if (typeof(script.RecvSubscribeData)!="function") return;
16884
+
16885
+ var kData=this.GetKData();
16886
+ if (!kData) return;
16887
+
16888
+ script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,kData);
16889
+ }
16856
16890
  }
16857
16891
 
16858
16892
  function GetDevicePixelRatio()
@@ -63230,8 +63264,16 @@ function ChartCorssCursor()
63230
63264
  if (IFrameSplitOperator.IsNumber(itemSize.Height)) yValue=itemSize.Height/2;
63231
63265
  }
63232
63266
 
63233
- rtBG.Top=rtBG.YCenter-yValue;
63234
- rtBG.Bottom=rtBG.Top+rtBG.Height;
63267
+ if (complexText.BaseLine=="center")
63268
+ {
63269
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
63270
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63271
+ }
63272
+ else
63273
+ {
63274
+ rtBG.Top=rtBG.YCenter-yValue;
63275
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63276
+ }
63235
63277
  }
63236
63278
  else
63237
63279
  {
@@ -63444,7 +63486,6 @@ function ChartCorssCursor()
63444
63486
  if (complexText.ShowType==1) showType=complexText.ShowType;
63445
63487
  if (showType==1) //多行
63446
63488
  {
63447
- var xLeft=rtBG.Left;
63448
63489
  var yTop=rtBG.Top; //顶
63449
63490
  for(var i=0; i<complexText.Text.length; ++i)
63450
63491
  {
@@ -63458,7 +63499,17 @@ function ChartCorssCursor()
63458
63499
  else this.Canvas.fillStyle=complexText.Color;
63459
63500
 
63460
63501
  var y=yTop+itemSize.Height;
63502
+ var xLeft=rtBG.Left, xRight=rtBG.Right;
63503
+ if (item.Margin)
63504
+ {
63505
+ var margin=item.Margin;
63506
+ if (IFrameSplitOperator.IsNumber(margin.Left)) xLeft+=margin.Left;
63507
+ if (IFrameSplitOperator.IsNumber(margin.Right)) xRight-=margin.Right;
63508
+ }
63509
+
63461
63510
  var x=xLeft;
63511
+ if (item.TextAlign=="right") x=xRight-itemSize.TextWidth;
63512
+ else if (item.TextAlign=="center") x=rtBG.Left+rtBG.Width/2-itemSize.TextWidth/2;
63462
63513
 
63463
63514
  if (item.TextOffset)
63464
63515
  {
@@ -63467,7 +63518,7 @@ function ChartCorssCursor()
63467
63518
  if (IFrameSplitOperator.IsNumber(textOffset.Y)) y+=textOffset.Y;
63468
63519
  }
63469
63520
 
63470
- this.Canvas.fillText(item.Text,x,y,itemSize.Width);
63521
+ this.Canvas.fillText(item.Text,x,y,itemSize.TextWidth);
63471
63522
 
63472
63523
  yTop+=itemSize.Height;
63473
63524
  }
@@ -63518,7 +63569,8 @@ function ChartCorssCursor()
63518
63569
  var item=complexText.Text[i];
63519
63570
  if (item.Font) this.Canvas.font=item.Font;
63520
63571
  else this.Canvas.font=complexText.Font;
63521
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
63572
+ var outWidth=this.Canvas.measureText(item.Text).width;
63573
+ var itemWidth=outWidth
63522
63574
  var itemHeight=this.GetFontHeight();
63523
63575
  if (item.Margin)
63524
63576
  {
@@ -63529,7 +63581,7 @@ function ChartCorssCursor()
63529
63581
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
63530
63582
  }
63531
63583
 
63532
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
63584
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
63533
63585
 
63534
63586
  if (textWidth<itemWidth) textWidth=itemWidth;
63535
63587
  textHeight+=itemHeight;
@@ -63546,8 +63598,8 @@ function ChartCorssCursor()
63546
63598
  var item=complexText.Text[i];
63547
63599
  if (item.Font) this.Canvas.font=item.Font;
63548
63600
  else this.Canvas.font=complexText.Font;
63549
-
63550
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
63601
+ var outWidth=this.Canvas.measureText(item.Text).width;
63602
+ var itemWidth=outWidth;
63551
63603
  var itemHeight=this.Canvas.measureText("擎").width;
63552
63604
  if (item.Margin)
63553
63605
  {
@@ -63558,7 +63610,7 @@ function ChartCorssCursor()
63558
63610
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
63559
63611
  }
63560
63612
 
63561
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
63613
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
63562
63614
 
63563
63615
  textWidth+=itemWidth;
63564
63616
  if (textHeight<itemHeight) textHeight=itemHeight;
@@ -64569,6 +64621,24 @@ function HQPriceStringFormat()
64569
64621
  this.Point;
64570
64622
  this.ClientPos=-1;
64571
64623
  this.HQChart;
64624
+ this.TextStyleConfig={ Right:{ Type:-1 } }; //输出文本样式 Type: -1=默认 1=价格 2=价格|涨幅 2行(分时图)
64625
+ //自定义样式模板
64626
+ this.TextStyleTemplate=
64627
+ [
64628
+ null,
64629
+ null,
64630
+ /*
64631
+ {
64632
+ ShowType:1, Space:2,
64633
+ BaseLine:"center",
64634
+ Text:
64635
+ [
64636
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } },
64637
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } }
64638
+ ]
64639
+ }
64640
+ */
64641
+ ]
64572
64642
 
64573
64643
  this.ExtendChartPaint;
64574
64644
  this.RExtendText=[];
@@ -64662,6 +64732,13 @@ function HQPriceStringFormat()
64662
64732
  }
64663
64733
  }
64664
64734
 
64735
+ this.GetTextStyleTemplate=function(type, defaultTemplate)
64736
+ {
64737
+ var template=this.TextStyleTemplate[type];
64738
+ if (!template) return defaultTemplate;
64739
+ return CloneData(template);
64740
+ }
64741
+
64665
64742
  this.Operator=function()
64666
64743
  {
64667
64744
  this.RText=null;
@@ -64680,7 +64757,41 @@ function HQPriceStringFormat()
64680
64757
  else
64681
64758
  this.Text=this.Value.toFixed(defaultfloatPrecision);
64682
64759
 
64683
- if (this.YClose>0) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
64760
+ if (this.TextStyleConfig.Right.Type==2)
64761
+ {
64762
+ if (IFrameSplitOperator.IsNumber(this.YClose))
64763
+ {
64764
+ var value=(this.Value-this.YClose)*100/this.YClose;
64765
+ var text=`${value.toFixed(2)}%`;
64766
+ if (value>=0) text=` ${value.toFixed(2)}%`;
64767
+
64768
+ var defaultTemplate=
64769
+ {
64770
+ ShowType:1, Space:2,
64771
+ BaseLine:"center",
64772
+ Text:
64773
+ [
64774
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 } },
64775
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 }}
64776
+ ]
64777
+ }
64778
+
64779
+ var complexText=this.GetTextStyleTemplate(this.TextStyleConfig.Right.Type,defaultTemplate);
64780
+
64781
+ complexText.Text[0].Text=this.Text; //价格
64782
+ complexText.Text[1].Text=text; //百分比
64783
+
64784
+ this.RComplexText=complexText;
64785
+ }
64786
+ }
64787
+ else if (this.TextStyleConfig.Right.Type==1)
64788
+ {
64789
+
64790
+ }
64791
+ else
64792
+ {
64793
+ if (IFrameSplitOperator.IsNumber(this.YClose)) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
64794
+ }
64684
64795
 
64685
64796
  this.GetExtendPaintData(defaultfloatPrecision);
64686
64797
  }
@@ -93086,25 +93197,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
93086
93197
  return null;
93087
93198
  }
93088
93199
 
93089
- this.RecvOverlayIndex=function(identify, data)
93090
- {
93091
- var overlayIndex=this.GetOverlayIndexByIdentify(identify);
93092
- if (overlayIndex==null)
93093
- {
93094
- console.warn(`[KLineChartContainer::RecvOverlayIndex] can't find overlay index. [identify=${identify}]`);
93095
- return;
93096
- }
93097
-
93098
- if (!overlayIndex.Script) return;
93099
- if (typeof(overlayIndex.RecvSubscribeData)!="function") return;
93100
-
93101
- if (!this.ChartPaint[0]) return;
93102
- var kData=this.ChartPaint[0].Data;
93103
- if (!kData) return;
93104
-
93105
- overlayIndex.Script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,kData);
93106
- }
93107
-
93108
93200
  //更新叠加指标
93109
93201
  this.UpdateOverlayIndex=function(identify)
93110
93202
  {
@@ -96849,6 +96941,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96849
96941
  var bCorssDrawVaildTime=false;
96850
96942
  var bCorssDrawPoint=false;
96851
96943
  var bCorssBCClick=false;
96944
+ var corssRightTextStyle=-1;
96852
96945
  if (this.ChartCorssCursor)
96853
96946
  {
96854
96947
  bShowCorss=this.ChartCorssCursor.IsShowCorss;
@@ -96856,6 +96949,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96856
96949
  bCorssDrawVaildTime=this.ChartCorssCursor.IsFixXLastTime;
96857
96950
  bCorssDrawPoint=this.ChartCorssCursor.CorssPointConfig.Enable;
96858
96951
  bCorssBCClick=this.ChartCorssCursor.EnableDBClick;
96952
+ if (this.ChartCorssCursor.StringFormatY) corssRightTextStyle=this.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type;
96859
96953
  }
96860
96954
 
96861
96955
  var bRButtonSelectRect=false,bLButtonSelectRect=false;
@@ -96963,6 +97057,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96963
97057
  { Name:"画在有效X轴上",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_ON_VAILD_TIME_ID, Args:[!bCorssDrawVaildTime]}, Checked:bCorssDrawVaildTime },
96964
97058
  { Name:"画圆点",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_POINT_ID, Args:[!bCorssDrawPoint]}, Checked:bCorssDrawPoint },
96965
97059
  { Name:"双击显示/隐藏", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_DBCLICK_ID, Args:[!bCorssBCClick]}, Checked:bCorssBCClick },
97060
+ {
97061
+ Name:"主图右侧文字格式",
97062
+ SubMenu:
97063
+ [
97064
+ { Name:"默认(百分比)", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE, Args:[-1]}, Checked:corssRightTextStyle===-1 },
97065
+ { Name:"价格", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE, Args:[1]}, Checked:corssRightTextStyle===1 },
97066
+ { Name:"价格|百分比(两行)", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE, Args:[2]}, Checked:corssRightTextStyle===2 },
97067
+ ]
97068
+ },
96966
97069
  ]
96967
97070
  },
96968
97071
 
@@ -100247,6 +100350,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
100247
100350
  return null;
100248
100351
  }
100249
100352
 
100353
+ /*
100250
100354
  this.RecvOverlayIndex=function(identify, data)
100251
100355
  {
100252
100356
  var overlayIndex=this.GetOverlayIndexByIdentify(identify);
@@ -100256,14 +100360,16 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
100256
100360
  return;
100257
100361
  }
100258
100362
 
100259
- if (!overlayIndex.Script) return;
100260
- if (typeof(overlayIndex.RecvSubscribeData)!="function") return;
100363
+ var script=overlayIndex.OverlayItem.Script;
100364
+ if (!script) return;
100365
+ if (typeof(script.RecvSubscribeData)!="function") return;
100261
100366
 
100262
100367
  var bindData=this.SourceData;
100263
100368
  if (!bindData) return;
100264
100369
 
100265
- overlayIndex.Script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,bindData);
100370
+ script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,bindData);
100266
100371
  }
100372
+ */
100267
100373
 
100268
100374
  //更新叠加指标
100269
100375
  this.UpdateOverlayIndex=function(identify)
@@ -155035,7 +155141,7 @@ function ScrollBarBGChart()
155035
155141
 
155036
155142
 
155037
155143
 
155038
- var HQCHART_VERSION="1.1.15309";
155144
+ var HQCHART_VERSION="1.1.15314";
155039
155145
 
155040
155146
  function PrintHQChartVersion()
155041
155147
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.15309";
8
+ var HQCHART_VERSION="1.1.15314";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {