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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.14299",
3
+ "version": "1.1.14307",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -55745,7 +55745,7 @@ HQData.Minute_RequestMinuteData=function(data, callback)
55745
55745
  }
55746
55746
  */
55747
55747
 
55748
- stockItem.minute.length=50;
55748
+ //stockItem.minute.length=50;
55749
55749
 
55750
55750
  var hqchartData={code:0, stock:[stockItem] };
55751
55751
 
@@ -57374,6 +57374,9 @@ HQData.Report_APIIndex=function(data, callback)
57374
57374
  HQData.APIIndex_DRAWTEXT_LINE(data, callback);
57375
57375
  else if (request.Data.indexname=="API_DRAW_SIMPLE_TABLE")
57376
57376
  HQData.APIIndex_DRAW_SIMPLE_TABLE(data, callback);
57377
+ else if (request.Data.indexname=="API_DRAW_SIMPLE_PIE")
57378
+ HQData.APIIndex_DRAW_SIMPLE_PIE(data, callback);
57379
+
57377
57380
  }
57378
57381
 
57379
57382
 
@@ -57778,8 +57781,19 @@ HQData.APIIndex_DRAWTEXT_LINE=function(data, callback)
57778
57781
  DrawData:
57779
57782
  {
57780
57783
  Price:price,
57781
- Text:{ Title:`价格:${price.toFixed(2)}`, Color:"rgb(255, 165, 0)" },
57782
- Line:{ Type:1, Color:"rgb(200,200,0)" }, //Type 0=不画 1=直线 2=虚线
57784
+ Text:
57785
+ {
57786
+ Title:`价格:${price.toFixed(2)}`,
57787
+ Color:"rgb(255, 165, 0)",
57788
+ },
57789
+
57790
+ Line:
57791
+ {
57792
+ Type:1, //Type 0=不画 1=直线 2=虚线
57793
+ //LineDash:[10,10],
57794
+ Color:"rgb(200,200,0)",
57795
+ //Width:1,
57796
+ },
57783
57797
  }
57784
57798
  }
57785
57799
  };
@@ -57841,3 +57855,50 @@ HQData.APIIndex_DRAW_SIMPLE_TABLE=function(data, callback)
57841
57855
  }
57842
57856
 
57843
57857
 
57858
+ HQData.APIIndex_DRAW_SIMPLE_PIE=function(data, callback)
57859
+ {
57860
+ data.PreventDefault=true;
57861
+ var hqchart=data.HQChart;
57862
+ var kData=hqchart.GetKData();
57863
+
57864
+ var tableData=
57865
+ {
57866
+ name:'DRAW_SIMPLE_PIE', type:1,
57867
+ Draw:
57868
+ {
57869
+ DrawType:'DRAW_SIMPLE_PIE',
57870
+ DrawData:
57871
+ {
57872
+ //BGColor:"rgba(250,250,210,0.8)",
57873
+ //BorderColor:"rgb(110,110,110)",
57874
+ //TextColor:"rgb(0,191,255)",
57875
+ Data:
57876
+ [
57877
+ { Value:10, Text:"数据1:10", Color:"rgba(255,182,193,0.8)", TextColor:"rgb(250,250,250)", LineColor:"rgb(255,182,193)"},
57878
+ { Value:70, Text:"数据2:70", Color:"rgba(255,0,255,0.8)",TextColor:"rgb(250,250,250)", LineColor:"rgb(255,0,255)"},
57879
+ { Value:110, Text:"数据3:110", Color:"rgba(72,61,139,0.8)",TextColor:"rgb(250,250,250)", LineColor:"rgb(72,61,139)"},
57880
+ { Value:210, Text:"数据4:210", Color:"rgba(0,191,255,0.8)",TextColor:"rgb(250,250,250)", LineColor:"rgb(0,191,255)"},
57881
+ { Value:310, Text:"数据5:310", Color:"rgba(255,140,0,0.8)",TextColor:"rgb(250,250,250)", LineColor:"rgb(255,140,0)"},
57882
+ ],
57883
+
57884
+ //TextFont:{ Size:16, Name:"微软雅黑"},
57885
+ //XOffset:-10,
57886
+ //YOffset:-15,
57887
+ Radius:80,
57888
+ }
57889
+ }
57890
+ };
57891
+
57892
+ var apiData=
57893
+ {
57894
+ code:0,
57895
+ stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
57896
+ outdata: { date:kData.GetDate(), time:kData.GetTime() , outvar:[tableData] }
57897
+ };
57898
+
57899
+
57900
+ console.log('[HQData.APIIndex_DRAW_SIMPLE_PIE] apiData ', apiData);
57901
+ callback(apiData);
57902
+ }
57903
+
57904
+
@@ -11540,6 +11540,30 @@ function JSDraw(errorHandler,symbolData)
11540
11540
 
11541
11541
  return result={ DrawData:{ TableData:tableData }, DrawType:'DRAW_SIMPLE_TABLE' };
11542
11542
  }
11543
+
11544
+ //饼图
11545
+ this.PIE_CELL=function(value, color, text, textColor, lineColor)
11546
+ {
11547
+ var cellItem={ Value:value, Color:color };
11548
+ if (text) cellItem.Text=text;
11549
+ if (textColor) cellItem.TextColor=textColor;
11550
+ if (lineColor) cellItem.LineColor=lineColor;
11551
+
11552
+ return cellItem
11553
+ }
11554
+
11555
+ //0=Radius半径
11556
+ this.DRAWPIE=function(aryData)
11557
+ {
11558
+ var radius=aryData[0];
11559
+ var aryCell=[];
11560
+ for(var i=1;i<aryData.length;++i)
11561
+ {
11562
+ aryCell.push(aryData[i]);
11563
+ }
11564
+
11565
+ return result={ DrawData:{ Data:aryCell, Radius:radius }, DrawType:"DRAW_SIMPLE_PIE" };
11566
+ }
11543
11567
  }
11544
11568
 
11545
11569
 
@@ -11594,7 +11618,7 @@ JSDraw.prototype.IsDrawFunction=function(name)
11594
11618
  'DRAWOVERLAYLINE',"FILLRGN", "FILLRGN2","FILLTOPRGN", "FILLBOTTOMRGN", "FILLVERTICALRGN","FLOATRGN","DRAWSL", "DRAWGBK2","DRAWGBK_DIV",
11595
11619
  "VERTLINE","HORLINE","TIPICON",
11596
11620
  "BUY","SELL","SELLSHORT","BUYSHORT",
11597
- "DRAWLASTBARICON","DRAWLASTBARNUMBER", "DRAWLASTBARTEXT","DRAWTABLE",
11621
+ "DRAWLASTBARICON","DRAWLASTBARNUMBER", "DRAWLASTBARTEXT","DRAWTABLE","DRAWPIE",
11598
11622
  ]);
11599
11623
  if (setFunctionName.has(name)) return true;
11600
11624
 
@@ -18475,6 +18499,14 @@ function JSExecute(ast,option)
18475
18499
  node.Draw=this.Draw.DRAWTABLE(args);
18476
18500
  node.Out=[];
18477
18501
  break;
18502
+ //饼图
18503
+ case "PIE_CELL":
18504
+ node.Out=this.Draw.PIE_CELL(args[0],args[1],args[2],args[3],args[4]);
18505
+ break;
18506
+ case "DRAWPIE":
18507
+ node.Draw=this.Draw.DRAWPIE(args);
18508
+ node.Out=[];
18509
+ break;
18478
18510
 
18479
18511
  default:
18480
18512
  node.Out=this.Algorithm.CallFunction(funcName, args, node, this.SymbolData);
@@ -21468,6 +21500,29 @@ function ScriptIndex(name,script,args,option)
21468
21500
  hqChart.ChartPaint.push(chart);
21469
21501
  }
21470
21502
 
21503
+ this.CreateSimplePie=function(hqChart,windowIndex,varItem,id)
21504
+ {
21505
+ var chart=new ChartSimplePie();
21506
+ chart.Canvas=hqChart.Canvas;
21507
+ chart.Name=varItem.Name;
21508
+ chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
21509
+ chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
21510
+
21511
+ if (varItem.Draw && varItem.Draw.DrawData)
21512
+ {
21513
+ var drawData=varItem.Draw.DrawData;
21514
+ if (drawData.Data) chart.Data.Data=drawData.Data;
21515
+ if (drawData.BorderColor) chart.BorderColor=drawData.BorderColor;
21516
+ if (drawData.TextFont) chart.TextFontConfig=drawData.TextFont;
21517
+ if (drawData.TextColor) chart.TextColor=drawData.TextColor;
21518
+ if (IFrameSplitOperator.IsNumber(drawData.XOffset)) chart.Offset.X=drawData.XOffset;
21519
+ if (IFrameSplitOperator.IsNumber(drawData.YOffset)) chart.Offset.Y=drawData.YOffset;
21520
+ if (IFrameSplitOperator.IsPlusNumber(drawData.Radius)) chart.Radius=drawData.Radius;
21521
+ }
21522
+
21523
+ hqChart.ChartPaint.push(chart);
21524
+ }
21525
+
21471
21526
  this.CreateTradeIcon=function(hqChart,windowIndex,varItem,id)
21472
21527
  {
21473
21528
  var chart=new ChartTradeIcon();
@@ -21674,11 +21729,12 @@ function ScriptIndex(name,script,args,option)
21674
21729
  for(var j=0;j<drawData.length;++j)
21675
21730
  {
21676
21731
  var item=drawData[j];
21732
+ var kItem=chart.Data.Data[j];
21677
21733
  if (!IFrameSplitOperator.IsNumber(item)) continue;
21678
21734
 
21679
21735
  var svgItem=
21680
21736
  {
21681
- Index:j, Value:item,
21737
+ Value:item, Date:kItem.Date, Time:kItem.Time,
21682
21738
  SVG:{ Symbol:varItem.Draw.Icon.Symbol, Size:svgSize, Color:svgColor, YOffset:svgYOffset, VAlign:svgVAlign }
21683
21739
  };
21684
21740
 
@@ -21698,6 +21754,7 @@ function ScriptIndex(name,script,args,option)
21698
21754
  chart.Texts= aryData;
21699
21755
  }
21700
21756
 
21757
+ chart.BuildCacheData();
21701
21758
  hqChart.ChartPaint.push(chart);
21702
21759
  }
21703
21760
 
@@ -21921,6 +21978,8 @@ function ScriptIndex(name,script,args,option)
21921
21978
  chart.Family=varItem.Draw.DrawData.Family;
21922
21979
  chart.TextFont=varItem.Draw.DrawData.TextFont;
21923
21980
  chart.Texts= varItem.Draw.DrawData.Data;
21981
+ chart.BuildCacheData();
21982
+ this.SetChartIndexName(chart);
21924
21983
  hqChart.ChartPaint.push(chart);
21925
21984
  }
21926
21985
 
@@ -22336,6 +22395,8 @@ function ScriptIndex(name,script,args,option)
22336
22395
  case "DRAW_SIMPLE_TABLE":
22337
22396
  this.CreateSimpleTable(hqChart,windowIndex,item,i);
22338
22397
  break;
22398
+ case "DRAW_SIMPLE_PIE":
22399
+ this.CreateSimplePie(hqChart,windowIndex,item,i);
22339
22400
  case "BUY":
22340
22401
  case "SELL":
22341
22402
  case "SELLSHORT":
@@ -22686,6 +22747,8 @@ function OverlayScriptIndex(name,script,args,option)
22686
22747
  case "DRAW_SIMPLE_TABLE":
22687
22748
  this.CreateSimpleTable(hqChart,windowIndex,item,i);
22688
22749
  break;
22750
+ case "DRAW_SIMPLE_PIE":
22751
+ this.CreateSimplePie(hqChart,windowIndex,item,i);
22689
22752
 
22690
22753
  case "KLINE_BG":
22691
22754
  this.CreateBackgroud(hqChart,windowIndex,item,i);
@@ -23437,11 +23500,12 @@ function OverlayScriptIndex(name,script,args,option)
23437
23500
  for(var j=0;j<drawData.length;++j)
23438
23501
  {
23439
23502
  var item=drawData[j];
23503
+ var kItem=chart.Data.Data[j];
23440
23504
  if (!IFrameSplitOperator.IsNumber(item)) continue;
23441
23505
 
23442
23506
  var svgItem=
23443
23507
  {
23444
- Index:j, Value:item,
23508
+ Value:item, Date:kItem.Date, Time:kItem.Time,
23445
23509
  SVG:{ Symbol:varItem.Draw.Icon.Symbol, Size:svgSize, Color:svgColor, YOffset:svgYOffset, VAlign:svgVAlign }
23446
23510
  };
23447
23511
 
@@ -23461,6 +23525,7 @@ function OverlayScriptIndex(name,script,args,option)
23461
23525
  chart.Texts= aryData;
23462
23526
  }
23463
23527
 
23528
+ chart.BuildCacheData();
23464
23529
  frame.ChartPaint.push(chart);
23465
23530
  }
23466
23531
 
@@ -23672,7 +23737,8 @@ function OverlayScriptIndex(name,script,args,option)
23672
23737
  if (varItem.Draw.AutoPosition) chart.AutoPosition=varItem.Draw.AutoPosition;
23673
23738
 
23674
23739
  this.ReloadChartResource(hqChart, windowIndex, chart);
23675
-
23740
+
23741
+ chart.BuildCacheData();
23676
23742
  this.SetChartIndexName(chart);
23677
23743
  frame.ChartPaint.push(chart);
23678
23744
  }
@@ -23723,6 +23789,33 @@ function OverlayScriptIndex(name,script,args,option)
23723
23789
  frame.ChartPaint.push(chart);
23724
23790
  }
23725
23791
 
23792
+ this.CreateSimplePie=function(hqChart,windowIndex,varItem,id)
23793
+ {
23794
+ var overlayIndex=this.OverlayIndex;
23795
+ var frame=overlayIndex.Frame;
23796
+ var chart=new ChartSimplePie();
23797
+ chart.Canvas=hqChart.Canvas;
23798
+ chart.Name=varItem.Name;
23799
+ chart.ChartBorder=frame.Frame.ChartBorder;
23800
+ chart.ChartFrame=frame.Frame;
23801
+ chart.Identify=overlayIndex.Identify;
23802
+ chart.HQChart=hqChart;
23803
+
23804
+ if (varItem.Draw && varItem.Draw.DrawData)
23805
+ {
23806
+ var drawData=varItem.Draw.DrawData;
23807
+ if (drawData.Data) chart.Data.Data=drawData.Data;
23808
+ if (drawData.BorderColor) chart.BorderColor=drawData.BorderColor;
23809
+ if (drawData.TextFont) chart.TextFontConfig=drawData.TextFont;
23810
+ if (drawData.TextColor) chart.TextColor=drawData.TextColor;
23811
+ if (IFrameSplitOperator.IsNumber(drawData.XOffset)) chart.Offset.X=drawData.XOffset;
23812
+ if (IFrameSplitOperator.IsNumber(drawData.YOffset)) chart.Offset.Y=drawData.YOffset;
23813
+ if (IFrameSplitOperator.IsPlusNumber(drawData.Radius)) chart.Radius=drawData.Radius;
23814
+ }
23815
+
23816
+ frame.ChartPaint.push(chart);
23817
+ }
23818
+
23726
23819
  this.CreateChartVericaltLine=function(hqChart,windowIndex,varItem,id)
23727
23820
  {
23728
23821
  var overlayIndex=this.OverlayIndex;
@@ -24784,8 +24877,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
24784
24877
  drawItem.Name=draw.Name;
24785
24878
  drawItem.DrawType=draw.DrawType;
24786
24879
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
24787
- drawItem.DrawData={ Data:this.FittingMultiText(draw.Data,date,time,hqChart), Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
24788
- this.GetKLineData(drawItem.DrawData.Data, hqChart);
24880
+ drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
24789
24881
  outVarItem.Draw=drawItem;
24790
24882
 
24791
24883
  result.push(outVarItem);
@@ -24925,6 +25017,17 @@ function APIScriptIndex(name,script,args,option, isOverlay)
24925
25017
  outVarItem.Draw=drawItem;
24926
25018
  result.push(outVarItem);
24927
25019
  }
25020
+ else if (draw.DrawType=="DRAW_SIMPLE_PIE")
25021
+ {
25022
+ drawItem.Name=draw.Name;
25023
+ drawItem.Type=draw.Type;
25024
+
25025
+ drawItem.DrawType=draw.DrawType;
25026
+ drawItem.DrawData=draw.DrawData; //{ Data:[ {Value, Color, Text: }, ], BorderColor:, TextFont:{ Size:, Name: } };
25027
+
25028
+ outVarItem.Draw=drawItem;
25029
+ result.push(outVarItem);
25030
+ }
24928
25031
  else
24929
25032
  {
24930
25033
  var find=g_ScriptIndexChartFactory.Get(draw.DrawType); //外部挂接
@@ -25265,8 +25368,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
25265
25368
  drawItem.Name=draw.Name;
25266
25369
  drawItem.DrawType=draw.DrawType;
25267
25370
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
25268
- drawItem.DrawData={ Data:this.FittingMultiText(draw.Data,date,time,hqChart), Family:draw.Family, TextFont:draw.TextFont ,EnableTooltip:draw.EnableTooltip,IsDrawFirst:draw.IsDrawFirst };
25269
- this.GetKLineData(drawItem.DrawData.Data, hqChart);
25371
+ drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont , EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
25270
25372
  outVarItem.Draw=drawItem;
25271
25373
 
25272
25374
  result.push(outVarItem);