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.
@@ -5276,6 +5276,15 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5276
5276
  if (IFrameSplitOperator.IsBool(item.EnableDBClick)) chart.ChartCorssCursor.EnableDBClick=item.EnableDBClick;
5277
5277
  if (IFrameSplitOperator.IsBool(item.IsShowCorssPoint)) chart.ChartCorssCursor.CorssPointConfig.Enable=item.IsShowCorssPoint;
5278
5278
  if (IFrameSplitOperator.IsNumber(item.VLineType)) chart.ChartCorssCursor.VLineType=item.VLineType;
5279
+
5280
+ if (item.TextStyle)
5281
+ {
5282
+ if (item.TextStyle.Right) //右侧输出样式
5283
+ {
5284
+ var subItem=item.TextStyle.Right;
5285
+ if (IFrameSplitOperator.IsNumber(subItem.Type)) chart.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type=subItem.Type;
5286
+ }
5287
+ }
5279
5288
  }
5280
5289
 
5281
5290
  if (option.MinuteInfo) chart.CreateMinuteInfo(option.MinuteInfo);
@@ -7279,6 +7288,7 @@ var JSCHART_MENU_ID=
7279
7288
 
7280
7289
  CMD_CHANGE_YRIGHT_TEXT_FORMAT:62, //分时图主图 右侧刻度格式
7281
7290
  CMD_ENABLE_ZOOM_Y_ID:63, //放大缩小Y坐标 { FrameID:, Enable: , Range:{ Max:, Min: }}
7291
+ CMD_CORSS_YRIGHT_TEXT_STYLE:64, //十字光标右侧输出样式
7282
7292
 
7283
7293
 
7284
7294
  CMD_REPORT_CHANGE_BLOCK_ID:100, //报价列表 切换板块ID
@@ -16081,6 +16091,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
16081
16091
  this.ResetFrameXYSplit();
16082
16092
  this.Draw();
16083
16093
  break;
16094
+ case JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE:
16095
+ if (param==null) return false;
16096
+ if (!this.ChartCorssCursor || !this.ChartCorssCursor.StringFormatY) return false;
16097
+ this.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type=param;
16098
+ break;
16084
16099
  case JSCHART_MENU_ID.CMD_ENABLE_ZOOM_Y_ID:
16085
16100
  if (!srcParam) return false;
16086
16101
  if (this.EnableZoomYCoordinate) this.EnableZoomYCoordinate(srcParam);
@@ -16897,6 +16912,25 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
16897
16912
 
16898
16913
  return false;
16899
16914
  }
16915
+
16916
+ this.RecvOverlayIndex=function(identify, data)
16917
+ {
16918
+ var overlayIndex=this.GetOverlayIndexByIdentify(identify);
16919
+ if (overlayIndex==null)
16920
+ {
16921
+ console.warn(`[JSChartContainer::RecvOverlayIndex] can't find overlay index. [identify=${identify}]`);
16922
+ return;
16923
+ }
16924
+
16925
+ var script=overlayIndex.OverlayItem.Script;
16926
+ if (!script) return;
16927
+ if (typeof(script.RecvSubscribeData)!="function") return;
16928
+
16929
+ var kData=this.GetKData();
16930
+ if (!kData) return;
16931
+
16932
+ script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,kData);
16933
+ }
16900
16934
  }
16901
16935
 
16902
16936
  function GetDevicePixelRatio()
@@ -63274,8 +63308,16 @@ function ChartCorssCursor()
63274
63308
  if (IFrameSplitOperator.IsNumber(itemSize.Height)) yValue=itemSize.Height/2;
63275
63309
  }
63276
63310
 
63277
- rtBG.Top=rtBG.YCenter-yValue;
63278
- rtBG.Bottom=rtBG.Top+rtBG.Height;
63311
+ if (complexText.BaseLine=="center")
63312
+ {
63313
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
63314
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63315
+ }
63316
+ else
63317
+ {
63318
+ rtBG.Top=rtBG.YCenter-yValue;
63319
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63320
+ }
63279
63321
  }
63280
63322
  else
63281
63323
  {
@@ -63488,7 +63530,6 @@ function ChartCorssCursor()
63488
63530
  if (complexText.ShowType==1) showType=complexText.ShowType;
63489
63531
  if (showType==1) //多行
63490
63532
  {
63491
- var xLeft=rtBG.Left;
63492
63533
  var yTop=rtBG.Top; //顶
63493
63534
  for(var i=0; i<complexText.Text.length; ++i)
63494
63535
  {
@@ -63502,7 +63543,17 @@ function ChartCorssCursor()
63502
63543
  else this.Canvas.fillStyle=complexText.Color;
63503
63544
 
63504
63545
  var y=yTop+itemSize.Height;
63546
+ var xLeft=rtBG.Left, xRight=rtBG.Right;
63547
+ if (item.Margin)
63548
+ {
63549
+ var margin=item.Margin;
63550
+ if (IFrameSplitOperator.IsNumber(margin.Left)) xLeft+=margin.Left;
63551
+ if (IFrameSplitOperator.IsNumber(margin.Right)) xRight-=margin.Right;
63552
+ }
63553
+
63505
63554
  var x=xLeft;
63555
+ if (item.TextAlign=="right") x=xRight-itemSize.TextWidth;
63556
+ else if (item.TextAlign=="center") x=rtBG.Left+rtBG.Width/2-itemSize.TextWidth/2;
63506
63557
 
63507
63558
  if (item.TextOffset)
63508
63559
  {
@@ -63511,7 +63562,7 @@ function ChartCorssCursor()
63511
63562
  if (IFrameSplitOperator.IsNumber(textOffset.Y)) y+=textOffset.Y;
63512
63563
  }
63513
63564
 
63514
- this.Canvas.fillText(item.Text,x,y,itemSize.Width);
63565
+ this.Canvas.fillText(item.Text,x,y,itemSize.TextWidth);
63515
63566
 
63516
63567
  yTop+=itemSize.Height;
63517
63568
  }
@@ -63562,7 +63613,8 @@ function ChartCorssCursor()
63562
63613
  var item=complexText.Text[i];
63563
63614
  if (item.Font) this.Canvas.font=item.Font;
63564
63615
  else this.Canvas.font=complexText.Font;
63565
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
63616
+ var outWidth=this.Canvas.measureText(item.Text).width;
63617
+ var itemWidth=outWidth
63566
63618
  var itemHeight=this.GetFontHeight();
63567
63619
  if (item.Margin)
63568
63620
  {
@@ -63573,7 +63625,7 @@ function ChartCorssCursor()
63573
63625
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
63574
63626
  }
63575
63627
 
63576
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
63628
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
63577
63629
 
63578
63630
  if (textWidth<itemWidth) textWidth=itemWidth;
63579
63631
  textHeight+=itemHeight;
@@ -63590,8 +63642,8 @@ function ChartCorssCursor()
63590
63642
  var item=complexText.Text[i];
63591
63643
  if (item.Font) this.Canvas.font=item.Font;
63592
63644
  else this.Canvas.font=complexText.Font;
63593
-
63594
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
63645
+ var outWidth=this.Canvas.measureText(item.Text).width;
63646
+ var itemWidth=outWidth;
63595
63647
  var itemHeight=this.Canvas.measureText("擎").width;
63596
63648
  if (item.Margin)
63597
63649
  {
@@ -63602,7 +63654,7 @@ function ChartCorssCursor()
63602
63654
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
63603
63655
  }
63604
63656
 
63605
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
63657
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
63606
63658
 
63607
63659
  textWidth+=itemWidth;
63608
63660
  if (textHeight<itemHeight) textHeight=itemHeight;
@@ -64613,6 +64665,24 @@ function HQPriceStringFormat()
64613
64665
  this.Point;
64614
64666
  this.ClientPos=-1;
64615
64667
  this.HQChart;
64668
+ this.TextStyleConfig={ Right:{ Type:-1 } }; //输出文本样式 Type: -1=默认 1=价格 2=价格|涨幅 2行(分时图)
64669
+ //自定义样式模板
64670
+ this.TextStyleTemplate=
64671
+ [
64672
+ null,
64673
+ null,
64674
+ /*
64675
+ {
64676
+ ShowType:1, Space:2,
64677
+ BaseLine:"center",
64678
+ Text:
64679
+ [
64680
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } },
64681
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } }
64682
+ ]
64683
+ }
64684
+ */
64685
+ ]
64616
64686
 
64617
64687
  this.ExtendChartPaint;
64618
64688
  this.RExtendText=[];
@@ -64706,6 +64776,13 @@ function HQPriceStringFormat()
64706
64776
  }
64707
64777
  }
64708
64778
 
64779
+ this.GetTextStyleTemplate=function(type, defaultTemplate)
64780
+ {
64781
+ var template=this.TextStyleTemplate[type];
64782
+ if (!template) return defaultTemplate;
64783
+ return CloneData(template);
64784
+ }
64785
+
64709
64786
  this.Operator=function()
64710
64787
  {
64711
64788
  this.RText=null;
@@ -64724,7 +64801,41 @@ function HQPriceStringFormat()
64724
64801
  else
64725
64802
  this.Text=this.Value.toFixed(defaultfloatPrecision);
64726
64803
 
64727
- if (this.YClose>0) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
64804
+ if (this.TextStyleConfig.Right.Type==2)
64805
+ {
64806
+ if (IFrameSplitOperator.IsNumber(this.YClose))
64807
+ {
64808
+ var value=(this.Value-this.YClose)*100/this.YClose;
64809
+ var text=`${value.toFixed(2)}%`;
64810
+ if (value>=0) text=` ${value.toFixed(2)}%`;
64811
+
64812
+ var defaultTemplate=
64813
+ {
64814
+ ShowType:1, Space:2,
64815
+ BaseLine:"center",
64816
+ Text:
64817
+ [
64818
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 } },
64819
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 }}
64820
+ ]
64821
+ }
64822
+
64823
+ var complexText=this.GetTextStyleTemplate(this.TextStyleConfig.Right.Type,defaultTemplate);
64824
+
64825
+ complexText.Text[0].Text=this.Text; //价格
64826
+ complexText.Text[1].Text=text; //百分比
64827
+
64828
+ this.RComplexText=complexText;
64829
+ }
64830
+ }
64831
+ else if (this.TextStyleConfig.Right.Type==1)
64832
+ {
64833
+
64834
+ }
64835
+ else
64836
+ {
64837
+ if (IFrameSplitOperator.IsNumber(this.YClose)) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
64838
+ }
64728
64839
 
64729
64840
  this.GetExtendPaintData(defaultfloatPrecision);
64730
64841
  }
@@ -93130,25 +93241,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
93130
93241
  return null;
93131
93242
  }
93132
93243
 
93133
- this.RecvOverlayIndex=function(identify, data)
93134
- {
93135
- var overlayIndex=this.GetOverlayIndexByIdentify(identify);
93136
- if (overlayIndex==null)
93137
- {
93138
- console.warn(`[KLineChartContainer::RecvOverlayIndex] can't find overlay index. [identify=${identify}]`);
93139
- return;
93140
- }
93141
-
93142
- if (!overlayIndex.Script) return;
93143
- if (typeof(overlayIndex.RecvSubscribeData)!="function") return;
93144
-
93145
- if (!this.ChartPaint[0]) return;
93146
- var kData=this.ChartPaint[0].Data;
93147
- if (!kData) return;
93148
-
93149
- overlayIndex.Script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,kData);
93150
- }
93151
-
93152
93244
  //更新叠加指标
93153
93245
  this.UpdateOverlayIndex=function(identify)
93154
93246
  {
@@ -96893,6 +96985,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96893
96985
  var bCorssDrawVaildTime=false;
96894
96986
  var bCorssDrawPoint=false;
96895
96987
  var bCorssBCClick=false;
96988
+ var corssRightTextStyle=-1;
96896
96989
  if (this.ChartCorssCursor)
96897
96990
  {
96898
96991
  bShowCorss=this.ChartCorssCursor.IsShowCorss;
@@ -96900,6 +96993,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96900
96993
  bCorssDrawVaildTime=this.ChartCorssCursor.IsFixXLastTime;
96901
96994
  bCorssDrawPoint=this.ChartCorssCursor.CorssPointConfig.Enable;
96902
96995
  bCorssBCClick=this.ChartCorssCursor.EnableDBClick;
96996
+ if (this.ChartCorssCursor.StringFormatY) corssRightTextStyle=this.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type;
96903
96997
  }
96904
96998
 
96905
96999
  var bRButtonSelectRect=false,bLButtonSelectRect=false;
@@ -97007,6 +97101,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
97007
97101
  { Name:"画在有效X轴上",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_ON_VAILD_TIME_ID, Args:[!bCorssDrawVaildTime]}, Checked:bCorssDrawVaildTime },
97008
97102
  { Name:"画圆点",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_POINT_ID, Args:[!bCorssDrawPoint]}, Checked:bCorssDrawPoint },
97009
97103
  { Name:"双击显示/隐藏", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_DBCLICK_ID, Args:[!bCorssBCClick]}, Checked:bCorssBCClick },
97104
+ {
97105
+ Name:"主图右侧文字格式",
97106
+ SubMenu:
97107
+ [
97108
+ { Name:"默认(百分比)", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE, Args:[-1]}, Checked:corssRightTextStyle===-1 },
97109
+ { Name:"价格", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE, Args:[1]}, Checked:corssRightTextStyle===1 },
97110
+ { Name:"价格|百分比(两行)", Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_YRIGHT_TEXT_STYLE, Args:[2]}, Checked:corssRightTextStyle===2 },
97111
+ ]
97112
+ },
97010
97113
  ]
97011
97114
  },
97012
97115
 
@@ -100291,6 +100394,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
100291
100394
  return null;
100292
100395
  }
100293
100396
 
100397
+ /*
100294
100398
  this.RecvOverlayIndex=function(identify, data)
100295
100399
  {
100296
100400
  var overlayIndex=this.GetOverlayIndexByIdentify(identify);
@@ -100300,14 +100404,16 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
100300
100404
  return;
100301
100405
  }
100302
100406
 
100303
- if (!overlayIndex.Script) return;
100304
- if (typeof(overlayIndex.RecvSubscribeData)!="function") return;
100407
+ var script=overlayIndex.OverlayItem.Script;
100408
+ if (!script) return;
100409
+ if (typeof(script.RecvSubscribeData)!="function") return;
100305
100410
 
100306
100411
  var bindData=this.SourceData;
100307
100412
  if (!bindData) return;
100308
100413
 
100309
- overlayIndex.Script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,bindData);
100414
+ script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,bindData);
100310
100415
  }
100416
+ */
100311
100417
 
100312
100418
  //更新叠加指标
100313
100419
  this.UpdateOverlayIndex=function(identify)
@@ -167094,7 +167200,7 @@ function HQChartScriptWorker()
167094
167200
 
167095
167201
 
167096
167202
 
167097
- var HQCHART_VERSION="1.1.15309";
167203
+ var HQCHART_VERSION="1.1.15314";
167098
167204
 
167099
167205
  function PrintHQChartVersion()
167100
167206
  {