hqchart 1.1.14299 → 1.1.14307

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.
@@ -31763,109 +31763,156 @@ function ChartSimpleTable()
31763
31763
 
31764
31764
 
31765
31765
  //饼图
31766
- function ChartPie()
31766
+ function ChartSimplePie()
31767
31767
  {
31768
31768
  this.newMethod=IChartPainting; //派生
31769
31769
  this.newMethod();
31770
31770
  delete this.newMethod;
31771
31771
 
31772
- this.Radius = 100; //半径默认值
31773
- this.Width=40;
31774
- this.Height=50;
31775
-
31776
- //this.Distance = 30; //指示线超出圆饼的距离
31777
- //this.txtLine = 20; // 文本下划线
31778
- //this.paddingX = 20 / 3;// 设置文本的移动
31779
-
31772
+ this.ClassName='ChartSimplePie'; //类名
31780
31773
 
31774
+ this.BorderColor=g_JSChartResource.ChartSimplePie.BorderColor;
31775
+ this.Offset=CloneData(g_JSChartResource.ChartSimplePie.Offset);
31776
+ this.LineExtendWidth=10;
31777
+ this.TextFontConfig=CloneData(g_JSChartResource.ChartSimplePie.TextFont);
31781
31778
 
31782
31779
  this.RectClient={ };
31783
-
31784
- this.Draw=function()
31780
+ this.TotalValue=1;
31781
+ this.Radius = 50; //半径默认值
31782
+ this.TextFont;
31783
+
31784
+
31785
+ this.ReloadResource=function(resource)
31785
31786
  {
31786
- if (!this.Data || !this.Data.Data || !(this.Data.Data.length>0)) return this.DrawEmptyData();
31787
+ this.BorderColor=g_JSChartResource.ChartSimplePie.BorderColor;
31788
+ this.Offset=CloneData(g_JSChartResource.ChartSimplePie.Offset);
31789
+ this.TextFontConfig=CloneData(g_JSChartResource.ChartSimplePie.TextFont);
31790
+ }
31787
31791
 
31792
+ this.CalculateSize=function()
31793
+ {
31794
+ var border=this.ChartFrame.GetBorder();
31795
+ var pixelRatio=GetDevicePixelRatio();
31796
+ this.TextFont=`${this.TextFontConfig.Size*pixelRatio}px ${ this.TextFontConfig.Name}`;
31797
+ this.LineExtendWidth=this.GetFontHeight(this.TextFont,"擎")+1;
31788
31798
 
31789
31799
 
31790
- let left=this.ChartBorder.GetLeft();
31791
- let right=this.ChartBorder.GetRight();
31792
- let top=this.ChartBorder.GetTop();
31793
- let bottom=this.ChartBorder.GetBottom();
31794
- let width=this.ChartBorder.GetWidth();
31795
- let height=this.ChartBorder.GetHeight();
31800
+ this.RectClient={ Width:this.Radius*2*pixelRatio, Height:this.Radius*2*pixelRatio };
31796
31801
 
31797
- if(isNaN(this.Radius)){
31798
- let str = this.Radius.replace("%","");
31799
- str = str/100;
31800
- if(width >= height){
31801
- this.Radius = str*height;
31802
- }
31803
- if(width < height) this.Radius = str*width;
31802
+ this.RectClient.Right=border.Right+this.Offset.X;
31803
+ this.RectClient.Top=border.TopEx+this.Offset.Y;
31804
+ this.RectClient.Left=this.RectClient.Right-this.RectClient.Width;
31805
+ this.RectClient.Bottom=this.RectClient.Top+this.RectClient.Height;
31806
+ }
31807
+
31808
+ this.CalculateTotalValue=function()
31809
+ {
31810
+ var totalValue=0;
31811
+ for(var i=0; i<this.Data.Data.length; ++i)
31812
+ {
31813
+ var item=this.Data.Data[i];
31814
+ if (!IFrameSplitOperator.IsPlusNumber(item.Value)) continue;
31815
+ totalValue += item.Value;
31804
31816
  }
31805
31817
 
31818
+ this.TotalValue=totalValue;
31819
+ }
31806
31820
 
31807
- this.Canvas.save();
31808
- this.Canvas.translate(width/2,height/2);
31821
+ this.DrawPie=function()
31822
+ {
31823
+ this.Canvas.font=this.TextFont;
31824
+ this.Canvas.textBaseline='bottom';
31825
+ this.Canvas.textAlign = 'left';
31809
31826
 
31810
- let totalValue=0; //求和
31811
- for(let i in this.Data.Data)
31827
+ var aryText=[];
31828
+ var maxTextWidth=0;
31829
+ for(var i=0;i<this.Data.Data.length;++i)
31812
31830
  {
31813
- totalValue += this.Data.Data[i].Value;
31831
+ var item=this.Data.Data[i];
31832
+ if (!IFrameSplitOperator.IsPlusNumber(item.Value)) continue;
31833
+ if (!item.Text) continue;
31834
+ var textWidth=this.Canvas.measureText(item.Text).width;
31835
+
31836
+ aryText[i]={ Width:textWidth };
31837
+
31838
+ if (maxTextWidth<textWidth) maxTextWidth=textWidth;
31814
31839
  }
31815
- let start = 0;
31816
- let end = 0;
31817
- //画饼图
31818
- for(let i in this.Data.Data)
31840
+
31841
+ var xOffset=maxTextWidth+this.LineExtendWidth;
31842
+ this.RectClient.Left-=xOffset;
31843
+ this.RectClient.Right-=xOffset;
31844
+
31845
+
31846
+ var start=0, end=0;
31847
+ var x=this.RectClient.Left+this.Radius;
31848
+ var y=this.RectClient.Top+this.Radius;
31849
+
31850
+ for(var i=0;i<this.Data.Data.length;++i)
31819
31851
  {
31820
- let item =this.Data.Data[i];
31821
- let rate=(item.Value/totalValue).toFixed(2); //占比
31822
- //JSConsole.Chart.Log('[ChartPie::Draw]', i, rate, item);
31852
+ var item=this.Data.Data[i];
31853
+ if (!IFrameSplitOperator.IsPlusNumber(item.Value)) continue;
31854
+
31855
+ var rate=item.Value/this.TotalValue;
31823
31856
 
31824
31857
  // 绘制扇形
31825
31858
  this.Canvas.beginPath();
31826
- this.Canvas.moveTo(0,0);
31827
-
31859
+ this.Canvas.moveTo(x,y);
31860
+
31828
31861
  end += rate*2*Math.PI;//终止角度
31829
- this.Canvas.strokeStyle = "white";
31862
+ this.Canvas.strokeStyle = this.BorderColor;
31830
31863
  this.Canvas.fillStyle = item.Color;
31831
- this.Canvas.arc(0,0,this.Radius,start,end);
31864
+ this.Canvas.arc(x,y,this.Radius,start,end);
31832
31865
  this.Canvas.fill();
31833
31866
  this.Canvas.closePath();
31834
- this.Canvas.stroke();
31835
-
31836
- // 绘制直线
31837
- this.Canvas.beginPath();
31838
- this.Canvas.strokeStyle = item.Color;
31839
- this.Canvas.moveTo(0,0);
31840
- let x = (this.Radius + this.Distance)*Math.cos(end- (end-start)/2);
31841
- let y = (this.Radius + this.Distance)*Math.sin(end - (end-start)/2);
31842
- this.Canvas.lineTo(x,y);
31843
- // JSConsole.Chart.Log(x,y,"xy")
31844
-
31845
- // 绘制横线
31846
- let txtLine = this.txtLine;
31847
- let paddingX = this.paddingX;
31848
- this.Canvas.textAlign = 'left';
31849
- if( end - (end-start)/2 < 1.5*Math.PI && end - (end-start)/2 > 0.5*Math.PI ){
31850
-
31851
- txtLine = - this.txtLine;
31852
- paddingX = - this.paddingX;
31853
- this.Canvas.textAlign = 'right';
31854
- }
31855
- this.Canvas.lineTo( x + txtLine, y );
31856
31867
  this.Canvas.stroke();
31857
31868
 
31858
- // 写文字
31859
- if(item.Text){
31860
- this.Canvas.fillText( item.Text, x + txtLine + paddingX, y );
31861
- }else{
31862
- let text = `${item.Name}:${item.Value}`;
31863
- this.Canvas.fillText( text, x + txtLine + paddingX, y );
31864
- }
31865
-
31869
+ if (item.Text)
31870
+ {
31871
+ // 绘制直线
31872
+ var xLine=this.Radius*Math.cos(end- (end-start)/2)+x;
31873
+ var yLine=this.Radius*Math.sin(end - (end-start)/2)+y;
31874
+ var xEnd = (this.Radius + this.LineExtendWidth)*Math.cos(end- (end-start)/2)+x;
31875
+ var yEnd = (this.Radius + this.LineExtendWidth)*Math.sin(end - (end-start)/2)+y;
31876
+
31877
+ this.Canvas.beginPath();
31878
+ if (item.LineColor) this.Canvas.strokeStyle =item.LineColor;
31879
+ else this.Canvas.strokeStyle = item.Color;
31880
+ this.Canvas.moveTo(xLine,yLine);
31881
+ this.Canvas.lineTo(xEnd,yEnd);
31882
+
31883
+ var textWidth=aryText[i].Width;
31884
+ var yText=xEnd;
31885
+ if( end - (end-start)/2 < 1.5*Math.PI && end - (end-start)/2 > 0.5*Math.PI )
31886
+ {
31887
+ this.Canvas.lineTo( xEnd - textWidth, yEnd );
31888
+ yText=xEnd - textWidth;
31889
+ }
31890
+ else
31891
+ {
31892
+ this.Canvas.lineTo( xEnd + textWidth, yEnd );
31893
+ }
31894
+ this.Canvas.stroke();
31895
+
31896
+ if (item.TextColor) this.Canvas.fillStyle = item.TextColor;
31897
+ else this.Canvas.fillStyle=item.Color;
31898
+ this.Canvas.fillText(item.Text, yText, yEnd);
31899
+ }
31866
31900
 
31867
31901
  start += rate*2*Math.PI;//起始角度
31868
31902
  }
31903
+ }
31904
+
31905
+ this.Draw=function()
31906
+ {
31907
+ if (!this.Data || !this.Data.Data || !(this.Data.Data.length>0)) return this.DrawEmptyData();
31908
+
31909
+ this.CalculateTotalValue();
31910
+ if (!IFrameSplitOperator.IsPlusNumber(this.TotalValue)) this.DrawEmptyData();
31911
+ this.CalculateSize();
31912
+
31913
+ this.Canvas.save();
31914
+
31915
+ this.DrawPie();
31869
31916
 
31870
31917
  this.Canvas.restore();
31871
31918
  }
@@ -31873,7 +31920,7 @@ function ChartPie()
31873
31920
  //空数据
31874
31921
  this.DrawEmptyData=function()
31875
31922
  {
31876
- JSConsole.Chart.Log('[ChartPie::DrawEmptyData]')
31923
+ JSConsole.Chart.Log('[ChartSimplePie::DrawEmptyData]')
31877
31924
  }
31878
31925
 
31879
31926
  this.GetMaxMin=function()
@@ -36439,6 +36486,7 @@ function ChartMinutePriceLine()
36439
36486
  var pointCount=0;
36440
36487
 
36441
36488
  this.Canvas.save();
36489
+ this.ClipClient(isHScreen);
36442
36490
  if (IFrameSplitOperator.IsPlusNumber(this.LineWidth>0)) this.Canvas.lineWidth=this.LineWidth;
36443
36491
  for(var i=data.DataOffset,j=0;i<data.Data.length && j<xPointCount;++i,++j)
36444
36492
  {
@@ -39944,8 +39992,8 @@ function ChartTextLine()
39944
39992
 
39945
39993
  this.ClassName="ChartTextLine";
39946
39994
 
39947
- this.Text; //Text=内容 Color
39948
- this.Line; //Type=线段类型 0=不画 1=直线 2=虚线, Color
39995
+ this.Text; //{ Title:内容, Color: YOffset:, }
39996
+ this.Line; //{ Type=线段类型 0=不画 1=直线 2=虚线, Color:, Width:, LineDash:[] }
39949
39997
  this.Price;
39950
39998
 
39951
39999
  this.Draw=function()
@@ -39959,6 +40007,10 @@ function ChartTextLine()
39959
40007
  var bottom=this.ChartBorder.GetBottomEx();
39960
40008
  var top=this.ChartBorder.GetTopEx();
39961
40009
  var y=this.ChartFrame.GetYFromData(this.Price);
40010
+
40011
+ this.Canvas.save();
40012
+ this.ClipClient(this.IsHScreen);
40013
+
39962
40014
  var textWidth=0;
39963
40015
  if (this.Text.Title)
39964
40016
  {
@@ -39988,23 +40040,22 @@ function ChartTextLine()
39988
40040
  {
39989
40041
  if (this.Line.Type==2) //虚线
39990
40042
  {
39991
- this.Canvas.save();
39992
- this.Canvas.setLineDash([3,5]); //虚线
40043
+ if (IFrameSplitOperator.IsNonEmptyArray(this.Line.LineDash)) this.Canvas.setLineDash(this.Line.LineDash)
40044
+ else this.Canvas.setLineDash([3,5]); //虚线
39993
40045
  }
39994
40046
 
40047
+ if (IFrameSplitOperator.IsNumber(this.Line.Width)) this.Canvas.lineWidth=this.Line.Width;
40048
+
39995
40049
  var x=left+textWidth;
39996
40050
  this.Canvas.strokeStyle=this.Line.Color;
39997
40051
  this.Canvas.beginPath();
39998
40052
  this.Canvas.moveTo(x,ToFixedPoint(y));
39999
40053
  this.Canvas.lineTo(right,ToFixedPoint(y));
40000
40054
  this.Canvas.stroke();
40001
-
40002
- if (this.Line.Type==2)
40003
- {
40004
- this.Canvas.restore();
40005
- }
40006
40055
  }
40007
40056
 
40057
+
40058
+ this.Canvas.restore();
40008
40059
  }
40009
40060
 
40010
40061
  this.GetMaxMin=function()
@@ -41406,6 +41457,7 @@ function ChartDrawSVG()
41406
41457
  this.Family;
41407
41458
  this.TextFont;
41408
41459
  this.Texts=[]; //[ { Index:, Value:, Symbol:, Text:, Size: } ] SVG:图标 Text:文字 Size:图标大小
41460
+ //this.Data; 存K线数据
41409
41461
  this.IsHScreen=false; //是否横屏
41410
41462
  this.IsDestroy=false; //是否已销毁
41411
41463
  this.EnableTooltip=true;
@@ -41415,8 +41467,38 @@ function ChartDrawSVG()
41415
41467
 
41416
41468
  this.AryDrawRect=[]; //已经绘制的区域
41417
41469
  this.AutoYOffset=0;
41418
-
41419
- //this.Data; 存K线数据
41470
+
41471
+ this.BuildKeyCallback=null;
41472
+ this.MapCache=null; //key=date/date-time value={ Data:[] }
41473
+
41474
+ this.BuildKey=function(item)
41475
+ {
41476
+ if (this.BuildKeyCallback) return this.BuildKeyCallback(item);
41477
+
41478
+ if (IFrameSplitOperator.IsNumber(item.Time)) return `${item.Date}-${item.Time}`;
41479
+ else return `${item.Date}`;
41480
+ }
41481
+
41482
+ this.BuildCacheData=function()
41483
+ {
41484
+ var mapData=new Map();
41485
+ this.MapCache=mapData;
41486
+ for(var i=0; i<this.Texts.length;++i)
41487
+ {
41488
+ var item=this.Texts[i];
41489
+ var key=this.BuildKey(item);
41490
+
41491
+ if (mapData.has(key))
41492
+ {
41493
+ var mapItem=mapData.get(key);
41494
+ mapItem.Data.push(item);
41495
+ }
41496
+ else
41497
+ {
41498
+ mapData.set(key,{ Date:item.Date, Time:item.Time, Data:[item] });
41499
+ }
41500
+ }
41501
+ }
41420
41502
 
41421
41503
  this.Draw=function()
41422
41504
  {
@@ -41427,8 +41509,9 @@ function ChartDrawSVG()
41427
41509
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
41428
41510
  if (this.IsShowIndexTitleOnly()) return;
41429
41511
  if (this.IsHideScriptIndex()) return;
41512
+ if (!this.MapCache || this.MapCache.size<=0) return;
41430
41513
 
41431
- this.DrawSVG();
41514
+ this.DrawSVGV2();
41432
41515
  }
41433
41516
 
41434
41517
  this.DrawDetail=function(rtSVG, data, svgItem)
@@ -41657,6 +41740,221 @@ function ChartDrawSVG()
41657
41740
  return false;
41658
41741
  }
41659
41742
 
41743
+ this.GetKValue=function(kItem, valueName)
41744
+ {
41745
+ switch(valueName)
41746
+ {
41747
+ case "HIGH":
41748
+ case "H":
41749
+ return kItem.High;
41750
+ case "L":
41751
+ case "LOW":
41752
+ return kItem.Low;
41753
+ case "C":
41754
+ case "CLOSE":
41755
+ return kItem.Close;
41756
+ case "O":
41757
+ case "OPEN":
41758
+ return KItem.Open;
41759
+ default:
41760
+ return null;
41761
+ }
41762
+ }
41763
+
41764
+ this.DrawSVGV2=function()
41765
+ {
41766
+ if (!this.IsShow || this.ChartFrame.IsMinSize) return;
41767
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
41768
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Texts)) return;
41769
+ if (!this.Family) return;
41770
+
41771
+ this.IsHScreen=(this.ChartFrame.IsHScreen===true);
41772
+ if (this.IsHScreen) return;
41773
+
41774
+ var xPointCount=this.ChartFrame.XPointCount;
41775
+ var dataWidth=this.ChartFrame.DataWidth;
41776
+ var distanceWidth=this.ChartFrame.DistanceWidth;
41777
+ var isMinute=this.IsMinuteFrame();
41778
+ var border=this.GetBorder();
41779
+ var pixelRatio = GetDevicePixelRatio();
41780
+
41781
+ if (this.IsHScreen)
41782
+ {
41783
+
41784
+ }
41785
+ else
41786
+ {
41787
+ var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
41788
+ var chartright=border.RightEx;
41789
+ var chartLeft=border.LeftEx;
41790
+ }
41791
+
41792
+ var x,y,price;
41793
+ for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
41794
+ {
41795
+ var kItem=this.Data.Data[i];
41796
+ var key=this.BuildKey(kItem);
41797
+ if (!this.MapCache.has(key)) continue;
41798
+ var mapItem=this.MapCache.get(key);
41799
+
41800
+ if (isMinute)
41801
+ {
41802
+ x=this.ChartFrame.GetXFromIndex(j);
41803
+ }
41804
+ else
41805
+ {
41806
+ var left=xOffset;
41807
+ var right=xOffset+dataWidth;
41808
+ if (right>chartright) break;
41809
+ x=left+(right-left)/2;
41810
+ }
41811
+
41812
+ for(var j=0;j<mapItem.Data.length;++j)
41813
+ {
41814
+ var item=mapItem.Data[j];
41815
+
41816
+ if (item.Value=="Top") y=top;
41817
+ else if (item.Value=="Bottom") y=bottom;
41818
+ else
41819
+ {
41820
+ if (IFrameSplitOperator.IsString(item.Value)) price=this.GetKValue(kItem,item.Value);
41821
+ else price=item.Value;
41822
+
41823
+ y=this.ChartFrame.GetYFromData(price, false);
41824
+ }
41825
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
41826
+
41827
+ var svgItem=item.SVG;
41828
+ if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
41829
+
41830
+ if (this.AutoPosition)
41831
+ {
41832
+ var pt={ X:x, Y:y };
41833
+ this.CalculateShowPosition(item, pt); //重新计算位置
41834
+ x=pt.X;
41835
+ y=pt.Y;
41836
+ }
41837
+
41838
+ var fontSVG=`${svgItem.Size}px ${this.Family}`;
41839
+ this.Canvas.font=fontSVG;
41840
+ var halfSize=svgItem.Size/2;
41841
+ var textBaseline='bottom';
41842
+ var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
41843
+ if (svgItem.VAlign===0)
41844
+ {
41845
+ textBaseline="top";
41846
+ rtSVG.Top=y;
41847
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
41848
+ }
41849
+ else if (svgItem.VAlign===1)
41850
+ {
41851
+ textBaseline='middle';
41852
+ rtSVG.Top=y-svgItem.Size/2;
41853
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
41854
+ }
41855
+
41856
+ if (rtSVG.Top<0)
41857
+ {
41858
+ rtSVG.Top=0;
41859
+ rtSVG.Bottom=svgItem.Size;
41860
+ y=rtSVG.Bottom;
41861
+ }
41862
+
41863
+ this.Canvas.textBaseline=textBaseline;
41864
+ this.Canvas.textAlign='center';
41865
+ this.Canvas.fillStyle = svgItem.Color;
41866
+ this.Canvas.fillText(svgItem.Symbol, x, y);
41867
+
41868
+ this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
41869
+
41870
+ if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:i, Item:item });
41871
+
41872
+ //文字
41873
+ if (item.Text && item.Text.Content && this.TextFont)
41874
+ {
41875
+ var textItem=item.Text;
41876
+ this.Canvas.font=this.TextFont;
41877
+ this.Canvas.fillStyle=textItem.Color;
41878
+ var yText=y;
41879
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
41880
+ this.Canvas.fillText(textItem.Content, x, yText);
41881
+ }
41882
+
41883
+ if (item.Detail)
41884
+ {
41885
+ this.DrawDetail(rtSVG,item.Detail, item);
41886
+ }
41887
+
41888
+ //连线
41889
+ if (item.Line)
41890
+ {
41891
+ var lineItem=item.Line;
41892
+ var price=null, yPrice=null;
41893
+ if (lineItem.Value=="Bottom")
41894
+ {
41895
+ yPrice=bottom;
41896
+ }
41897
+ else if (lineItem.Value=="Top")
41898
+ {
41899
+ yPrice=top;
41900
+ }
41901
+ else
41902
+ {
41903
+ if (IFrameSplitOperator.IsString(lineItem.Value))
41904
+ price=this.GetKValue(kItem,lineItem.Value);
41905
+
41906
+ if (!IFrameSplitOperator.IsNumber(price)) continue;
41907
+ yPrice=this.ChartFrame.GetYFromData(price);
41908
+ }
41909
+
41910
+ if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
41911
+
41912
+ var yText;
41913
+ if (yPrice<rtSVG.Top)
41914
+ {
41915
+ yText=rtSVG.Top;
41916
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
41917
+ {
41918
+ //yPrice+=lineItem.Blank;
41919
+ yText-=lineItem.SVGBlank;
41920
+ }
41921
+ }
41922
+ else
41923
+ {
41924
+ yText=rtSVG.Bottom;
41925
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
41926
+ {
41927
+ //yPrice-=lineItem.Blank;
41928
+ yText+=lineItem.SVGBlank;
41929
+ }
41930
+ }
41931
+
41932
+ if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
41933
+ var lineWidth=1*pixelRatio;
41934
+ if (lineItem.Width>0) lineWidth=lineItem.Width*pixelRatio;
41935
+ this.Canvas.lineWidth=lineWidth; //线宽
41936
+ this.Canvas.strokeStyle = lineItem.Color;
41937
+ this.Canvas.beginPath();
41938
+
41939
+ if (this.IsHScreen)
41940
+ {
41941
+ this.Canvas.moveTo(yText, ToFixedPoint(x));
41942
+ this.Canvas.lineTo(yPrice,ToFixedPoint(x));
41943
+ }
41944
+ else
41945
+ {
41946
+ this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
41947
+ this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
41948
+ }
41949
+
41950
+ this.Canvas.stroke();
41951
+ this.Canvas.setLineDash([]);
41952
+ }
41953
+ }
41954
+ }
41955
+ }
41956
+
41957
+ /*
41660
41958
  this.DrawSVG=function()
41661
41959
  {
41662
41960
  if (!this.IsShow || this.ChartFrame.IsMinSize) return;
@@ -41831,26 +42129,35 @@ function ChartDrawSVG()
41831
42129
  }
41832
42130
  }
41833
42131
  }
42132
+ */
41834
42133
 
41835
42134
  this.GetMaxMin=function()
41836
42135
  {
42136
+ this.IsHScreen=(this.ChartFrame.IsHScreen===true);
41837
42137
  var range={ Min:null, Max:null };
42138
+ if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return range;
42139
+ if (!this.MapCache || this.MapCache.size<=0) return;
41838
42140
  var xPointCount=this.ChartFrame.XPointCount;
41839
- var start=this.Data.DataOffset;
41840
- var end=start+xPointCount;
41841
- if (!IFrameSplitOperator.IsNonEmptyArray(this.Texts)) return range;
41842
42141
 
41843
- for(var i=0; i<this.Texts.length; ++i)
42142
+ for(var i=this.Data.DataOffset,j=0, k=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
41844
42143
  {
41845
- var item=this.Texts[i];
41846
- if (!IFrameSplitOperator.IsNumber(item.Index)) continue;
41847
- if (item.Index>=start && item.Index<end)
42144
+ var kItem=this.Data.Data[i];
42145
+ var key=this.BuildKey(kItem);
42146
+ if (!this.MapCache.has(key)) continue;
42147
+ var mapItem=this.MapCache.get(key);
42148
+ if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
42149
+
42150
+ for(k=0;k<mapItem.Data.length;++k)
41848
42151
  {
41849
- if(!IFrameSplitOperator.IsNumber(item.Value)) continue;
41850
- if (range.Max==null) range.Max=item.Value;
41851
- else if (range.Max<item.Value) range.Max=item.Value;
41852
- if (range.Min==null) range.Min=item.Value;
41853
- else if (range.Min>item.Value) range.Min=item.Value;
42152
+ var item=mapItem.Data[k];
42153
+ var value=item.Value;
42154
+ if (IFrameSplitOperator.IsString(item.Value)) value=this.GetKValue(kItem,item.Value);
42155
+ if (!IFrameSplitOperator.IsNumber(value)) continue;
42156
+
42157
+ if (range.Max==null) range.Max=value;
42158
+ else if (range.Max<value) range.Max=value;
42159
+ if (range.Min==null) range.Min=value;
42160
+ else if (range.Min>value) range.Min=value;
41854
42161
  }
41855
42162
  }
41856
42163
 
@@ -41866,11 +42173,10 @@ function ChartDrawSVG()
41866
42173
  var item=this.TooltipRect[i];
41867
42174
  if (!item.Rect) continue;
41868
42175
  var rect=item.Rect;
41869
- this.Canvas.beginPath();
41870
- this.Canvas.rect(rect.Left,rect.Top,rect.Width,rect.Height);
41871
- if (this.Canvas.isPointInPath(x,y))
42176
+
42177
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom)
41872
42178
  {
41873
- var data=this.Texts[item.Index];
42179
+ var data=item.Item;
41874
42180
  JSConsole.Chart.Log('[ChartDrawSVG::GetTooltipData] svg icon.', item);
41875
42181
  tooltip.Data={ Rect:item.Rect, Item:data, Index:item.Index };
41876
42182
  tooltip.ChartPaint=this;
@@ -70493,6 +70799,13 @@ function JSChartResource()
70493
70799
  BorderColor:"rgb(217,217,217)",
70494
70800
  }
70495
70801
 
70802
+ this.ChartSimplePie=
70803
+ {
70804
+ TextFont:{ Family:'微软雅黑' , Size:12 },
70805
+ BorderColor:"rgb(169,169,169)",
70806
+ Offset:{ X:-5, Y:5 }
70807
+ }
70808
+
70496
70809
  //手机端tooltip
70497
70810
  this.TooltipPaint = {
70498
70811
  BGColor:'rgba(250,250,250,0.8)', //背景色
@@ -71722,6 +72035,7 @@ function JSChartResource()
71722
72035
  }
71723
72036
 
71724
72037
  if (style.ChartSimpleTable) this.SetChartSimpleTable(style.ChartSimpleTable);
72038
+ if (style.ChartSimplePie) this.SetChartSimplePie(style.ChartSimplePie);
71725
72039
 
71726
72040
  if (style.DRAWICON)
71727
72041
  {
@@ -72794,6 +73108,27 @@ function JSChartResource()
72794
73108
  }
72795
73109
  }
72796
73110
 
73111
+ this.SetChartSimplePie=function(style)
73112
+ {
73113
+ var dest=this.ChartSimplePie;
73114
+
73115
+ if (style.TextFont)
73116
+ {
73117
+ var item=style.TextFont;
73118
+ if (item.Name) dest.TextFont.Name=item.Name;
73119
+ if (IFrameSplitOperator.IsNumber(item.Size)) dest.TextFont.Size=item.Size;
73120
+ }
73121
+
73122
+ if (style.BorderColor) dest.BorderColor=style.BorderColor;
73123
+
73124
+ if (style.Offset)
73125
+ {
73126
+ var item=style.Offset;
73127
+ if (IFrameSplitOperator.IsNumber(item.X)) dest.Offset.X=item.X;
73128
+ if (IFrameSplitOperator.IsNumber(item.Y)) dest.Offset.Y=item.Y;
73129
+ }
73130
+ }
73131
+
72797
73132
  }
72798
73133
 
72799
73134
  var g_JSChartResource=new JSChartResource();
@@ -87722,7 +88057,7 @@ MinuteChartContainer.JsonDataToMinuteData=function(data,isBeforeData)
87722
88057
  return aryMinuteData;
87723
88058
  }
87724
88059
 
87725
- //分钟增量数据 stock: [ { date:, yclose:, yclearing: , minute:[ [],]} 0=日期 1=时间 2=开 3=高 4=低 5=收 6=均价 7=量 8=金额 9=涨幅 10=涨跌 11=领先指标 ]
88060
+ //分钟增量数据 stock: [ { date:, yclose:, yclearing: , minute:[ [],]} 0=日期 1=时间 2=开 3=高 4=低 5=收 6=均价 7=量 8=金额 9=涨幅 10=涨跌 11=领先指标 12=持仓 ]
87726
88061
  MinuteChartContainer.JsonDataToUpdateMinuteData=function(data)
87727
88062
  {
87728
88063
  if (!data || !data.stock) return null;
@@ -87760,16 +88095,17 @@ MinuteChartContainer.JsonDataToUpdateMinuteData=function(data)
87760
88095
  if (IFrameSplitOperator.IsNumber(jsData[9])) item.Increase=jsData[9];
87761
88096
  if (IFrameSplitOperator.IsNumber(jsData[10])) item.Risefall=jsData[10];
87762
88097
  if (IFrameSplitOperator.IsNumber(jsData[11])) item.Lead=jsData[11];
87763
-
88098
+ if (IFrameSplitOperator.IsNumber(jsData[12])) item.Position=jsData[12];
87764
88099
 
87765
88100
  if (jsData[extendDataIndex]) item.ExtendData=jsData[extendDataIndex];
87766
- item.DateTime=item.Date.toString()+" "+item.Time.toString();
88101
+
88102
+ item.DateTime=`${item.Date} ${item.Time}`;
87767
88103
 
87768
88104
  if (IFrameSplitOperator.IsNumber(minuteData.YClose) && item.Close)
87769
- item.Increase=(item.Close-minuteData.YClose)/minuteData.YClose*100; //涨幅 (最新价格-昨收)/昨收*100;
88105
+ item.Increase=(item.Close-minuteData.YClose)/minuteData.YClose*100; //涨幅 (最新价格-昨收)/昨收*100;
87770
88106
 
87771
88107
  if (isFutures && minuteData.YClearing && item.Close)
87772
- item.Increase=(item.Close-minuteData.YClearing)/minuteData.YClearing*100; //涨幅 (最新价格-昨结算价)/昨结算价*100;
88108
+ item.Increase=(item.Close-minuteData.YClearing)/minuteData.YClearing*100; //涨幅 (最新价格-昨结算价)/昨结算价*100;
87773
88109
 
87774
88110
 
87775
88111
  minuteData.Data.push(item);