hqchart 1.1.14670 → 1.1.14683

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.14670",
3
+ "version": "1.1.14683",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -58499,24 +58499,38 @@ HQData.APIIndex_TITLE=function(data, callback)
58499
58499
  var textData={ name:"标题", type:10, color:"rgb(0,128,128)", data:[], }; //名字
58500
58500
  var closeData={ name:"收盘价", type:0, color:"rgb(255,165,0)", data:[] } ; //
58501
58501
 
58502
- var aryDate=[];
58503
- var aryTime=[];
58502
+ var titleData=
58503
+ {
58504
+ name:"我的指标标题", type:1,
58505
+ Draw:
58506
+ {
58507
+ Name:"指标标题测试",
58508
+ DrawType:"DRAWTITLE",
58509
+ DrawData:{ AryTitle:[] },
58510
+ },
58511
+ };
58512
+
58504
58513
  for(var i=0;i<kData.Data.length-30;++i)
58505
58514
  {
58506
58515
  var kItem=kData.Data[i];
58507
58516
 
58508
58517
  closeData.data.push(kItem.Close);
58509
58518
 
58510
- textData.data.push(
58511
- [
58512
- { Name:`收`, Text:`${kItem.Close.toFixed(2)}`, Color:"rgb(200,10,10)",},
58513
- { Name:`开`, Text:`${kItem.Open.toFixed(2)}`, Color:"rgb(0,200,10)", LeftSpace:2 }
58514
- ]);
58519
+ titleData.Draw.DrawData.AryTitle.push(
58520
+ {
58521
+ Date:kItem.Date, Time:kItem.Time,
58515
58522
 
58516
- //textData.data.push(`价格:${kItem.Close.toFixed(2)}`);
58523
+ AryText:
58524
+ [
58525
+ { Name:`收`, Text:`${kItem.Close.toFixed(2)}`, Color:"rgb(200,10,10)",},
58526
+ { Name:`开`, Text:`${kItem.Open.toFixed(2)}`, Color:"rgb(0,200,10)", LeftSpace:2 },
58527
+ { Name:"标题1", Text:"1xxxxx", Color:"rgb(100,200,10)", LeftSpace:2},
58528
+ { Name:"标题2", Text:"2xxxxx", Color:"rgb(200,200,10)", LeftSpace:2},
58529
+ { Name:"标题3", Text:"3xxxxx", Color:"rgb(100,70,80)", LeftSpace:2},
58530
+ ]
58531
+ });
58517
58532
 
58518
- aryDate.push(kItem.Date);
58519
- aryTime.push(kItem.Time);
58533
+ //textData.data.push(`价格:${kItem.Close.toFixed(2)}`);
58520
58534
  }
58521
58535
 
58522
58536
 
@@ -58524,7 +58538,7 @@ HQData.APIIndex_TITLE=function(data, callback)
58524
58538
  {
58525
58539
  code:0,
58526
58540
  stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
58527
- outdata: { date:aryDate, time:aryTime, outvar:[ textData, closeData] },
58541
+ outdata: { date:kData.GetDate(), time:kData.GetTime(), outvar:[ titleData, closeData] },
58528
58542
 
58529
58543
  //error: { message:"无权限查看指标“测试指标1”" }
58530
58544
  };
@@ -20813,13 +20813,16 @@ function ScriptIndex(name,script,args,option)
20813
20813
  chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
20814
20814
  chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
20815
20815
  chart.Identify=this.Guid;
20816
+ chart.Data=hqChart.GetKData(); //绑定K线
20816
20817
  if (varItem.Color) chart.Color=this.GetColor(varItem.Color);
20817
20818
  else chart.Color=this.GetDefaultColor(id);
20818
- chart.Data.Data=varItem.Data;
20819
+ chart.AryTitle=varItem.Draw.DrawData.AryTitle;
20820
+ chart.BuildCacheData();
20819
20821
 
20820
20822
  var titleIndex=windowIndex+1;
20821
20823
  var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);
20822
20824
  titleData.DataType="ChartIndexTitle";
20825
+ titleData.Chart=chart;
20823
20826
  hqChart.TitlePaint[titleIndex].Data[id]=titleData;
20824
20827
 
20825
20828
  this.SetChartIndexName(chart);
@@ -22637,6 +22640,9 @@ function ScriptIndex(name,script,args,option)
22637
22640
  case "DRAWSVG":
22638
22641
  this.CreateChartDrawSVG(hqChart,windowIndex,item,i);
22639
22642
  break;
22643
+ case "DRAWTITLE":
22644
+ this.CreateTitle(hqChart,windowIndex,item,i);
22645
+ break;
22640
22646
  case "MULTI_HTMLDOM":
22641
22647
  this.CreateMulitHtmlDom(hqChart,windowIndex,item,i);
22642
22648
  break;
@@ -22730,11 +22736,7 @@ function ScriptIndex(name,script,args,option)
22730
22736
  {
22731
22737
  this.CreateArea(hqChart,windowIndex,item,i);
22732
22738
  }
22733
- else if (item.Type==10) //标题
22734
- {
22735
- this.CreateTitle(hqChart,windowIndex,item,i);
22736
- }
22737
-
22739
+
22738
22740
  var titlePaint=hqChart.TitlePaint[windowIndex+1];
22739
22741
  if (titlePaint && titlePaint.Data && i<titlePaint.Data.length) //设置标题数值 小数位数和格式
22740
22742
  {
@@ -23011,6 +23013,9 @@ function OverlayScriptIndex(name,script,args,option)
23011
23013
  case "DRAWSVG":
23012
23014
  this.CreateChartDrawSVG(hqChart,windowIndex,item,i);
23013
23015
  break;
23016
+ case "DRAWTITLE":
23017
+ this.CreateTitle(hqChart,windowIndex,item,i);
23018
+ break;
23014
23019
  case "MULTI_HTMLDOM":
23015
23020
  this.CreateMulitHtmlDom(hqChart,windowIndex,item,i);
23016
23021
  break;
@@ -23084,11 +23089,6 @@ function OverlayScriptIndex(name,script,args,option)
23084
23089
  {
23085
23090
  this.CreateLine(hqChart,windowIndex,item,i, item.Type);
23086
23091
  }
23087
- else if (item.Type==10)
23088
- {
23089
- this.CreateTitle(hqChart,windowIndex,item,i);
23090
- }
23091
-
23092
23092
 
23093
23093
 
23094
23094
  var titleData=titleInfo.Data[i];
@@ -23673,22 +23673,25 @@ function OverlayScriptIndex(name,script,args,option)
23673
23673
  {
23674
23674
  var overlayIndex=this.OverlayIndex;
23675
23675
  var frame=overlayIndex.Frame;
23676
- let chart=new ChartIndexTitle();
23676
+ var chart=new ChartIndexTitle();
23677
23677
  chart.Canvas=hqChart.Canvas;
23678
23678
 
23679
23679
  chart.Name=varItem.Name;
23680
23680
  chart.ChartBorder=frame.Frame.ChartBorder;
23681
23681
  chart.ChartFrame=frame.Frame;
23682
23682
  chart.Identify=overlayIndex.Identify;
23683
-
23683
+ chart.Data=hqChart.GetKData(); //绑定K线
23684
+
23684
23685
  if (varItem.Color) chart.Color=this.GetColor(varItem.Color);
23685
23686
  else chart.Color=this.GetDefaultColor(id);
23686
- chart.Data.Data=varItem.Data;
23687
+ chart.AryTitle=varItem.Draw.DrawData.AryTitle;
23688
+ chart.BuildCacheData();
23687
23689
 
23688
23690
  var titleIndex=windowIndex+1;
23689
23691
  var titlePaint=hqChart.TitlePaint[titleIndex];
23690
23692
  var titleData=new DynamicTitleData(chart.Data,chart.Name,chart.Color);
23691
23693
  titleData.DataType="ChartIndexTitle";
23694
+ titleData.Chart=chart;
23692
23695
  titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=titleData;
23693
23696
 
23694
23697
  this.SetChartIndexName(chart);
@@ -25304,6 +25307,18 @@ function APIScriptIndex(name,script,args,option, isOverlay)
25304
25307
 
25305
25308
  result.push(outVarItem);
25306
25309
  }
25310
+ else if (draw.DrawType=="DRAWTITLE")
25311
+ {
25312
+ drawItem.Name=draw.Name;
25313
+ drawItem.Type=draw.Type;
25314
+
25315
+ drawItem.DrawType=draw.DrawType;
25316
+ drawItem.DrawData=draw.DrawData;
25317
+
25318
+ outVarItem.Draw=drawItem;
25319
+
25320
+ result.push(outVarItem);
25321
+ }
25307
25322
  else if (draw.DrawType=="MULTI_HTMLDOM") //外部自己创建dom
25308
25323
  {
25309
25324
  drawItem.Text=draw.Text;
@@ -25862,6 +25877,18 @@ function APIScriptIndex(name,script,args,option, isOverlay)
25862
25877
 
25863
25878
  result.push(outVarItem);
25864
25879
  }
25880
+ else if (draw.DrawType=="DRAWTITLE")
25881
+ {
25882
+ drawItem.Name=draw.Name;
25883
+ drawItem.Type=draw.Type;
25884
+
25885
+ drawItem.DrawType=draw.DrawType;
25886
+ drawItem.DrawData=draw.DrawData;
25887
+
25888
+ outVarItem.Draw=drawItem;
25889
+
25890
+ result.push(outVarItem);
25891
+ }
25865
25892
  else
25866
25893
  {
25867
25894
  var find=g_ScriptIndexChartFactory.Get(draw.DrawType); //外部挂接
@@ -3468,7 +3468,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3468
3468
 
3469
3469
  this.DestroyDialogModifyIndexParam=function()
3470
3470
  {
3471
- if (this.DialogModifyIndexParam) return;
3471
+ if (!this.DialogModifyIndexParam) return;
3472
3472
 
3473
3473
  this.DialogModifyIndexParam.Destroy();
3474
3474
  this.DialogModifyIndexParam=null;
@@ -11802,7 +11802,7 @@ function CoordinateInfo()
11802
11802
  //不在当前屏范围 (可定义刻度使用)
11803
11803
  //this.OutRange={ BGColor:"", TextColor:, BorderColor: TopYOffset:, BottomYOffset: }
11804
11804
  //Y轴文字偏移
11805
- //this.YOffset=[{ Offset:5}, { Offset:10}] //目前只对框子外的刻度文字生效
11805
+ //this.YOffset=[{ Offset:5}, { Offset:10} ] //目前只对框子外的刻度文字生效 0=外左 1=外右 2=内左 3=内右
11806
11806
  }
11807
11807
 
11808
11808
 
@@ -13512,10 +13512,18 @@ function AverageWidthFrame()
13512
13512
  this.Canvas.textBaseline = "middle";
13513
13513
  }
13514
13514
 
13515
- var textObj={ X:left, Y:yText, Text:{ BaseLine:this.Canvas.textBaseline, TextAlign: this.Canvas.textAlign, Font:this.Canvas.font, Value:item.Message[0]}} ;
13515
+ var yOffset=0;
13516
+ if (IFrameSplitOperator.IsNonEmptyArray(item.YOffset)) //文字Y轴偏移
13517
+ {
13518
+ var offsetItem=item.YOffset[2];
13519
+ if (offsetItem && IFrameSplitOperator.IsNumber(offsetItem.Offset))
13520
+ yOffset=offsetItem.Offset;
13521
+ }
13522
+
13523
+ var textObj={ X:left, Y:yText+yOffset, Text:{ BaseLine:this.Canvas.textBaseline, TextAlign: this.Canvas.textAlign, Font:this.Canvas.font, Value:item.Message[0]}} ;
13516
13524
  if (!this.IsOverlayMaxMin || !this.IsOverlayMaxMin(textObj))
13517
13525
  {
13518
- this.Canvas.fillText(item.Message[2], left + 1*pixelTatio, yText);
13526
+ this.Canvas.fillText(item.Message[2], left + 1*pixelTatio, yText+yOffset);
13519
13527
  if (yInsideText==null || yInsideText>yText)
13520
13528
  {
13521
13529
  this.YInsideOffset=this.Canvas.measureText(item.Message[2]).width+4*GetDevicePixelRatio();
@@ -13544,10 +13552,19 @@ function AverageWidthFrame()
13544
13552
  {
13545
13553
  this.Canvas.textBaseline = "middle";
13546
13554
  }
13555
+
13556
+ var yOffset=0;
13557
+ if (IFrameSplitOperator.IsNonEmptyArray(item.YOffset)) //文字Y轴偏移
13558
+ {
13559
+ var offsetItem=item.YOffset[3];
13560
+ if (offsetItem && IFrameSplitOperator.IsNumber(offsetItem.Offset))
13561
+ yOffset=offsetItem.Offset;
13562
+ }
13563
+
13547
13564
  var textWidth = this.Canvas.measureText(item.Message[3]).width;
13548
- var textObj={ X:right-textWidth, Y:yText, Text:{ BaseLine:this.Canvas.textBaseline, TextAlign: this.Canvas.textAlign, Font:this.Canvas.font, Value:item.Message[1]}} ;
13565
+ var textObj={ X:right-textWidth, Y:yText+yOffset, Text:{ BaseLine:this.Canvas.textBaseline, TextAlign: this.Canvas.textAlign, Font:this.Canvas.font, Value:item.Message[1]}} ;
13549
13566
  if (!this.IsOverlayMaxMin || !this.IsOverlayMaxMin(textObj))
13550
- this.Canvas.fillText(item.Message[3], right - 1*pixelTatio, yText);
13567
+ this.Canvas.fillText(item.Message[3], right - 1*pixelTatio, yText+yOffset);
13551
13568
  }
13552
13569
  yPrev = y;
13553
13570
  }
@@ -13610,10 +13627,18 @@ function AverageWidthFrame()
13610
13627
  else this.Canvas.textBaseline = "middle";
13611
13628
  }
13612
13629
 
13613
- var textObj={ X:left, Y:yText, Text:{ BaseLine:this.Canvas.textBaseline, TextAlign: this.Canvas.textAlign, Font:this.Canvas.font, Value:item.Message[0]}} ;
13630
+ var yOffset=0;
13631
+ if (IFrameSplitOperator.IsNonEmptyArray(item.YOffset)) //文字Y轴偏移
13632
+ {
13633
+ var offsetItem=item.YOffset[0];
13634
+ if (offsetItem && IFrameSplitOperator.IsNumber(offsetItem.Offset))
13635
+ yOffset=offsetItem.Offset;
13636
+ }
13637
+
13638
+ var textObj={ X:left, Y:yText+yOffset, Text:{ BaseLine:this.Canvas.textBaseline, TextAlign: this.Canvas.textAlign, Font:this.Canvas.font, Value:item.Message[0]}} ;
13614
13639
  if (!this.IsOverlayMaxMin || !this.IsOverlayMaxMin(textObj))
13615
13640
  {
13616
- this.Canvas.fillText(item.Message[0], left + 1*pixelTatio, yText);
13641
+ this.Canvas.fillText(item.Message[0], left + 1*pixelTatio, yText+yOffset);
13617
13642
  if (yInsideText==null || yInsideText>yText)
13618
13643
  {
13619
13644
  this.YInsideOffset=this.Canvas.measureText(item.Message[0]).width+4*GetDevicePixelRatio();
@@ -13648,10 +13673,18 @@ function AverageWidthFrame()
13648
13673
  if (Array.isArray(item.Message[1])) var text=item.Message[1][0];
13649
13674
  else var text=item.Message[1];
13650
13675
 
13676
+ var yOffset=0;
13677
+ if (IFrameSplitOperator.IsNonEmptyArray(item.YOffset)) //文字Y轴偏移
13678
+ {
13679
+ var offsetItem=item.YOffset[1];
13680
+ if (offsetItem && IFrameSplitOperator.IsNumber(offsetItem.Offset))
13681
+ yOffset=offsetItem.Offset;
13682
+ }
13683
+
13651
13684
  var textWidth = this.Canvas.measureText(text).width;
13652
- var textObj={ X:right-textWidth, Y:yText, Text:{ BaseLine:this.Canvas.textBaseline, TextAlign: this.Canvas.textAlign, Font:this.Canvas.font, Value:item.Message[1]}} ;
13685
+ var textObj={ X:right-textWidth, Y:yText+yOffset, Text:{ BaseLine:this.Canvas.textBaseline, TextAlign: this.Canvas.textAlign, Font:this.Canvas.font, Value:item.Message[1]}} ;
13653
13686
  if (!this.IsOverlayMaxMin || !this.IsOverlayMaxMin(textObj))
13654
- this.Canvas.fillText(text, right - 1*pixelTatio, yText);
13687
+ this.Canvas.fillText(text, right - 1*pixelTatio, yText+yOffset);
13655
13688
  }
13656
13689
  yPrev = y;
13657
13690
  }
@@ -25656,7 +25689,7 @@ function IChartPainting()
25656
25689
  if (isHScreen==true)
25657
25690
  {
25658
25691
  var left=this.ChartBorder.GetLeftEx();
25659
- var right=this.ChartBorder.GetRightEx();
25692
+ var right=this.ChartBorder.GetRightEx()+1;
25660
25693
  var top=this.ChartBorder.GetTop();
25661
25694
  var bottom=this.ChartBorder.GetBottom();
25662
25695
  }
@@ -25664,7 +25697,7 @@ function IChartPainting()
25664
25697
  {
25665
25698
  var left=this.ChartBorder.GetLeft();
25666
25699
  var right=this.ChartBorder.GetRight();
25667
- var top=this.ChartBorder.GetTopEx();
25700
+ var top=this.ChartBorder.GetTopEx()-1;
25668
25701
  var bottom=this.ChartBorder.GetBottomEx();
25669
25702
  }
25670
25703
 
@@ -26599,7 +26632,8 @@ function ChartKLine()
26599
26632
  this.DaySummaryConfig=
26600
26633
  {
26601
26634
  Font: g_JSChartResource.DaySummaryKLine.Font,
26602
- TextColor: g_JSChartResource.DaySummaryKLine.TextColor
26635
+ TextColor: g_JSChartResource.DaySummaryKLine.TextColor,
26636
+ LeftMargin:g_JSChartResource.DaySummaryKLine.LeftMargin,
26603
26637
  }
26604
26638
 
26605
26639
  this.AddToDaySummary=function(kItem)
@@ -26681,7 +26715,8 @@ function ChartKLine()
26681
26715
  this.DaySummaryConfig=
26682
26716
  {
26683
26717
  Font: g_JSChartResource.DaySummaryKLine.Font,
26684
- TextColor: g_JSChartResource.DaySummaryKLine.TextColor
26718
+ TextColor: g_JSChartResource.DaySummaryKLine.TextColor,
26719
+ LeftMargin:g_JSChartResource.DaySummaryKLine.LeftMargin,
26685
26720
  }
26686
26721
 
26687
26722
  }
@@ -26785,6 +26820,7 @@ function ChartKLine()
26785
26820
  var yOpen=this.GetYFromData(data.Open,false);
26786
26821
  var yClose=this.GetYFromData(data.Close,false);
26787
26822
  this.DrawKRange.End=i;
26823
+ this.AddToDaySummary(data);
26788
26824
 
26789
26825
  var kItemInfo={ Data:data, Coordinate:{ X:x, Low:yLow, High:yHigh, Close:yClose, Open:yOpen, Left:left, Right:right }};
26790
26826
 
@@ -27068,6 +27104,7 @@ function ChartKLine()
27068
27104
  var x=left+(right-left)/2;
27069
27105
  var yClose=this.GetYFromData(data.Close,false);
27070
27106
  this.DrawKRange.End=i;
27107
+ this.AddToDaySummary(data);
27071
27108
 
27072
27109
  if (data.IsVirtual && this.PredictionConfig.Enable) //预测数据|虚拟数据
27073
27110
  {
@@ -27211,6 +27248,7 @@ function ChartKLine()
27211
27248
  var x=left+(right-left)/2;
27212
27249
  var yClose=this.GetYFromData(data.Close,false);
27213
27250
  this.DrawKRange.End=i;
27251
+ this.AddToDaySummary(data);
27214
27252
 
27215
27253
  if (data.IsVirtual && this.PredictionConfig.Enable) //预测数据|虚拟数据
27216
27254
  {
@@ -27315,7 +27353,7 @@ function ChartKLine()
27315
27353
  this.ShowRange.End=i;
27316
27354
  if (!data || data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
27317
27355
 
27318
- this.AddToDaySummary(data);
27356
+
27319
27357
 
27320
27358
  var left=xOffset;
27321
27359
  var right=xOffset+dataWidth;
@@ -27329,6 +27367,7 @@ function ChartKLine()
27329
27367
 
27330
27368
  var kItemInfo={ Data:data, Coordinate:{ X:x, Low:yLow, High:yHigh, Close:yClose, Open:yOpen, Left:left, Right:right }};
27331
27369
 
27370
+ this.AddToDaySummary(data);
27332
27371
  this.DrawKRange.End=i;
27333
27372
  if (ptMax.Value==null || ptMax.Value<data.High) //求最大值
27334
27373
  {
@@ -31635,7 +31674,7 @@ function ChartKLine()
31635
31674
  this.Canvas.textBaseline = 'bottom';
31636
31675
 
31637
31676
  var border=this.ChartBorder.GetBorder();
31638
- var xText=border.Left+1;
31677
+ var xText=border.Left+this.DaySummaryConfig.LeftMargin;
31639
31678
  var yText=border.Bottom;
31640
31679
 
31641
31680
  var textSize=GetTextSize(this.Canvas,text);
@@ -34937,6 +34976,32 @@ function ChartIndexTitle()
34937
34976
  delete this.newMethod;
34938
34977
 
34939
34978
  this.ClassName='ChartIndexTitle'; //类名
34979
+ this.AryTitle=[]; //{ Date, Time, AryText:[ ] }
34980
+ this.MapCache=null; //key=date/date-time value={ Data:[] }
34981
+
34982
+ this.BuildCacheData=function()
34983
+ {
34984
+ var mapData=new Map();
34985
+ this.MapCache=mapData;
34986
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryTitle)) return;
34987
+
34988
+ for(var i=0;i<this.AryTitle.length;++i)
34989
+ {
34990
+ var item=this.AryTitle[i];
34991
+ var key=this.BuildKey(item);
34992
+
34993
+ mapData.set(key,{ Data:item });
34994
+ }
34995
+ }
34996
+
34997
+ this.GetItem=function(kItem)
34998
+ {
34999
+ if (!this.MapCache || this.MapCache.size<=0) return null;
35000
+ var key=this.BuildKey(kItem);
35001
+ if (!this.MapCache.has(key)) return null;
35002
+
35003
+ return this.MapCache.get(key);
35004
+ }
34940
35005
 
34941
35006
  this.Draw=function()
34942
35007
  {
@@ -55829,44 +55894,39 @@ function ChartCorssCursor()
55829
55894
  var textSize={ Width:textWidth+4, Height:this.TextHeight, Text:[] };
55830
55895
  var buttonData={Y:y, YValue:yValue, FrameID:yValueExtend.FrameID };
55831
55896
 
55832
- if (this.Frame.ChartBorder.Left>=30) //左边
55897
+ var margin=this.LeftConfig.Margin;
55898
+ var textOffset=this.LeftConfig.TextOffset;
55899
+ var rtBG=null;
55900
+ if (this.Frame.ChartBorder.Left>=30 && this.ShowTextMode.Left==1) //左边
55833
55901
  {
55834
- var margin=this.LeftConfig.Margin;
55835
- var textOffset=this.LeftConfig.TextOffset;
55836
-
55837
- var rtBG=null;
55838
- if (this.ShowTextMode.Left==1)
55839
- {
55840
- var rtBG={ Right:left, Width:textWidth+margin.Left+margin.Right, YCenter:y, Height:textHeight+margin.Top+margin.Bottom };
55841
- rtBG.Left=rtBG.Right-rtBG.Width;
55842
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
55843
- rtBG.Bottom=rtBG.Top+rtBG.Height;
55902
+ var rtBG={ Right:left, Width:textWidth+margin.Left+margin.Right, YCenter:y, Height:textHeight+margin.Top+margin.Bottom };
55903
+ rtBG.Left=rtBG.Right-rtBG.Width;
55904
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
55905
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
55844
55906
 
55845
- if (rtBG.Left<0)
55846
- {
55847
- rtBG.Left=0;
55848
- rtBG.Right=rtBG.Left+rtBG.Width;
55849
- }
55850
- }
55851
- else if (this.ShowTextMode.Left==2) //在框架内显示
55907
+ if (rtBG.Left<0)
55852
55908
  {
55853
- var rtBG={ Left:left, Width:textWidth+margin.Left+margin.Right, YCenter:y, Height:textHeight+margin.Top+margin.Bottom };
55909
+ rtBG.Left=0;
55854
55910
  rtBG.Right=rtBG.Left+rtBG.Width;
55855
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
55856
- rtBG.Bottom=rtBG.Top+rtBG.Height;
55857
- }
55858
-
55859
- if (rtBG)
55860
- {
55861
- this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
55862
- this.Canvas.textAlign="left";
55863
- this.Canvas.textBaseline="bottom";
55864
- this.Canvas.fillStyle=this.TextColor;
55865
- this.Canvas.fillText(text,rtBG.Left+textOffset.X, rtBG.Bottom+textOffset.Y);
55866
55911
  }
55912
+
55913
+ }
55914
+ else if (this.ShowTextMode.Left==2) //在框架内显示
55915
+ {
55916
+ var rtBG={ Left:left, Width:textWidth+margin.Left+margin.Right, YCenter:y, Height:textHeight+margin.Top+margin.Bottom };
55917
+ rtBG.Right=rtBG.Left+rtBG.Width;
55918
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
55919
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
55867
55920
  }
55868
55921
 
55869
-
55922
+ if (rtBG)
55923
+ {
55924
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
55925
+ this.Canvas.textAlign="left";
55926
+ this.Canvas.textBaseline="bottom";
55927
+ this.Canvas.fillStyle=this.TextColor;
55928
+ this.Canvas.fillText(text,rtBG.Left+textOffset.X, rtBG.Bottom+textOffset.Y);
55929
+ }
55870
55930
 
55871
55931
  var complexText=
55872
55932
  {
@@ -56056,7 +56116,7 @@ function ChartCorssCursor()
56056
56116
  this.Canvas.textBaseline="bottom";
56057
56117
  this.Canvas.fillStyle=this.TextColor;
56058
56118
  this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y,textWidth);
56059
- }
56119
+ }
56060
56120
  }
56061
56121
 
56062
56122
  //子坐标Y轴
@@ -60031,33 +60091,40 @@ function DynamicChartTitlePainting()
60031
60091
  return aryText;
60032
60092
  }
60033
60093
 
60034
- this.FormatIndexTitle=function(value, dataInfo)
60094
+ this.FormatIndexTitle=function(kItem, dataInfo)
60035
60095
  {
60036
- if (!value) return null;
60096
+ var result=null;
60097
+ var aryText=[];
60098
+ if (dataInfo.Name)
60099
+ {
60100
+ aryText.push({ Text:dataInfo.Name, Color:dataInfo.Color});
60101
+ result={ Text:null, ArrayText:aryText };
60102
+ }
60037
60103
 
60038
- if (IFrameSplitOperator.IsString(value)) return { Text:value, ArrayText:null };
60104
+ if (!kItem) return result;
60105
+ if (!dataInfo.Chart) return result;
60106
+
60107
+ var titleItem=dataInfo.Chart.GetItem(kItem);
60108
+ if (!titleItem || !titleItem.Data) return result;
60109
+ if (!IFrameSplitOperator.IsNonEmptyArray(titleItem.Data.AryText)) return result;
60039
60110
 
60040
- if (IFrameSplitOperator.IsNonEmptyArray(value))
60111
+ if (!result) result={ Text:null, ArrayText:aryText };
60112
+
60113
+ for(var i=0;i<titleItem.Data.AryText.length;++i)
60041
60114
  {
60042
- var aryText=[];
60043
- for(var i=0;i<value.length;++i)
60044
- {
60045
- var item=value[i];
60046
- if (!item) continue;
60047
-
60048
- var textItem={ Name:null, Text:null };
60049
- if (item.Name) textItem.Name=item.Name;
60050
- if (item.Text) textItem.Text=item.Text;
60051
- if (item.Color) textItem.Color=item.Color;
60052
- if (IFrameSplitOperator.IsNumber(item.LeftSpace)) textItem.LeftSpace=item.LeftSpace;
60115
+ var item=titleItem.Data.AryText[i];
60116
+ if (!item) continue;
60053
60117
 
60054
- aryText.push(textItem);
60055
- }
60118
+ var textItem={ Name:null, Text:null };
60119
+ if (item.Name) textItem.Name=item.Name;
60120
+ if (item.Text) textItem.Text=item.Text;
60121
+ if (item.Color) textItem.Color=item.Color;
60122
+ if (IFrameSplitOperator.IsNumber(item.LeftSpace)) textItem.LeftSpace=item.LeftSpace;
60056
60123
 
60057
- return { Text:null, ArrayText:aryText }
60124
+ aryText.push(textItem);
60058
60125
  }
60059
60126
 
60060
- return null;
60127
+ return result;
60061
60128
  }
60062
60129
 
60063
60130
  this.GetColor=function(price,yClose)
@@ -73778,7 +73845,8 @@ function JSChartResource()
73778
73845
  this.DaySummaryKLine=
73779
73846
  {
73780
73847
  Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
73781
- TextColor:"rgb(105,105,105)"
73848
+ TextColor:"rgb(105,105,105)",
73849
+ LeftMargin:2*GetDevicePixelRatio(),
73782
73850
  }
73783
73851
 
73784
73852
  //订单流配置
@@ -75238,6 +75306,7 @@ function JSChartResource()
75238
75306
  var dest=this.DaySummaryKLine;
75239
75307
  if (item.Font) dest.Font=item.Font;
75240
75308
  if (item.TextColor) dest.TextColor=item.TextColor;
75309
+ if (IFrameSplitOperator.IsNumber(item.LeftMargin)) dest.LeftMargin=item.LeftMargin;
75241
75310
  }
75242
75311
 
75243
75312
  if (style.Index)
@@ -2985,24 +2985,38 @@ HQData.APIIndex_TITLE=function(data, callback)
2985
2985
  var textData={ name:"标题", type:10, color:"rgb(0,128,128)", data:[], }; //名字
2986
2986
  var closeData={ name:"收盘价", type:0, color:"rgb(255,165,0)", data:[] } ; //
2987
2987
 
2988
- var aryDate=[];
2989
- var aryTime=[];
2988
+ var titleData=
2989
+ {
2990
+ name:"我的指标标题", type:1,
2991
+ Draw:
2992
+ {
2993
+ Name:"指标标题测试",
2994
+ DrawType:"DRAWTITLE",
2995
+ DrawData:{ AryTitle:[] },
2996
+ },
2997
+ };
2998
+
2990
2999
  for(var i=0;i<kData.Data.length-30;++i)
2991
3000
  {
2992
3001
  var kItem=kData.Data[i];
2993
3002
 
2994
3003
  closeData.data.push(kItem.Close);
2995
3004
 
2996
- textData.data.push(
2997
- [
2998
- { Name:`收`, Text:`${kItem.Close.toFixed(2)}`, Color:"rgb(200,10,10)",},
2999
- { Name:`开`, Text:`${kItem.Open.toFixed(2)}`, Color:"rgb(0,200,10)", LeftSpace:2 }
3000
- ]);
3005
+ titleData.Draw.DrawData.AryTitle.push(
3006
+ {
3007
+ Date:kItem.Date, Time:kItem.Time,
3001
3008
 
3002
- //textData.data.push(`价格:${kItem.Close.toFixed(2)}`);
3009
+ AryText:
3010
+ [
3011
+ { Name:`收`, Text:`${kItem.Close.toFixed(2)}`, Color:"rgb(200,10,10)",},
3012
+ { Name:`开`, Text:`${kItem.Open.toFixed(2)}`, Color:"rgb(0,200,10)", LeftSpace:2 },
3013
+ { Name:"标题1", Text:"1xxxxx", Color:"rgb(100,200,10)", LeftSpace:2},
3014
+ { Name:"标题2", Text:"2xxxxx", Color:"rgb(200,200,10)", LeftSpace:2},
3015
+ { Name:"标题3", Text:"3xxxxx", Color:"rgb(100,70,80)", LeftSpace:2},
3016
+ ]
3017
+ });
3003
3018
 
3004
- aryDate.push(kItem.Date);
3005
- aryTime.push(kItem.Time);
3019
+ //textData.data.push(`价格:${kItem.Close.toFixed(2)}`);
3006
3020
  }
3007
3021
 
3008
3022
 
@@ -3010,7 +3024,7 @@ HQData.APIIndex_TITLE=function(data, callback)
3010
3024
  {
3011
3025
  code:0,
3012
3026
  stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
3013
- outdata: { date:aryDate, time:aryTime, outvar:[ textData, closeData] },
3027
+ outdata: { date:kData.GetDate(), time:kData.GetTime(), outvar:[ titleData, closeData] },
3014
3028
 
3015
3029
  //error: { message:"无权限查看指标“测试指标1”" }
3016
3030
  };