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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.15306",
3
+ "version": "1.1.15312",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -18122,6 +18122,8 @@ function JSExecute(ast,option)
18122
18122
  if (!Array.isArray(outVar)) outVar=this.SingleDataToArrayData(outVar);
18123
18123
  let value={Name:varName, Data:outVar, Radius:g_JSChartResource.CIRCLEDOT.Radius, Type:3, UpDownDot:true };
18124
18124
  if (color) value.Color=color;
18125
+ if (upColor) value.UpColor=upColor;
18126
+ if (downColor) value.DownColor=downColor;
18125
18127
  if (lineWidth) value.LineWidth=lineWidth;
18126
18128
  this.OutVarTable.push(value);
18127
18129
  }
@@ -21501,6 +21503,8 @@ function ScriptIndex(name,script,args,option)
21501
21503
  {
21502
21504
  pointDot.EnableUpDownColor=varItem.UpDownDot;
21503
21505
  pointDot.HistoryData=hisData;
21506
+ if (varItem.UpColor) pointDot.UpColor=varItem.UpColor;
21507
+ if (varItem.DownColor) pointDot.DownColor=varItem.DownColor;
21504
21508
  }
21505
21509
 
21506
21510
  let titleIndex=windowIndex+1;
@@ -23929,6 +23933,8 @@ function OverlayScriptIndex(name,script,args,option)
23929
23933
  {
23930
23934
  chart.EnableUpDownColor=varItem.UpDownDot;
23931
23935
  chart.HistoryData=hisData;
23936
+ if (varItem.UpColor) chart.UpColor=varItem.UpColor;
23937
+ if (varItem.DownColor) chart.DownColor=varItem.DownColor;
23932
23938
  }
23933
23939
 
23934
23940
  let titleIndex=windowIndex+1;
@@ -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);
@@ -37969,6 +37984,8 @@ function ChartPointDot()
37969
37984
  this.Color="rgb(255,193,37)"; //线段颜色
37970
37985
  this.Radius=1; //点半径
37971
37986
  this.EnableUpDownColor=false; //是否是红绿点
37987
+ this.UpColor=g_JSChartResource.ChartPointDot.UpColor;
37988
+ this.DownColor=g_JSChartResource.ChartPointDot.DownColor;
37972
37989
  this.HistoryData;
37973
37990
 
37974
37991
  this.ExportData=this.ExportArrayData;
@@ -38012,8 +38029,8 @@ function ChartPointDot()
38012
38029
  {
38013
38030
  var kItem=this.HistoryData.Data[i];
38014
38031
 
38015
- if (kItem.Close>value) colorDot="rgb(255,61,61)";
38016
- else colorDot='rgb(0,199,65)';
38032
+ if (kItem.Close>value) colorDot=this.UpColor
38033
+ else colorDot=this.DownColor;
38017
38034
 
38018
38035
  this.Canvas.fillStyle=colorDot;
38019
38036
  }
@@ -59132,8 +59149,16 @@ function ChartCorssCursor()
59132
59149
  if (IFrameSplitOperator.IsNumber(itemSize.Height)) yValue=itemSize.Height/2;
59133
59150
  }
59134
59151
 
59135
- rtBG.Top=rtBG.YCenter-yValue;
59136
- rtBG.Bottom=rtBG.Top+rtBG.Height;
59152
+ if (complexText.BaseLine=="center")
59153
+ {
59154
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
59155
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
59156
+ }
59157
+ else
59158
+ {
59159
+ rtBG.Top=rtBG.YCenter-yValue;
59160
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
59161
+ }
59137
59162
  }
59138
59163
  else
59139
59164
  {
@@ -59346,7 +59371,6 @@ function ChartCorssCursor()
59346
59371
  if (complexText.ShowType==1) showType=complexText.ShowType;
59347
59372
  if (showType==1) //多行
59348
59373
  {
59349
- var xLeft=rtBG.Left;
59350
59374
  var yTop=rtBG.Top; //顶
59351
59375
  for(var i=0; i<complexText.Text.length; ++i)
59352
59376
  {
@@ -59360,7 +59384,17 @@ function ChartCorssCursor()
59360
59384
  else this.Canvas.fillStyle=complexText.Color;
59361
59385
 
59362
59386
  var y=yTop+itemSize.Height;
59387
+ var xLeft=rtBG.Left, xRight=rtBG.Right;
59388
+ if (item.Margin)
59389
+ {
59390
+ var margin=item.Margin;
59391
+ if (IFrameSplitOperator.IsNumber(margin.Left)) xLeft+=margin.Left;
59392
+ if (IFrameSplitOperator.IsNumber(margin.Right)) xRight-=margin.Right;
59393
+ }
59394
+
59363
59395
  var x=xLeft;
59396
+ if (item.TextAlign=="right") x=xRight-itemSize.TextWidth;
59397
+ else if (item.TextAlign=="center") x=rtBG.Left+rtBG.Width/2-itemSize.TextWidth/2;
59364
59398
 
59365
59399
  if (item.TextOffset)
59366
59400
  {
@@ -59369,7 +59403,7 @@ function ChartCorssCursor()
59369
59403
  if (IFrameSplitOperator.IsNumber(textOffset.Y)) y+=textOffset.Y;
59370
59404
  }
59371
59405
 
59372
- this.Canvas.fillText(item.Text,x,y,itemSize.Width);
59406
+ this.Canvas.fillText(item.Text,x,y,itemSize.TextWidth);
59373
59407
 
59374
59408
  yTop+=itemSize.Height;
59375
59409
  }
@@ -59420,7 +59454,8 @@ function ChartCorssCursor()
59420
59454
  var item=complexText.Text[i];
59421
59455
  if (item.Font) this.Canvas.font=item.Font;
59422
59456
  else this.Canvas.font=complexText.Font;
59423
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
59457
+ var outWidth=this.Canvas.measureText(item.Text).width;
59458
+ var itemWidth=outWidth
59424
59459
  var itemHeight=this.GetFontHeight();
59425
59460
  if (item.Margin)
59426
59461
  {
@@ -59431,7 +59466,7 @@ function ChartCorssCursor()
59431
59466
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
59432
59467
  }
59433
59468
 
59434
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
59469
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
59435
59470
 
59436
59471
  if (textWidth<itemWidth) textWidth=itemWidth;
59437
59472
  textHeight+=itemHeight;
@@ -59448,8 +59483,8 @@ function ChartCorssCursor()
59448
59483
  var item=complexText.Text[i];
59449
59484
  if (item.Font) this.Canvas.font=item.Font;
59450
59485
  else this.Canvas.font=complexText.Font;
59451
-
59452
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
59486
+ var outWidth=this.Canvas.measureText(item.Text).width;
59487
+ var itemWidth=outWidth;
59453
59488
  var itemHeight=this.Canvas.measureText("擎").width;
59454
59489
  if (item.Margin)
59455
59490
  {
@@ -59460,7 +59495,7 @@ function ChartCorssCursor()
59460
59495
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
59461
59496
  }
59462
59497
 
59463
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
59498
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
59464
59499
 
59465
59500
  textWidth+=itemWidth;
59466
59501
  if (textHeight<itemHeight) textHeight=itemHeight;
@@ -60471,6 +60506,24 @@ function HQPriceStringFormat()
60471
60506
  this.Point;
60472
60507
  this.ClientPos=-1;
60473
60508
  this.HQChart;
60509
+ this.TextStyleConfig={ Right:{ Type:-1 } }; //输出文本样式 Type: -1=默认 1=价格 2=价格|涨幅 2行(分时图)
60510
+ //自定义样式模板
60511
+ this.TextStyleTemplate=
60512
+ [
60513
+ null,
60514
+ null,
60515
+ /*
60516
+ {
60517
+ ShowType:1, Space:2,
60518
+ BaseLine:"center",
60519
+ Text:
60520
+ [
60521
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } },
60522
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } }
60523
+ ]
60524
+ }
60525
+ */
60526
+ ]
60474
60527
 
60475
60528
  this.ExtendChartPaint;
60476
60529
  this.RExtendText=[];
@@ -60564,6 +60617,13 @@ function HQPriceStringFormat()
60564
60617
  }
60565
60618
  }
60566
60619
 
60620
+ this.GetTextStyleTemplate=function(type, defaultTemplate)
60621
+ {
60622
+ var template=this.TextStyleTemplate[type];
60623
+ if (!template) return defaultTemplate;
60624
+ return CloneData(template);
60625
+ }
60626
+
60567
60627
  this.Operator=function()
60568
60628
  {
60569
60629
  this.RText=null;
@@ -60582,7 +60642,41 @@ function HQPriceStringFormat()
60582
60642
  else
60583
60643
  this.Text=this.Value.toFixed(defaultfloatPrecision);
60584
60644
 
60585
- if (this.YClose>0) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
60645
+ if (this.TextStyleConfig.Right.Type==2)
60646
+ {
60647
+ if (IFrameSplitOperator.IsNumber(this.YClose))
60648
+ {
60649
+ var value=(this.Value-this.YClose)*100/this.YClose;
60650
+ var text=`${value.toFixed(2)}%`;
60651
+ if (value>=0) text=` ${value.toFixed(2)}%`;
60652
+
60653
+ var defaultTemplate=
60654
+ {
60655
+ ShowType:1, Space:2,
60656
+ BaseLine:"center",
60657
+ Text:
60658
+ [
60659
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 } },
60660
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 }}
60661
+ ]
60662
+ }
60663
+
60664
+ var complexText=this.GetTextStyleTemplate(this.TextStyleConfig.Right.Type,defaultTemplate);
60665
+
60666
+ complexText.Text[0].Text=this.Text; //价格
60667
+ complexText.Text[1].Text=text; //百分比
60668
+
60669
+ this.RComplexText=complexText;
60670
+ }
60671
+ }
60672
+ else if (this.TextStyleConfig.Right.Type==1)
60673
+ {
60674
+
60675
+ }
60676
+ else
60677
+ {
60678
+ if (IFrameSplitOperator.IsNumber(this.YClose)) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
60679
+ }
60586
60680
 
60587
60681
  this.GetExtendPaintData(defaultfloatPrecision);
60588
60682
  }
@@ -78420,6 +78514,12 @@ function JSChartResource()
78420
78514
  DownColor:"rgb(25,158,0)"
78421
78515
  }
78422
78516
 
78517
+ this.ChartPointDot=
78518
+ {
78519
+ UpColor:"rgb(255,61,61)",
78520
+ DownColor:"rgb(0,199,65)"
78521
+ }
78522
+
78423
78523
  this.ChartDrawTVLongPosition=
78424
78524
  {
78425
78525
  TopArea:
@@ -79797,6 +79897,7 @@ function JSChartResource()
79797
79897
  if (style.ChartSimpleRadar) this.SetChartSimpleRadar(style.ChartSimpleRadar);
79798
79898
 
79799
79899
  if (style.ChartBaseLineBar) this.SetChartBaseLineBar(style.ChartBaseLineBar);
79900
+ if (style.ChartPointDot) this.SetChartPointDot(style.ChartPointDot);
79800
79901
 
79801
79902
  if (style.DRAWICON)
79802
79903
  {
@@ -81072,6 +81173,13 @@ function JSChartResource()
81072
81173
  if (style.DownColor) dest.DownColor=style.DownColor;
81073
81174
  }
81074
81175
 
81176
+ this.SetChartPointDot=function(style)
81177
+ {
81178
+ var dest=this.ChartPointDot;
81179
+ if (style.UpColor) dest.UpColor=style.UpColor;
81180
+ if (style.DownColor) dest.DownColor=style.DownColor;
81181
+ }
81182
+
81075
81183
  this.SetIndexLock=function(style)
81076
81184
  {
81077
81185
  var item=style;
@@ -92737,6 +92845,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92737
92845
  var bCorssDrawVaildTime=false;
92738
92846
  var bCorssDrawPoint=false;
92739
92847
  var bCorssBCClick=false;
92848
+ var corssRightTextStyle=-1;
92740
92849
  if (this.ChartCorssCursor)
92741
92850
  {
92742
92851
  bShowCorss=this.ChartCorssCursor.IsShowCorss;
@@ -92744,6 +92853,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92744
92853
  bCorssDrawVaildTime=this.ChartCorssCursor.IsFixXLastTime;
92745
92854
  bCorssDrawPoint=this.ChartCorssCursor.CorssPointConfig.Enable;
92746
92855
  bCorssBCClick=this.ChartCorssCursor.EnableDBClick;
92856
+ if (this.ChartCorssCursor.StringFormatY) corssRightTextStyle=this.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type;
92747
92857
  }
92748
92858
 
92749
92859
  var bRButtonSelectRect=false,bLButtonSelectRect=false;
@@ -92851,6 +92961,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92851
92961
  { Name:"画在有效X轴上",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_ON_VAILD_TIME_ID, Args:[!bCorssDrawVaildTime]}, Checked:bCorssDrawVaildTime },
92852
92962
  { Name:"画圆点",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_POINT_ID, Args:[!bCorssDrawPoint]}, Checked:bCorssDrawPoint },
92853
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
+ },
92854
92973
  ]
92855
92974
  },
92856
92975
 
@@ -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);
@@ -42065,6 +42080,8 @@ function ChartPointDot()
42065
42080
  this.Color="rgb(255,193,37)"; //线段颜色
42066
42081
  this.Radius=1; //点半径
42067
42082
  this.EnableUpDownColor=false; //是否是红绿点
42083
+ this.UpColor=g_JSChartResource.ChartPointDot.UpColor;
42084
+ this.DownColor=g_JSChartResource.ChartPointDot.DownColor;
42068
42085
  this.HistoryData;
42069
42086
 
42070
42087
  this.ExportData=this.ExportArrayData;
@@ -42108,8 +42125,8 @@ function ChartPointDot()
42108
42125
  {
42109
42126
  var kItem=this.HistoryData.Data[i];
42110
42127
 
42111
- if (kItem.Close>value) colorDot="rgb(255,61,61)";
42112
- else colorDot='rgb(0,199,65)';
42128
+ if (kItem.Close>value) colorDot=this.UpColor
42129
+ else colorDot=this.DownColor;
42113
42130
 
42114
42131
  this.Canvas.fillStyle=colorDot;
42115
42132
  }
@@ -63228,8 +63245,16 @@ function ChartCorssCursor()
63228
63245
  if (IFrameSplitOperator.IsNumber(itemSize.Height)) yValue=itemSize.Height/2;
63229
63246
  }
63230
63247
 
63231
- rtBG.Top=rtBG.YCenter-yValue;
63232
- rtBG.Bottom=rtBG.Top+rtBG.Height;
63248
+ if (complexText.BaseLine=="center")
63249
+ {
63250
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
63251
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63252
+ }
63253
+ else
63254
+ {
63255
+ rtBG.Top=rtBG.YCenter-yValue;
63256
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63257
+ }
63233
63258
  }
63234
63259
  else
63235
63260
  {
@@ -63442,7 +63467,6 @@ function ChartCorssCursor()
63442
63467
  if (complexText.ShowType==1) showType=complexText.ShowType;
63443
63468
  if (showType==1) //多行
63444
63469
  {
63445
- var xLeft=rtBG.Left;
63446
63470
  var yTop=rtBG.Top; //顶
63447
63471
  for(var i=0; i<complexText.Text.length; ++i)
63448
63472
  {
@@ -63456,7 +63480,17 @@ function ChartCorssCursor()
63456
63480
  else this.Canvas.fillStyle=complexText.Color;
63457
63481
 
63458
63482
  var y=yTop+itemSize.Height;
63483
+ var xLeft=rtBG.Left, xRight=rtBG.Right;
63484
+ if (item.Margin)
63485
+ {
63486
+ var margin=item.Margin;
63487
+ if (IFrameSplitOperator.IsNumber(margin.Left)) xLeft+=margin.Left;
63488
+ if (IFrameSplitOperator.IsNumber(margin.Right)) xRight-=margin.Right;
63489
+ }
63490
+
63459
63491
  var x=xLeft;
63492
+ if (item.TextAlign=="right") x=xRight-itemSize.TextWidth;
63493
+ else if (item.TextAlign=="center") x=rtBG.Left+rtBG.Width/2-itemSize.TextWidth/2;
63460
63494
 
63461
63495
  if (item.TextOffset)
63462
63496
  {
@@ -63465,7 +63499,7 @@ function ChartCorssCursor()
63465
63499
  if (IFrameSplitOperator.IsNumber(textOffset.Y)) y+=textOffset.Y;
63466
63500
  }
63467
63501
 
63468
- this.Canvas.fillText(item.Text,x,y,itemSize.Width);
63502
+ this.Canvas.fillText(item.Text,x,y,itemSize.TextWidth);
63469
63503
 
63470
63504
  yTop+=itemSize.Height;
63471
63505
  }
@@ -63516,7 +63550,8 @@ function ChartCorssCursor()
63516
63550
  var item=complexText.Text[i];
63517
63551
  if (item.Font) this.Canvas.font=item.Font;
63518
63552
  else this.Canvas.font=complexText.Font;
63519
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
63553
+ var outWidth=this.Canvas.measureText(item.Text).width;
63554
+ var itemWidth=outWidth
63520
63555
  var itemHeight=this.GetFontHeight();
63521
63556
  if (item.Margin)
63522
63557
  {
@@ -63527,7 +63562,7 @@ function ChartCorssCursor()
63527
63562
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
63528
63563
  }
63529
63564
 
63530
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
63565
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
63531
63566
 
63532
63567
  if (textWidth<itemWidth) textWidth=itemWidth;
63533
63568
  textHeight+=itemHeight;
@@ -63544,8 +63579,8 @@ function ChartCorssCursor()
63544
63579
  var item=complexText.Text[i];
63545
63580
  if (item.Font) this.Canvas.font=item.Font;
63546
63581
  else this.Canvas.font=complexText.Font;
63547
-
63548
- var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
63582
+ var outWidth=this.Canvas.measureText(item.Text).width;
63583
+ var itemWidth=outWidth;
63549
63584
  var itemHeight=this.Canvas.measureText("擎").width;
63550
63585
  if (item.Margin)
63551
63586
  {
@@ -63556,7 +63591,7 @@ function ChartCorssCursor()
63556
63591
  if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
63557
63592
  }
63558
63593
 
63559
- size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
63594
+ size.Text[i]={ Width:itemWidth, Height:itemHeight, TextWidth:outWidth }; //保存所有文字的大小信息
63560
63595
 
63561
63596
  textWidth+=itemWidth;
63562
63597
  if (textHeight<itemHeight) textHeight=itemHeight;
@@ -64567,6 +64602,24 @@ function HQPriceStringFormat()
64567
64602
  this.Point;
64568
64603
  this.ClientPos=-1;
64569
64604
  this.HQChart;
64605
+ this.TextStyleConfig={ Right:{ Type:-1 } }; //输出文本样式 Type: -1=默认 1=价格 2=价格|涨幅 2行(分时图)
64606
+ //自定义样式模板
64607
+ this.TextStyleTemplate=
64608
+ [
64609
+ null,
64610
+ null,
64611
+ /*
64612
+ {
64613
+ ShowType:1, Space:2,
64614
+ BaseLine:"center",
64615
+ Text:
64616
+ [
64617
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } },
64618
+ { Text:null, TextAlign:"center", Margin:{ Left:5, Right:5 } }
64619
+ ]
64620
+ }
64621
+ */
64622
+ ]
64570
64623
 
64571
64624
  this.ExtendChartPaint;
64572
64625
  this.RExtendText=[];
@@ -64660,6 +64713,13 @@ function HQPriceStringFormat()
64660
64713
  }
64661
64714
  }
64662
64715
 
64716
+ this.GetTextStyleTemplate=function(type, defaultTemplate)
64717
+ {
64718
+ var template=this.TextStyleTemplate[type];
64719
+ if (!template) return defaultTemplate;
64720
+ return CloneData(template);
64721
+ }
64722
+
64663
64723
  this.Operator=function()
64664
64724
  {
64665
64725
  this.RText=null;
@@ -64678,7 +64738,41 @@ function HQPriceStringFormat()
64678
64738
  else
64679
64739
  this.Text=this.Value.toFixed(defaultfloatPrecision);
64680
64740
 
64681
- if (this.YClose>0) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
64741
+ if (this.TextStyleConfig.Right.Type==2)
64742
+ {
64743
+ if (IFrameSplitOperator.IsNumber(this.YClose))
64744
+ {
64745
+ var value=(this.Value-this.YClose)*100/this.YClose;
64746
+ var text=`${value.toFixed(2)}%`;
64747
+ if (value>=0) text=` ${value.toFixed(2)}%`;
64748
+
64749
+ var defaultTemplate=
64750
+ {
64751
+ ShowType:1, Space:2,
64752
+ BaseLine:"center",
64753
+ Text:
64754
+ [
64755
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 } },
64756
+ { Text:null, TextAlign:"center", Margin:{ Left:2, Right:2 }}
64757
+ ]
64758
+ }
64759
+
64760
+ var complexText=this.GetTextStyleTemplate(this.TextStyleConfig.Right.Type,defaultTemplate);
64761
+
64762
+ complexText.Text[0].Text=this.Text; //价格
64763
+ complexText.Text[1].Text=text; //百分比
64764
+
64765
+ this.RComplexText=complexText;
64766
+ }
64767
+ }
64768
+ else if (this.TextStyleConfig.Right.Type==1)
64769
+ {
64770
+
64771
+ }
64772
+ else
64773
+ {
64774
+ if (IFrameSplitOperator.IsNumber(this.YClose)) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
64775
+ }
64682
64776
 
64683
64777
  this.GetExtendPaintData(defaultfloatPrecision);
64684
64778
  }
@@ -82516,6 +82610,12 @@ function JSChartResource()
82516
82610
  DownColor:"rgb(25,158,0)"
82517
82611
  }
82518
82612
 
82613
+ this.ChartPointDot=
82614
+ {
82615
+ UpColor:"rgb(255,61,61)",
82616
+ DownColor:"rgb(0,199,65)"
82617
+ }
82618
+
82519
82619
  this.ChartDrawTVLongPosition=
82520
82620
  {
82521
82621
  TopArea:
@@ -83893,6 +83993,7 @@ function JSChartResource()
83893
83993
  if (style.ChartSimpleRadar) this.SetChartSimpleRadar(style.ChartSimpleRadar);
83894
83994
 
83895
83995
  if (style.ChartBaseLineBar) this.SetChartBaseLineBar(style.ChartBaseLineBar);
83996
+ if (style.ChartPointDot) this.SetChartPointDot(style.ChartPointDot);
83896
83997
 
83897
83998
  if (style.DRAWICON)
83898
83999
  {
@@ -85168,6 +85269,13 @@ function JSChartResource()
85168
85269
  if (style.DownColor) dest.DownColor=style.DownColor;
85169
85270
  }
85170
85271
 
85272
+ this.SetChartPointDot=function(style)
85273
+ {
85274
+ var dest=this.ChartPointDot;
85275
+ if (style.UpColor) dest.UpColor=style.UpColor;
85276
+ if (style.DownColor) dest.DownColor=style.DownColor;
85277
+ }
85278
+
85171
85279
  this.SetIndexLock=function(style)
85172
85280
  {
85173
85281
  var item=style;
@@ -96833,6 +96941,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96833
96941
  var bCorssDrawVaildTime=false;
96834
96942
  var bCorssDrawPoint=false;
96835
96943
  var bCorssBCClick=false;
96944
+ var corssRightTextStyle=-1;
96836
96945
  if (this.ChartCorssCursor)
96837
96946
  {
96838
96947
  bShowCorss=this.ChartCorssCursor.IsShowCorss;
@@ -96840,6 +96949,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96840
96949
  bCorssDrawVaildTime=this.ChartCorssCursor.IsFixXLastTime;
96841
96950
  bCorssDrawPoint=this.ChartCorssCursor.CorssPointConfig.Enable;
96842
96951
  bCorssBCClick=this.ChartCorssCursor.EnableDBClick;
96952
+ if (this.ChartCorssCursor.StringFormatY) corssRightTextStyle=this.ChartCorssCursor.StringFormatY.TextStyleConfig.Right.Type;
96843
96953
  }
96844
96954
 
96845
96955
  var bRButtonSelectRect=false,bLButtonSelectRect=false;
@@ -96947,6 +97057,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96947
97057
  { Name:"画在有效X轴上",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_ON_VAILD_TIME_ID, Args:[!bCorssDrawVaildTime]}, Checked:bCorssDrawVaildTime },
96948
97058
  { Name:"画圆点",Data:{ ID:JSCHART_MENU_ID.CMD_CORSS_POINT_ID, Args:[!bCorssDrawPoint]}, Checked:bCorssDrawPoint },
96949
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
+ },
96950
97069
  ]
96951
97070
  },
96952
97071
 
@@ -128570,6 +128689,8 @@ function JSExecute(ast,option)
128570
128689
  if (!Array.isArray(outVar)) outVar=this.SingleDataToArrayData(outVar);
128571
128690
  let value={Name:varName, Data:outVar, Radius:g_JSChartResource.CIRCLEDOT.Radius, Type:3, UpDownDot:true };
128572
128691
  if (color) value.Color=color;
128692
+ if (upColor) value.UpColor=upColor;
128693
+ if (downColor) value.DownColor=downColor;
128573
128694
  if (lineWidth) value.LineWidth=lineWidth;
128574
128695
  this.OutVarTable.push(value);
128575
128696
  }
@@ -131949,6 +132070,8 @@ function ScriptIndex(name,script,args,option)
131949
132070
  {
131950
132071
  pointDot.EnableUpDownColor=varItem.UpDownDot;
131951
132072
  pointDot.HistoryData=hisData;
132073
+ if (varItem.UpColor) pointDot.UpColor=varItem.UpColor;
132074
+ if (varItem.DownColor) pointDot.DownColor=varItem.DownColor;
131952
132075
  }
131953
132076
 
131954
132077
  let titleIndex=windowIndex+1;
@@ -134377,6 +134500,8 @@ function OverlayScriptIndex(name,script,args,option)
134377
134500
  {
134378
134501
  chart.EnableUpDownColor=varItem.UpDownDot;
134379
134502
  chart.HistoryData=hisData;
134503
+ if (varItem.UpColor) chart.UpColor=varItem.UpColor;
134504
+ if (varItem.DownColor) chart.DownColor=varItem.DownColor;
134380
134505
  }
134381
134506
 
134382
134507
  let titleIndex=windowIndex+1;
@@ -155013,7 +155138,7 @@ function ScrollBarBGChart()
155013
155138
 
155014
155139
 
155015
155140
 
155016
- var HQCHART_VERSION="1.1.15305";
155141
+ var HQCHART_VERSION="1.1.15311";
155017
155142
 
155018
155143
  function PrintHQChartVersion()
155019
155144
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.15305";
8
+ var HQCHART_VERSION="1.1.15311";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {