hqchart 1.1.13003 → 1.1.13014

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.
@@ -4921,7 +4921,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4921
4921
  if (item.TimeFormat) chart.TitlePaint[0].TimeFormat=item.TimeFormat;
4922
4922
  }
4923
4923
 
4924
- if (option.CorssCursorTouchEnd===true) chart.CorssCursorTouchEnd = option.CorssCursorTouchEnd;
4924
+ if (IFrameSplitOperator.IsBool(option.CorssCursorTouchEnd)) chart.CorssCursorTouchEnd = option.CorssCursorTouchEnd;
4925
+ if (IFrameSplitOperator.IsBool(option.IsClickShowCorssCursor)) chart.IsClickShowCorssCursor=option.IsClickShowCorssCursor;
4925
4926
  if (option.IsShowBeforeData===true) chart.IsShowBeforeData=option.IsShowBeforeData;
4926
4927
 
4927
4928
  //分钟数据指标从第3个指标窗口设置
@@ -40523,7 +40524,7 @@ function ChartMultiSVGIcon()
40523
40524
  if (item.Color) this.Canvas.fillStyle = item.Color;
40524
40525
  else this.Canvas.fillStyle = this.Color;
40525
40526
 
40526
- var textWidth=this.Canvas.measureText(item.Text).width;
40527
+ var textWidth=this.Canvas.measureText(item.Symbol).width;
40527
40528
  this.Canvas.textAlign='center';
40528
40529
  var rtIcon=new Rect(x-fontSize/2,y-fontSize/2,fontSize,fontSize);
40529
40530
  if (x+textWidth/2>=right)
@@ -40658,6 +40659,300 @@ function ChartMultiSVGIcon()
40658
40659
  }
40659
40660
  }
40660
40661
 
40662
+
40663
+ //图标集合(2.0) 支持横屏
40664
+ function ChartMultiSVGIconV2()
40665
+ {
40666
+ this.newMethod=IChartPainting; //派生
40667
+ this.newMethod();
40668
+ delete this.newMethod;
40669
+
40670
+ this.ClassName="ChartMultiSVGIconV2";
40671
+ this.AryIcon; //[ {Index:, Value:, Symbol:, Color:, Baseline:, Line:{ Color:, Dash:[虚线点], KData:"H/L", Offset:[5,10], Width:线粗细 } } ]
40672
+ this.IconSize=
40673
+ {
40674
+ Max: g_JSChartResource.DRAWICON.Icon.MaxSize, Min:g_JSChartResource.DRAWICON.Icon.MinSize , //图标的最大最小值
40675
+ Zoom:{ Type:g_JSChartResource.DRAWICON.Icon.Zoom.Type , Value:g_JSChartResource.DRAWICON.Icon.Zoom.Value } //放大倍数
40676
+ };
40677
+ this.Family;
40678
+ this.Color=g_JSChartResource.DefaultTextColor;
40679
+ this.IsHScreen=false;
40680
+ this.IconRect=[]; //0=序号,1=区域
40681
+
40682
+ this.MapCache=null; //key=date/date-time value={ Data:[] }
40683
+
40684
+ this.BuildKey=function(item)
40685
+ {
40686
+ if (IFrameSplitOperator.IsNumber(item.Time)) return `${item.Date}-${item.Time}`;
40687
+ else return item.Date;
40688
+ }
40689
+
40690
+ this.BuildCacheData=function()
40691
+ {
40692
+ var mapData=new Map();
40693
+ this.MapCache=mapData;
40694
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryIcon)) return;
40695
+
40696
+ for(var i=0;i<this.AryIcon.length;++i)
40697
+ {
40698
+ var item=this.AryIcon[i];
40699
+ var key=this.BuildKey(item);
40700
+ if (mapData.has(key))
40701
+ {
40702
+ var mapItem=mapData.get(key);
40703
+ mapItem.Data.push(item);
40704
+ }
40705
+ else
40706
+ {
40707
+ mapData.set(key,{ Data:[item] });
40708
+ }
40709
+ }
40710
+ }
40711
+
40712
+ this.Draw=function()
40713
+ {
40714
+ this.IconRect=[];
40715
+ if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
40716
+ if (this.IsShowIndexTitleOnly()) return;
40717
+ if (this.IsHideScriptIndex()) return;
40718
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return; //k线数据
40719
+ if (!this.Family) return;
40720
+ if (!this.MapCache || this.MapCache.size<=0) return;
40721
+
40722
+ this.IsHScreen=(this.ChartFrame.IsHScreen===true);
40723
+ var xPointCount=this.ChartFrame.XPointCount;
40724
+ var dataWidth=this.ChartFrame.DataWidth;
40725
+ var distanceWidth=this.ChartFrame.DistanceWidth;
40726
+ var isMinute=this.IsMinuteFrame();
40727
+
40728
+ var border=this.GetBorder();
40729
+ if (this.IsHScreen)
40730
+ {
40731
+ var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
40732
+ var chartright=border.BottomEx;
40733
+ var chartLeft=border.TopEx;
40734
+ }
40735
+ else
40736
+ {
40737
+ var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
40738
+ var chartright=border.RightEx;
40739
+ var chartLeft=border.LeftEx;
40740
+ }
40741
+
40742
+ var fontSize=this.GetDynamicIconSize(dataWidth,distanceWidth,this.IconSize.Max,this.IconSize.Min,this.IconSize.Zoom);
40743
+ this.Canvas.font=fontSize+'px '+this.Family;
40744
+
40745
+ var drawInfo={ Left:chartLeft, Right:chartright, FontSize:fontSize, DataWidth:dataWidth, DistanceWidth:distanceWidth };
40746
+
40747
+ for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
40748
+ {
40749
+ var kItem=this.Data.Data[i];
40750
+ var key=this.BuildKey(kItem);
40751
+ if (!this.MapCache.has(key)) continue;
40752
+ var mapItem=this.MapCache.get(key);
40753
+
40754
+ if (isMinute)
40755
+ {
40756
+ var x=this.ChartFrame.GetXFromIndex(j);
40757
+ }
40758
+ else
40759
+ {
40760
+ var left=xOffset;
40761
+ var right=xOffset+dataWidth;
40762
+ if (right>chartright) break;
40763
+ var x=left+(right-left)/2;
40764
+ }
40765
+
40766
+ this.DrawItem(mapItem, kItem, x, drawInfo);
40767
+ }
40768
+ }
40769
+
40770
+ this.GetKValue=function(kItem, valueName)
40771
+ {
40772
+ switch(valueName)
40773
+ {
40774
+ case "HIGH":
40775
+ case "H":
40776
+ return kItem.High;
40777
+ case "L":
40778
+ case "LOW":
40779
+ return kItem.Low;
40780
+ case "C":
40781
+ case "CLOSE":
40782
+ return kItem.Close;
40783
+ case "O":
40784
+ case "OPEN":
40785
+ return KItem.Open;
40786
+ default:
40787
+ return null;
40788
+ }
40789
+ }
40790
+
40791
+ this.DrawItem=function(groupItem, kItem, x, drawInfo)
40792
+ {
40793
+ if (!IFrameSplitOperator.IsNonEmptyArray(groupItem.Data)) return;
40794
+
40795
+ var fontSize=drawInfo.FontSize;
40796
+ var left=drawInfo.Left, right=drawInfo.Right;
40797
+ var dataWidth=drawInfo.DataWidth;
40798
+ //var distanceWidth=drawInfo.DistanceWidth;
40799
+
40800
+ for(var i=0;i<groupItem.Data.length;++i)
40801
+ {
40802
+ var item=groupItem.Data[i];
40803
+ var value=item.Value;
40804
+ if (IFrameSplitOperator.IsString(item.Value)) value=this.GetKValue(kItem,item.Value);
40805
+ if (!IFrameSplitOperator.IsNumber(value)) continue;
40806
+
40807
+ var y=this.ChartFrame.GetYFromData(item.Value,false);
40808
+
40809
+ if (item.Color) this.Canvas.fillStyle = item.Color;
40810
+ else this.Canvas.fillStyle = this.Color;
40811
+
40812
+ var textWidth=this.Canvas.measureText(item.Symbol).width;
40813
+ this.Canvas.textAlign='center';
40814
+ var rtIcon=new Rect(x-fontSize/2,y-fontSize/2,fontSize,fontSize);
40815
+ if (x+textWidth/2>=right)
40816
+ {
40817
+ this.Canvas.textAlign='right';
40818
+ x+=dataWidth/2;
40819
+ rtIcon.X=x-fontSize;
40820
+ }
40821
+ else if (x-textWidth/2<left)
40822
+ {
40823
+ this.Canvas.textAlign = 'left';
40824
+ x-=dataWidth/2;
40825
+ rtIcon.X=x;
40826
+ }
40827
+
40828
+ if (item.Baseline==1)
40829
+ {
40830
+ this.Canvas.textBaseline='top';
40831
+ rtIcon.Y=y;
40832
+ }
40833
+ else if (item.Baseline==2)
40834
+ {
40835
+ this.Canvas.textBaseline='bottom';
40836
+ rtIcon.Y=y-fontSize;
40837
+ }
40838
+ else
40839
+ {
40840
+ this.Canvas.textBaseline = 'middle';
40841
+ rtIcon.Y=y-fontSize/2;
40842
+ }
40843
+
40844
+ if (this.IsHScreen)
40845
+ {
40846
+ this.Canvas.save();
40847
+ this.Canvas.translate(y, x);
40848
+ this.Canvas.rotate(90 * Math.PI / 180);
40849
+ this.Canvas.fillText(item.Symbol,0,0);
40850
+ this.Canvas.restore();
40851
+ }
40852
+ else
40853
+ {
40854
+ if (IFrameSplitOperator.IsNumber(item.YMove)) y+=item.YMove;
40855
+ this.Canvas.fillText(item.Symbol, x, y);
40856
+ if (item.Text) this.IconRect.push({ Rect:rtIcon , Item:item, KItem:kItem });
40857
+ }
40858
+
40859
+ if (item.Line)
40860
+ {
40861
+ var price=item.Line.KData=="H"? kItem.High:kItem.Low;
40862
+ var yPrice=this.ChartFrame.GetYFromData(price, false);
40863
+ var yText=y;
40864
+ if (Array.isArray(item.Line.Offset) && item.Line.Offset.length==2)
40865
+ {
40866
+ if (yText>yPrice) //文字在下方
40867
+ {
40868
+ yText-=item.Line.Offset[1];
40869
+ yPrice+=item.Line.Offset[0]
40870
+ }
40871
+ else if (yText<yPrice)
40872
+ {
40873
+ yText+=item.Line.Offset[1];
40874
+ yPrice-=item.Line.Offset[0]
40875
+ }
40876
+ }
40877
+ this.Canvas.save();
40878
+ if (item.Line.Dash) this.Canvas.setLineDash(item.Line.Dash); //虚线
40879
+ if (item.Line.Width>0) this.Canvas.lineWidth=item.Line.Width; //线宽
40880
+ this.Canvas.strokeStyle = item.Line.Color;
40881
+ this.Canvas.beginPath();
40882
+ if (this.IsHScreen)
40883
+ {
40884
+ this.Canvas.moveTo(yText, ToFixedPoint(x));
40885
+ this.Canvas.lineTo(yPrice,ToFixedPoint(x));
40886
+ }
40887
+ else
40888
+ {
40889
+ this.Canvas.moveTo(ToFixedPoint(x),yText);
40890
+ this.Canvas.lineTo(ToFixedPoint(x),yPrice);
40891
+ }
40892
+
40893
+ this.Canvas.stroke();
40894
+ this.Canvas.restore();
40895
+ }
40896
+ }
40897
+ }
40898
+
40899
+ this.GetTooltipData=function(x,y,tooltip)
40900
+ {
40901
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.IconRect)) return false;
40902
+ for(var i=0; i<this.IconRect.length; ++i)
40903
+ {
40904
+ var item=this.IconRect[i];
40905
+ if (!item.Rect) continue;
40906
+ var rect=item.Rect;
40907
+ this.Canvas.beginPath();
40908
+ this.Canvas.rect(rect.X,rect.Y,rect.Width,rect.Height);
40909
+ if (this.Canvas.isPointInPath(x,y))
40910
+ {
40911
+ JSConsole.Chart.Log('[ChartMultiSVGIconV2::GetTooltipData] icon ', item);
40912
+ tooltip.Data=item;
40913
+ tooltip.ChartPaint=this;
40914
+ tooltip.Type=4; //指标
40915
+ return true;
40916
+ }
40917
+ }
40918
+
40919
+ return false;
40920
+ }
40921
+
40922
+ this.GetMaxMin=function()
40923
+ {
40924
+ this.IsHScreen=(this.ChartFrame.IsHScreen===true);
40925
+ var range={ Min:null, Max:null };
40926
+ if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return range;
40927
+ if (!this.MapCache || this.MapCache.size<=0) return;
40928
+ var xPointCount=this.ChartFrame.XPointCount;
40929
+
40930
+ for(var i=this.Data.DataOffset,j=0, k=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
40931
+ {
40932
+ var kItem=this.Data.Data[i];
40933
+ var key=this.BuildKey(kItem);
40934
+ if (!this.MapCache.has(key)) continue;
40935
+ var mapItem=this.MapCache.get(key);
40936
+ if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
40937
+
40938
+ for(k=0;k<mapItem.Data.length;++k)
40939
+ {
40940
+ var item=mapItem.Data[k];
40941
+ var value=item.Value;
40942
+ if (IFrameSplitOperator.IsString(item.Value)) value=this.GetKValue(kItem,item.Value);
40943
+ if (!IFrameSplitOperator.IsNumber(value)) continue;
40944
+
40945
+ if (range.Max==null) range.Max=value;
40946
+ else if (range.Max<value) range.Max=value;
40947
+ if (range.Min==null) range.Min=value;
40948
+ else if (range.Min>value) range.Min=value;
40949
+ }
40950
+ }
40951
+
40952
+ return range;
40953
+ }
40954
+ }
40955
+
40661
40956
  // 多dom节点
40662
40957
  function ChartMultiHtmlDom()
40663
40958
  {
@@ -77028,6 +77323,8 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
77028
77323
 
77029
77324
  if (this.EnableScrollUpDown==false)
77030
77325
  T_ShowCorssCursor(); //移动十字光标
77326
+ else if (this.IsClickShowCorssCursor)
77327
+ T_ShowCorssCursor();
77031
77328
  }
77032
77329
 
77033
77330
  if (this.EnableZoomIndexWindow)
@@ -114134,7 +114431,7 @@ function ScriptIndex(name,script,args,option)
114134
114431
 
114135
114432
  this.CreateMultiSVGIcon=function(hqChart,windowIndex,varItem,i)
114136
114433
  {
114137
- let chart=new ChartMultiSVGIcon();
114434
+ let chart=new ChartMultiSVGIconV2();
114138
114435
  chart.Canvas=hqChart.Canvas;
114139
114436
  chart.Name=varItem.Name;
114140
114437
  chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
@@ -114142,7 +114439,8 @@ function ScriptIndex(name,script,args,option)
114142
114439
 
114143
114440
  chart.Data=hqChart.ChartPaint[0].Data;//绑定K线
114144
114441
  chart.Family=varItem.Draw.DrawData.Family;
114145
- chart.Icon= varItem.Draw.DrawData.Icon;
114442
+ chart.AryIcon= varItem.Draw.DrawData.Icon;
114443
+ chart.BuildCacheData();
114146
114444
  hqChart.ChartPaint.push(chart);
114147
114445
  }
114148
114446
 
@@ -115798,7 +116096,7 @@ function OverlayScriptIndex(name,script,args,option)
115798
116096
  {
115799
116097
  var overlayIndex=this.OverlayIndex;
115800
116098
  var frame=overlayIndex.Frame;
115801
- let chart=new ChartMultiSVGIcon();
116099
+ let chart=new ChartMultiSVGIconV2();
115802
116100
  chart.Canvas=hqChart.Canvas;
115803
116101
  chart.Name=varItem.Name;
115804
116102
  chart.ChartBorder=frame.Frame.ChartBorder;
@@ -115807,7 +116105,8 @@ function OverlayScriptIndex(name,script,args,option)
115807
116105
 
115808
116106
  chart.Data=hqChart.ChartPaint[0].Data;//绑定K线
115809
116107
  chart.Family=varItem.Draw.DrawData.Family;
115810
- chart.Icon= varItem.Draw.DrawData.Icon;
116108
+ chart.AryIcon= varItem.Draw.DrawData.Icon;
116109
+ chart.BuildCacheData();
115811
116110
  frame.ChartPaint.push(chart);
115812
116111
  }
115813
116112
 
@@ -116897,8 +117196,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
116897
117196
  drawItem.Text=draw.Text;
116898
117197
  drawItem.Name=draw.Name;
116899
117198
  drawItem.DrawType=draw.DrawType;
116900
- drawItem.DrawData={ Icon:this.FittingMultiText(draw.DrawData.Icon,date,time,hqChart), Family:draw.DrawData.Family };
116901
- this.GetKLineData(drawItem.DrawData.Icon, hqChart);
117199
+ drawItem.DrawData={ Icon:draw.DrawData.Icon, Family:draw.DrawData.Family };
116902
117200
  outVarItem.Draw=drawItem;
116903
117201
 
116904
117202
  result.push(outVarItem);
@@ -117298,8 +117596,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
117298
117596
  drawItem.Text=draw.Text;
117299
117597
  drawItem.Name=draw.Name;
117300
117598
  drawItem.DrawType=draw.DrawType;
117301
- drawItem.DrawData={ Icon:this.FittingMultiText(draw.DrawData.Icon,date,time,hqChart), Family:draw.DrawData.Family };
117302
- this.GetKLineData(drawItem.DrawData.Icon, hqChart);
117599
+ drawItem.DrawData={ Icon:draw.DrawData.Icon, Family:draw.DrawData.Family };
117303
117600
  outVarItem.Draw=drawItem;
117304
117601
 
117305
117602
  result.push(outVarItem);
@@ -129557,7 +129854,7 @@ function ScrollBarBGChart()
129557
129854
 
129558
129855
 
129559
129856
 
129560
- var HQCHART_VERSION="1.1.13002";
129857
+ var HQCHART_VERSION="1.1.13013";
129561
129858
 
129562
129859
  function PrintHQChartVersion()
129563
129860
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13002";
8
+ var HQCHART_VERSION="1.1.13013";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {