hqchart 1.1.14354 → 1.1.14363

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.
@@ -45265,10 +45265,18 @@ function ChartMultiText()
45265
45265
  var mapItem=this.MapCache.get(key);
45266
45266
  if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
45267
45267
 
45268
- var left=xOffset;
45269
- var right=xOffset+dataWidth;
45270
- if (right>chartright) break;
45271
- var x=left+(right-left)/2;
45268
+ if (isMinute)
45269
+ {
45270
+ var x=this.ChartFrame.GetXFromIndex(j);
45271
+ }
45272
+ else
45273
+ {
45274
+ var left=xOffset;
45275
+ var right=xOffset+dataWidth;
45276
+ if (right>chartright) break;
45277
+ var x=left+(right-left)/2;
45278
+ }
45279
+
45272
45280
 
45273
45281
  for(var k=0;k<mapItem.Data.length;++k)
45274
45282
  {
@@ -57074,8 +57082,9 @@ function ChartCorssCursor()
57074
57082
  Icon:g_JSChartResource.CorssCursor.RightButton.Icon
57075
57083
  };
57076
57084
 
57077
- this.RightMargin={ Left:2, Right:2, Top:4, Bottom:3 };
57078
- CopyMarginConfig(this.RightMargin, g_JSChartResource.CorssCursor.RightMargin);
57085
+ this.RightMargin=CloneData(g_JSChartResource.CorssCursor.RightMargin);
57086
+ this.BottomConfig=CloneData(g_JSChartResource.CorssCursor.BottomText); //底部输出配置
57087
+ this.LeftConfig=CloneData(g_JSChartResource.CorssCursor.LeftText);
57079
57088
 
57080
57089
  //内部使用
57081
57090
  this.Close=null; //收盘价格
@@ -57447,36 +57456,48 @@ function ChartCorssCursor()
57447
57456
  {
57448
57457
  var text=this.StringFormatY.Text;
57449
57458
  this.Canvas.font=this.Font;
57450
- var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
57451
- var textSize={ Width:textWidth, Height:this.TextHeight, Text:[] };
57459
+ var textWidth=this.Canvas.measureText(text).width; //前后各空2个像素
57460
+ var textSize={ Width:textWidth+4, Height:this.TextHeight, Text:[] };
57452
57461
  var buttonData={Y:y, YValue:yValue, FrameID:yValueExtend.FrameID };
57453
- if (this.Frame.ChartBorder.Left>=30 && this.ShowTextMode.Left==1)
57462
+
57463
+ if (this.Frame.ChartBorder.Left>=30) //左边
57454
57464
  {
57455
- if (left<textWidth ) //左边空白的地方太少了画布下
57465
+ var margin=this.LeftConfig.Margin;
57466
+ var textOffset=this.LeftConfig.TextOffset;
57467
+
57468
+ var rtBG=null;
57469
+ if (this.ShowTextMode.Left==1)
57456
57470
  {
57457
- this.DrawTextBGRect(ToFixedPoint(2),ToFixedPoint(y-this.TextHeight/2),ToFixedRect(textWidth),ToFixedRect(this.TextHeight));
57458
- this.Canvas.textAlign="left";
57459
- this.Canvas.textBaseline="middle";
57460
- this.Canvas.fillStyle=this.TextColor;
57461
- this.Canvas.fillText(text,2+2,y,textWidth);
57471
+ var rtBG={ Right:left, Width:textWidth+margin.Left+margin.Right, YCenter:y, Height:textHeight+margin.Top+margin.Bottom };
57472
+ rtBG.Left=rtBG.Right-rtBG.Width;
57473
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
57474
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
57475
+
57476
+ if (rtBG.Left<0)
57477
+ {
57478
+ rtBG.Left=0;
57479
+ rtBG.Right=rtBG.Left+rtBG.Width;
57480
+ }
57462
57481
  }
57463
- else
57482
+ else if (this.ShowTextMode.Left==2) //在框架内显示
57464
57483
  {
57465
- this.DrawTextBGRect(left-2,y-this.TextHeight/2,-textWidth,this.TextHeight);
57466
- this.Canvas.textAlign="right";
57467
- this.Canvas.textBaseline="middle";
57484
+ var rtBG={ Left:left, Width:textWidth+margin.Left+margin.Right, YCenter:y, Height:textHeight+margin.Top+margin.Bottom };
57485
+ rtBG.Right=rtBG.Left+rtBG.Width;
57486
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
57487
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
57488
+ }
57489
+
57490
+ if (rtBG)
57491
+ {
57492
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
57493
+ this.Canvas.textAlign="left";
57494
+ this.Canvas.textBaseline="bottom";
57468
57495
  this.Canvas.fillStyle=this.TextColor;
57469
- this.Canvas.fillText(text,left-4,y,textWidth);
57496
+ this.Canvas.fillText(text,rtBG.Left+textOffset.X, rtBG.Bottom+textOffset.Y);
57470
57497
  }
57471
57498
  }
57472
- else if (this.ShowTextMode.Left==2) //在框架内显示
57473
- {
57474
- this.DrawTextBGRect(left,y-this.TextHeight/2,textWidth,this.TextHeight);
57475
- this.Canvas.textAlign="left";
57476
- this.Canvas.textBaseline="middle";
57477
- this.Canvas.fillStyle=this.TextColor;
57478
- this.Canvas.fillText(text,left+2,y,textWidth);
57479
- }
57499
+
57500
+
57480
57501
 
57481
57502
  var complexText=
57482
57503
  {
@@ -57618,26 +57639,42 @@ function ChartCorssCursor()
57618
57639
  var text=this.StringFormatX.Text;
57619
57640
  this.Canvas.font=this.Font;
57620
57641
  this.Canvas.fillStyle=this.TextBGColor;
57621
- var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
57642
+ var textWidth=this.Canvas.measureText(text).width; //前后各空2个像素
57643
+ var margin=this.BottomConfig.Margin;
57644
+ var textOffset=this.BottomConfig.TextOffset;
57645
+ var rtBG=
57646
+ {
57647
+ Top:bottom, Height:margin.Top+margin.Bottom+textHeight,
57648
+ XCenter:x, Width:textWidth+margin.Left+margin.Right
57649
+ };
57650
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
57651
+ rtBG.Left=rtBG.XCenter-rtBG.Width/2;
57652
+ rtBG.Right=rtBG.Left+rtBG.Width;
57653
+
57654
+ if (rtBG.Left<=0)
57655
+ {
57656
+ rtBG.Left=0;
57657
+ rtBG.Right=rtBG.Left+rtBG.Width;
57658
+ }
57659
+ else if (rtBG.Right>=right)
57660
+ {
57661
+ rtBG.Right=right;
57662
+ rtBG.Left=rtBG.Right-rtBG.Width;
57663
+ }
57622
57664
 
57623
- var yCenter=bottom+2+this.TextHeight/2;
57624
- var yTop=bottom+2;
57625
57665
  var bShowText=true;
57626
57666
  if (this.ShowTextMode.Bottom==2)
57627
57667
  {
57628
- yCenter=bottom-this.TextHeight/2-2;
57629
- yTop=bottom-this.TextHeight-2;
57668
+ rtBG.Bottom=bottom;
57669
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
57630
57670
  }
57631
57671
  else if (this.ShowTextMode.Bottom==8)
57632
57672
  {
57633
57673
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_CORSSCURSOR_POSITION);
57634
57674
  if (event && event.Callback)
57635
57675
  {
57636
- var sendData={ YCenter:yCenter, YTop:yTop, Height:this.TextHeight, IsShowText:bShowText };
57676
+ var sendData={ RectText:rtBG, IsShowText:bShowText, X:x, Y:y };
57637
57677
  event.Callback(event, sendData, this);
57638
-
57639
- yCenter=sendData.YCenter;
57640
- yTop=sendData.YTop;
57641
57678
  bShowText=sendData.IsShowText;
57642
57679
  }
57643
57680
  }
@@ -57645,31 +57682,12 @@ function ChartCorssCursor()
57645
57682
  //JSConsole.Chart.Log('[ChartCorssCursor::Draw] ',yCenter);
57646
57683
  if (bShowText)
57647
57684
  {
57648
- if (x-textWidth/2<3) //左边位置不够了, 顶着左边画
57649
- {
57650
- this.DrawTextBGRect(x-1,yTop,textWidth,this.TextHeight);
57651
- this.Canvas.textAlign="left";
57652
- this.Canvas.textBaseline="middle";
57653
- this.Canvas.fillStyle=this.TextColor;
57654
- this.Canvas.fillText(text,x+1,yCenter,textWidth);
57655
- }
57656
- else if (x+textWidth/2>=right)
57657
- {
57658
- this.DrawTextBGRect(right-textWidth,yTop,textWidth,this.TextHeight);
57659
- this.Canvas.textAlign="right";
57660
- this.Canvas.textBaseline="middle";
57661
- this.Canvas.fillStyle=this.TextColor;
57662
- this.Canvas.fillText(text,right-2,yCenter,textWidth);
57663
- }
57664
- else
57665
- {
57666
- this.DrawTextBGRect(x-textWidth/2,yTop,textWidth,this.TextHeight);
57667
- this.Canvas.textAlign="center";
57668
- this.Canvas.textBaseline="middle";
57669
- this.Canvas.fillStyle=this.TextColor;
57670
- this.Canvas.fillText(text,x,yCenter,textWidth);
57671
- }
57672
- }
57685
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
57686
+ this.Canvas.textAlign="left";
57687
+ this.Canvas.textBaseline="bottom";
57688
+ this.Canvas.fillStyle=this.TextColor;
57689
+ this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y,textWidth);
57690
+ }
57673
57691
  }
57674
57692
 
57675
57693
  //子坐标Y轴
@@ -74997,7 +75015,10 @@ function JSChartResource()
74997
75015
  Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
74998
75016
  },
74999
75017
 
75000
- RightMargin: { Left:2, Right:2, Top:5, Bottom:3 }
75018
+ RightMargin: { Left:2, Right:2, Top:5, Bottom:3 },
75019
+
75020
+ BottomText:{ Margin: { Left:4, Right:4, Top:0, Bottom:0 }, TextOffset:{X:4, Y:-1 } },
75021
+ LeftText:{ Margin: { Left:4, Right:4, Top:0, Bottom:0 }, TextOffset:{X:4, Y:-1 } }
75001
75022
  };
75002
75023
 
75003
75024
  this.LockBGColor = "rgb(220, 220, 220)"; //指标锁区域颜色
@@ -126919,6 +126940,16 @@ function APIScriptIndex(name,script,args,option, isOverlay)
126919
126940
 
126920
126941
  result.push(outVarItem);
126921
126942
  }
126943
+ else if (draw.DrawType=='MULTI_BAR')
126944
+ {
126945
+ drawItem.Text=draw.Text;
126946
+ drawItem.Name=draw.Name;
126947
+ drawItem.DrawType=draw.DrawType;
126948
+ drawItem.DrawData=draw.DrawData;
126949
+ outVarItem.Draw=drawItem;
126950
+
126951
+ result.push(outVarItem);
126952
+ }
126922
126953
  else if (draw.DrawType=="DRAWCOLORKLINE")
126923
126954
  {
126924
126955
  drawItem.Name=draw.Name;
@@ -142726,7 +142757,7 @@ function ScrollBarBGChart()
142726
142757
 
142727
142758
 
142728
142759
 
142729
- var HQCHART_VERSION="1.1.14353";
142760
+ var HQCHART_VERSION="1.1.14362";
142730
142761
 
142731
142762
  function PrintHQChartVersion()
142732
142763
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14353";
8
+ var HQCHART_VERSION="1.1.14362";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -57398,6 +57398,8 @@ HQData.Report_APIIndex=function(data, callback)
57398
57398
  HQData.APIIndex_DRAW_SIMPLE_RADAR(data, callback);
57399
57399
  else if (request.Data.indexname=="API_MULTI_BAR")
57400
57400
  HQData.APIIndex_MULTI_BAR(data, callback);
57401
+ else if (request.Data.indexname=="API_MULTI_TEXT")
57402
+ HQData.APIIndex_MULTI_TEXT(data, callback);
57401
57403
 
57402
57404
  }
57403
57405
 
@@ -58034,7 +58036,7 @@ HQData.APIIndex_MULTI_BAR=function(data, callback)
58034
58036
  [
58035
58037
  //{Date:20190916, Time: Value:15.5, Value2:0 },
58036
58038
  ],
58037
- Width:20
58039
+ Width:5
58038
58040
  };
58039
58041
 
58040
58042
  for(var i=0;i<kData.Data.length;++i)
@@ -58063,6 +58065,57 @@ HQData.APIIndex_MULTI_BAR=function(data, callback)
58063
58065
  }
58064
58066
 
58065
58067
 
58068
+ HQData.APIIndex_MULTI_TEXT=function(data, callback)
58069
+ {
58070
+ data.PreventDefault=true;
58071
+ var hqchart=data.HQChart;
58072
+ var kData=hqchart.GetKData();
58073
+
58074
+ var SVGData=
58075
+ {
58076
+ name:'MULTI_TEXT', type:1,
58077
+ Draw:
58078
+ {
58079
+ DrawType:'MULTI_TEXT',
58080
+ DrawData: []
58081
+ } //绘制文字
58082
+ };
58083
+
58084
+ var ARRAY_COLOR=['rgb(255,248,220)','rgb(230,230,250)','rgb(100,149,237)','rgb(32,178,170)','rgb(152,251,152)','rgb(128,128,0)','rgb(255,165,0)','rgb(255,160,122)','rgb(205,92,92)']
58085
+
58086
+ for(var i=0;i<kData.Data.length;++i)
58087
+ {
58088
+ var item=kData.Data[i];
58089
+ if (i%5!=3) continue;
58090
+
58091
+ var colorIndex=Math.ceil(Math.random()*ARRAY_COLOR.length-1);
58092
+ var drawItem=
58093
+ {
58094
+ Date:item.Date, Time:item.Time, Value:"H", Text:`最高:${item.High.toFixed(2)}`,Color:ARRAY_COLOR[colorIndex], Baseline:2, YMove:-2
58095
+ };
58096
+
58097
+ var colorIndex=Math.ceil(Math.random()*ARRAY_COLOR.length-1);
58098
+ var drawItem2=
58099
+ {
58100
+ Date:item.Date, Time:item.Time, Value:item.Low, Text:`最低:${item.Low.toFixed(2)}`,Color:ARRAY_COLOR[colorIndex], Baseline:1, YMove:2
58101
+ };
58102
+
58103
+ SVGData.Draw.DrawData.push(drawItem);
58104
+ SVGData.Draw.DrawData.push(drawItem2);
58105
+ }
58106
+
58107
+ var apiData=
58108
+ {
58109
+ code:0,
58110
+ stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
58111
+ outdata: { date:kData.GetDate(), time:kData.GetTime(), outvar:[SVGData] }
58112
+ };
58113
+
58114
+ console.log('[HQData.APIIndex_MULTI_TEXT] apiData ', apiData);
58115
+ callback(apiData);
58116
+ }
58117
+
58118
+
58066
58119
 
58067
58120
 
58068
58121
  /*暴露外部用的方法*/