hqchart 1.1.15306 → 1.1.15312

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);
@@ -42109,6 +42124,8 @@ function ChartPointDot()
42109
42124
  this.Color="rgb(255,193,37)"; //线段颜色
42110
42125
  this.Radius=1; //点半径
42111
42126
  this.EnableUpDownColor=false; //是否是红绿点
42127
+ this.UpColor=g_JSChartResource.ChartPointDot.UpColor;
42128
+ this.DownColor=g_JSChartResource.ChartPointDot.DownColor;
42112
42129
  this.HistoryData;
42113
42130
 
42114
42131
  this.ExportData=this.ExportArrayData;
@@ -42152,8 +42169,8 @@ function ChartPointDot()
42152
42169
  {
42153
42170
  var kItem=this.HistoryData.Data[i];
42154
42171
 
42155
- if (kItem.Close>value) colorDot="rgb(255,61,61)";
42156
- else colorDot='rgb(0,199,65)';
42172
+ if (kItem.Close>value) colorDot=this.UpColor
42173
+ else colorDot=this.DownColor;
42157
42174
 
42158
42175
  this.Canvas.fillStyle=colorDot;
42159
42176
  }
@@ -63272,8 +63289,16 @@ function ChartCorssCursor()
63272
63289
  if (IFrameSplitOperator.IsNumber(itemSize.Height)) yValue=itemSize.Height/2;
63273
63290
  }
63274
63291
 
63275
- rtBG.Top=rtBG.YCenter-yValue;
63276
- rtBG.Bottom=rtBG.Top+rtBG.Height;
63292
+ if (complexText.BaseLine=="center")
63293
+ {
63294
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
63295
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63296
+ }
63297
+ else
63298
+ {
63299
+ rtBG.Top=rtBG.YCenter-yValue;
63300
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63301
+ }
63277
63302
  }
63278
63303
  else
63279
63304
  {
@@ -63486,7 +63511,6 @@ function ChartCorssCursor()
63486
63511
  if (complexText.ShowType==1) showType=complexText.ShowType;
63487
63512
  if (showType==1) //多行
63488
63513
  {
63489
- var xLeft=rtBG.Left;
63490
63514
  var yTop=rtBG.Top; //顶
63491
63515
  for(var i=0; i<complexText.Text.length; ++i)
63492
63516
  {
@@ -63500,7 +63524,17 @@ function ChartCorssCursor()
63500
63524
  else this.Canvas.fillStyle=complexText.Color;
63501
63525
 
63502
63526
  var y=yTop+itemSize.Height;
63527
+ var xLeft=rtBG.Left, xRight=rtBG.Right;
63528
+ if (item.Margin)
63529
+ {
63530
+ var margin=item.Margin;
63531
+ if (IFrameSplitOperator.IsNumber(margin.Left)) xLeft+=margin.Left;
63532
+ if (IFrameSplitOperator.IsNumber(margin.Right)) xRight-=margin.Right;
63533
+ }
63534
+
63503
63535
  var x=xLeft;
63536
+ if (item.TextAlign=="right") x=xRight-itemSize.TextWidth;
63537
+ else if (item.TextAlign=="center") x=rtBG.Left+rtBG.Width/2-itemSize.TextWidth/2;
63504
63538
 
63505
63539
  if (item.TextOffset)
63506
63540
  {
@@ -63509,7 +63543,7 @@ function ChartCorssCursor()
63509
63543
  if (IFrameSplitOperator.IsNumber(textOffset.Y)) y+=textOffset.Y;
63510
63544
  }
63511
63545
 
63512
- this.Canvas.fillText(item.Text,x,y,itemSize.Width);
63546
+ this.Canvas.fillText(item.Text,x,y,itemSize.TextWidth);
63513
63547
 
63514
63548
  yTop+=itemSize.Height;
63515
63549
  }
@@ -63560,7 +63594,8 @@ function ChartCorssCursor()
63560
63594
  var item=complexText.Text[i];
63561
63595
  if (item.Font) this.Canvas.font=item.Font;
63562
63596
  else this.Canvas.font=complexText.Font;
63563
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
63597
+ var outWidth=this.Canvas.measureText(item.Text).width;
63598
+ var itemWidth=outWidth
63564
63599
  var itemHeight=this.GetFontHeight();
63565
63600
  if (item.Margin)
63566
63601
  {
@@ -63571,7 +63606,7 @@ function ChartCorssCursor()
63571
63606
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
63572
63607
  }
63573
63608
 
63574
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
63609
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
63575
63610
 
63576
63611
  if (textWidth<itemWidth) textWidth=itemWidth;
63577
63612
  textHeight+=itemHeight;
@@ -63588,8 +63623,8 @@ function ChartCorssCursor()
63588
63623
  var item=complexText.Text[i];
63589
63624
  if (item.Font) this.Canvas.font=item.Font;
63590
63625
  else this.Canvas.font=complexText.Font;
63591
-
63592
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
63626
+ var outWidth=this.Canvas.measureText(item.Text).width;
63627
+ var itemWidth=outWidth;
63593
63628
  var itemHeight=this.Canvas.measureText("擎").width;
63594
63629
  if (item.Margin)
63595
63630
  {
@@ -63600,7 +63635,7 @@ function ChartCorssCursor()
63600
63635
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
63601
63636
  }
63602
63637
 
63603
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
63638
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
63604
63639
 
63605
63640
  textWidth+=itemWidth;
63606
63641
  if (textHeight<itemHeight) textHeight=itemHeight;
@@ -64611,6 +64646,24 @@ function HQPriceStringFormat()
64611
64646
  this.Point;
64612
64647
  this.ClientPos=-1;
64613
64648
  this.HQChart;
64649
+ this.TextStyleConfig={ Right:{ Type:-1 } }; //输出文本样式 Type: -1=默认 1=价格 2=价格|涨幅 2行(分时图)
64650
+ //自定义样式模板
64651
+ this.TextStyleTemplate=
64652
+ [
64653
+ null,
64654
+ null,
64655
+ /*
64656
+ {
64657
+ ShowType:1, Space:2,
64658
+ BaseLine:"center",
64659
+ Text:
64660
+ [
64661
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } },
64662
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } }
64663
+ ]
64664
+ }
64665
+ */
64666
+ ]
64614
64667
 
64615
64668
  this.ExtendChartPaint;
64616
64669
  this.RExtendText=[];
@@ -64704,6 +64757,13 @@ function HQPriceStringFormat()
64704
64757
  }
64705
64758
  }
64706
64759
 
64760
+ this.GetTextStyleTemplate=function(type, defaultTemplate)
64761
+ {
64762
+ var template=this.TextStyleTemplate[type];
64763
+ if (!template) return defaultTemplate;
64764
+ return CloneData(template);
64765
+ }
64766
+
64707
64767
  this.Operator=function()
64708
64768
  {
64709
64769
  this.RText=null;
@@ -64722,7 +64782,41 @@ function HQPriceStringFormat()
64722
64782
  else
64723
64783
  this.Text=this.Value.toFixed(defaultfloatPrecision);
64724
64784
 
64725
- if (this.YClose>0) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
64785
+ if (this.TextStyleConfig.Right.Type==2)
64786
+ {
64787
+ if (IFrameSplitOperator.IsNumber(this.YClose))
64788
+ {
64789
+ var value=(this.Value-this.YClose)*100/this.YClose;
64790
+ var text=`${value.toFixed(2)}%`;
64791
+ if (value>=0) text=` ${value.toFixed(2)}%`;
64792
+
64793
+ var defaultTemplate=
64794
+ {
64795
+ ShowType:1, Space:2,
64796
+ BaseLine:"center",
64797
+ Text:
64798
+ [
64799
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 } },
64800
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 }}
64801
+ ]
64802
+ }
64803
+
64804
+ var complexText=this.GetTextStyleTemplate(this.TextStyleConfig.Right.Type,defaultTemplate);
64805
+
64806
+ complexText.Text[0].Text=this.Text; //价格
64807
+ complexText.Text[1].Text=text; //百分比
64808
+
64809
+ this.RComplexText=complexText;
64810
+ }
64811
+ }
64812
+ else if (this.TextStyleConfig.Right.Type==1)
64813
+ {
64814
+
64815
+ }
64816
+ else
64817
+ {
64818
+ if (IFrameSplitOperator.IsNumber(this.YClose)) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
64819
+ }
64726
64820
 
64727
64821
  this.GetExtendPaintData(defaultfloatPrecision);
64728
64822
  }
@@ -82560,6 +82654,12 @@ function JSChartResource()
82560
82654
  DownColor:"rgb(25,158,0)"
82561
82655
  }
82562
82656
 
82657
+ this.ChartPointDot=
82658
+ {
82659
+ UpColor:"rgb(255,61,61)",
82660
+ DownColor:"rgb(0,199,65)"
82661
+ }
82662
+
82563
82663
  this.ChartDrawTVLongPosition=
82564
82664
  {
82565
82665
  TopArea:
@@ -83937,6 +84037,7 @@ function JSChartResource()
83937
84037
  if (style.ChartSimpleRadar) this.SetChartSimpleRadar(style.ChartSimpleRadar);
83938
84038
 
83939
84039
  if (style.ChartBaseLineBar) this.SetChartBaseLineBar(style.ChartBaseLineBar);
84040
+ if (style.ChartPointDot) this.SetChartPointDot(style.ChartPointDot);
83940
84041
 
83941
84042
  if (style.DRAWICON)
83942
84043
  {
@@ -85212,6 +85313,13 @@ function JSChartResource()
85212
85313
  if (style.DownColor) dest.DownColor=style.DownColor;
85213
85314
  }
85214
85315
 
85316
+ this.SetChartPointDot=function(style)
85317
+ {
85318
+ var dest=this.ChartPointDot;
85319
+ if (style.UpColor) dest.UpColor=style.UpColor;
85320
+ if (style.DownColor) dest.DownColor=style.DownColor;
85321
+ }
85322
+
85215
85323
  this.SetIndexLock=function(style)
85216
85324
  {
85217
85325
  var item=style;
@@ -96877,6 +96985,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96877
96985
  var bCorssDrawVaildTime=false;
96878
96986
  var bCorssDrawPoint=false;
96879
96987
  var bCorssBCClick=false;
96988
+ var corssRightTextStyle=-1;
96880
96989
  if (this.ChartCorssCursor)
96881
96990
  {
96882
96991
  bShowCorss=this.ChartCorssCursor.IsShowCorss;
@@ -96884,6 +96993,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96884
96993
  bCorssDrawVaildTime=this.ChartCorssCursor.IsFixXLastTime;
96885
96994
  bCorssDrawPoint=this.ChartCorssCursor.CorssPointConfig.Enable;
96886
96995
  bCorssBCClick=this.ChartCorssCursor.EnableDBClick;
96996
+ if (this.ChartCorssCursor.StringFormatY) corssRightTextStyle=this.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type;
96887
96997
  }
96888
96998
 
96889
96999
  var bRButtonSelectRect=false,bLButtonSelectRect=false;
@@ -96991,6 +97101,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96991
97101
  { Name:"画在有效X轴上",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_ON_VAILD_TIME_ID, Args:[!bCorssDrawVaildTime]}, Checked:bCorssDrawVaildTime },
96992
97102
  { Name:"画圆点",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_POINT_ID, Args:[!bCorssDrawPoint]}, Checked:bCorssDrawPoint },
96993
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
+ },
96994
97113
  ]
96995
97114
  },
96996
97115
 
@@ -128614,6 +128733,8 @@ function JSExecute(ast,option)
128614
128733
  if (!Array.isArray(outVar)) outVar=this.SingleDataToArrayData(outVar);
128615
128734
  let value={Name:varName, Data:outVar, Radius:g_JSChartResource.CIRCLEDOT.Radius, Type:3, UpDownDot:true };
128616
128735
  if (color) value.Color=color;
128736
+ if (upColor) value.UpColor=upColor;
128737
+ if (downColor) value.DownColor=downColor;
128617
128738
  if (lineWidth) value.LineWidth=lineWidth;
128618
128739
  this.OutVarTable.push(value);
128619
128740
  }
@@ -131993,6 +132114,8 @@ function ScriptIndex(name,script,args,option)
131993
132114
  {
131994
132115
  pointDot.EnableUpDownColor=varItem.UpDownDot;
131995
132116
  pointDot.HistoryData=hisData;
132117
+ if (varItem.UpColor) pointDot.UpColor=varItem.UpColor;
132118
+ if (varItem.DownColor) pointDot.DownColor=varItem.DownColor;
131996
132119
  }
131997
132120
 
131998
132121
  let titleIndex=windowIndex+1;
@@ -134421,6 +134544,8 @@ function OverlayScriptIndex(name,script,args,option)
134421
134544
  {
134422
134545
  chart.EnableUpDownColor=varItem.UpDownDot;
134423
134546
  chart.HistoryData=hisData;
134547
+ if (varItem.UpColor) chart.UpColor=varItem.UpColor;
134548
+ if (varItem.DownColor) chart.DownColor=varItem.DownColor;
134424
134549
  }
134425
134550
 
134426
134551
  let titleIndex=windowIndex+1;
@@ -167072,7 +167197,7 @@ function HQChartScriptWorker()
167072
167197
 
167073
167198
 
167074
167199
 
167075
- var HQCHART_VERSION="1.1.15305";
167200
+ var HQCHART_VERSION="1.1.15311";
167076
167201
 
167077
167202
  function PrintHQChartVersion()
167078
167203
  {