hqchart 1.1.13162 → 1.1.13167

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.
@@ -245,7 +245,7 @@ JSIndexScript.ModifyAttribute=function(indexInfo, attribute)
245
245
  if (IFrameSplitOperator.IsNumber(item.FloatPrecision)) indexInfo.YAxis.FloatPrecision=item.FloatPrecision;
246
246
  if (IFrameSplitOperator.IsNumber(item.StringFormat)) indexInfo.YAxis.StringFormat=item.StringFormat;
247
247
  if (IFrameSplitOperator.IsBool(item.EnableRemoveZero)) indexInfo.YAxis.EnableRemoveZero=item.EnableRemoveZero;
248
- if (IFrameSplitOperator.IsBool(item.ExcludeValue)) indexInfo.YAxis.ExcludeValue=attribute.ExcludeValue; //不参数Y轴的计算
248
+ if (IFrameSplitOperator.IsBool(item.ExcludeValue)) indexInfo.YAxis.ExcludeValue=item.ExcludeValue; //不参数Y轴的计算
249
249
  }
250
250
  }
251
251
 
@@ -6430,6 +6430,9 @@ var JSCHART_EVENT_ID=
6430
6430
  ON_RCLICK_TREPORT_HEADER:125, //右键点击T型报价表头
6431
6431
  ON_TREPORT_LOCAL_SORT:126, //T型报价列表本地排序
6432
6432
  ON_CLICK_TREPORT_ROW:127, //左键点击点击T型报价列表
6433
+
6434
+
6435
+ ON_CHANGE_INDEX:150, //切换指标
6433
6436
  }
6434
6437
 
6435
6438
  var JSCHART_OPERATOR_ID=
@@ -9594,7 +9597,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9594
9597
  if (option.Point) item.LatestPoint=option.Point;
9595
9598
  }
9596
9599
 
9597
- if (item.IsDynamic && item.DrawAfterTitle===true) item.Draw();
9600
+ if (item.IsDynamic && item.DrawAfterTitle===true) item.Draw(moveonPoint, this.LastMouseStatus);
9598
9601
  }
9599
9602
 
9600
9603
  if (this.EnableAnimation)
@@ -43381,7 +43384,8 @@ function ExtendChartPaintFactory()
43381
43384
  ["FrameSplitPaint", { Create:function() { return new FrameSplitPaint(); } }],
43382
43385
  ["RectSelectPaint", { Create:function() { return new RectSelectPaint(); } }],
43383
43386
  ["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
43384
- ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}]
43387
+ ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}],
43388
+ ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}]
43385
43389
  ]
43386
43390
  );
43387
43391
 
@@ -47898,6 +47902,207 @@ function SessionBreaksPaint()
47898
47902
  }
47899
47903
  }
47900
47904
 
47905
+ //窗口底部工具栏
47906
+ function FrameButtomToolbarPaint()
47907
+ {
47908
+ this.newMethod=IExtendChartPainting; //派生
47909
+ this.newMethod();
47910
+ delete this.newMethod;
47911
+
47912
+ this.ClassName='FrameButtomToolbarPaint';
47913
+ this.FrameID=-1;
47914
+ this.FrameGuid=null;
47915
+ this.IsDynamic=true;
47916
+ this.DrawAfterTitle=true;
47917
+
47918
+ this.AryButton=[]; // { Title:, ID:, Data:数据, TooltipText:提示信息 }
47919
+ this.SelectedID=null; // 选中按钮ID
47920
+ this.AryRectButton=[];
47921
+
47922
+ this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;
47923
+ this.BorderColor=g_JSChartResource.FrameButtomToolbar.BorderColor;
47924
+ this.ButtonConfig=CloneData(g_JSChartResource.FrameButtomToolbar.Button);
47925
+ /*
47926
+ {
47927
+ Font:{ Family:"微软雅黑" },
47928
+ TitleColor:
47929
+ {
47930
+ Selected:"rgb(255,255,255)", Default:"rgb(140,140,140)", MoveOn:"rgb(255,255,255)"
47931
+ },
47932
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(25,25,25)", MoveOn:"rgb(59,59,59)" },
47933
+ BorderColor:"rgb(60,60,60)",
47934
+
47935
+ Mergin: { Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), Top:4*GetDevicePixelRatio(), Bottom:2*GetDevicePixelRatio() }
47936
+ };
47937
+ */
47938
+
47939
+ /*
47940
+ this.AryButton=
47941
+ [
47942
+ { Title:"MACD", ID:"A", TooltipText:"切换MACD指标", Data:{ IndexID:"MACD"}},
47943
+ { Title:"RSI", ID:"A1", TooltipText:"切换RSI指标", Data:{ IndexID:"RSI"} },
47944
+ { Title:"大狗棍法", ID:"B1" },
47945
+ { Title:"降龙掌", ID:"B3"}
47946
+ ];
47947
+ this.SelectedID="A1"
47948
+ */
47949
+
47950
+ this.ReloadResource=function(resource)
47951
+ {
47952
+ this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;
47953
+ this.BorderColor=g_JSChartResource.FrameButtomToolbar.BorderColor;
47954
+
47955
+ this.ButtonConfig=CloneData(g_JSChartResource.FrameButtomToolbar.Button);
47956
+ }
47957
+
47958
+ this.SetOption=function(option)
47959
+ {
47960
+ if (option)
47961
+ {
47962
+ if (IFrameSplitOperator.IsNumber(option.FrameID)) this.FrameID=option.FrameID;
47963
+ if (option.FrameGuid) this.FrameGuid=option.FrameGuid;
47964
+ if (IFrameSplitOperator.IsNonEmptyArray(option.AryButton)) this.AryButton=option.AryButton.slice();
47965
+ if (option.SelectedID) this.SelectedID=option.SelectedID;
47966
+ }
47967
+ }
47968
+
47969
+ //设置当前选中的菜单ID
47970
+ this.SetSelectedID=function(id)
47971
+ {
47972
+ this.SelectedID=id;
47973
+ }
47974
+
47975
+ this.Draw=function(moveonPoint, mouseStatus)
47976
+ {
47977
+ this.AryRectButton=[];
47978
+
47979
+ var frame=this.GetFrame();
47980
+ if (!frame) return;
47981
+ if (frame.IsHScreen) return; //不支持横屏
47982
+ if (frame.IsMinSize) return;
47983
+ if (frame.ChartBorder.IsShowTitleOnly) return;
47984
+
47985
+ var border=frame.ChartBorder.GetBorder();
47986
+ var rtBG={ Left:border.Left+1, Right:border.Right-1, Top:border.BottomEx+1, Bottom:border.Bottom-1 };
47987
+ rtBG.Width=rtBG.Right-rtBG.Left;
47988
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
47989
+ if (rtBG.Height<10) return;
47990
+
47991
+ if (this.BGColor)
47992
+ {
47993
+ this.Canvas.fillStyle=this.BGColor;
47994
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
47995
+ }
47996
+
47997
+ var font=this.TitleFont(rtBG.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom);
47998
+ this.Canvas.textBaseline='middle';
47999
+ this.Canvas.textAlign='center';
48000
+ this.Canvas.font=font;
48001
+ var xBotton=rtBG.Left;
48002
+ for(var i=0;i<this.AryButton.length;++i)
48003
+ {
48004
+ var item=this.AryButton[i];
48005
+ if (!item.Title) return;
48006
+ var textWidth=this.Canvas.measureText(item.Title).width+2;
48007
+ var buttonWidth=textWidth+this.ButtonConfig.Mergin.Left+this.ButtonConfig.Mergin.Right;
48008
+ var rtButton={ Left:xBotton, Top:rtBG.Top, Bottom:rtBG.Bottom, Height:rtBG.Height, Width:buttonWidth };
48009
+ rtButton.Right=rtButton.Left+rtButton.Width;
48010
+
48011
+ //鼠标是否在按钮上
48012
+ var bgColor=this.ButtonConfig.BGColor.Default;
48013
+ var titleColor=this.ButtonConfig.TitleColor.Default;
48014
+ if (moveonPoint && (moveonPoint.X>=rtButton.Left && moveonPoint.X<rtButton.Right && moveonPoint.Y>=rtButton.Top && moveonPoint.Y<=rtButton.Bottom))
48015
+ {
48016
+ bgColor=this.ButtonConfig.BGColor.MoveOn;
48017
+ titleColor=this.ButtonConfig.TitleColor.MoveOn;
48018
+ if (mouseStatus)
48019
+ mouseStatus.MouseOnToolbar={ Rect:rtButton, Item:item, Frame:frame, Point:{X:moveonPoint.X, Y:moveonPoint.Y}, ID:"TitleButton" };
48020
+ }
48021
+
48022
+ if (this.SelectedID && this.SelectedID==item.ID)
48023
+ {
48024
+ bgColor=this.ButtonConfig.BGColor.Selected;
48025
+ titleColor=this.ButtonConfig.TitleColor.Selected;
48026
+ }
48027
+
48028
+
48029
+ if (bgColor)
48030
+ {
48031
+ this.Canvas.fillStyle=bgColor;
48032
+ this.Canvas.fillRect(rtButton.Left,rtButton.Top,rtButton.Width,rtButton.Height);
48033
+ }
48034
+
48035
+ if (this.ButtonConfig.BorderColor)
48036
+ {
48037
+ this.Canvas.strokeStyle=this.ButtonConfig.BorderColor;
48038
+ this.Canvas.beginPath();
48039
+ this.Canvas.moveTo(ToFixedPoint(rtButton.Right),rtButton.Top);
48040
+ this.Canvas.lineTo(ToFixedPoint(rtButton.Right),rtButton.Bottom);
48041
+ this.Canvas.stroke();
48042
+ }
48043
+
48044
+ this.Canvas.fillStyle=titleColor;
48045
+ var xText=rtButton.Left+rtButton.Width/2; //居中
48046
+ var yText=rtButton.Top+this.ButtonConfig.Mergin.Top+(rtButton.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom)/2;
48047
+ this.Canvas.fillText(item.Title,xText,yText);
48048
+
48049
+ this.AryRectButton.push({ Rect:rtButton, ID:item.ID, Data:item });
48050
+
48051
+ xBotton+=buttonWidth+1;
48052
+ }
48053
+
48054
+ if (this.BorderColor)
48055
+ {
48056
+ this.Canvas.strokeStyle=this.BorderColor;
48057
+ this.Canvas.beginPath();
48058
+ this.Canvas.moveTo(border.Left,ToFixedPoint(border.BottomEx));
48059
+ this.Canvas.lineTo(border.Right,ToFixedPoint(border.BottomEx));
48060
+ this.Canvas.stroke();
48061
+ }
48062
+ }
48063
+
48064
+ this.GetFrame=function()
48065
+ {
48066
+ if (!this.ChartFrame) return null;
48067
+ if (this.FrameID>=0)
48068
+ {
48069
+ var subFrame=this.ChartFrame.SubFrame[this.FrameID];
48070
+ if (!subFrame || !subFrame.Frame) return null;
48071
+
48072
+ return subFrame.Frame;
48073
+ }
48074
+
48075
+ return null;
48076
+ }
48077
+
48078
+ this.TitleFont=function(height)
48079
+ {
48080
+ var config=this.ButtonConfig.Font;
48081
+ var fontSize=height;
48082
+ if (IFrameSplitOperator.IsPlusNumber(config.Size)) fontSize=config.Size;
48083
+
48084
+ var font=`${fontSize*GetDevicePixelRatio()}px ${config.Family}`;
48085
+ return font;
48086
+ }
48087
+
48088
+ this.PtInButtons=function(x,y)
48089
+ {
48090
+ for(var i=0;i<this.AryRectButton.length;++i)
48091
+ {
48092
+ var item=this.AryRectButton[i];
48093
+ var rect=item.Rect;
48094
+ if (x>rect.Left && x<rect.Right && y>rect.Top && y<rect.Bottom)
48095
+ {
48096
+ var frame=this.GetFrame();
48097
+ var result={ ID:item.Data.ID, Rect:rect, FrameID:this.FrameID, Frame:frame, Data:item.Data };
48098
+ return result;
48099
+ }
48100
+ }
48101
+
48102
+ return null;
48103
+ }
48104
+ }
48105
+
47901
48106
 
47902
48107
 
47903
48108
  //弹幕数据 { X:X偏移, Y:Y偏移, Text:内容, Color:颜色 }
@@ -68550,6 +68755,21 @@ function JSChartResource()
68550
68755
  }
68551
68756
  },
68552
68757
 
68758
+ this.FrameButtomToolbar=
68759
+ {
68760
+ BGColor:"rgb(235,235,235)",
68761
+ BorderColor:"rgb(204,204,204)",
68762
+ Button:
68763
+ {
68764
+ Font:{ Family:"微软雅黑" },
68765
+ TitleColor: { Selected:"rgb(255,255,255)", Default:"rgb(125,125,125)", MoveOn:"rgb(234,85,4)" },
68766
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(235,235,235)", MoveOn:"rgb(242,242,242)" },
68767
+ BorderColor:"rgb(204,204,204)",
68768
+
68769
+ Mergin: { Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), Top:4*GetDevicePixelRatio(), Bottom:2*GetDevicePixelRatio() }
68770
+ }
68771
+ }
68772
+
68553
68773
 
68554
68774
  //自定义风格
68555
68775
  this.SetStyle=function(style)
@@ -69205,6 +69425,9 @@ function JSChartResource()
69205
69425
  }
69206
69426
 
69207
69427
  }
69428
+
69429
+ if (style.FrameButtomToolbar)
69430
+ this.SetFrameButtomToolbar(style.FrameButtomToolbar);
69208
69431
  }
69209
69432
 
69210
69433
  this.SetReportStyle=function(style)
@@ -69515,6 +69738,57 @@ function JSChartResource()
69515
69738
  }
69516
69739
 
69517
69740
  }
69741
+
69742
+ this.SetFrameButtomToolbar=function(style)
69743
+ {
69744
+ var dest=this.FrameButtomToolbar;
69745
+
69746
+ if (style.BGColor) dest.BGColor=style.BGColor;
69747
+ if (style.BorderColor) dest.BorderColor=style.BorderColor;
69748
+ if (style.Button)
69749
+ {
69750
+ var button=style.Button;
69751
+ if (button.BorderColor) dest.Button.BorderColor=button.BorderColor;
69752
+
69753
+ if (button.Font)
69754
+ {
69755
+ var item=button.Font;
69756
+ var destItem=this.FrameButtomToolbar.Button.Font;
69757
+ if (item.Family) destItem.Family=item.Family;
69758
+ if (IFrameSplitOperator.IsNumber(item.Size)) destItem.Size=item.Size;
69759
+ }
69760
+
69761
+ if (button.TitleColor)
69762
+ {
69763
+ var item=button.TitleColor;
69764
+ var destItem=this.FrameButtomToolbar.Button.TitleColor;
69765
+ if (item.Selected) destItem.Selected=item.Selected;
69766
+ if (item.Default) destItem.Default=item.Default;
69767
+ if (item.MoveOn) destItem.MoveOn=item.MoveOn;
69768
+ }
69769
+
69770
+ if (button.BGColor)
69771
+ {
69772
+ var item=button.BGColor;
69773
+ var destItem=this.FrameButtomToolbar.Button.BGColor;
69774
+ if (item.Selected) destItem.Selected=item.Selected;
69775
+ if (item.Default) destItem.Default=item.Default;
69776
+ if (item.MoveOn) destItem.MoveOn=item.MoveOn;
69777
+ }
69778
+
69779
+ if (button.Mergin)
69780
+ {
69781
+ var item=button.Mergin;
69782
+ var destItem=this.FrameButtomToolbar.Button.Mergin;
69783
+ if (IFrameSplitOperator.IsNumber(item.Left)) destItem.Left=item.Left;
69784
+ if (IFrameSplitOperator.IsNumber(item.Right)) destItem.Left=item.Right;
69785
+ if (IFrameSplitOperator.IsNumber(item.Top)) destItem.Top=item.Top;
69786
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) destItem.Bottom=item.Bottom;
69787
+ }
69788
+ }
69789
+
69790
+ }
69791
+
69518
69792
  }
69519
69793
 
69520
69794
  var g_JSChartResource=new JSChartResource();
@@ -73887,6 +74161,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73887
74161
  if (option.Window) this.SetFrameToolbar(windowIndex,option.Window);
73888
74162
  }
73889
74163
 
74164
+ this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeScriptIndex" });
74165
+
73890
74166
  this.Frame.ClearUpDonwFrameYData({ Index:windowIndex });
73891
74167
  var bindData=this.ChartPaint[0].Data;
73892
74168
  this.BindIndexData(windowIndex,bindData); //执行脚本
@@ -73930,6 +74206,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73930
74206
  var apiItem=indexData.API;
73931
74207
  this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,indexData);
73932
74208
 
74209
+ this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeAPIIndex" });
74210
+
73933
74211
  if (indexData)
73934
74212
  {
73935
74213
  if (indexData.Window) this.SetFrameToolbar(windowIndex,indexData.Window);
@@ -73944,6 +74222,16 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73944
74222
  this.Draw();
73945
74223
  }
73946
74224
 
74225
+ this.OnChangeIndexEvent=function(windowIndex, indexInfo)
74226
+ {
74227
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CHANGE_INDEX);
74228
+ if (event && event.Callback)
74229
+ {
74230
+ var data={ IndexInfo:indexInfo, WindowIndex:windowIndex };
74231
+ event.Callback(event,data,this);
74232
+ }
74233
+ }
74234
+
73947
74235
  //切换指标 指定切换窗口指标
73948
74236
  this.ChangeIndex=function(windowIndex,indexName,option)
73949
74237
  {
@@ -73966,7 +74254,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73966
74254
  if (windowIndex == 0) windowIndex = 1; //幅图指标,不能再主图显示
73967
74255
  }
73968
74256
 
73969
- JSIndexScript.ModifyAttribute(indexInfo, option)
74257
+ JSIndexScript.ModifyAttribute(indexInfo, option);
73970
74258
  return this.ChangeScriptIndex(windowIndex, indexInfo, option);
73971
74259
  }
73972
74260
 
@@ -121471,6 +121759,19 @@ function GetBlackStyle()
121471
121759
  AreaColor:"rgba(24,28,42,0.5)",
121472
121760
  },
121473
121761
  },
121762
+
121763
+ FrameButtomToolbar:
121764
+ {
121765
+ BGColor:"rgb(25,25,25)",
121766
+ BorderColor:"rgb(60,60,60)",
121767
+ Button:
121768
+ {
121769
+ Font:{ Family:"微软雅黑" },
121770
+ TitleColor: { Selected:"rgb(255,255,255)", Default:"rgb(140,140,140)", MoveOn:"rgb(255,255,255)" },
121771
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(25,25,25)", MoveOn:"rgb(59,59,59)" },
121772
+ BorderColor:"rgb(60,60,60)",
121773
+ }
121774
+ }
121474
121775
 
121475
121776
  };
121476
121777
 
@@ -134758,7 +135059,7 @@ function HQChartScriptWorker()
134758
135059
 
134759
135060
 
134760
135061
 
134761
- var HQCHART_VERSION="1.1.13161";
135062
+ var HQCHART_VERSION="1.1.13166";
134762
135063
 
134763
135064
  function PrintHQChartVersion()
134764
135065
  {