hqchart 1.1.14349 → 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.
@@ -44487,7 +44487,7 @@ function ChartMultiBar()
44487
44487
 
44488
44488
  for(var mapItem of mapBar)
44489
44489
  {
44490
- aryBar=mapItem[1].AryBar;
44490
+ var aryBar=mapItem[1].AryBar;
44491
44491
  if (!IFrameSplitOperator.IsNonEmptyArray(aryBar)) continue;
44492
44492
 
44493
44493
  var config=null;
@@ -44495,6 +44495,7 @@ function ChartMultiBar()
44495
44495
  var count=0;
44496
44496
  var drawType=-1; //1=直线 2=实心 3=空心
44497
44497
  var barWidth=1;
44498
+ this.Canvas.beginPath();
44498
44499
  for(var i=0;i<aryBar.length;++i)
44499
44500
  {
44500
44501
  var item=aryBar[i];
@@ -44518,7 +44519,6 @@ function ChartMultiBar()
44518
44519
 
44519
44520
  if (drawType==1)
44520
44521
  {
44521
- this.Canvas.beginPath();
44522
44522
  if (this.IsHScreen)
44523
44523
  {
44524
44524
  this.Canvas.moveTo(ToFixedPoint(item.Y),ToFixedPoint(item.X));
@@ -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
  {
@@ -45323,7 +45331,6 @@ function ChartMultiText()
45323
45331
 
45324
45332
  if (item.Line)
45325
45333
  {
45326
- var kItem=this.Data.Data[item.Index];
45327
45334
  var price=item.Line.KData=="H"? kItem.High:kItem.Low;
45328
45335
  var yPrice=this.ChartFrame.GetYFromData(price, false);
45329
45336
  var yText=y;
@@ -57075,8 +57082,9 @@ function ChartCorssCursor()
57075
57082
  Icon:g_JSChartResource.CorssCursor.RightButton.Icon
57076
57083
  };
57077
57084
 
57078
- this.RightMargin={ Left:2, Right:2, Top:4, Bottom:3 };
57079
- 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);
57080
57088
 
57081
57089
  //内部使用
57082
57090
  this.Close=null; //收盘价格
@@ -57448,36 +57456,48 @@ function ChartCorssCursor()
57448
57456
  {
57449
57457
  var text=this.StringFormatY.Text;
57450
57458
  this.Canvas.font=this.Font;
57451
- var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
57452
- 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:[] };
57453
57461
  var buttonData={Y:y, YValue:yValue, FrameID:yValueExtend.FrameID };
57454
- if (this.Frame.ChartBorder.Left>=30 && this.ShowTextMode.Left==1)
57462
+
57463
+ if (this.Frame.ChartBorder.Left>=30) //左边
57455
57464
  {
57456
- 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)
57457
57470
  {
57458
- this.DrawTextBGRect(ToFixedPoint(2),ToFixedPoint(y-this.TextHeight/2),ToFixedRect(textWidth),ToFixedRect(this.TextHeight));
57459
- this.Canvas.textAlign="left";
57460
- this.Canvas.textBaseline="middle";
57461
- this.Canvas.fillStyle=this.TextColor;
57462
- 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
+ }
57463
57481
  }
57464
- else
57482
+ else if (this.ShowTextMode.Left==2) //在框架内显示
57465
57483
  {
57466
- this.DrawTextBGRect(left-2,y-this.TextHeight/2,-textWidth,this.TextHeight);
57467
- this.Canvas.textAlign="right";
57468
- 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";
57469
57495
  this.Canvas.fillStyle=this.TextColor;
57470
- this.Canvas.fillText(text,left-4,y,textWidth);
57496
+ this.Canvas.fillText(text,rtBG.Left+textOffset.X, rtBG.Bottom+textOffset.Y);
57471
57497
  }
57472
57498
  }
57473
- else if (this.ShowTextMode.Left==2) //在框架内显示
57474
- {
57475
- this.DrawTextBGRect(left,y-this.TextHeight/2,textWidth,this.TextHeight);
57476
- this.Canvas.textAlign="left";
57477
- this.Canvas.textBaseline="middle";
57478
- this.Canvas.fillStyle=this.TextColor;
57479
- this.Canvas.fillText(text,left+2,y,textWidth);
57480
- }
57499
+
57500
+
57481
57501
 
57482
57502
  var complexText=
57483
57503
  {
@@ -57619,26 +57639,42 @@ function ChartCorssCursor()
57619
57639
  var text=this.StringFormatX.Text;
57620
57640
  this.Canvas.font=this.Font;
57621
57641
  this.Canvas.fillStyle=this.TextBGColor;
57622
- 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
+ }
57623
57664
 
57624
- var yCenter=bottom+2+this.TextHeight/2;
57625
- var yTop=bottom+2;
57626
57665
  var bShowText=true;
57627
57666
  if (this.ShowTextMode.Bottom==2)
57628
57667
  {
57629
- yCenter=bottom-this.TextHeight/2-2;
57630
- yTop=bottom-this.TextHeight-2;
57668
+ rtBG.Bottom=bottom;
57669
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
57631
57670
  }
57632
57671
  else if (this.ShowTextMode.Bottom==8)
57633
57672
  {
57634
57673
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_CORSSCURSOR_POSITION);
57635
57674
  if (event && event.Callback)
57636
57675
  {
57637
- var sendData={ YCenter:yCenter, YTop:yTop, Height:this.TextHeight, IsShowText:bShowText };
57676
+ var sendData={ RectText:rtBG, IsShowText:bShowText, X:x, Y:y };
57638
57677
  event.Callback(event, sendData, this);
57639
-
57640
- yCenter=sendData.YCenter;
57641
- yTop=sendData.YTop;
57642
57678
  bShowText=sendData.IsShowText;
57643
57679
  }
57644
57680
  }
@@ -57646,31 +57682,12 @@ function ChartCorssCursor()
57646
57682
  //JSConsole.Chart.Log('[ChartCorssCursor::Draw] ',yCenter);
57647
57683
  if (bShowText)
57648
57684
  {
57649
- if (x-textWidth/2<3) //左边位置不够了, 顶着左边画
57650
- {
57651
- this.DrawTextBGRect(x-1,yTop,textWidth,this.TextHeight);
57652
- this.Canvas.textAlign="left";
57653
- this.Canvas.textBaseline="middle";
57654
- this.Canvas.fillStyle=this.TextColor;
57655
- this.Canvas.fillText(text,x+1,yCenter,textWidth);
57656
- }
57657
- else if (x+textWidth/2>=right)
57658
- {
57659
- this.DrawTextBGRect(right-textWidth,yTop,textWidth,this.TextHeight);
57660
- this.Canvas.textAlign="right";
57661
- this.Canvas.textBaseline="middle";
57662
- this.Canvas.fillStyle=this.TextColor;
57663
- this.Canvas.fillText(text,right-2,yCenter,textWidth);
57664
- }
57665
- else
57666
- {
57667
- this.DrawTextBGRect(x-textWidth/2,yTop,textWidth,this.TextHeight);
57668
- this.Canvas.textAlign="center";
57669
- this.Canvas.textBaseline="middle";
57670
- this.Canvas.fillStyle=this.TextColor;
57671
- this.Canvas.fillText(text,x,yCenter,textWidth);
57672
- }
57673
- }
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
+ }
57674
57691
  }
57675
57692
 
57676
57693
  //子坐标Y轴
@@ -74998,7 +75015,10 @@ function JSChartResource()
74998
75015
  Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
74999
75016
  },
75000
75017
 
75001
- 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 } }
75002
75022
  };
75003
75023
 
75004
75024
  this.LockBGColor = "rgb(220, 220, 220)"; //指标锁区域颜色
@@ -126920,6 +126940,16 @@ function APIScriptIndex(name,script,args,option, isOverlay)
126920
126940
 
126921
126941
  result.push(outVarItem);
126922
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
+ }
126923
126953
  else if (draw.DrawType=="DRAWCOLORKLINE")
126924
126954
  {
126925
126955
  drawItem.Name=draw.Name;
@@ -142727,7 +142757,7 @@ function ScrollBarBGChart()
142727
142757
 
142728
142758
 
142729
142759
 
142730
- var HQCHART_VERSION="1.1.14348";
142760
+ var HQCHART_VERSION="1.1.14362";
142731
142761
 
142732
142762
  function PrintHQChartVersion()
142733
142763
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14348";
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
  /*暴露外部用的方法*/