hqchart 1.1.14354 → 1.1.14367

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.
@@ -8512,11 +8512,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8512
8512
  var y=(e.clientY-uielement.getBoundingClientRect().top)*pixelTatio;
8513
8513
  var data= { X:e.clientX, Y:e.clientY, FrameID:-1 };
8514
8514
 
8515
- var isInClient=false;
8516
- this.Canvas.beginPath();
8517
- this.Canvas.rect(this.Frame.ChartBorder.GetLeft(),this.Frame.ChartBorder.GetTop(),this.Frame.ChartBorder.GetWidth(),this.Frame.ChartBorder.GetHeight());
8518
- isInClient=this.Canvas.isPointInPath(x,y);
8519
- if (isInClient)
8515
+ var clientPos=this.PtInClient(x,y);
8516
+ if (clientPos>0)
8520
8517
  {
8521
8518
  var yValueExtend={};
8522
8519
  var yValue=this.Frame.GetYData(y,yValueExtend);
@@ -45265,10 +45262,18 @@ function ChartMultiText()
45265
45262
  var mapItem=this.MapCache.get(key);
45266
45263
  if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
45267
45264
 
45268
- var left=xOffset;
45269
- var right=xOffset+dataWidth;
45270
- if (right>chartright) break;
45271
- var x=left+(right-left)/2;
45265
+ if (isMinute)
45266
+ {
45267
+ var x=this.ChartFrame.GetXFromIndex(j);
45268
+ }
45269
+ else
45270
+ {
45271
+ var left=xOffset;
45272
+ var right=xOffset+dataWidth;
45273
+ if (right>chartright) break;
45274
+ var x=left+(right-left)/2;
45275
+ }
45276
+
45272
45277
 
45273
45278
  for(var k=0;k<mapItem.Data.length;++k)
45274
45279
  {
@@ -48290,11 +48295,15 @@ function KLineTooltipPaint()
48290
48295
  }
48291
48296
 
48292
48297
  //换手率
48293
- if (MARKET_SUFFIX_NAME.IsSHSZStockA(this.HQChart.Symbol) && item.FlowCapital>0)
48298
+ if (IFrameSplitOperator.IsNumber(item.FlowCapital))
48294
48299
  {
48300
+ var text="--.--"
48295
48301
  title=g_JSChartLocalization.GetText('Tooltip-Exchange',this.LanguageID);
48296
- var value=item.Vol/item.FlowCapital*100;
48297
- var text=value.toFixed(2)+'%';
48302
+ if (item.FlowCapital!=0)
48303
+ {
48304
+ var value=item.Vol/item.FlowCapital*100;
48305
+ var text=value.toFixed(2)+'%';
48306
+ }
48298
48307
  aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:this.TitleColor });
48299
48308
  }
48300
48309
 
@@ -57074,8 +57083,9 @@ function ChartCorssCursor()
57074
57083
  Icon:g_JSChartResource.CorssCursor.RightButton.Icon
57075
57084
  };
57076
57085
 
57077
- this.RightMargin={ Left:2, Right:2, Top:4, Bottom:3 };
57078
- CopyMarginConfig(this.RightMargin, g_JSChartResource.CorssCursor.RightMargin);
57086
+ this.RightMargin=CloneData(g_JSChartResource.CorssCursor.RightMargin);
57087
+ this.BottomConfig=CloneData(g_JSChartResource.CorssCursor.BottomText); //底部输出配置
57088
+ this.LeftConfig=CloneData(g_JSChartResource.CorssCursor.LeftText);
57079
57089
 
57080
57090
  //内部使用
57081
57091
  this.Close=null; //收盘价格
@@ -57447,36 +57457,48 @@ function ChartCorssCursor()
57447
57457
  {
57448
57458
  var text=this.StringFormatY.Text;
57449
57459
  this.Canvas.font=this.Font;
57450
- var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
57451
- var textSize={ Width:textWidth, Height:this.TextHeight, Text:[] };
57460
+ var textWidth=this.Canvas.measureText(text).width; //前后各空2个像素
57461
+ var textSize={ Width:textWidth+4, Height:this.TextHeight, Text:[] };
57452
57462
  var buttonData={Y:y, YValue:yValue, FrameID:yValueExtend.FrameID };
57453
- if (this.Frame.ChartBorder.Left>=30 && this.ShowTextMode.Left==1)
57463
+
57464
+ if (this.Frame.ChartBorder.Left>=30) //左边
57454
57465
  {
57455
- if (left<textWidth ) //左边空白的地方太少了画布下
57466
+ var margin=this.LeftConfig.Margin;
57467
+ var textOffset=this.LeftConfig.TextOffset;
57468
+
57469
+ var rtBG=null;
57470
+ if (this.ShowTextMode.Left==1)
57456
57471
  {
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);
57472
+ var rtBG={ Right:left, Width:textWidth+margin.Left+margin.Right, YCenter:y, Height:textHeight+margin.Top+margin.Bottom };
57473
+ rtBG.Left=rtBG.Right-rtBG.Width;
57474
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
57475
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
57476
+
57477
+ if (rtBG.Left<0)
57478
+ {
57479
+ rtBG.Left=0;
57480
+ rtBG.Right=rtBG.Left+rtBG.Width;
57481
+ }
57462
57482
  }
57463
- else
57483
+ else if (this.ShowTextMode.Left==2) //在框架内显示
57464
57484
  {
57465
- this.DrawTextBGRect(left-2,y-this.TextHeight/2,-textWidth,this.TextHeight);
57466
- this.Canvas.textAlign="right";
57467
- this.Canvas.textBaseline="middle";
57485
+ var rtBG={ Left:left, Width:textWidth+margin.Left+margin.Right, YCenter:y, Height:textHeight+margin.Top+margin.Bottom };
57486
+ rtBG.Right=rtBG.Left+rtBG.Width;
57487
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
57488
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
57489
+ }
57490
+
57491
+ if (rtBG)
57492
+ {
57493
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
57494
+ this.Canvas.textAlign="left";
57495
+ this.Canvas.textBaseline="bottom";
57468
57496
  this.Canvas.fillStyle=this.TextColor;
57469
- this.Canvas.fillText(text,left-4,y,textWidth);
57497
+ this.Canvas.fillText(text,rtBG.Left+textOffset.X, rtBG.Bottom+textOffset.Y);
57470
57498
  }
57471
57499
  }
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
- }
57500
+
57501
+
57480
57502
 
57481
57503
  var complexText=
57482
57504
  {
@@ -57618,26 +57640,42 @@ function ChartCorssCursor()
57618
57640
  var text=this.StringFormatX.Text;
57619
57641
  this.Canvas.font=this.Font;
57620
57642
  this.Canvas.fillStyle=this.TextBGColor;
57621
- var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
57643
+ var textWidth=this.Canvas.measureText(text).width; //前后各空2个像素
57644
+ var margin=this.BottomConfig.Margin;
57645
+ var textOffset=this.BottomConfig.TextOffset;
57646
+ var rtBG=
57647
+ {
57648
+ Top:bottom, Height:margin.Top+margin.Bottom+textHeight,
57649
+ XCenter:x, Width:textWidth+margin.Left+margin.Right
57650
+ };
57651
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
57652
+ rtBG.Left=rtBG.XCenter-rtBG.Width/2;
57653
+ rtBG.Right=rtBG.Left+rtBG.Width;
57654
+
57655
+ if (rtBG.Left<=0)
57656
+ {
57657
+ rtBG.Left=0;
57658
+ rtBG.Right=rtBG.Left+rtBG.Width;
57659
+ }
57660
+ else if (rtBG.Right>=right)
57661
+ {
57662
+ rtBG.Right=right;
57663
+ rtBG.Left=rtBG.Right-rtBG.Width;
57664
+ }
57622
57665
 
57623
- var yCenter=bottom+2+this.TextHeight/2;
57624
- var yTop=bottom+2;
57625
57666
  var bShowText=true;
57626
57667
  if (this.ShowTextMode.Bottom==2)
57627
57668
  {
57628
- yCenter=bottom-this.TextHeight/2-2;
57629
- yTop=bottom-this.TextHeight-2;
57669
+ rtBG.Bottom=bottom;
57670
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
57630
57671
  }
57631
57672
  else if (this.ShowTextMode.Bottom==8)
57632
57673
  {
57633
57674
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_CORSSCURSOR_POSITION);
57634
57675
  if (event && event.Callback)
57635
57676
  {
57636
- var sendData={ YCenter:yCenter, YTop:yTop, Height:this.TextHeight, IsShowText:bShowText };
57677
+ var sendData={ RectText:rtBG, IsShowText:bShowText, X:x, Y:y };
57637
57678
  event.Callback(event, sendData, this);
57638
-
57639
- yCenter=sendData.YCenter;
57640
- yTop=sendData.YTop;
57641
57679
  bShowText=sendData.IsShowText;
57642
57680
  }
57643
57681
  }
@@ -57645,31 +57683,12 @@ function ChartCorssCursor()
57645
57683
  //JSConsole.Chart.Log('[ChartCorssCursor::Draw] ',yCenter);
57646
57684
  if (bShowText)
57647
57685
  {
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
- }
57686
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
57687
+ this.Canvas.textAlign="left";
57688
+ this.Canvas.textBaseline="bottom";
57689
+ this.Canvas.fillStyle=this.TextColor;
57690
+ this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y,textWidth);
57691
+ }
57673
57692
  }
57674
57693
 
57675
57694
  //子坐标Y轴
@@ -59476,13 +59495,19 @@ function HistoryDataStringFormat()
59476
59495
  aryText.push(item);
59477
59496
  }
59478
59497
 
59479
- if(MARKET_SUFFIX_NAME.IsSHSZStockA(this.Symbol) && data.FlowCapital>0) //换手率
59498
+ if(IFrameSplitOperator.IsNumber(data.FlowCapital)) //换手率
59480
59499
  {
59481
- var value=data.Vol/data.FlowCapital*100;
59500
+ var text="--.--";
59501
+ if (data.FlowCapital!=0)
59502
+ {
59503
+ var value=data.Vol/data.FlowCapital*100;
59504
+ var text=`${value.toFixed(2)}%`;
59505
+ }
59506
+
59482
59507
  var item=
59483
59508
  {
59484
59509
  Title:g_JSChartLocalization.GetText('DivTooltip-Exchange',this.LanguageID),
59485
- Text:`${value.toFixed(2)}%`,
59510
+ Text:text,
59486
59511
  Color:this.TurnoverRateColor
59487
59512
  }
59488
59513
  aryText.push(item);
@@ -60179,10 +60204,14 @@ function DynamicKLineTitlePainting()
60179
60204
  aryText.push({ Text:text, Color:this.AmountColor});
60180
60205
  }
60181
60206
 
60182
- if (MARKET_SUFFIX_NAME.IsSHSZStockA(this.Symbol) && item.FlowCapital>0) //A股有换手率
60207
+ if (IFrameSplitOperator.IsNumber(item.FlowCapital)) //换手率
60183
60208
  {
60184
- var value=item.Vol/item.FlowCapital*100; //成交量/流通A股*100
60185
- var text=g_JSChartLocalization.GetText('KTitle-Exchange',this.LanguageID)+IFrameSplitOperator.FormatValueString(value,2,this.LanguageID)+'%';
60209
+ var text="--.--";
60210
+ if (item.FlowCapital!=0)
60211
+ {
60212
+ var value=item.Vol/item.FlowCapital*100; //成交量/流通A股*100
60213
+ var text=g_JSChartLocalization.GetText('KTitle-Exchange',this.LanguageID)+IFrameSplitOperator.FormatValueString(value,2,this.LanguageID)+'%';
60214
+ }
60186
60215
  aryText.push({ Text:text, Color:this.TurnoverRateColor});
60187
60216
  }
60188
60217
 
@@ -74997,7 +75026,10 @@ function JSChartResource()
74997
75026
  Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
74998
75027
  },
74999
75028
 
75000
- RightMargin: { Left:2, Right:2, Top:5, Bottom:3 }
75029
+ RightMargin: { Left:2, Right:2, Top:5, Bottom:3 },
75030
+
75031
+ BottomText:{ Margin: { Left:4, Right:4, Top:0, Bottom:0 }, TextOffset:{X:4, Y:-1 } },
75032
+ LeftText:{ Margin: { Left:4, Right:4, Top:0, Bottom:0 }, TextOffset:{X:4, Y:-1 } }
75001
75033
  };
75002
75034
 
75003
75035
  this.LockBGColor = "rgb(220, 220, 220)"; //指标锁区域颜色
@@ -126919,6 +126951,16 @@ function APIScriptIndex(name,script,args,option, isOverlay)
126919
126951
 
126920
126952
  result.push(outVarItem);
126921
126953
  }
126954
+ else if (draw.DrawType=='MULTI_BAR')
126955
+ {
126956
+ drawItem.Text=draw.Text;
126957
+ drawItem.Name=draw.Name;
126958
+ drawItem.DrawType=draw.DrawType;
126959
+ drawItem.DrawData=draw.DrawData;
126960
+ outVarItem.Draw=drawItem;
126961
+
126962
+ result.push(outVarItem);
126963
+ }
126922
126964
  else if (draw.DrawType=="DRAWCOLORKLINE")
126923
126965
  {
126924
126966
  drawItem.Name=draw.Name;
@@ -142726,7 +142768,7 @@ function ScrollBarBGChart()
142726
142768
 
142727
142769
 
142728
142770
 
142729
- var HQCHART_VERSION="1.1.14353";
142771
+ var HQCHART_VERSION="1.1.14366";
142730
142772
 
142731
142773
  function PrintHQChartVersion()
142732
142774
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14353";
8
+ var HQCHART_VERSION="1.1.14366";
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
  /*暴露外部用的方法*/