hqchart 1.1.14632 → 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.
@@ -12192,6 +12192,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12192
12192
  return;
12193
12193
  }
12194
12194
  }
12195
+ else if (toolTip.Type==9) //ChartKLineTable
12196
+ {
12197
+ if (toolTip.Data.Item && toolTip.Data.Item.Tooltip && this.FloatTooltip)
12198
+ {
12199
+ this.DrawFloatTooltip({X:x, Y:y, YMove:20/pixelTatio}, toolTip);
12200
+ bHideFloatToolip=false;
12201
+ return;
12202
+ }
12203
+ }
12195
12204
 
12196
12205
 
12197
12206
  if (bHideFloatToolip) this.HideFloatTooltip();
@@ -36753,6 +36762,7 @@ function ChartKLineTable()
36753
36762
  this.AryTableData=[];
36754
36763
  this.MapCache=null; //key=date/date-time value={ Date:, Time:, Data:[ ] }
36755
36764
  this.GetKValue=ChartData.GetKValue;
36765
+ this.AryCellRect=[]; //保存单元格信息
36756
36766
 
36757
36767
  this.BuildCacheData=function()
36758
36768
  {
@@ -36812,6 +36822,7 @@ function ChartKLineTable()
36812
36822
 
36813
36823
  this.Draw=function()
36814
36824
  {
36825
+ this.AryCellRect=[];
36815
36826
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
36816
36827
  if (this.IsShowIndexTitleOnly()) return;
36817
36828
  if (this.IsHideScriptIndex()) return;
@@ -36925,7 +36936,7 @@ function ChartKLineTable()
36925
36936
 
36926
36937
  if (this.BGColor)
36927
36938
  {
36928
- var rtRightBG={Left:border.RightEx, Top:border.TopTitle, Right:border.ChartWidth, Bottom:border.Bottom };
36939
+ var rtRightBG={Left:border.RightEx, Top:border.Top, Right:border.ChartWidth, Bottom:border.Bottom };
36929
36940
  rtRightBG.Width=rtRightBG.Right-rtRightBG.Left;
36930
36941
  rtRightBG.Height=rtRightBG.Bottom-rtRightBG.Top;
36931
36942
  this.Canvas.fillStyle=this.BGColor;
@@ -36966,9 +36977,11 @@ function ChartKLineTable()
36966
36977
  var x=left,y=top, width=right-left;
36967
36978
  var yOffset=3;
36968
36979
  if (this.ItemMergin.YOffset) yOffset=this.ItemMergin.YOffset;
36969
- for(var i=0;i<data.Data.length;++i)
36980
+ for(var i=0; i<data.Data.length; ++i, y+=this.RowHeight)
36970
36981
  {
36971
36982
  var item=data.Data[i];
36983
+ if (!item) continue;
36984
+
36972
36985
  var rtBG={Left:x, Top:y, Right:right, Height:this.RowHeight, Width:width };
36973
36986
  rtBG.Bottom=rtBG.Top+this.RowHeight;
36974
36987
 
@@ -37013,20 +37026,27 @@ function ChartKLineTable()
37013
37026
  }
37014
37027
  }
37015
37028
 
37029
+ if (rtBG.Width>5)
37030
+ {
37031
+ this.AryCellRect.push({ Item:{ Cell:item, Colunm:data, RowIndex:i, SubCell:subItem, SubIndex:j, Tooltip:subItem.Tooltip, Type:2 }, Rect:rtSubBG });
37032
+ }
37033
+
37016
37034
  xCell+=subCellWidth;
37017
37035
  }
37018
37036
  }
37019
37037
  else
37020
37038
  {
37021
- if (item && item.BGColor)
37039
+ if (item.BGColor)
37022
37040
  {
37023
37041
  this.Canvas.fillStyle=item.BGColor;
37024
37042
  this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
37025
37043
  }
37026
37044
 
37027
- if (item && item.Color && rtBG.Width>10)
37045
+ if (item.Text && rtBG.Width>10)
37028
37046
  {
37029
- this.Canvas.fillStyle=item.Color;
37047
+ if (item.Color) this.Canvas.fillStyle=item.Color;
37048
+ else this.Canvas.fillStyle=this.TextColor;
37049
+
37030
37050
  this.Canvas.textBaseline='bottom';
37031
37051
  var yText=rtBG.Bottom-yOffset;
37032
37052
 
@@ -37046,9 +37066,14 @@ function ChartKLineTable()
37046
37066
  this.Canvas.fillText(item.Text,rtBG.Left+2,yText, width-4);
37047
37067
  }
37048
37068
  }
37069
+
37070
+ if (rtBG.Width>5)
37071
+ {
37072
+ this.AryCellRect.push({ Item:{ Cell:item, Colunm:data, RowIndex:i, Tooltip:item.Tooltip, Type:1 }, Rect:rtBG });
37073
+ }
37049
37074
  }
37050
37075
 
37051
- y+=this.RowHeight;
37076
+
37052
37077
  }
37053
37078
  }
37054
37079
 
@@ -37082,6 +37107,30 @@ function ChartKLineTable()
37082
37107
  {
37083
37108
  return {Min:0, Max:this.RowCount};
37084
37109
  }
37110
+
37111
+ this.GetTooltipData=function(x,y,tooltip)
37112
+ {
37113
+ if (!this.IsShow) return false;
37114
+
37115
+ for(var i=0;i<this.AryCellRect.length;++i)
37116
+ {
37117
+ var item=this.AryCellRect[i];
37118
+ if (!item.Rect) continue;
37119
+
37120
+ var rect=item.Rect;
37121
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom)
37122
+ {
37123
+ var data=item.Item;
37124
+ JSConsole.Chart.Log('[ChartKLineTable::GetTooltipData] cell', item);
37125
+ tooltip.Data={ Rect:item.Rect, Item:data };
37126
+ tooltip.ChartPaint=this;
37127
+ tooltip.Type=9; //ChartKLineTable
37128
+ return true;
37129
+ }
37130
+ }
37131
+
37132
+ return false;
37133
+ }
37085
37134
  }
37086
37135
 
37087
37136
  //表格
@@ -38909,7 +38958,7 @@ function ChartArea()
38909
38958
  }
38910
38959
  }
38911
38960
 
38912
- //散点图
38961
+ //散点图 建议使用新版本 ChartScatterPlotV2
38913
38962
  function ChartScatterPlot()
38914
38963
  {
38915
38964
  this.newMethod=IChartPainting; //派生
@@ -39114,7 +39163,7 @@ function ChartScatterPlot()
39114
39163
 
39115
39164
  }
39116
39165
 
39117
- //散点图
39166
+ //散点图 2.0
39118
39167
  function ChartScatterPlotV2()
39119
39168
  {
39120
39169
  this.newMethod=IChartPainting; //派生
@@ -48091,6 +48140,9 @@ function ChartDrawSVG()
48091
48140
  this.BuildKeyCallback=null;
48092
48141
  this.MapCache=null; //key=date/date-time value={ Data:[] }
48093
48142
 
48143
+ this.AryDrawDetail=[]; //需要绘制的文字信息
48144
+ this.EnalbeDetailOnVerlap=false; //详情重叠不显示
48145
+
48094
48146
  this.BuildKey=function(item)
48095
48147
  {
48096
48148
  if (this.BuildKeyCallback) return this.BuildKeyCallback(item);
@@ -48125,6 +48177,7 @@ function ChartDrawSVG()
48125
48177
  {
48126
48178
  this.TooltipRect=[];
48127
48179
  this.AryDrawRect=[];
48180
+ this.AryDrawDetail=[];
48128
48181
  this.AutoYOffset=0;
48129
48182
 
48130
48183
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
@@ -48133,6 +48186,10 @@ function ChartDrawSVG()
48133
48186
  if (!this.MapCache || this.MapCache.size<=0) return;
48134
48187
 
48135
48188
  this.DrawSVGV2();
48189
+
48190
+ if (this.EnalbeDetailOnVerlap) this.DrawOnVerlapDetail();
48191
+
48192
+ this.AryDrawDetail=[];
48136
48193
  }
48137
48194
 
48138
48195
  this.DrawDetail=function(rtSVG, data, svgItem)
@@ -48199,6 +48256,21 @@ function ChartDrawSVG()
48199
48256
  }
48200
48257
  }
48201
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
+
48202
48274
  if (data.BGColor)
48203
48275
  {
48204
48276
  this.Canvas.fillStyle=data.BGColor;
@@ -48215,12 +48287,27 @@ function ChartDrawSVG()
48215
48287
  for(var i=0;i<aryText.length;++i)
48216
48288
  {
48217
48289
  var item=aryText[i];
48218
-
48290
+
48219
48291
  this.Canvas.fillStyle = item.Data.Color;
48220
48292
  this.Canvas.fillText(item.Data.Text, item.X, item.Y);
48221
48293
  }
48294
+ }
48222
48295
 
48223
- 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
+ }
48224
48311
  }
48225
48312
 
48226
48313
  this.GetDetailPosition=function(rtSVG, data)
@@ -48582,183 +48669,6 @@ function ChartDrawSVG()
48582
48669
  }
48583
48670
  }
48584
48671
 
48585
- /*
48586
- this.DrawSVG=function()
48587
- {
48588
- if (!this.IsShow || this.ChartFrame.IsMinSize) return;
48589
- if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
48590
- if (!IFrameSplitOperator.IsNonEmptyArray(this.Texts)) return;
48591
- if (!this.Family) return;
48592
-
48593
- this.IsHScreen=(this.ChartFrame.IsHScreen===true);
48594
- var xPointCount=this.ChartFrame.XPointCount;
48595
- var offset=this.Data.DataOffset;
48596
- var top=this.ChartBorder.GetTopEx();
48597
- var bottom=this.ChartBorder.GetBottomEx();
48598
- var pixelRatio = GetDevicePixelRatio();
48599
-
48600
- var x=0,y=0;
48601
- for(var i=0; i<this.Texts.length; ++i)
48602
- {
48603
- var item=this.Texts[i];
48604
-
48605
- if (!item.SVG || !item.SVG.Symbol) continue;
48606
- if (!IFrameSplitOperator.IsNumber(item.Index)) continue;
48607
-
48608
- var isMinuteFrame=this.IsMinuteFrame();
48609
- var index=item.Index-offset;
48610
- var kItem=this.Data.Data[item.Index];
48611
- if (index<0 || index>=xPointCount) continue;
48612
-
48613
- x=this.ChartFrame.GetXFromIndex(index);
48614
- if (item.Value=="Top") y=top;
48615
- else if (item.Value=="Bottom") y=bottom;
48616
- else y=this.ChartFrame.GetYFromData(item.Value, false);
48617
- if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48618
-
48619
- var svgItem=item.SVG;
48620
- if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48621
-
48622
- if (this.AutoPosition)
48623
- {
48624
- var pt={ X:x, Y:y };
48625
- this.CalculateShowPosition(item, pt); //重新计算位置
48626
- x=pt.X;
48627
- y=pt.Y;
48628
- }
48629
-
48630
-
48631
- var fontSVG=`${svgItem.Size}px ${this.Family}`;
48632
- this.Canvas.font=fontSVG;
48633
- var halfSize=svgItem.Size/2;
48634
- var textBaseline='bottom';
48635
- var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
48636
- if (svgItem.VAlign===0)
48637
- {
48638
- textBaseline="top";
48639
- rtSVG.Top=y;
48640
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48641
- }
48642
- else if (svgItem.VAlign===1)
48643
- {
48644
- textBaseline='middle';
48645
- rtSVG.Top=y-svgItem.Size/2;
48646
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48647
- }
48648
-
48649
- if (rtSVG.Top<0)
48650
- {
48651
- rtSVG.Top=0;
48652
- rtSVG.Bottom=svgItem.Size;
48653
- y=rtSVG.Bottom;
48654
- }
48655
-
48656
- this.Canvas.textBaseline=textBaseline;
48657
- this.Canvas.textAlign='center';
48658
- this.Canvas.fillStyle = svgItem.Color;
48659
- this.Canvas.fillText(svgItem.Symbol, x, y);
48660
-
48661
- this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48662
-
48663
- if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG,Index:i });
48664
-
48665
- //文字
48666
- if (item.Text && item.Text.Content && this.TextFont)
48667
- {
48668
- var textItem=item.Text;
48669
- this.Canvas.font=this.TextFont;
48670
- this.Canvas.fillStyle=textItem.Color;
48671
- var yText=y;
48672
- if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48673
- this.Canvas.fillText(textItem.Content, x, yText);
48674
- }
48675
-
48676
- if (item.Detail)
48677
- {
48678
- this.DrawDetail(rtSVG,item.Detail, item);
48679
- }
48680
-
48681
- //连线
48682
- if (item.Line)
48683
- {
48684
- var lineItem=item.Line;
48685
- var price=null, yPrice=null;
48686
- var kItem=this.Data.Data[item.Index];
48687
- if (lineItem.Value=="Bottom")
48688
- {
48689
- yPrice=bottom;
48690
- }
48691
- else if (lineItem.Value=="Top")
48692
- {
48693
- yPrice=top;
48694
- }
48695
- else
48696
- {
48697
- switch(lineItem.Value)
48698
- {
48699
- case "C":
48700
- price=kItem.Close;
48701
- break;
48702
- case "H":
48703
- price=kItem.High;
48704
- break;
48705
- case "L":
48706
- price=kItem.Low;
48707
- break;
48708
- }
48709
-
48710
- if (!IFrameSplitOperator.IsNumber(price)) continue;
48711
-
48712
- yPrice=this.ChartFrame.GetYFromData(price);
48713
- }
48714
-
48715
- if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
48716
-
48717
- var yText;
48718
- if (yPrice<rtSVG.Top)
48719
- {
48720
- yText=rtSVG.Top;
48721
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48722
- {
48723
- //yPrice+=lineItem.Blank;
48724
- yText-=lineItem.SVGBlank;
48725
- }
48726
- }
48727
- else
48728
- {
48729
- yText=rtSVG.Bottom;
48730
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48731
- {
48732
- //yPrice-=lineItem.Blank;
48733
- yText+=lineItem.SVGBlank;
48734
- }
48735
- }
48736
-
48737
- if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
48738
- var lineWidth=1*pixelRatio;
48739
- if (lineItem.Width>0) lineWidth=lineItem.Width*pixelRatio;
48740
- this.Canvas.lineWidth=lineWidth; //线宽
48741
- this.Canvas.strokeStyle = lineItem.Color;
48742
- this.Canvas.beginPath();
48743
-
48744
- if (this.IsHScreen)
48745
- {
48746
- this.Canvas.moveTo(yText, ToFixedPoint(x));
48747
- this.Canvas.lineTo(yPrice,ToFixedPoint(x));
48748
- }
48749
- else
48750
- {
48751
- this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
48752
- this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
48753
- }
48754
-
48755
- this.Canvas.stroke();
48756
- this.Canvas.setLineDash([]);
48757
- }
48758
- }
48759
- }
48760
- */
48761
-
48762
48672
  this.GetMaxMin=function()
48763
48673
  {
48764
48674
  this.IsHScreen=(this.ChartFrame.IsHScreen===true);
@@ -126667,6 +126577,7 @@ function ScriptIndex(name,script,args,option)
126667
126577
  chart.Data=hqChart.GetKData()
126668
126578
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.EnableTooltip)) chart.EnableTooltip=varItem.Draw.DrawData.EnableTooltip;
126669
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;
126670
126581
  if (varItem.Draw.BuildKeyCallback) chart.BuildKeyCallback=varItem.Draw.BuildKeyCallback;
126671
126582
  chart.Family=varItem.Draw.DrawData.Family;
126672
126583
  chart.TextFont=varItem.Draw.DrawData.TextFont;
@@ -126737,6 +126648,7 @@ function ScriptIndex(name,script,args,option)
126737
126648
  if (config.TextColor) chart.TextColor=config.TextColor;
126738
126649
  if (config.BorderColor) chart.BorderColor=config.BorderColor;
126739
126650
  if (IFrameSplitOperator.IsNumber(config.RowNamePosition)) chart.RowNamePosition=config.RowNamePosition;
126651
+ if (IFrameSplitOperator.IsNumber(config.RowHeightType)) chart.RowHeightType=config.RowHeightType;
126740
126652
 
126741
126653
  if (config.ItemMergin)
126742
126654
  {
@@ -128577,6 +128489,7 @@ function OverlayScriptIndex(name,script,args,option)
128577
128489
  chart.TextFont=varItem.Draw.DrawData.TextFont;
128578
128490
  chart.Texts= varItem.Draw.DrawData.Data;
128579
128491
  if (varItem.Draw.AutoPosition) chart.AutoPosition=varItem.Draw.AutoPosition;
128492
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailOnVerlap)) chart.EnalbeDetailOnVerlap=varItem.Draw.EnalbeDetailOnVerlap;
128580
128493
 
128581
128494
  this.ReloadChartResource(hqChart, windowIndex, chart);
128582
128495
 
@@ -129783,6 +129696,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
129783
129696
  drawItem.Name=draw.Name;
129784
129697
  drawItem.DrawType=draw.DrawType;
129785
129698
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
129699
+ drawItem.EnalbeDetailOnVerlap=draw.EnalbeDetailOnVerlap;
129786
129700
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
129787
129701
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
129788
129702
  outVarItem.Draw=drawItem;
@@ -154150,6 +154064,10 @@ function JSFloatTooltip()
154150
154064
  {
154151
154065
  this.UpdateChartDrawSVGV2Tooltip(data);
154152
154066
  }
154067
+ else if (tooltipData.Type==9) //ChartKLineTable
154068
+ {
154069
+ this.UpdateChartKLineTableTooltip(data);
154070
+ }
154153
154071
 
154154
154072
  }
154155
154073
  else if (data.DataType==2) //更新实时行情数据
@@ -154295,6 +154213,12 @@ function JSFloatTooltip()
154295
154213
 
154296
154214
  this.ShowTooltip(data);
154297
154215
  }
154216
+
154217
+
154218
+ this.UpdateChartKLineTableTooltip=function(data)
154219
+ {
154220
+ this.UpdateChartDrawSVGV2Tooltip(data);
154221
+ }
154298
154222
 
154299
154223
  //交易指标
154300
154224
  this.UpdateTradeIndexTooltip=function(data)
@@ -157343,7 +157267,7 @@ function HQChartScriptWorker()
157343
157267
 
157344
157268
 
157345
157269
 
157346
- var HQCHART_VERSION="1.1.14631";
157270
+ var HQCHART_VERSION="1.1.14638";
157347
157271
 
157348
157272
  function PrintHQChartVersion()
157349
157273
  {