hqchart 1.1.14367 → 1.1.14372

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.
@@ -15087,7 +15087,7 @@ function ChartFrameFactory()
15087
15087
  {
15088
15088
  if (!this.DataMap.has(name))
15089
15089
  {
15090
- JSConsole.Warn(`[ChartFrameFactory::Create] can't find class=${name}.`);
15090
+ JSConsole.Chart.Warn(`[ChartFrameFactory::Create] can't find class=${name}.`);
15091
15091
  return null;
15092
15092
  }
15093
15093
 
@@ -28388,7 +28388,7 @@ function ChartPaintFactory()
28388
28388
  {
28389
28389
  if (!this.DataMap.has(name))
28390
28390
  {
28391
- JSConsole.Warn(`[ChartPaintFactory::Create] can't find class=${name}.`);
28391
+ JSConsole.Chart.Warn(`[ChartPaintFactory::Create] can't find class=${name}.`);
28392
28392
  return null;
28393
28393
  }
28394
28394
 
@@ -35839,10 +35839,11 @@ function ChartSimplePie()
35839
35839
  this.RectClient.Left-=xOffset;
35840
35840
  this.RectClient.Right-=xOffset;
35841
35841
 
35842
-
35842
+ var pixelRatio=GetDevicePixelRatio();
35843
+ var radius=this.Radius*pixelRatio;
35843
35844
  var start=0, end=0;
35844
- var x=this.RectClient.Left+this.Radius;
35845
- var y=this.RectClient.Top+this.Radius;
35845
+ var x=this.RectClient.Left+radius;
35846
+ var y=this.RectClient.Top+radius;
35846
35847
 
35847
35848
  for(var i=0;i<this.Data.Data.length;++i)
35848
35849
  {
@@ -35858,7 +35859,178 @@ function ChartSimplePie()
35858
35859
  end += rate*2*Math.PI;//终止角度
35859
35860
  this.Canvas.strokeStyle = this.BorderColor;
35860
35861
  this.Canvas.fillStyle = item.Color;
35861
- this.Canvas.arc(x,y,this.Radius,start,end);
35862
+ this.Canvas.arc(x,y,radius,start,end);
35863
+ this.Canvas.fill();
35864
+ this.Canvas.closePath();
35865
+ this.Canvas.stroke();
35866
+
35867
+ if (item.Text)
35868
+ {
35869
+ // 绘制直线
35870
+ var xLine=radius*Math.cos(end- (end-start)/2)+x;
35871
+ var yLine=radius*Math.sin(end - (end-start)/2)+y;
35872
+ var xEnd = (radius + this.LineExtendWidth)*Math.cos(end- (end-start)/2)+x;
35873
+ var yEnd = (radius + this.LineExtendWidth)*Math.sin(end - (end-start)/2)+y;
35874
+
35875
+ this.Canvas.beginPath();
35876
+ if (item.LineColor) this.Canvas.strokeStyle =item.LineColor;
35877
+ else this.Canvas.strokeStyle = item.Color;
35878
+ this.Canvas.moveTo(xLine,yLine);
35879
+ this.Canvas.lineTo(xEnd,yEnd);
35880
+
35881
+ var textWidth=aryText[i].Width;
35882
+ var yText=xEnd;
35883
+ if( end - (end-start)/2 < 1.5*Math.PI && end - (end-start)/2 > 0.5*Math.PI )
35884
+ {
35885
+ this.Canvas.lineTo( xEnd - textWidth, yEnd );
35886
+ yText=xEnd - textWidth;
35887
+ }
35888
+ else
35889
+ {
35890
+ this.Canvas.lineTo( xEnd + textWidth, yEnd );
35891
+ }
35892
+ this.Canvas.stroke();
35893
+
35894
+ if (item.TextColor) this.Canvas.fillStyle = item.TextColor;
35895
+ else this.Canvas.fillStyle=item.Color;
35896
+ this.Canvas.fillText(item.Text, yText, yEnd);
35897
+ }
35898
+
35899
+ start += rate*2*Math.PI;//起始角度
35900
+ }
35901
+ }
35902
+
35903
+ this.Draw=function()
35904
+ {
35905
+ if (!this.Data || !this.Data.Data || !(this.Data.Data.length>0)) return this.DrawEmptyData();
35906
+
35907
+ this.CalculateTotalValue();
35908
+ if (!IFrameSplitOperator.IsPlusNumber(this.TotalValue)) this.DrawEmptyData();
35909
+ this.CalculateSize();
35910
+
35911
+ this.Canvas.save();
35912
+
35913
+ this.DrawPie();
35914
+
35915
+ this.Canvas.restore();
35916
+ }
35917
+
35918
+ //空数据
35919
+ this.DrawEmptyData=function()
35920
+ {
35921
+ JSConsole.Chart.Log('[ChartSimplePie::DrawEmptyData]')
35922
+ }
35923
+
35924
+ this.GetMaxMin=function()
35925
+ {
35926
+ return { Min:null, Max:null };
35927
+ }
35928
+ }
35929
+
35930
+
35931
+ //圆环
35932
+ function ChartSimpleDoughnut()
35933
+ {
35934
+ this.newMethod=IChartPainting; //派生
35935
+ this.newMethod();
35936
+ delete this.newMethod;
35937
+
35938
+ this.ClassName='ChartSimpleDoughnut'; //类名
35939
+
35940
+ this.BorderColor=g_JSChartResource.ChartSimpleDoughnut.BorderColor;
35941
+ this.Offset=CloneData(g_JSChartResource.ChartSimpleDoughnut.Offset);
35942
+ this.LineExtendWidth=10;
35943
+ this.TextFontConfig=CloneData(g_JSChartResource.ChartSimpleDoughnut.TextFont);
35944
+
35945
+ this.RectClient={ };
35946
+ this.TotalValue=1;
35947
+ this.Radius = 50; //外圈半径默认值
35948
+ this.InnerRadius=30; //内圈半径
35949
+ this.TextFont;
35950
+
35951
+
35952
+ this.ReloadResource=function(resource)
35953
+ {
35954
+ this.BorderColor=g_JSChartResource.ChartSimpleDoughnut.BorderColor;
35955
+ this.Offset=CloneData(g_JSChartResource.ChartSimpleDoughnut.Offset);
35956
+ this.TextFontConfig=CloneData(g_JSChartResource.ChartSimpleDoughnut.TextFont);
35957
+ }
35958
+
35959
+ this.CalculateSize=function()
35960
+ {
35961
+ var border=this.ChartFrame.GetBorder();
35962
+ var pixelRatio=GetDevicePixelRatio();
35963
+ this.TextFont=`${this.TextFontConfig.Size*pixelRatio}px ${ this.TextFontConfig.Name}`;
35964
+ this.LineExtendWidth=this.GetFontHeight(this.TextFont,"擎")+1;
35965
+
35966
+
35967
+ this.RectClient={ Width:this.Radius*2*pixelRatio, Height:this.Radius*2*pixelRatio };
35968
+
35969
+ this.RectClient.Right=border.Right+this.Offset.X;
35970
+ this.RectClient.Top=border.TopEx+this.Offset.Y;
35971
+ this.RectClient.Left=this.RectClient.Right-this.RectClient.Width;
35972
+ this.RectClient.Bottom=this.RectClient.Top+this.RectClient.Height;
35973
+ }
35974
+
35975
+ this.CalculateTotalValue=function()
35976
+ {
35977
+ var totalValue=0;
35978
+ for(var i=0; i<this.Data.Data.length; ++i)
35979
+ {
35980
+ var item=this.Data.Data[i];
35981
+ if (!IFrameSplitOperator.IsPlusNumber(item.Value)) continue;
35982
+ totalValue += item.Value;
35983
+ }
35984
+
35985
+ this.TotalValue=totalValue;
35986
+ }
35987
+
35988
+ this.DrawPie=function()
35989
+ {
35990
+ this.Canvas.font=this.TextFont;
35991
+ this.Canvas.textBaseline='bottom';
35992
+ this.Canvas.textAlign = 'left';
35993
+
35994
+ var aryText=[];
35995
+ var maxTextWidth=0;
35996
+ for(var i=0;i<this.Data.Data.length;++i)
35997
+ {
35998
+ var item=this.Data.Data[i];
35999
+ if (!IFrameSplitOperator.IsPlusNumber(item.Value)) continue;
36000
+ if (!item.Text) continue;
36001
+ var textWidth=this.Canvas.measureText(item.Text).width;
36002
+
36003
+ aryText[i]={ Width:textWidth };
36004
+
36005
+ if (maxTextWidth<textWidth) maxTextWidth=textWidth;
36006
+ }
36007
+
36008
+ var xOffset=maxTextWidth+this.LineExtendWidth;
36009
+ this.RectClient.Left-=xOffset;
36010
+ this.RectClient.Right-=xOffset;
36011
+
36012
+ var pixelRatio=GetDevicePixelRatio();
36013
+ var radius=this.Radius*pixelRatio;
36014
+ var innerRadius=this.InnerRadius*pixelRatio;
36015
+ var start=0, end=0;
36016
+ var x=this.RectClient.Left+radius;
36017
+ var y=this.RectClient.Top+radius;
36018
+
36019
+ for(var i=0;i<this.Data.Data.length;++i)
36020
+ {
36021
+ var item=this.Data.Data[i];
36022
+ if (!IFrameSplitOperator.IsPlusNumber(item.Value)) continue;
36023
+
36024
+ var rate=item.Value/this.TotalValue;
36025
+
36026
+ // 绘制扇形
36027
+ this.Canvas.beginPath();
36028
+
36029
+ end += rate*2*Math.PI;//终止角度
36030
+ this.Canvas.strokeStyle = this.BorderColor;
36031
+ this.Canvas.fillStyle = item.Color;
36032
+ this.Canvas.arc(x,y,radius,start,end);
36033
+ this.Canvas.arc(x,y,innerRadius,end-2*Math.PI,start-2*Math.PI, true);
35862
36034
  this.Canvas.fill();
35863
36035
  this.Canvas.closePath();
35864
36036
  this.Canvas.stroke();
@@ -35866,10 +36038,10 @@ function ChartSimplePie()
35866
36038
  if (item.Text)
35867
36039
  {
35868
36040
  // 绘制直线
35869
- var xLine=this.Radius*Math.cos(end- (end-start)/2)+x;
35870
- var yLine=this.Radius*Math.sin(end - (end-start)/2)+y;
35871
- var xEnd = (this.Radius + this.LineExtendWidth)*Math.cos(end- (end-start)/2)+x;
35872
- var yEnd = (this.Radius + this.LineExtendWidth)*Math.sin(end - (end-start)/2)+y;
36041
+ var xLine=radius*Math.cos(end- (end-start)/2)+x;
36042
+ var yLine=radius*Math.sin(end - (end-start)/2)+y;
36043
+ var xEnd = (radius + this.LineExtendWidth)*Math.cos(end- (end-start)/2)+x;
36044
+ var yEnd = (radius + this.LineExtendWidth)*Math.sin(end - (end-start)/2)+y;
35873
36045
 
35874
36046
  this.Canvas.beginPath();
35875
36047
  if (item.LineColor) this.Canvas.strokeStyle =item.LineColor;
@@ -75433,6 +75605,13 @@ function JSChartResource()
75433
75605
  Offset:{ X:-5, Y:5 }
75434
75606
  }
75435
75607
 
75608
+ this.ChartSimpleDoughnut=
75609
+ {
75610
+ TextFont:{ Family:'微软雅黑' , Size:12 },
75611
+ BorderColor:"rgb(169,169,169)",
75612
+ Offset:{ X:-5, Y:5 }
75613
+ }
75614
+
75436
75615
  this.ChartSimpleRadar=
75437
75616
  {
75438
75617
  TextFont:{ Family:'微软雅黑' , Size:12 },
@@ -76678,6 +76857,8 @@ function JSChartResource()
76678
76857
 
76679
76858
  if (style.ChartSimpleTable) this.SetChartSimpleTable(style.ChartSimpleTable);
76680
76859
  if (style.ChartSimplePie) this.SetChartSimplePie(style.ChartSimplePie);
76860
+ if (style.ChartSimpleDoughnut) this.SetChartSimpleDoughnut(style.ChartSimpleDoughnut);
76861
+
76681
76862
  if (style.ChartSimpleRadar) this.SetChartSimpleRadar(style.ChartSimpleRadar);
76682
76863
 
76683
76864
  if (style.DRAWICON)
@@ -77772,6 +77953,27 @@ function JSChartResource()
77772
77953
  }
77773
77954
  }
77774
77955
 
77956
+ this.SetChartSimpleDoughnut=function(style)
77957
+ {
77958
+ var dest=this.ChartSimpleDoughnut;
77959
+
77960
+ if (style.TextFont)
77961
+ {
77962
+ var item=style.TextFont;
77963
+ if (item.Name) dest.TextFont.Name=item.Name;
77964
+ if (IFrameSplitOperator.IsNumber(item.Size)) dest.TextFont.Size=item.Size;
77965
+ }
77966
+
77967
+ if (style.BorderColor) dest.BorderColor=style.BorderColor;
77968
+
77969
+ if (style.Offset)
77970
+ {
77971
+ var item=style.Offset;
77972
+ if (IFrameSplitOperator.IsNumber(item.X)) dest.Offset.X=item.X;
77973
+ if (IFrameSplitOperator.IsNumber(item.Y)) dest.Offset.Y=item.Y;
77974
+ }
77975
+ }
77976
+
77775
77977
  this.SetChartSimpleRadar=function(style)
77776
77978
  {
77777
77979
  var dest=this.ChartSimpleRadar;
@@ -96908,7 +97110,7 @@ function DialogFactory()
96908
97110
  {
96909
97111
  if (!this.DataMap.has(name))
96910
97112
  {
96911
- JSConsole.Warn(`[DialogFactory::Create] can't find class=${name}.`);
97113
+ JSConsole.Chart.Warn(`[DialogFactory::Create] can't find class=${name}.`);
96912
97114
  return null;
96913
97115
  }
96914
97116
 
@@ -113087,6 +113289,18 @@ function JSDraw(errorHandler,symbolData)
113087
113289
 
113088
113290
  return result={ DrawData:{ Data:aryData, AryIndex:aryIndex, Radius:radius, AryArea:[{ LineColor:color }] }, DrawType:"DRAW_SIMPLE_RADAR" };
113089
113291
  }
113292
+
113293
+ this.DRAWDOUGHNUT=function(aryData)
113294
+ {
113295
+ var radius=aryData[0];
113296
+ var aryCell=[];
113297
+ for(var i=1;i<aryData.length;++i)
113298
+ {
113299
+ aryCell.push(aryData[i]);
113300
+ }
113301
+
113302
+ return result={ DrawData:{ Data:aryCell, Radius:radius , InnerRadius:radius/2 }, DrawType:"DRAW_SIMPLE_DOUGHNUT" };
113303
+ }
113090
113304
  }
113091
113305
 
113092
113306
 
@@ -113141,7 +113355,7 @@ JSDraw.prototype.IsDrawFunction=function(name)
113141
113355
  'DRAWOVERLAYLINE',"FILLRGN", "FILLRGN2","FILLTOPRGN", "FILLBOTTOMRGN", "FILLVERTICALRGN","FLOATRGN","DRAWSL", "DRAWGBK2","DRAWGBK_DIV",
113142
113356
  "VERTLINE","HORLINE","TIPICON",
113143
113357
  "BUY","SELL","SELLSHORT","BUYSHORT",
113144
- "DRAWLASTBARICON","DRAWLASTBARNUMBER", "DRAWLASTBARTEXT","DRAWTABLE","DRAWPIE","DRAWRADAR",
113358
+ "DRAWLASTBARICON","DRAWLASTBARNUMBER", "DRAWLASTBARTEXT","DRAWTABLE","DRAWPIE","DRAWRADAR","DRAWDOUGHNUT",
113145
113359
  ]);
113146
113360
  if (setFunctionName.has(name)) return true;
113147
113361
 
@@ -120030,6 +120244,10 @@ function JSExecute(ast,option)
120030
120244
  node.Draw=this.Draw.DRAWPIE(args);
120031
120245
  node.Out=[];
120032
120246
  break;
120247
+ case "DRAWDOUGHNUT":
120248
+ node.Draw=this.Draw.DRAWDOUGHNUT(args);
120249
+ node.Out=[];
120250
+ break;
120033
120251
  //雷达图
120034
120252
  case "RADAR_CELL":
120035
120253
  node.Out=this.Draw.RADAR_CELL(args[0],args[1],args[2],args[3]);
@@ -123083,6 +123301,30 @@ function ScriptIndex(name,script,args,option)
123083
123301
  hqChart.ChartPaint.push(chart);
123084
123302
  }
123085
123303
 
123304
+ this.CreateSimpleDoughnut=function(hqChart,windowIndex,varItem,id)
123305
+ {
123306
+ var chart=new ChartSimpleDoughnut();
123307
+ chart.Canvas=hqChart.Canvas;
123308
+ chart.Name=varItem.Name;
123309
+ chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
123310
+ chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
123311
+
123312
+ if (varItem.Draw && varItem.Draw.DrawData)
123313
+ {
123314
+ var drawData=varItem.Draw.DrawData;
123315
+ if (drawData.Data) chart.Data.Data=drawData.Data;
123316
+ if (drawData.BorderColor) chart.BorderColor=drawData.BorderColor;
123317
+ if (drawData.TextFont) chart.TextFontConfig=drawData.TextFont;
123318
+ if (drawData.TextColor) chart.TextColor=drawData.TextColor;
123319
+ if (IFrameSplitOperator.IsNumber(drawData.XOffset)) chart.Offset.X=drawData.XOffset;
123320
+ if (IFrameSplitOperator.IsNumber(drawData.YOffset)) chart.Offset.Y=drawData.YOffset;
123321
+ if (IFrameSplitOperator.IsPlusNumber(drawData.Radius)) chart.Radius=drawData.Radius;
123322
+ if (IFrameSplitOperator.IsPlusNumber(drawData.InnerRadius)) chart.InnerRadius=drawData.InnerRadius;
123323
+ }
123324
+
123325
+ hqChart.ChartPaint.push(chart);
123326
+ }
123327
+
123086
123328
  this.CreateTradeIcon=function(hqChart,windowIndex,varItem,id)
123087
123329
  {
123088
123330
  var chart=new ChartTradeIcon();
@@ -123965,6 +124207,9 @@ function ScriptIndex(name,script,args,option)
123965
124207
  case "DRAW_SIMPLE_RADAR":
123966
124208
  this.CreateSimpleRadar(hqChart,windowIndex,item,i);
123967
124209
  break;
124210
+ case "DRAW_SIMPLE_DOUGHNUT":
124211
+ this.CreateSimpleDoughnut(hqChart,windowIndex,item,i);
124212
+ break;
123968
124213
  case "BUY":
123969
124214
  case "SELL":
123970
124215
  case "SELLSHORT":
@@ -124318,6 +124563,9 @@ function OverlayScriptIndex(name,script,args,option)
124318
124563
  case "DRAW_SIMPLE_PIE":
124319
124564
  this.CreateSimplePie(hqChart,windowIndex,item,i);
124320
124565
  break;
124566
+ case "DRAW_SIMPLE_DOUGHNUT":
124567
+ this.CreateSimpleDoughnut(hqChart,windowIndex,item,i);
124568
+ break;
124321
124569
  case "DRAW_SIMPLE_RADAR":
124322
124570
  this.CreateSimpleRadar(hqChart,windowIndex,item,i);
124323
124571
  break;
@@ -125396,6 +125644,34 @@ function OverlayScriptIndex(name,script,args,option)
125396
125644
  frame.ChartPaint.push(chart);
125397
125645
  }
125398
125646
 
125647
+ this.CreateSimpleDoughnut=function(hqChart,windowIndex,varItem,id)
125648
+ {
125649
+ var overlayIndex=this.OverlayIndex;
125650
+ var frame=overlayIndex.Frame;
125651
+ var chart=new ChartSimpleDoughnut();
125652
+ chart.Canvas=hqChart.Canvas;
125653
+ chart.Name=varItem.Name;
125654
+ chart.ChartBorder=frame.Frame.ChartBorder;
125655
+ chart.ChartFrame=frame.Frame;
125656
+ chart.Identify=overlayIndex.Identify;
125657
+ chart.HQChart=hqChart;
125658
+
125659
+ if (varItem.Draw && varItem.Draw.DrawData)
125660
+ {
125661
+ var drawData=varItem.Draw.DrawData;
125662
+ if (drawData.Data) chart.Data.Data=drawData.Data;
125663
+ if (drawData.BorderColor) chart.BorderColor=drawData.BorderColor;
125664
+ if (drawData.TextFont) chart.TextFontConfig=drawData.TextFont;
125665
+ if (drawData.TextColor) chart.TextColor=drawData.TextColor;
125666
+ if (IFrameSplitOperator.IsNumber(drawData.XOffset)) chart.Offset.X=drawData.XOffset;
125667
+ if (IFrameSplitOperator.IsNumber(drawData.YOffset)) chart.Offset.Y=drawData.YOffset;
125668
+ if (IFrameSplitOperator.IsPlusNumber(drawData.Radius)) chart.Radius=drawData.Radius;
125669
+ if (IFrameSplitOperator.IsPlusNumber(drawData.InnerRadius)) chart.InnerRadius=drawData.InnerRadius;
125670
+ }
125671
+
125672
+ frame.ChartPaint.push(chart);
125673
+ }
125674
+
125399
125675
  this.CreateSimpleRadar=function(hqChart,windowIndex,varItem,id)
125400
125676
  {
125401
125677
  var overlayIndex=this.OverlayIndex;
@@ -126623,7 +126899,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
126623
126899
  outVarItem.Draw=drawItem;
126624
126900
  result.push(outVarItem);
126625
126901
  }
126626
- else if (draw.DrawType=="DRAW_SIMPLE_PIE")
126902
+ else if (draw.DrawType=="DRAW_SIMPLE_PIE" || draw.DrawType=="DRAW_SIMPLE_DOUGHNUT")
126627
126903
  {
126628
126904
  drawItem.Name=draw.Name;
126629
126905
  drawItem.Type=draw.Type;
@@ -128263,6 +128539,11 @@ function GetBlackStyle()
128263
128539
  BorderColor:"rgb(220,220,220)",
128264
128540
  },
128265
128541
 
128542
+ ChartSimpleDoughnut:
128543
+ {
128544
+ BorderColor:"rgb(220,220,220)",
128545
+ },
128546
+
128266
128547
  ChartSimpleRadar:
128267
128548
  {
128268
128549
  //TextFont:{ Family:'微软雅黑' , Size:12 },
@@ -152521,7 +152802,7 @@ function HQChartScriptWorker()
152521
152802
 
152522
152803
 
152523
152804
 
152524
- var HQCHART_VERSION="1.1.14366";
152805
+ var HQCHART_VERSION="1.1.14371";
152525
152806
 
152526
152807
  function PrintHQChartVersion()
152527
152808
  {