hqchart 1.1.13160 → 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.
@@ -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=
@@ -5658,7 +5661,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5658
5661
  if (option.Point) item.LatestPoint=option.Point;
5659
5662
  }
5660
5663
 
5661
- if (item.IsDynamic && item.DrawAfterTitle===true) item.Draw();
5664
+ if (item.IsDynamic && item.DrawAfterTitle===true) item.Draw(moveonPoint, this.LastMouseStatus);
5662
5665
  }
5663
5666
 
5664
5667
  if (this.EnableAnimation)
@@ -39445,7 +39448,8 @@ function ExtendChartPaintFactory()
39445
39448
  ["FrameSplitPaint", { Create:function() { return new FrameSplitPaint(); } }],
39446
39449
  ["RectSelectPaint", { Create:function() { return new RectSelectPaint(); } }],
39447
39450
  ["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
39448
- ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}]
39451
+ ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}],
39452
+ ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}]
39449
39453
  ]
39450
39454
  );
39451
39455
 
@@ -43962,6 +43966,207 @@ function SessionBreaksPaint()
43962
43966
  }
43963
43967
  }
43964
43968
 
43969
+ //窗口底部工具栏
43970
+ function FrameButtomToolbarPaint()
43971
+ {
43972
+ this.newMethod=IExtendChartPainting; //派生
43973
+ this.newMethod();
43974
+ delete this.newMethod;
43975
+
43976
+ this.ClassName='FrameButtomToolbarPaint';
43977
+ this.FrameID=-1;
43978
+ this.FrameGuid=null;
43979
+ this.IsDynamic=true;
43980
+ this.DrawAfterTitle=true;
43981
+
43982
+ this.AryButton=[]; // { Title:, ID:, Data:数据, TooltipText:提示信息 }
43983
+ this.SelectedID=null; // 选中按钮ID
43984
+ this.AryRectButton=[];
43985
+
43986
+ this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;
43987
+ this.BorderColor=g_JSChartResource.FrameButtomToolbar.BorderColor;
43988
+ this.ButtonConfig=CloneData(g_JSChartResource.FrameButtomToolbar.Button);
43989
+ /*
43990
+ {
43991
+ Font:{ Family:"微软雅黑" },
43992
+ TitleColor:
43993
+ {
43994
+ Selected:"rgb(255,255,255)", Default:"rgb(140,140,140)", MoveOn:"rgb(255,255,255)"
43995
+ },
43996
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(25,25,25)", MoveOn:"rgb(59,59,59)" },
43997
+ BorderColor:"rgb(60,60,60)",
43998
+
43999
+ Mergin: { Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), Top:4*GetDevicePixelRatio(), Bottom:2*GetDevicePixelRatio() }
44000
+ };
44001
+ */
44002
+
44003
+ /*
44004
+ this.AryButton=
44005
+ [
44006
+ { Title:"MACD", ID:"A", TooltipText:"切换MACD指标", Data:{ IndexID:"MACD"}},
44007
+ { Title:"RSI", ID:"A1", TooltipText:"切换RSI指标", Data:{ IndexID:"RSI"} },
44008
+ { Title:"大狗棍法", ID:"B1" },
44009
+ { Title:"降龙掌", ID:"B3"}
44010
+ ];
44011
+ this.SelectedID="A1"
44012
+ */
44013
+
44014
+ this.ReloadResource=function(resource)
44015
+ {
44016
+ this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;
44017
+ this.BorderColor=g_JSChartResource.FrameButtomToolbar.BorderColor;
44018
+
44019
+ this.ButtonConfig=CloneData(g_JSChartResource.FrameButtomToolbar.Button);
44020
+ }
44021
+
44022
+ this.SetOption=function(option)
44023
+ {
44024
+ if (option)
44025
+ {
44026
+ if (IFrameSplitOperator.IsNumber(option.FrameID)) this.FrameID=option.FrameID;
44027
+ if (option.FrameGuid) this.FrameGuid=option.FrameGuid;
44028
+ if (IFrameSplitOperator.IsNonEmptyArray(option.AryButton)) this.AryButton=option.AryButton.slice();
44029
+ if (option.SelectedID) this.SelectedID=option.SelectedID;
44030
+ }
44031
+ }
44032
+
44033
+ //设置当前选中的菜单ID
44034
+ this.SetSelectedID=function(id)
44035
+ {
44036
+ this.SelectedID=id;
44037
+ }
44038
+
44039
+ this.Draw=function(moveonPoint, mouseStatus)
44040
+ {
44041
+ this.AryRectButton=[];
44042
+
44043
+ var frame=this.GetFrame();
44044
+ if (!frame) return;
44045
+ if (frame.IsHScreen) return; //不支持横屏
44046
+ if (frame.IsMinSize) return;
44047
+ if (frame.ChartBorder.IsShowTitleOnly) return;
44048
+
44049
+ var border=frame.ChartBorder.GetBorder();
44050
+ var rtBG={ Left:border.Left+1, Right:border.Right-1, Top:border.BottomEx+1, Bottom:border.Bottom-1 };
44051
+ rtBG.Width=rtBG.Right-rtBG.Left;
44052
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
44053
+ if (rtBG.Height<10) return;
44054
+
44055
+ if (this.BGColor)
44056
+ {
44057
+ this.Canvas.fillStyle=this.BGColor;
44058
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
44059
+ }
44060
+
44061
+ var font=this.TitleFont(rtBG.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom);
44062
+ this.Canvas.textBaseline='middle';
44063
+ this.Canvas.textAlign='center';
44064
+ this.Canvas.font=font;
44065
+ var xBotton=rtBG.Left;
44066
+ for(var i=0;i<this.AryButton.length;++i)
44067
+ {
44068
+ var item=this.AryButton[i];
44069
+ if (!item.Title) return;
44070
+ var textWidth=this.Canvas.measureText(item.Title).width+2;
44071
+ var buttonWidth=textWidth+this.ButtonConfig.Mergin.Left+this.ButtonConfig.Mergin.Right;
44072
+ var rtButton={ Left:xBotton, Top:rtBG.Top, Bottom:rtBG.Bottom, Height:rtBG.Height, Width:buttonWidth };
44073
+ rtButton.Right=rtButton.Left+rtButton.Width;
44074
+
44075
+ //鼠标是否在按钮上
44076
+ var bgColor=this.ButtonConfig.BGColor.Default;
44077
+ var titleColor=this.ButtonConfig.TitleColor.Default;
44078
+ if (moveonPoint && (moveonPoint.X>=rtButton.Left && moveonPoint.X<rtButton.Right && moveonPoint.Y>=rtButton.Top && moveonPoint.Y<=rtButton.Bottom))
44079
+ {
44080
+ bgColor=this.ButtonConfig.BGColor.MoveOn;
44081
+ titleColor=this.ButtonConfig.TitleColor.MoveOn;
44082
+ if (mouseStatus)
44083
+ mouseStatus.MouseOnToolbar={ Rect:rtButton, Item:item, Frame:frame, Point:{X:moveonPoint.X, Y:moveonPoint.Y}, ID:"TitleButton" };
44084
+ }
44085
+
44086
+ if (this.SelectedID && this.SelectedID==item.ID)
44087
+ {
44088
+ bgColor=this.ButtonConfig.BGColor.Selected;
44089
+ titleColor=this.ButtonConfig.TitleColor.Selected;
44090
+ }
44091
+
44092
+
44093
+ if (bgColor)
44094
+ {
44095
+ this.Canvas.fillStyle=bgColor;
44096
+ this.Canvas.fillRect(rtButton.Left,rtButton.Top,rtButton.Width,rtButton.Height);
44097
+ }
44098
+
44099
+ if (this.ButtonConfig.BorderColor)
44100
+ {
44101
+ this.Canvas.strokeStyle=this.ButtonConfig.BorderColor;
44102
+ this.Canvas.beginPath();
44103
+ this.Canvas.moveTo(ToFixedPoint(rtButton.Right),rtButton.Top);
44104
+ this.Canvas.lineTo(ToFixedPoint(rtButton.Right),rtButton.Bottom);
44105
+ this.Canvas.stroke();
44106
+ }
44107
+
44108
+ this.Canvas.fillStyle=titleColor;
44109
+ var xText=rtButton.Left+rtButton.Width/2; //居中
44110
+ var yText=rtButton.Top+this.ButtonConfig.Mergin.Top+(rtButton.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom)/2;
44111
+ this.Canvas.fillText(item.Title,xText,yText);
44112
+
44113
+ this.AryRectButton.push({ Rect:rtButton, ID:item.ID, Data:item });
44114
+
44115
+ xBotton+=buttonWidth+1;
44116
+ }
44117
+
44118
+ if (this.BorderColor)
44119
+ {
44120
+ this.Canvas.strokeStyle=this.BorderColor;
44121
+ this.Canvas.beginPath();
44122
+ this.Canvas.moveTo(border.Left,ToFixedPoint(border.BottomEx));
44123
+ this.Canvas.lineTo(border.Right,ToFixedPoint(border.BottomEx));
44124
+ this.Canvas.stroke();
44125
+ }
44126
+ }
44127
+
44128
+ this.GetFrame=function()
44129
+ {
44130
+ if (!this.ChartFrame) return null;
44131
+ if (this.FrameID>=0)
44132
+ {
44133
+ var subFrame=this.ChartFrame.SubFrame[this.FrameID];
44134
+ if (!subFrame || !subFrame.Frame) return null;
44135
+
44136
+ return subFrame.Frame;
44137
+ }
44138
+
44139
+ return null;
44140
+ }
44141
+
44142
+ this.TitleFont=function(height)
44143
+ {
44144
+ var config=this.ButtonConfig.Font;
44145
+ var fontSize=height;
44146
+ if (IFrameSplitOperator.IsPlusNumber(config.Size)) fontSize=config.Size;
44147
+
44148
+ var font=`${fontSize*GetDevicePixelRatio()}px ${config.Family}`;
44149
+ return font;
44150
+ }
44151
+
44152
+ this.PtInButtons=function(x,y)
44153
+ {
44154
+ for(var i=0;i<this.AryRectButton.length;++i)
44155
+ {
44156
+ var item=this.AryRectButton[i];
44157
+ var rect=item.Rect;
44158
+ if (x>rect.Left && x<rect.Right && y>rect.Top && y<rect.Bottom)
44159
+ {
44160
+ var frame=this.GetFrame();
44161
+ var result={ ID:item.Data.ID, Rect:rect, FrameID:this.FrameID, Frame:frame, Data:item.Data };
44162
+ return result;
44163
+ }
44164
+ }
44165
+
44166
+ return null;
44167
+ }
44168
+ }
44169
+
43965
44170
 
43966
44171
 
43967
44172
  //弹幕数据 { X:X偏移, Y:Y偏移, Text:内容, Color:颜色 }
@@ -64614,6 +64819,21 @@ function JSChartResource()
64614
64819
  }
64615
64820
  },
64616
64821
 
64822
+ this.FrameButtomToolbar=
64823
+ {
64824
+ BGColor:"rgb(235,235,235)",
64825
+ BorderColor:"rgb(204,204,204)",
64826
+ Button:
64827
+ {
64828
+ Font:{ Family:"微软雅黑" },
64829
+ TitleColor: { Selected:"rgb(255,255,255)", Default:"rgb(125,125,125)", MoveOn:"rgb(234,85,4)" },
64830
+ BGColor: { Selected:"rgb(234,85,4)", Default:"rgb(235,235,235)", MoveOn:"rgb(242,242,242)" },
64831
+ BorderColor:"rgb(204,204,204)",
64832
+
64833
+ Mergin: { Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), Top:4*GetDevicePixelRatio(), Bottom:2*GetDevicePixelRatio() }
64834
+ }
64835
+ }
64836
+
64617
64837
 
64618
64838
  //自定义风格
64619
64839
  this.SetStyle=function(style)
@@ -65269,6 +65489,9 @@ function JSChartResource()
65269
65489
  }
65270
65490
 
65271
65491
  }
65492
+
65493
+ if (style.FrameButtomToolbar)
65494
+ this.SetFrameButtomToolbar(style.FrameButtomToolbar);
65272
65495
  }
65273
65496
 
65274
65497
  this.SetReportStyle=function(style)
@@ -65579,6 +65802,57 @@ function JSChartResource()
65579
65802
  }
65580
65803
 
65581
65804
  }
65805
+
65806
+ this.SetFrameButtomToolbar=function(style)
65807
+ {
65808
+ var dest=this.FrameButtomToolbar;
65809
+
65810
+ if (style.BGColor) dest.BGColor=style.BGColor;
65811
+ if (style.BorderColor) dest.BorderColor=style.BorderColor;
65812
+ if (style.Button)
65813
+ {
65814
+ var button=style.Button;
65815
+ if (button.BorderColor) dest.Button.BorderColor=button.BorderColor;
65816
+
65817
+ if (button.Font)
65818
+ {
65819
+ var item=button.Font;
65820
+ var destItem=this.FrameButtomToolbar.Button.Font;
65821
+ if (item.Family) destItem.Family=item.Family;
65822
+ if (IFrameSplitOperator.IsNumber(item.Size)) destItem.Size=item.Size;
65823
+ }
65824
+
65825
+ if (button.TitleColor)
65826
+ {
65827
+ var item=button.TitleColor;
65828
+ var destItem=this.FrameButtomToolbar.Button.TitleColor;
65829
+ if (item.Selected) destItem.Selected=item.Selected;
65830
+ if (item.Default) destItem.Default=item.Default;
65831
+ if (item.MoveOn) destItem.MoveOn=item.MoveOn;
65832
+ }
65833
+
65834
+ if (button.BGColor)
65835
+ {
65836
+ var item=button.BGColor;
65837
+ var destItem=this.FrameButtomToolbar.Button.BGColor;
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.Mergin)
65844
+ {
65845
+ var item=button.Mergin;
65846
+ var destItem=this.FrameButtomToolbar.Button.Mergin;
65847
+ if (IFrameSplitOperator.IsNumber(item.Left)) destItem.Left=item.Left;
65848
+ if (IFrameSplitOperator.IsNumber(item.Right)) destItem.Left=item.Right;
65849
+ if (IFrameSplitOperator.IsNumber(item.Top)) destItem.Top=item.Top;
65850
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) destItem.Bottom=item.Bottom;
65851
+ }
65852
+ }
65853
+
65854
+ }
65855
+
65582
65856
  }
65583
65857
 
65584
65858
  var g_JSChartResource=new JSChartResource();
@@ -69951,6 +70225,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
69951
70225
  if (option.Window) this.SetFrameToolbar(windowIndex,option.Window);
69952
70226
  }
69953
70227
 
70228
+ this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeScriptIndex" });
70229
+
69954
70230
  this.Frame.ClearUpDonwFrameYData({ Index:windowIndex });
69955
70231
  var bindData=this.ChartPaint[0].Data;
69956
70232
  this.BindIndexData(windowIndex,bindData); //执行脚本
@@ -69994,6 +70270,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
69994
70270
  var apiItem=indexData.API;
69995
70271
  this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,indexData);
69996
70272
 
70273
+ this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeAPIIndex" });
70274
+
69997
70275
  if (indexData)
69998
70276
  {
69999
70277
  if (indexData.Window) this.SetFrameToolbar(windowIndex,indexData.Window);
@@ -70008,6 +70286,16 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
70008
70286
  this.Draw();
70009
70287
  }
70010
70288
 
70289
+ this.OnChangeIndexEvent=function(windowIndex, indexInfo)
70290
+ {
70291
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CHANGE_INDEX);
70292
+ if (event && event.Callback)
70293
+ {
70294
+ var data={ IndexInfo:indexInfo, WindowIndex:windowIndex };
70295
+ event.Callback(event,data,this);
70296
+ }
70297
+ }
70298
+
70011
70299
  //切换指标 指定切换窗口指标
70012
70300
  this.ChangeIndex=function(windowIndex,indexName,option)
70013
70301
  {
@@ -70030,7 +70318,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
70030
70318
  if (windowIndex == 0) windowIndex = 1; //幅图指标,不能再主图显示
70031
70319
  }
70032
70320
 
70033
- JSIndexScript.ModifyAttribute(indexInfo, option)
70321
+ JSIndexScript.ModifyAttribute(indexInfo, option);
70034
70322
  return this.ChangeScriptIndex(windowIndex, indexInfo, option);
70035
70323
  }
70036
70324
 
@@ -70346,6 +70634,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
70346
70634
 
70347
70635
  this.Frame.SubFrame.splice(count,currentLength-count);
70348
70636
  this.WindowIndex.splice(count,currentLength-count);
70637
+ this.TitlePaint.splice(count+1,currentLength-count);
70349
70638
 
70350
70639
  //最后一个显示X轴坐标
70351
70640
  for(var i=0;i<this.Frame.SubFrame.length;++i)
@@ -75869,6 +76158,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
75869
76158
 
75870
76159
  this.Frame.SubFrame.splice(count,currentLength-count);
75871
76160
  this.WindowIndex.splice(count,currentLength-count);
76161
+ this.TitlePaint.splice(count+1,currentLength-count);
75872
76162
  }
75873
76163
  else
75874
76164
  {
@@ -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