hqchart 1.1.14635 → 1.1.14639

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.
@@ -37028,7 +37028,7 @@ function ChartKLineTable()
37028
37028
 
37029
37029
  if (rtBG.Width>5)
37030
37030
  {
37031
- this.AryCellRect.push({ Item:{ Cell:item, Colunm:data, RowIndex:i, SubCell:subItem, SubIndex:j, Tooltip:subItem.Tooltip, Type:2 }, Rect:rtBG });
37031
+ this.AryCellRect.push({ Item:{ Cell:item, Colunm:data, RowIndex:i, SubCell:subItem, SubIndex:j, Tooltip:subItem.Tooltip, Type:2 }, Rect:rtSubBG });
37032
37032
  }
37033
37033
 
37034
37034
  xCell+=subCellWidth;
@@ -38958,7 +38958,7 @@ function ChartArea()
38958
38958
  }
38959
38959
  }
38960
38960
 
38961
- //散点图
38961
+ //散点图 建议使用新版本 ChartScatterPlotV2
38962
38962
  function ChartScatterPlot()
38963
38963
  {
38964
38964
  this.newMethod=IChartPainting; //派生
@@ -39163,7 +39163,7 @@ function ChartScatterPlot()
39163
39163
 
39164
39164
  }
39165
39165
 
39166
- //散点图
39166
+ //散点图 2.0
39167
39167
  function ChartScatterPlotV2()
39168
39168
  {
39169
39169
  this.newMethod=IChartPainting; //派生
@@ -48140,6 +48140,9 @@ function ChartDrawSVG()
48140
48140
  this.BuildKeyCallback=null;
48141
48141
  this.MapCache=null; //key=date/date-time value={ Data:[] }
48142
48142
 
48143
+ this.AryDrawDetail=[]; //需要绘制的文字信息
48144
+ this.EnalbeDetailOnVerlap=false; //详情重叠不显示
48145
+
48143
48146
  this.BuildKey=function(item)
48144
48147
  {
48145
48148
  if (this.BuildKeyCallback) return this.BuildKeyCallback(item);
@@ -48174,6 +48177,7 @@ function ChartDrawSVG()
48174
48177
  {
48175
48178
  this.TooltipRect=[];
48176
48179
  this.AryDrawRect=[];
48180
+ this.AryDrawDetail=[];
48177
48181
  this.AutoYOffset=0;
48178
48182
 
48179
48183
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
@@ -48182,6 +48186,10 @@ function ChartDrawSVG()
48182
48186
  if (!this.MapCache || this.MapCache.size<=0) return;
48183
48187
 
48184
48188
  this.DrawSVGV2();
48189
+
48190
+ if (this.EnalbeDetailOnVerlap) this.DrawOnVerlapDetail();
48191
+
48192
+ this.AryDrawDetail=[];
48185
48193
  }
48186
48194
 
48187
48195
  this.DrawDetail=function(rtSVG, data, svgItem)
@@ -48248,6 +48256,21 @@ function ChartDrawSVG()
48248
48256
  }
48249
48257
  }
48250
48258
 
48259
+ if (this.EnalbeDetailOnVerlap) //启动重叠不会 先不画只计算位置, 后面统一画
48260
+ {
48261
+ this.AryDrawDetail.push({ Rect:rtBorder, AryText:aryText, Data:svgItem });
48262
+ return;
48263
+ }
48264
+
48265
+ this.DrawDetailText(data,aryText,rtBorder);
48266
+
48267
+ this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:svgItem } );
48268
+ }
48269
+
48270
+ this.DrawDetailText=function(data, aryText, rtBorder)
48271
+ {
48272
+ if (!data) return;
48273
+
48251
48274
  if (data.BGColor)
48252
48275
  {
48253
48276
  this.Canvas.fillStyle=data.BGColor;
@@ -48264,12 +48287,27 @@ function ChartDrawSVG()
48264
48287
  for(var i=0;i<aryText.length;++i)
48265
48288
  {
48266
48289
  var item=aryText[i];
48267
-
48290
+
48268
48291
  this.Canvas.fillStyle = item.Data.Color;
48269
48292
  this.Canvas.fillText(item.Data.Text, item.X, item.Y);
48270
48293
  }
48294
+ }
48271
48295
 
48272
- this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:svgItem } );
48296
+ this.DrawOnVerlapDetail=function()
48297
+ {
48298
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryDrawDetail)) return;
48299
+
48300
+ for(var i=this.AryDrawDetail.length-1;i>=0; --i)
48301
+ {
48302
+ var drawItem=this.AryDrawDetail[i];
48303
+ var rtBorder=drawItem.Rect;
48304
+
48305
+ if (this.IsRectOverlap(rtBorder)) continue;
48306
+
48307
+ this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
48308
+
48309
+ this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:drawItem.Data } );
48310
+ }
48273
48311
  }
48274
48312
 
48275
48313
  this.GetDetailPosition=function(rtSVG, data)
@@ -48631,183 +48669,6 @@ function ChartDrawSVG()
48631
48669
  }
48632
48670
  }
48633
48671
 
48634
- /*
48635
- this.DrawSVG=function()
48636
- {
48637
- if (!this.IsShow || this.ChartFrame.IsMinSize) return;
48638
- if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
48639
- if (!IFrameSplitOperator.IsNonEmptyArray(this.Texts)) return;
48640
- if (!this.Family) return;
48641
-
48642
- this.IsHScreen=(this.ChartFrame.IsHScreen===true);
48643
- var xPointCount=this.ChartFrame.XPointCount;
48644
- var offset=this.Data.DataOffset;
48645
- var top=this.ChartBorder.GetTopEx();
48646
- var bottom=this.ChartBorder.GetBottomEx();
48647
- var pixelRatio = GetDevicePixelRatio();
48648
-
48649
- var x=0,y=0;
48650
- for(var i=0; i<this.Texts.length; ++i)
48651
- {
48652
- var item=this.Texts[i];
48653
-
48654
- if (!item.SVG || !item.SVG.Symbol) continue;
48655
- if (!IFrameSplitOperator.IsNumber(item.Index)) continue;
48656
-
48657
- var isMinuteFrame=this.IsMinuteFrame();
48658
- var index=item.Index-offset;
48659
- var kItem=this.Data.Data[item.Index];
48660
- if (index<0 || index>=xPointCount) continue;
48661
-
48662
- x=this.ChartFrame.GetXFromIndex(index);
48663
- if (item.Value=="Top") y=top;
48664
- else if (item.Value=="Bottom") y=bottom;
48665
- else y=this.ChartFrame.GetYFromData(item.Value, false);
48666
- if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48667
-
48668
- var svgItem=item.SVG;
48669
- if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48670
-
48671
- if (this.AutoPosition)
48672
- {
48673
- var pt={ X:x, Y:y };
48674
- this.CalculateShowPosition(item, pt); //重新计算位置
48675
- x=pt.X;
48676
- y=pt.Y;
48677
- }
48678
-
48679
-
48680
- var fontSVG=`${svgItem.Size}px ${this.Family}`;
48681
- this.Canvas.font=fontSVG;
48682
- var halfSize=svgItem.Size/2;
48683
- var textBaseline='bottom';
48684
- var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
48685
- if (svgItem.VAlign===0)
48686
- {
48687
- textBaseline="top";
48688
- rtSVG.Top=y;
48689
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48690
- }
48691
- else if (svgItem.VAlign===1)
48692
- {
48693
- textBaseline='middle';
48694
- rtSVG.Top=y-svgItem.Size/2;
48695
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48696
- }
48697
-
48698
- if (rtSVG.Top<0)
48699
- {
48700
- rtSVG.Top=0;
48701
- rtSVG.Bottom=svgItem.Size;
48702
- y=rtSVG.Bottom;
48703
- }
48704
-
48705
- this.Canvas.textBaseline=textBaseline;
48706
- this.Canvas.textAlign='center';
48707
- this.Canvas.fillStyle = svgItem.Color;
48708
- this.Canvas.fillText(svgItem.Symbol, x, y);
48709
-
48710
- this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48711
-
48712
- if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG,Index:i });
48713
-
48714
- //文字
48715
- if (item.Text && item.Text.Content && this.TextFont)
48716
- {
48717
- var textItem=item.Text;
48718
- this.Canvas.font=this.TextFont;
48719
- this.Canvas.fillStyle=textItem.Color;
48720
- var yText=y;
48721
- if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48722
- this.Canvas.fillText(textItem.Content, x, yText);
48723
- }
48724
-
48725
- if (item.Detail)
48726
- {
48727
- this.DrawDetail(rtSVG,item.Detail, item);
48728
- }
48729
-
48730
- //连线
48731
- if (item.Line)
48732
- {
48733
- var lineItem=item.Line;
48734
- var price=null, yPrice=null;
48735
- var kItem=this.Data.Data[item.Index];
48736
- if (lineItem.Value=="Bottom")
48737
- {
48738
- yPrice=bottom;
48739
- }
48740
- else if (lineItem.Value=="Top")
48741
- {
48742
- yPrice=top;
48743
- }
48744
- else
48745
- {
48746
- switch(lineItem.Value)
48747
- {
48748
- case "C":
48749
- price=kItem.Close;
48750
- break;
48751
- case "H":
48752
- price=kItem.High;
48753
- break;
48754
- case "L":
48755
- price=kItem.Low;
48756
- break;
48757
- }
48758
-
48759
- if (!IFrameSplitOperator.IsNumber(price)) continue;
48760
-
48761
- yPrice=this.ChartFrame.GetYFromData(price);
48762
- }
48763
-
48764
- if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
48765
-
48766
- var yText;
48767
- if (yPrice<rtSVG.Top)
48768
- {
48769
- yText=rtSVG.Top;
48770
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48771
- {
48772
- //yPrice+=lineItem.Blank;
48773
- yText-=lineItem.SVGBlank;
48774
- }
48775
- }
48776
- else
48777
- {
48778
- yText=rtSVG.Bottom;
48779
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48780
- {
48781
- //yPrice-=lineItem.Blank;
48782
- yText+=lineItem.SVGBlank;
48783
- }
48784
- }
48785
-
48786
- if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
48787
- var lineWidth=1*pixelRatio;
48788
- if (lineItem.Width>0) lineWidth=lineItem.Width*pixelRatio;
48789
- this.Canvas.lineWidth=lineWidth; //线宽
48790
- this.Canvas.strokeStyle = lineItem.Color;
48791
- this.Canvas.beginPath();
48792
-
48793
- if (this.IsHScreen)
48794
- {
48795
- this.Canvas.moveTo(yText, ToFixedPoint(x));
48796
- this.Canvas.lineTo(yPrice,ToFixedPoint(x));
48797
- }
48798
- else
48799
- {
48800
- this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
48801
- this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
48802
- }
48803
-
48804
- this.Canvas.stroke();
48805
- this.Canvas.setLineDash([]);
48806
- }
48807
- }
48808
- }
48809
- */
48810
-
48811
48672
  this.GetMaxMin=function()
48812
48673
  {
48813
48674
  this.IsHScreen=(this.ChartFrame.IsHScreen===true);
@@ -126716,6 +126577,7 @@ function ScriptIndex(name,script,args,option)
126716
126577
  chart.Data=hqChart.GetKData()
126717
126578
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.EnableTooltip)) chart.EnableTooltip=varItem.Draw.DrawData.EnableTooltip;
126718
126579
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.IsDrawFirst)) chart.IsDrawFirst=varItem.Draw.DrawData.IsDrawFirst;
126580
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailOnVerlap)) chart.EnalbeDetailOnVerlap=varItem.Draw.EnalbeDetailOnVerlap;
126719
126581
  if (varItem.Draw.BuildKeyCallback) chart.BuildKeyCallback=varItem.Draw.BuildKeyCallback;
126720
126582
  chart.Family=varItem.Draw.DrawData.Family;
126721
126583
  chart.TextFont=varItem.Draw.DrawData.TextFont;
@@ -128627,6 +128489,7 @@ function OverlayScriptIndex(name,script,args,option)
128627
128489
  chart.TextFont=varItem.Draw.DrawData.TextFont;
128628
128490
  chart.Texts= varItem.Draw.DrawData.Data;
128629
128491
  if (varItem.Draw.AutoPosition) chart.AutoPosition=varItem.Draw.AutoPosition;
128492
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailOnVerlap)) chart.EnalbeDetailOnVerlap=varItem.Draw.EnalbeDetailOnVerlap;
128630
128493
 
128631
128494
  this.ReloadChartResource(hqChart, windowIndex, chart);
128632
128495
 
@@ -129833,6 +129696,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
129833
129696
  drawItem.Name=draw.Name;
129834
129697
  drawItem.DrawType=draw.DrawType;
129835
129698
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
129699
+ drawItem.EnalbeDetailOnVerlap=draw.EnalbeDetailOnVerlap;
129836
129700
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
129837
129701
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
129838
129702
  outVarItem.Draw=drawItem;
@@ -157403,7 +157267,7 @@ function HQChartScriptWorker()
157403
157267
 
157404
157268
 
157405
157269
 
157406
- var HQCHART_VERSION="1.1.14634";
157270
+ var HQCHART_VERSION="1.1.14638";
157407
157271
 
157408
157272
  function PrintHQChartVersion()
157409
157273
  {