hqchart 1.1.13162 → 1.1.13171

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.
@@ -2494,6 +2494,9 @@ var JSCHART_EVENT_ID=
2494
2494
  ON_RCLICK_TREPORT_HEADER:125, //右键点击T型报价表头
2495
2495
  ON_TREPORT_LOCAL_SORT:126, //T型报价列表本地排序
2496
2496
  ON_CLICK_TREPORT_ROW:127, //左键点击点击T型报价列表
2497
+
2498
+
2499
+ ON_CHANGE_INDEX:150, //切换指标
2497
2500
  }
2498
2501
 
2499
2502
  var JSCHART_OPERATOR_ID=
@@ -5232,10 +5235,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5232
5235
  var item=this.ChartDrawPicture[i];
5233
5236
  if (item.IsDrawFirst) continue;
5234
5237
  if (item.IsDrawMain && item.IsDrawMain()) continue;
5238
+ if (this.SelectChartDrawPicture && this.SelectChartDrawPicture.Guid==item.Guid) continue; //当前选中在最后画
5235
5239
 
5236
5240
  item.Draw();
5237
5241
  }
5238
5242
 
5243
+ if (this.SelectChartDrawPicture) this.SelectChartDrawPicture.Draw();
5244
+
5239
5245
  if (this.CurrentChartDrawPicture && this.CurrentChartDrawPicture.Status!=10)
5240
5246
  {
5241
5247
  this.CurrentChartDrawPicture.Draw();
@@ -5658,7 +5664,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5658
5664
  if (option.Point) item.LatestPoint=option.Point;
5659
5665
  }
5660
5666
 
5661
- if (item.IsDynamic && item.DrawAfterTitle===true) item.Draw();
5667
+ if (item.IsDynamic && item.DrawAfterTitle===true) item.Draw(moveonPoint, this.LastMouseStatus);
5662
5668
  }
5663
5669
 
5664
5670
  if (this.EnableAnimation)
@@ -5675,10 +5681,16 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5675
5681
  var item=this.ChartDrawPicture[i];
5676
5682
  if (item.IsDrawFirst) continue;
5677
5683
  if (item.IsDrawMain && item.IsDrawMain()) continue;
5684
+ if (this.SelectChartDrawPicture &&item.Guid==this.SelectChartDrawPicture.Guid) continue; //选中画图最后画 确保显示在最外面
5678
5685
 
5679
5686
  item.Draw(moveonPoint, this.LastMouseStatus);
5680
5687
  }
5681
5688
 
5689
+ if (this.SelectChartDrawPicture)
5690
+ {
5691
+ this.SelectChartDrawPicture.Draw(moveonPoint, this.LastMouseStatus);
5692
+ }
5693
+
5682
5694
  if (this.CurrentChartDrawPicture && this.CurrentChartDrawPicture.Status!=10)
5683
5695
  {
5684
5696
  this.CurrentChartDrawPicture.Draw();
@@ -39445,7 +39457,8 @@ function ExtendChartPaintFactory()
39445
39457
  ["FrameSplitPaint", { Create:function() { return new FrameSplitPaint(); } }],
39446
39458
  ["RectSelectPaint", { Create:function() { return new RectSelectPaint(); } }],
39447
39459
  ["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
39448
- ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}]
39460
+ ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}],
39461
+ ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}]
39449
39462
  ]
39450
39463
  );
39451
39464
 
@@ -43962,6 +43975,207 @@ function SessionBreaksPaint()
43962
43975
  }
43963
43976
  }
43964
43977
 
43978
+ //窗口底部工具栏
43979
+ function FrameButtomToolbarPaint()
43980
+ {
43981
+ this.newMethod=IExtendChartPainting; //派生
43982
+ this.newMethod();
43983
+ delete this.newMethod;
43984
+
43985
+ this.ClassName='FrameButtomToolbarPaint';
43986
+ this.FrameID=-1;
43987
+ this.FrameGuid=null;
43988
+ this.IsDynamic=true;
43989
+ this.DrawAfterTitle=true;
43990
+
43991
+ this.AryButton=[]; // { Title:, ID:, Data:数据, TooltipText:提示信息 }
43992
+ this.SelectedID=null; // 选中按钮ID
43993
+ this.AryRectButton=[];
43994
+
43995
+ this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;
43996
+ this.BorderColor=g_JSChartResource.FrameButtomToolbar.BorderColor;
43997
+ this.ButtonConfig=CloneData(g_JSChartResource.FrameButtomToolbar.Button);
43998
+ /*
43999
+ {
44000
+ Font:{ Family:"微软雅黑" },
44001
+ TitleColor:
44002
+ {
44003
+ Selected:"rgb(255,255,255)", Default:"rgb(140,140,140)", MoveOn:"rgb(255,255,255)"
44004
+ },
44005
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(25,25,25)", MoveOn:"rgb(59,59,59)" },
44006
+ BorderColor:"rgb(60,60,60)",
44007
+
44008
+ Mergin: { Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), Top:4*GetDevicePixelRatio(), Bottom:2*GetDevicePixelRatio() }
44009
+ };
44010
+ */
44011
+
44012
+ /*
44013
+ this.AryButton=
44014
+ [
44015
+ { Title:"MACD", ID:"A", TooltipText:"切换MACD指标", Data:{ IndexID:"MACD"}},
44016
+ { Title:"RSI", ID:"A1", TooltipText:"切换RSI指标", Data:{ IndexID:"RSI"} },
44017
+ { Title:"大狗棍法", ID:"B1" },
44018
+ { Title:"降龙掌", ID:"B3"}
44019
+ ];
44020
+ this.SelectedID="A1"
44021
+ */
44022
+
44023
+ this.ReloadResource=function(resource)
44024
+ {
44025
+ this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;
44026
+ this.BorderColor=g_JSChartResource.FrameButtomToolbar.BorderColor;
44027
+
44028
+ this.ButtonConfig=CloneData(g_JSChartResource.FrameButtomToolbar.Button);
44029
+ }
44030
+
44031
+ this.SetOption=function(option)
44032
+ {
44033
+ if (option)
44034
+ {
44035
+ if (IFrameSplitOperator.IsNumber(option.FrameID)) this.FrameID=option.FrameID;
44036
+ if (option.FrameGuid) this.FrameGuid=option.FrameGuid;
44037
+ if (IFrameSplitOperator.IsNonEmptyArray(option.AryButton)) this.AryButton=option.AryButton.slice();
44038
+ if (option.SelectedID) this.SelectedID=option.SelectedID;
44039
+ }
44040
+ }
44041
+
44042
+ //设置当前选中的菜单ID
44043
+ this.SetSelectedID=function(id)
44044
+ {
44045
+ this.SelectedID=id;
44046
+ }
44047
+
44048
+ this.Draw=function(moveonPoint, mouseStatus)
44049
+ {
44050
+ this.AryRectButton=[];
44051
+
44052
+ var frame=this.GetFrame();
44053
+ if (!frame) return;
44054
+ if (frame.IsHScreen) return; //不支持横屏
44055
+ if (frame.IsMinSize) return;
44056
+ if (frame.ChartBorder.IsShowTitleOnly) return;
44057
+
44058
+ var border=frame.ChartBorder.GetBorder();
44059
+ var rtBG={ Left:border.Left+1, Right:border.Right-1, Top:border.BottomEx+1, Bottom:border.Bottom-1 };
44060
+ rtBG.Width=rtBG.Right-rtBG.Left;
44061
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
44062
+ if (rtBG.Height<10) return;
44063
+
44064
+ if (this.BGColor)
44065
+ {
44066
+ this.Canvas.fillStyle=this.BGColor;
44067
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
44068
+ }
44069
+
44070
+ var font=this.TitleFont(rtBG.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom);
44071
+ this.Canvas.textBaseline='middle';
44072
+ this.Canvas.textAlign='center';
44073
+ this.Canvas.font=font;
44074
+ var xBotton=rtBG.Left;
44075
+ for(var i=0;i<this.AryButton.length;++i)
44076
+ {
44077
+ var item=this.AryButton[i];
44078
+ if (!item.Title) return;
44079
+ var textWidth=this.Canvas.measureText(item.Title).width+2;
44080
+ var buttonWidth=textWidth+this.ButtonConfig.Mergin.Left+this.ButtonConfig.Mergin.Right;
44081
+ var rtButton={ Left:xBotton, Top:rtBG.Top, Bottom:rtBG.Bottom, Height:rtBG.Height, Width:buttonWidth };
44082
+ rtButton.Right=rtButton.Left+rtButton.Width;
44083
+
44084
+ //鼠标是否在按钮上
44085
+ var bgColor=this.ButtonConfig.BGColor.Default;
44086
+ var titleColor=this.ButtonConfig.TitleColor.Default;
44087
+ if (moveonPoint && (moveonPoint.X>=rtButton.Left && moveonPoint.X<rtButton.Right && moveonPoint.Y>=rtButton.Top && moveonPoint.Y<=rtButton.Bottom))
44088
+ {
44089
+ bgColor=this.ButtonConfig.BGColor.MoveOn;
44090
+ titleColor=this.ButtonConfig.TitleColor.MoveOn;
44091
+ if (mouseStatus)
44092
+ mouseStatus.MouseOnToolbar={ Rect:rtButton, Item:item, Frame:frame, Point:{X:moveonPoint.X, Y:moveonPoint.Y}, ID:"TitleButton" };
44093
+ }
44094
+
44095
+ if (this.SelectedID && this.SelectedID==item.ID)
44096
+ {
44097
+ bgColor=this.ButtonConfig.BGColor.Selected;
44098
+ titleColor=this.ButtonConfig.TitleColor.Selected;
44099
+ }
44100
+
44101
+
44102
+ if (bgColor)
44103
+ {
44104
+ this.Canvas.fillStyle=bgColor;
44105
+ this.Canvas.fillRect(rtButton.Left,rtButton.Top,rtButton.Width,rtButton.Height);
44106
+ }
44107
+
44108
+ if (this.ButtonConfig.BorderColor)
44109
+ {
44110
+ this.Canvas.strokeStyle=this.ButtonConfig.BorderColor;
44111
+ this.Canvas.beginPath();
44112
+ this.Canvas.moveTo(ToFixedPoint(rtButton.Right),rtButton.Top);
44113
+ this.Canvas.lineTo(ToFixedPoint(rtButton.Right),rtButton.Bottom);
44114
+ this.Canvas.stroke();
44115
+ }
44116
+
44117
+ this.Canvas.fillStyle=titleColor;
44118
+ var xText=rtButton.Left+rtButton.Width/2; //居中
44119
+ var yText=rtButton.Top+this.ButtonConfig.Mergin.Top+(rtButton.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom)/2;
44120
+ this.Canvas.fillText(item.Title,xText,yText);
44121
+
44122
+ this.AryRectButton.push({ Rect:rtButton, ID:item.ID, Data:item });
44123
+
44124
+ xBotton+=buttonWidth+1;
44125
+ }
44126
+
44127
+ if (this.BorderColor)
44128
+ {
44129
+ this.Canvas.strokeStyle=this.BorderColor;
44130
+ this.Canvas.beginPath();
44131
+ this.Canvas.moveTo(border.Left,ToFixedPoint(border.BottomEx));
44132
+ this.Canvas.lineTo(border.Right,ToFixedPoint(border.BottomEx));
44133
+ this.Canvas.stroke();
44134
+ }
44135
+ }
44136
+
44137
+ this.GetFrame=function()
44138
+ {
44139
+ if (!this.ChartFrame) return null;
44140
+ if (this.FrameID>=0)
44141
+ {
44142
+ var subFrame=this.ChartFrame.SubFrame[this.FrameID];
44143
+ if (!subFrame || !subFrame.Frame) return null;
44144
+
44145
+ return subFrame.Frame;
44146
+ }
44147
+
44148
+ return null;
44149
+ }
44150
+
44151
+ this.TitleFont=function(height)
44152
+ {
44153
+ var config=this.ButtonConfig.Font;
44154
+ var fontSize=height;
44155
+ if (IFrameSplitOperator.IsPlusNumber(config.Size)) fontSize=config.Size;
44156
+
44157
+ var font=`${fontSize*GetDevicePixelRatio()}px ${config.Family}`;
44158
+ return font;
44159
+ }
44160
+
44161
+ this.PtInButtons=function(x,y)
44162
+ {
44163
+ for(var i=0;i<this.AryRectButton.length;++i)
44164
+ {
44165
+ var item=this.AryRectButton[i];
44166
+ var rect=item.Rect;
44167
+ if (x>rect.Left && x<rect.Right && y>rect.Top && y<rect.Bottom)
44168
+ {
44169
+ var frame=this.GetFrame();
44170
+ var result={ ID:item.Data.ID, Rect:rect, FrameID:this.FrameID, Frame:frame, Data:item.Data };
44171
+ return result;
44172
+ }
44173
+ }
44174
+
44175
+ return null;
44176
+ }
44177
+ }
44178
+
43965
44179
 
43966
44180
 
43967
44181
  //弹幕数据 { X:X偏移, Y:Y偏移, Text:内容, Color:颜色 }
@@ -64614,6 +64828,21 @@ function JSChartResource()
64614
64828
  }
64615
64829
  },
64616
64830
 
64831
+ this.FrameButtomToolbar=
64832
+ {
64833
+ BGColor:"rgb(235,235,235)",
64834
+ BorderColor:"rgb(204,204,204)",
64835
+ Button:
64836
+ {
64837
+ Font:{ Family:"微软雅黑" },
64838
+ TitleColor: { Selected:"rgb(255,255,255)", Default:"rgb(125,125,125)", MoveOn:"rgb(234,85,4)" },
64839
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(235,235,235)", MoveOn:"rgb(242,242,242)" },
64840
+ BorderColor:"rgb(204,204,204)",
64841
+
64842
+ Mergin: { Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), Top:4*GetDevicePixelRatio(), Bottom:2*GetDevicePixelRatio() }
64843
+ }
64844
+ }
64845
+
64617
64846
 
64618
64847
  //自定义风格
64619
64848
  this.SetStyle=function(style)
@@ -65269,6 +65498,9 @@ function JSChartResource()
65269
65498
  }
65270
65499
 
65271
65500
  }
65501
+
65502
+ if (style.FrameButtomToolbar)
65503
+ this.SetFrameButtomToolbar(style.FrameButtomToolbar);
65272
65504
  }
65273
65505
 
65274
65506
  this.SetReportStyle=function(style)
@@ -65579,6 +65811,57 @@ function JSChartResource()
65579
65811
  }
65580
65812
 
65581
65813
  }
65814
+
65815
+ this.SetFrameButtomToolbar=function(style)
65816
+ {
65817
+ var dest=this.FrameButtomToolbar;
65818
+
65819
+ if (style.BGColor) dest.BGColor=style.BGColor;
65820
+ if (style.BorderColor) dest.BorderColor=style.BorderColor;
65821
+ if (style.Button)
65822
+ {
65823
+ var button=style.Button;
65824
+ if (button.BorderColor) dest.Button.BorderColor=button.BorderColor;
65825
+
65826
+ if (button.Font)
65827
+ {
65828
+ var item=button.Font;
65829
+ var destItem=this.FrameButtomToolbar.Button.Font;
65830
+ if (item.Family) destItem.Family=item.Family;
65831
+ if (IFrameSplitOperator.IsNumber(item.Size)) destItem.Size=item.Size;
65832
+ }
65833
+
65834
+ if (button.TitleColor)
65835
+ {
65836
+ var item=button.TitleColor;
65837
+ var destItem=this.FrameButtomToolbar.Button.TitleColor;
65838
+ if (item.Selected) destItem.Selected=item.Selected;
65839
+ if (item.Default) destItem.Default=item.Default;
65840
+ if (item.MoveOn) destItem.MoveOn=item.MoveOn;
65841
+ }
65842
+
65843
+ if (button.BGColor)
65844
+ {
65845
+ var item=button.BGColor;
65846
+ var destItem=this.FrameButtomToolbar.Button.BGColor;
65847
+ if (item.Selected) destItem.Selected=item.Selected;
65848
+ if (item.Default) destItem.Default=item.Default;
65849
+ if (item.MoveOn) destItem.MoveOn=item.MoveOn;
65850
+ }
65851
+
65852
+ if (button.Mergin)
65853
+ {
65854
+ var item=button.Mergin;
65855
+ var destItem=this.FrameButtomToolbar.Button.Mergin;
65856
+ if (IFrameSplitOperator.IsNumber(item.Left)) destItem.Left=item.Left;
65857
+ if (IFrameSplitOperator.IsNumber(item.Right)) destItem.Left=item.Right;
65858
+ if (IFrameSplitOperator.IsNumber(item.Top)) destItem.Top=item.Top;
65859
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) destItem.Bottom=item.Bottom;
65860
+ }
65861
+ }
65862
+
65863
+ }
65864
+
65582
65865
  }
65583
65866
 
65584
65867
  var g_JSChartResource=new JSChartResource();
@@ -69951,6 +70234,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
69951
70234
  if (option.Window) this.SetFrameToolbar(windowIndex,option.Window);
69952
70235
  }
69953
70236
 
70237
+ this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeScriptIndex" });
70238
+
69954
70239
  this.Frame.ClearUpDonwFrameYData({ Index:windowIndex });
69955
70240
  var bindData=this.ChartPaint[0].Data;
69956
70241
  this.BindIndexData(windowIndex,bindData); //执行脚本
@@ -69994,6 +70279,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
69994
70279
  var apiItem=indexData.API;
69995
70280
  this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,indexData);
69996
70281
 
70282
+ this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeAPIIndex" });
70283
+
69997
70284
  if (indexData)
69998
70285
  {
69999
70286
  if (indexData.Window) this.SetFrameToolbar(windowIndex,indexData.Window);
@@ -70008,6 +70295,16 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
70008
70295
  this.Draw();
70009
70296
  }
70010
70297
 
70298
+ this.OnChangeIndexEvent=function(windowIndex, indexInfo)
70299
+ {
70300
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CHANGE_INDEX);
70301
+ if (event && event.Callback)
70302
+ {
70303
+ var data={ IndexInfo:indexInfo, WindowIndex:windowIndex };
70304
+ event.Callback(event,data,this);
70305
+ }
70306
+ }
70307
+
70011
70308
  //切换指标 指定切换窗口指标
70012
70309
  this.ChangeIndex=function(windowIndex,indexName,option)
70013
70310
  {
@@ -70030,7 +70327,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
70030
70327
  if (windowIndex == 0) windowIndex = 1; //幅图指标,不能再主图显示
70031
70328
  }
70032
70329
 
70033
- JSIndexScript.ModifyAttribute(indexInfo, option)
70330
+ JSIndexScript.ModifyAttribute(indexInfo, option);
70034
70331
  return this.ChangeScriptIndex(windowIndex, indexInfo, option);
70035
70332
  }
70036
70333
 
@@ -682,6 +682,19 @@ function GetBlackStyle()
682
682
  AreaColor:"rgba(24,28,42,0.5)",
683
683
  },
684
684
  },
685
+
686
+ FrameButtomToolbar:
687
+ {
688
+ BGColor:"rgb(25,25,25)",
689
+ BorderColor:"rgb(60,60,60)",
690
+ Button:
691
+ {
692
+ Font:{ Family:"微软雅黑" },
693
+ TitleColor: { Selected:"rgb(255,255,255)", Default:"rgb(140,140,140)", MoveOn:"rgb(255,255,255)" },
694
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(25,25,25)", MoveOn:"rgb(59,59,59)" },
695
+ BorderColor:"rgb(60,60,60)",
696
+ }
697
+ }
685
698
 
686
699
  };
687
700