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.
@@ -201,7 +201,7 @@ JSIndexScript.ModifyAttribute=function(indexInfo, attribute)
201
201
  if (IFrameSplitOperator.IsNumber(item.FloatPrecision)) indexInfo.YAxis.FloatPrecision=item.FloatPrecision;
202
202
  if (IFrameSplitOperator.IsNumber(item.StringFormat)) indexInfo.YAxis.StringFormat=item.StringFormat;
203
203
  if (IFrameSplitOperator.IsBool(item.EnableRemoveZero)) indexInfo.YAxis.EnableRemoveZero=item.EnableRemoveZero;
204
- if (IFrameSplitOperator.IsBool(item.ExcludeValue)) indexInfo.YAxis.ExcludeValue=attribute.ExcludeValue; //不参数Y轴的计算
204
+ if (IFrameSplitOperator.IsBool(item.ExcludeValue)) indexInfo.YAxis.ExcludeValue=item.ExcludeValue; //不参数Y轴的计算
205
205
  }
206
206
  }
207
207
 
@@ -6386,6 +6386,9 @@ var JSCHART_EVENT_ID=
6386
6386
  ON_RCLICK_TREPORT_HEADER:125, //右键点击T型报价表头
6387
6387
  ON_TREPORT_LOCAL_SORT:126, //T型报价列表本地排序
6388
6388
  ON_CLICK_TREPORT_ROW:127, //左键点击点击T型报价列表
6389
+
6390
+
6391
+ ON_CHANGE_INDEX:150, //切换指标
6389
6392
  }
6390
6393
 
6391
6394
  var JSCHART_OPERATOR_ID=
@@ -9550,7 +9553,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9550
9553
  if (option.Point) item.LatestPoint=option.Point;
9551
9554
  }
9552
9555
 
9553
- if (item.IsDynamic && item.DrawAfterTitle===true) item.Draw();
9556
+ if (item.IsDynamic && item.DrawAfterTitle===true) item.Draw(moveonPoint, this.LastMouseStatus);
9554
9557
  }
9555
9558
 
9556
9559
  if (this.EnableAnimation)
@@ -43337,7 +43340,8 @@ function ExtendChartPaintFactory()
43337
43340
  ["FrameSplitPaint", { Create:function() { return new FrameSplitPaint(); } }],
43338
43341
  ["RectSelectPaint", { Create:function() { return new RectSelectPaint(); } }],
43339
43342
  ["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
43340
- ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}]
43343
+ ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}],
43344
+ ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}]
43341
43345
  ]
43342
43346
  );
43343
43347
 
@@ -47854,6 +47858,207 @@ function SessionBreaksPaint()
47854
47858
  }
47855
47859
  }
47856
47860
 
47861
+ //窗口底部工具栏
47862
+ function FrameButtomToolbarPaint()
47863
+ {
47864
+ this.newMethod=IExtendChartPainting; //派生
47865
+ this.newMethod();
47866
+ delete this.newMethod;
47867
+
47868
+ this.ClassName='FrameButtomToolbarPaint';
47869
+ this.FrameID=-1;
47870
+ this.FrameGuid=null;
47871
+ this.IsDynamic=true;
47872
+ this.DrawAfterTitle=true;
47873
+
47874
+ this.AryButton=[]; // { Title:, ID:, Data:数据, TooltipText:提示信息 }
47875
+ this.SelectedID=null; // 选中按钮ID
47876
+ this.AryRectButton=[];
47877
+
47878
+ this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;
47879
+ this.BorderColor=g_JSChartResource.FrameButtomToolbar.BorderColor;
47880
+ this.ButtonConfig=CloneData(g_JSChartResource.FrameButtomToolbar.Button);
47881
+ /*
47882
+ {
47883
+ Font:{ Family:"微软雅黑" },
47884
+ TitleColor:
47885
+ {
47886
+ Selected:"rgb(255,255,255)", Default:"rgb(140,140,140)", MoveOn:"rgb(255,255,255)"
47887
+ },
47888
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(25,25,25)", MoveOn:"rgb(59,59,59)" },
47889
+ BorderColor:"rgb(60,60,60)",
47890
+
47891
+ Mergin: { Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), Top:4*GetDevicePixelRatio(), Bottom:2*GetDevicePixelRatio() }
47892
+ };
47893
+ */
47894
+
47895
+ /*
47896
+ this.AryButton=
47897
+ [
47898
+ { Title:"MACD", ID:"A", TooltipText:"切换MACD指标", Data:{ IndexID:"MACD"}},
47899
+ { Title:"RSI", ID:"A1", TooltipText:"切换RSI指标", Data:{ IndexID:"RSI"} },
47900
+ { Title:"大狗棍法", ID:"B1" },
47901
+ { Title:"降龙掌", ID:"B3"}
47902
+ ];
47903
+ this.SelectedID="A1"
47904
+ */
47905
+
47906
+ this.ReloadResource=function(resource)
47907
+ {
47908
+ this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;
47909
+ this.BorderColor=g_JSChartResource.FrameButtomToolbar.BorderColor;
47910
+
47911
+ this.ButtonConfig=CloneData(g_JSChartResource.FrameButtomToolbar.Button);
47912
+ }
47913
+
47914
+ this.SetOption=function(option)
47915
+ {
47916
+ if (option)
47917
+ {
47918
+ if (IFrameSplitOperator.IsNumber(option.FrameID)) this.FrameID=option.FrameID;
47919
+ if (option.FrameGuid) this.FrameGuid=option.FrameGuid;
47920
+ if (IFrameSplitOperator.IsNonEmptyArray(option.AryButton)) this.AryButton=option.AryButton.slice();
47921
+ if (option.SelectedID) this.SelectedID=option.SelectedID;
47922
+ }
47923
+ }
47924
+
47925
+ //设置当前选中的菜单ID
47926
+ this.SetSelectedID=function(id)
47927
+ {
47928
+ this.SelectedID=id;
47929
+ }
47930
+
47931
+ this.Draw=function(moveonPoint, mouseStatus)
47932
+ {
47933
+ this.AryRectButton=[];
47934
+
47935
+ var frame=this.GetFrame();
47936
+ if (!frame) return;
47937
+ if (frame.IsHScreen) return; //不支持横屏
47938
+ if (frame.IsMinSize) return;
47939
+ if (frame.ChartBorder.IsShowTitleOnly) return;
47940
+
47941
+ var border=frame.ChartBorder.GetBorder();
47942
+ var rtBG={ Left:border.Left+1, Right:border.Right-1, Top:border.BottomEx+1, Bottom:border.Bottom-1 };
47943
+ rtBG.Width=rtBG.Right-rtBG.Left;
47944
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
47945
+ if (rtBG.Height<10) return;
47946
+
47947
+ if (this.BGColor)
47948
+ {
47949
+ this.Canvas.fillStyle=this.BGColor;
47950
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
47951
+ }
47952
+
47953
+ var font=this.TitleFont(rtBG.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom);
47954
+ this.Canvas.textBaseline='middle';
47955
+ this.Canvas.textAlign='center';
47956
+ this.Canvas.font=font;
47957
+ var xBotton=rtBG.Left;
47958
+ for(var i=0;i<this.AryButton.length;++i)
47959
+ {
47960
+ var item=this.AryButton[i];
47961
+ if (!item.Title) return;
47962
+ var textWidth=this.Canvas.measureText(item.Title).width+2;
47963
+ var buttonWidth=textWidth+this.ButtonConfig.Mergin.Left+this.ButtonConfig.Mergin.Right;
47964
+ var rtButton={ Left:xBotton, Top:rtBG.Top, Bottom:rtBG.Bottom, Height:rtBG.Height, Width:buttonWidth };
47965
+ rtButton.Right=rtButton.Left+rtButton.Width;
47966
+
47967
+ //鼠标是否在按钮上
47968
+ var bgColor=this.ButtonConfig.BGColor.Default;
47969
+ var titleColor=this.ButtonConfig.TitleColor.Default;
47970
+ if (moveonPoint && (moveonPoint.X>=rtButton.Left && moveonPoint.X<rtButton.Right && moveonPoint.Y>=rtButton.Top && moveonPoint.Y<=rtButton.Bottom))
47971
+ {
47972
+ bgColor=this.ButtonConfig.BGColor.MoveOn;
47973
+ titleColor=this.ButtonConfig.TitleColor.MoveOn;
47974
+ if (mouseStatus)
47975
+ mouseStatus.MouseOnToolbar={ Rect:rtButton, Item:item, Frame:frame, Point:{X:moveonPoint.X, Y:moveonPoint.Y}, ID:"TitleButton" };
47976
+ }
47977
+
47978
+ if (this.SelectedID && this.SelectedID==item.ID)
47979
+ {
47980
+ bgColor=this.ButtonConfig.BGColor.Selected;
47981
+ titleColor=this.ButtonConfig.TitleColor.Selected;
47982
+ }
47983
+
47984
+
47985
+ if (bgColor)
47986
+ {
47987
+ this.Canvas.fillStyle=bgColor;
47988
+ this.Canvas.fillRect(rtButton.Left,rtButton.Top,rtButton.Width,rtButton.Height);
47989
+ }
47990
+
47991
+ if (this.ButtonConfig.BorderColor)
47992
+ {
47993
+ this.Canvas.strokeStyle=this.ButtonConfig.BorderColor;
47994
+ this.Canvas.beginPath();
47995
+ this.Canvas.moveTo(ToFixedPoint(rtButton.Right),rtButton.Top);
47996
+ this.Canvas.lineTo(ToFixedPoint(rtButton.Right),rtButton.Bottom);
47997
+ this.Canvas.stroke();
47998
+ }
47999
+
48000
+ this.Canvas.fillStyle=titleColor;
48001
+ var xText=rtButton.Left+rtButton.Width/2; //居中
48002
+ var yText=rtButton.Top+this.ButtonConfig.Mergin.Top+(rtButton.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom)/2;
48003
+ this.Canvas.fillText(item.Title,xText,yText);
48004
+
48005
+ this.AryRectButton.push({ Rect:rtButton, ID:item.ID, Data:item });
48006
+
48007
+ xBotton+=buttonWidth+1;
48008
+ }
48009
+
48010
+ if (this.BorderColor)
48011
+ {
48012
+ this.Canvas.strokeStyle=this.BorderColor;
48013
+ this.Canvas.beginPath();
48014
+ this.Canvas.moveTo(border.Left,ToFixedPoint(border.BottomEx));
48015
+ this.Canvas.lineTo(border.Right,ToFixedPoint(border.BottomEx));
48016
+ this.Canvas.stroke();
48017
+ }
48018
+ }
48019
+
48020
+ this.GetFrame=function()
48021
+ {
48022
+ if (!this.ChartFrame) return null;
48023
+ if (this.FrameID>=0)
48024
+ {
48025
+ var subFrame=this.ChartFrame.SubFrame[this.FrameID];
48026
+ if (!subFrame || !subFrame.Frame) return null;
48027
+
48028
+ return subFrame.Frame;
48029
+ }
48030
+
48031
+ return null;
48032
+ }
48033
+
48034
+ this.TitleFont=function(height)
48035
+ {
48036
+ var config=this.ButtonConfig.Font;
48037
+ var fontSize=height;
48038
+ if (IFrameSplitOperator.IsPlusNumber(config.Size)) fontSize=config.Size;
48039
+
48040
+ var font=`${fontSize*GetDevicePixelRatio()}px ${config.Family}`;
48041
+ return font;
48042
+ }
48043
+
48044
+ this.PtInButtons=function(x,y)
48045
+ {
48046
+ for(var i=0;i<this.AryRectButton.length;++i)
48047
+ {
48048
+ var item=this.AryRectButton[i];
48049
+ var rect=item.Rect;
48050
+ if (x>rect.Left && x<rect.Right && y>rect.Top && y<rect.Bottom)
48051
+ {
48052
+ var frame=this.GetFrame();
48053
+ var result={ ID:item.Data.ID, Rect:rect, FrameID:this.FrameID, Frame:frame, Data:item.Data };
48054
+ return result;
48055
+ }
48056
+ }
48057
+
48058
+ return null;
48059
+ }
48060
+ }
48061
+
47857
48062
 
47858
48063
 
47859
48064
  //弹幕数据 { X:X偏移, Y:Y偏移, Text:内容, Color:颜色 }
@@ -68506,6 +68711,21 @@ function JSChartResource()
68506
68711
  }
68507
68712
  },
68508
68713
 
68714
+ this.FrameButtomToolbar=
68715
+ {
68716
+ BGColor:"rgb(235,235,235)",
68717
+ BorderColor:"rgb(204,204,204)",
68718
+ Button:
68719
+ {
68720
+ Font:{ Family:"微软雅黑" },
68721
+ TitleColor: { Selected:"rgb(255,255,255)", Default:"rgb(125,125,125)", MoveOn:"rgb(234,85,4)" },
68722
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(235,235,235)", MoveOn:"rgb(242,242,242)" },
68723
+ BorderColor:"rgb(204,204,204)",
68724
+
68725
+ Mergin: { Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), Top:4*GetDevicePixelRatio(), Bottom:2*GetDevicePixelRatio() }
68726
+ }
68727
+ }
68728
+
68509
68729
 
68510
68730
  //自定义风格
68511
68731
  this.SetStyle=function(style)
@@ -69161,6 +69381,9 @@ function JSChartResource()
69161
69381
  }
69162
69382
 
69163
69383
  }
69384
+
69385
+ if (style.FrameButtomToolbar)
69386
+ this.SetFrameButtomToolbar(style.FrameButtomToolbar);
69164
69387
  }
69165
69388
 
69166
69389
  this.SetReportStyle=function(style)
@@ -69471,6 +69694,57 @@ function JSChartResource()
69471
69694
  }
69472
69695
 
69473
69696
  }
69697
+
69698
+ this.SetFrameButtomToolbar=function(style)
69699
+ {
69700
+ var dest=this.FrameButtomToolbar;
69701
+
69702
+ if (style.BGColor) dest.BGColor=style.BGColor;
69703
+ if (style.BorderColor) dest.BorderColor=style.BorderColor;
69704
+ if (style.Button)
69705
+ {
69706
+ var button=style.Button;
69707
+ if (button.BorderColor) dest.Button.BorderColor=button.BorderColor;
69708
+
69709
+ if (button.Font)
69710
+ {
69711
+ var item=button.Font;
69712
+ var destItem=this.FrameButtomToolbar.Button.Font;
69713
+ if (item.Family) destItem.Family=item.Family;
69714
+ if (IFrameSplitOperator.IsNumber(item.Size)) destItem.Size=item.Size;
69715
+ }
69716
+
69717
+ if (button.TitleColor)
69718
+ {
69719
+ var item=button.TitleColor;
69720
+ var destItem=this.FrameButtomToolbar.Button.TitleColor;
69721
+ if (item.Selected) destItem.Selected=item.Selected;
69722
+ if (item.Default) destItem.Default=item.Default;
69723
+ if (item.MoveOn) destItem.MoveOn=item.MoveOn;
69724
+ }
69725
+
69726
+ if (button.BGColor)
69727
+ {
69728
+ var item=button.BGColor;
69729
+ var destItem=this.FrameButtomToolbar.Button.BGColor;
69730
+ if (item.Selected) destItem.Selected=item.Selected;
69731
+ if (item.Default) destItem.Default=item.Default;
69732
+ if (item.MoveOn) destItem.MoveOn=item.MoveOn;
69733
+ }
69734
+
69735
+ if (button.Mergin)
69736
+ {
69737
+ var item=button.Mergin;
69738
+ var destItem=this.FrameButtomToolbar.Button.Mergin;
69739
+ if (IFrameSplitOperator.IsNumber(item.Left)) destItem.Left=item.Left;
69740
+ if (IFrameSplitOperator.IsNumber(item.Right)) destItem.Left=item.Right;
69741
+ if (IFrameSplitOperator.IsNumber(item.Top)) destItem.Top=item.Top;
69742
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) destItem.Bottom=item.Bottom;
69743
+ }
69744
+ }
69745
+
69746
+ }
69747
+
69474
69748
  }
69475
69749
 
69476
69750
  var g_JSChartResource=new JSChartResource();
@@ -73843,6 +74117,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73843
74117
  if (option.Window) this.SetFrameToolbar(windowIndex,option.Window);
73844
74118
  }
73845
74119
 
74120
+ this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeScriptIndex" });
74121
+
73846
74122
  this.Frame.ClearUpDonwFrameYData({ Index:windowIndex });
73847
74123
  var bindData=this.ChartPaint[0].Data;
73848
74124
  this.BindIndexData(windowIndex,bindData); //执行脚本
@@ -73886,6 +74162,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73886
74162
  var apiItem=indexData.API;
73887
74163
  this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,indexData);
73888
74164
 
74165
+ this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeAPIIndex" });
74166
+
73889
74167
  if (indexData)
73890
74168
  {
73891
74169
  if (indexData.Window) this.SetFrameToolbar(windowIndex,indexData.Window);
@@ -73900,6 +74178,16 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73900
74178
  this.Draw();
73901
74179
  }
73902
74180
 
74181
+ this.OnChangeIndexEvent=function(windowIndex, indexInfo)
74182
+ {
74183
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CHANGE_INDEX);
74184
+ if (event && event.Callback)
74185
+ {
74186
+ var data={ IndexInfo:indexInfo, WindowIndex:windowIndex };
74187
+ event.Callback(event,data,this);
74188
+ }
74189
+ }
74190
+
73903
74191
  //切换指标 指定切换窗口指标
73904
74192
  this.ChangeIndex=function(windowIndex,indexName,option)
73905
74193
  {
@@ -73922,7 +74210,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73922
74210
  if (windowIndex == 0) windowIndex = 1; //幅图指标,不能再主图显示
73923
74211
  }
73924
74212
 
73925
- JSIndexScript.ModifyAttribute(indexInfo, option)
74213
+ JSIndexScript.ModifyAttribute(indexInfo, option);
73926
74214
  return this.ChangeScriptIndex(windowIndex, indexInfo, option);
73927
74215
  }
73928
74216
 
@@ -121427,6 +121715,19 @@ function GetBlackStyle()
121427
121715
  AreaColor:"rgba(24,28,42,0.5)",
121428
121716
  },
121429
121717
  },
121718
+
121719
+ FrameButtomToolbar:
121720
+ {
121721
+ BGColor:"rgb(25,25,25)",
121722
+ BorderColor:"rgb(60,60,60)",
121723
+ Button:
121724
+ {
121725
+ Font:{ Family:"微软雅黑" },
121726
+ TitleColor: { Selected:"rgb(255,255,255)", Default:"rgb(140,140,140)", MoveOn:"rgb(255,255,255)" },
121727
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(25,25,25)", MoveOn:"rgb(59,59,59)" },
121728
+ BorderColor:"rgb(60,60,60)",
121729
+ }
121730
+ }
121430
121731
 
121431
121732
  };
121432
121733
 
@@ -132194,7 +132495,7 @@ function ScrollBarBGChart()
132194
132495
 
132195
132496
 
132196
132497
 
132197
- var HQCHART_VERSION="1.1.13161";
132498
+ var HQCHART_VERSION="1.1.13166";
132198
132499
 
132199
132500
  function PrintHQChartVersion()
132200
132501
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13161";
8
+ var HQCHART_VERSION="1.1.13166";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {