hqchart 1.1.13081 → 1.1.13090

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.
@@ -6422,6 +6422,12 @@ var JSCHART_EVENT_ID=
6422
6422
 
6423
6423
  //T型报价
6424
6424
  ON_TREPORT_MARKET_STATUS:121, //T型报价列表交易状态
6425
+ ON_DBCLICK_TREPORT_ROW:122, //双击T型报报价列表
6426
+ ON_RCLICK_TREPORT_ROW:123, //右键点击T型报价列表
6427
+ ON_CLICK_TREPORT_HEADER:124, //单击T型报价表头
6428
+ ON_RCLICK_TREPORT_HEADER:125, //右键点击T型报价表头
6429
+ ON_TREPORT_LOCAL_SORT:126, //T型报价列表本地排序
6430
+ ON_CLICK_TREPORT_ROW:127, //左键点击点击T型报价列表
6425
6431
  }
6426
6432
 
6427
6433
  var JSCHART_OPERATOR_ID=
@@ -67921,7 +67927,7 @@ function JSChartResource()
67921
67927
  this.TReport=
67922
67928
  {
67923
67929
  BorderColor:'rgb(192,192,192)', //边框线
67924
- SelectedColor:"rgb(180,240,240)", //选中行
67930
+ SelectedColor:"rgb(3,89,245)", //选中行
67925
67931
  Header:
67926
67932
  {
67927
67933
  Color:"rgb(60,60,60)", //表头文字颜色
@@ -67939,6 +67945,13 @@ function JSChartResource()
67939
67945
  SymbolFont:{ Size:12, Name:"微软雅黑" }
67940
67946
  },
67941
67947
 
67948
+ CenterItem:
67949
+ {
67950
+ TextColor:"rgb(60,60,83)",
67951
+ BaseTextColor:"rgb(60,60,83)",
67952
+ BGColor:"rgb(180,180,180)"
67953
+ },
67954
+
67942
67955
  FieldColor:
67943
67956
  {
67944
67957
  Index:"rgb(60,60,60)", //序号
@@ -67952,22 +67965,14 @@ function JSChartResource()
67952
67965
 
67953
67966
  UpTextColor:"rgb(238,21,21)", //上涨文字颜色
67954
67967
  DownTextColor:"rgb(25,158,0)", //下跌文字颜色
67955
- UnchagneTextColor:"rgb(90,90,90)", //平盘文字颜色
67968
+ UnchangeTextColor:"rgb(90,90,90)", //平盘文字颜色
67956
67969
 
67957
- CloseLine:
67958
- {
67959
- CloseColor:"rgb(30,144,255)",
67960
- YCloseColor:"rgba(105,105,105,0.5)", //昨收线
67961
- AreaColor:'rgba(0,191,255,0.2)',
67962
- },
67970
+ UpBGColor:"rgb(255,220,220)",
67971
+ DownBGColor:"rgb(190,220,190)",
67963
67972
 
67964
- KLine:
67973
+ MarkBorder:
67965
67974
  {
67966
- UpColor:"rgb(255,0,0)",
67967
- DownColor:"rgb(0,128,0)",
67968
- UnchagneColor:'rgb(90,90,90)',
67969
- DataWidth:16,
67970
- DistanceWidth:3
67975
+ MaxPositionColor:"rgb(192,192,192)"
67971
67976
  },
67972
67977
  },
67973
67978
 
@@ -68751,6 +68756,8 @@ function JSChartResource()
68751
68756
  }
68752
68757
  }
68753
68758
 
68759
+ if (style.TReport) this.SetTReportStyle(style.TReport);
68760
+
68754
68761
  if (style.SelectedChart)
68755
68762
  {
68756
68763
  var item=style.SelectedChart;
@@ -68850,6 +68857,103 @@ function JSChartResource()
68850
68857
 
68851
68858
  }
68852
68859
  }
68860
+
68861
+ this.SetTReportStyle=function(style)
68862
+ {
68863
+ var item=style;
68864
+ var dest=this.TReport;
68865
+
68866
+ if (item.BorderColor) dest.BorderColor=item.BorderColor;
68867
+ if (item.UpTextColor) dest.UpTextColor=item.UpTextColor;
68868
+ if (item.DownTextColor) dest.DownTextColor=item.DownTextColor;
68869
+ if (item.UnchangeTextColor) dest.UnchangeTextColor=item.UnchangeTextColor;
68870
+ if (item.BorderColor) dest.SelectedColor=item.SelectedColor;
68871
+
68872
+ if (item.UpBGColor) dest.UpBGColor=item.UpBGColor;
68873
+ if (item.DownBGColor) dest.DownBGColor=item.DownBGColor;
68874
+
68875
+ if (item.Header)
68876
+ {
68877
+ var header=item.Header;
68878
+ if (header.Color) dest.Header.Color=header.Color;
68879
+ if (header.SortColor) dest.Header.SortColor=header.SortColor;
68880
+ if (header.Mergin)
68881
+ {
68882
+ var mergin=header.Mergin;
68883
+ if (IFrameSplitOperator.IsNumber(mergin.Left)) dest.Header.Mergin.Left=mergin.Left;
68884
+ if (IFrameSplitOperator.IsNumber(mergin.Right)) dest.Header.Mergin.Left=mergin.Right;
68885
+ if (IFrameSplitOperator.IsNumber(mergin.Top)) dest.Header.Mergin.Top=mergin.Top;
68886
+ if (IFrameSplitOperator.IsNumber(mergin.Bottom)) dest.Header.Mergin.Bottom=mergin.Bottom;
68887
+ }
68888
+ if (header.Font)
68889
+ {
68890
+ var font=header.Font;
68891
+ if (font.Name) dest.Header.Font.Name=font.Name;
68892
+ if (IFrameSplitOperator.IsNumber(font.Size)) dest.Header.Font.Size=font.Size;
68893
+ }
68894
+ }
68895
+
68896
+ if (item.CenterItem)
68897
+ {
68898
+ var cell=item.CenterItem;
68899
+ if (cell.TextColor) dest.CenterItem.TextColor=cell.TextColor;
68900
+ if (cell.BaseTextColor) dest.CenterItem.BaseTextColor=cell.BaseTextColor;
68901
+ if (cell.BGColor) dest.CenterItem.BGColor=cell.BGColor;
68902
+ }
68903
+
68904
+ if (item.Item)
68905
+ {
68906
+ var row=item.Item;
68907
+ if (row.Mergin)
68908
+ {
68909
+ var mergin=row.Mergin;
68910
+ if (IFrameSplitOperator.IsNumber(mergin.Left)) dest.Item.Mergin.Left=mergin.Left;
68911
+ if (IFrameSplitOperator.IsNumber(mergin.Right)) dest.Item.Mergin.Right=mergin.Right;
68912
+ if (IFrameSplitOperator.IsNumber(mergin.Top)) dest.Item.Mergin.Top=mergin.Top;
68913
+ if (IFrameSplitOperator.IsNumber(mergin.Bottom)) dest.Item.Mergin.Bottom=mergin.Bottom;
68914
+ }
68915
+
68916
+ if (row.Font)
68917
+ {
68918
+ var font=row.Font;
68919
+ if (font.Name) dest.Item.Font.Name=font.Name;
68920
+ if (IFrameSplitOperator.IsNumber(font.Size)) dest.Item.Font.Size=font.Size;
68921
+ }
68922
+
68923
+ if (row.NameFont)
68924
+ {
68925
+ var font=row.NameFont;
68926
+ if (font.Name) dest.Item.NameFont.Name=font.Name;
68927
+ if (IFrameSplitOperator.IsNumber(font.Size)) dest.Item.NameFont.Size=font.Size;
68928
+ }
68929
+
68930
+ if (row.SymbolFont)
68931
+ {
68932
+ var font=row.SymbolFont;
68933
+ if (font.Name) dest.Item.SymbolFont.Name=font.Name;
68934
+ if (IFrameSplitOperator.IsNumber(font.Size)) dest.Item.SymbolFont.Size=font.Size;
68935
+ }
68936
+ }
68937
+
68938
+ if (item.FieldColor)
68939
+ {
68940
+ var filed=item.FieldColor;
68941
+ if (filed.Name) dest.FieldColor.Name=filed.Name;
68942
+ if (filed.Symbol) dest.FieldColor.Symbol=filed.Symbol;
68943
+ if (filed.Vol) dest.FieldColor.Vol=filed.Vol;
68944
+ if (filed.Amount) dest.FieldColor.Amount=filed.Amount;
68945
+ if (filed.Index) dest.FieldColor.Index=filed.Index;
68946
+ if (filed.Text) dest.FieldColor.Text=filed.Text;
68947
+ if (filed.Position) dest.FieldColor.Position=filed.Position;
68948
+ }
68949
+
68950
+ if (item.MarkBorder)
68951
+ {
68952
+ var subIem=item.MarkBorder;
68953
+ if (subIem.MaxPositionColor) dest.MarkBorder.MaxPositionColor=subIem.MaxPositionColor;
68954
+ }
68955
+
68956
+ }
68853
68957
  }
68854
68958
 
68855
68959
  var g_JSChartResource=new JSChartResource();
@@ -120527,6 +120631,59 @@ function GetBlackStyle()
120527
120631
  }
120528
120632
  },
120529
120633
 
120634
+ //T型报价
120635
+ TReport:
120636
+ {
120637
+ BorderColor:'rgb(38,38,41)', //边框线
120638
+ SelectedColor:"rgb(180,180,180)", //选中行
120639
+ Header:
120640
+ {
120641
+ Color:"rgb(187,187,187)", //表头文字颜色
120642
+ SortColor:"rgb(255,0,0)", //排序箭头颜色
120643
+ Mergin:{ Left:5, Right:5, Top:4, Bottom:2}, //表头四周间距
120644
+ Font:{ Size:14, Name:"微软雅黑" } //表头字体
120645
+ },
120646
+
120647
+ Item:
120648
+ {
120649
+ Mergin:{ Top:2, Bottom:0,Left:5, Right:5 }, //单元格四周间距
120650
+ Font:{ Size:15, Name:"微软雅黑"},
120651
+ BarMergin:{ Top:2, Left:3, Right:3, Bottom:2 },//单元格字体
120652
+ NameFont:{ Size:14, Name:"微软雅黑" },
120653
+ SymbolFont:{ Size:12, Name:"微软雅黑" }
120654
+ },
120655
+
120656
+ CenterItem:
120657
+ {
120658
+ TextColor:"rgb(16,226,217)",
120659
+ BaseTextColor:"rgb(60,60,83)",
120660
+ BGColor:"rgb(65,65,65)"
120661
+ },
120662
+
120663
+ FieldColor:
120664
+ {
120665
+ Index:"rgb(250,250,250)", //序号
120666
+ Symbol:"rgb(60,60,60)",
120667
+ Name:"rgb(250,250,250)",
120668
+ Vol:"rgb(192,165,3)", //成交量
120669
+ Position:"rgb(250,250,250)", //持仓量
120670
+ Amount:"rgb(16,226,217)", //成交金额
120671
+ Text:"rgb(250,250,250)", //默认文本
120672
+ },
120673
+
120674
+ UpTextColor:"rgb(238,21,21)", //上涨文字颜色
120675
+ DownTextColor:"rgb(25,158,0)", //下跌文字颜色
120676
+ UnchangeTextColor:"rgb(187,187,187)", //平盘文字颜色
120677
+
120678
+ UpBGColor:"rgb(35,5,5)",
120679
+ DownBGColor:"rgb(5,35,5)",
120680
+
120681
+ MarkBorder:
120682
+ {
120683
+ MaxPositionColor:"rgb(192,192,0)"
120684
+ },
120685
+ },
120686
+
120530
120687
  ScrollBar:
120531
120688
  {
120532
120689
  BorderColor:'rgb(38,38,41)', //边框线
@@ -125490,7 +125647,7 @@ function ChartReport()
125490
125647
  }
125491
125648
  else
125492
125649
  {
125493
- result.Star=0;
125650
+ result.Start=0;
125494
125651
  result.End=0;
125495
125652
  result.IsEnd=true;
125496
125653
  result.IsSinglePage=true;
@@ -127844,25 +128001,24 @@ function ChartReportPageInfo()
127844
128001
 
127845
128002
  jones_2000@163.com
127846
128003
 
127847
- 封装键盘精灵控件 (页面版 不支持手机)
128004
+ 封装T型报价列表控件 (H5版本)
128005
+ 不提供内置测试数据
127848
128006
  */
127849
128007
 
127850
-
127851
-
127852
- function JSKeyboardChart(divElement)
128008
+ function JSTReportChart(divElement)
127853
128009
  {
127854
128010
  this.DivElement=divElement;
127855
128011
  this.JSChartContainer; //表格控件
127856
128012
 
127857
128013
  //h5 canvas
127858
128014
  this.CanvasElement=document.createElement("canvas");
127859
- this.CanvasElement.className='jskeyboard-drawing';
128015
+ this.CanvasElement.className='jstreport-drawing';
127860
128016
  this.CanvasElement.id=Guid();
127861
128017
  this.CanvasElement.setAttribute("tabindex",0);
127862
128018
  if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
127863
128019
  if(divElement.hasChildNodes())
127864
128020
  {
127865
- JSConsole.Chart.Log("[JSKeyboardChart::JSRepoJSKeyboardChartrtChart] divElement hasChildNodes", divElement.childNodes);
128021
+ JSConsole.Chart.Log("[JSTReportChart::JSReportChart] divElement hasChildNodes", divElement.childNodes);
127866
128022
  }
127867
128023
  divElement.appendChild(this.CanvasElement);
127868
128024
 
@@ -127880,7 +128036,7 @@ function JSKeyboardChart(divElement)
127880
128036
  this.CanvasElement.height*=pixelTatio;
127881
128037
  this.CanvasElement.width*=pixelTatio;
127882
128038
 
127883
- JSConsole.Chart.Log(`[JSKeyboardChart::OnSize] devicePixelRatio=${window.devicePixelRatio}, height=${this.CanvasElement.height}, width=${this.CanvasElement.width}`);
128039
+ JSConsole.Chart.Log(`[JSTReportChart::OnSize] devicePixelRatio=${window.devicePixelRatio}, height=${this.CanvasElement.height}, width=${this.CanvasElement.width}`);
127884
128040
 
127885
128041
  if (this.JSChartContainer && this.JSChartContainer.OnSize)
127886
128042
  {
@@ -127890,7 +128046,7 @@ function JSKeyboardChart(divElement)
127890
128046
 
127891
128047
  this.SetOption=function(option)
127892
128048
  {
127893
- var chart=this.CreateJSKeyboardChartContainer(option);
128049
+ var chart=this.CreateJSTReportChartContainer(option);
127894
128050
 
127895
128051
  if (!chart) return false;
127896
128052
 
@@ -127899,20 +128055,43 @@ function JSKeyboardChart(divElement)
127899
128055
  this.JSChartContainer=chart;
127900
128056
  this.DivElement.JSChart=this; //div中保存一份
127901
128057
 
127902
- chart.Draw();
128058
+ if (option.Symbol)
128059
+ {
128060
+ chart.Draw();
128061
+
128062
+ var name=option.Symbol;
128063
+ if (option.Name) name=option.Name;
128064
+ chart.ChangeSymbol(option.Symbol, {Name:name}); //下载列表码表
128065
+ }
128066
+
127903
128067
  }
127904
128068
 
127905
- this.CreateJSKeyboardChartContainer=function(option)
128069
+ this.CreateJSTReportChartContainer=function(option)
127906
128070
  {
127907
- var chart=new JSKeyboardChartContainer(this.CanvasElement);
128071
+ var chart=new JSTReportChartContainer(this.CanvasElement);
127908
128072
  chart.Create(option);
127909
128073
 
127910
128074
  if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
127911
128075
  if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) chart.SetColumn(option.Column);
127912
- if (IFrameSplitOperator.IsNumber(option.BorderLine)) chart.Frame.BorderLine=option.BorderLine;
128076
+ if (IFrameSplitOperator.IsNonEmptyArray(option.Tab)) chart.SetTab(option.Tab);
128077
+ if (IFrameSplitOperator.IsNumber(option.TabSelected)) chart.SetSelectedTab(option.TabSelected);
128078
+ if (IFrameSplitOperator.IsBool(option.EnableDragRow)) chart.EnableDragRow=option.EnableDragRow;
128079
+ if (IFrameSplitOperator.IsNumber(option.DragRowType)) chart.DragRowType=option.DragRowType;
128080
+ if (IFrameSplitOperator.IsBool(option.EnableDragHeader)) chart.EnableDragHeader=option.EnableDragHeader;
128081
+ if (option.SortInfo)
128082
+ {
128083
+ var item=option.SortInfo;
128084
+ if (IFrameSplitOperator.IsNumber(item.Field)) chart.SortInfo.Field=item.Field;
128085
+ if (IFrameSplitOperator.IsNumber(item.Sort)) chart.SortInfo.Sort=item.Sort;
128086
+ }
127913
128087
 
127914
128088
  this.SetChartBorder(chart, option);
127915
128089
 
128090
+ //是否自动更新
128091
+ if (option.IsAutoUpdate!=null) chart.IsAutoUpdate=option.IsAutoUpdate;
128092
+ if (option.AutoUpdateFrequency>0) chart.AutoUpdateFrequency=option.AutoUpdateFrequency;
128093
+ if (IFrameSplitOperator.IsBool(option.EnableFilter)) chart.EnableFilter=option.EnableFilter;
128094
+
127916
128095
  //注册事件
127917
128096
  if (option.EventCallback)
127918
128097
  {
@@ -127945,6 +128124,13 @@ function JSKeyboardChart(divElement)
127945
128124
 
127946
128125
  /////////////////////////////////////////////////////////////////////////////
127947
128126
  //对外接口
128127
+
128128
+ //切换股票代码接口
128129
+ this.ChangeSymbol=function(symbol, option)
128130
+ {
128131
+ if (this.JSChartContainer) this.JSChartContainer.ChangeSymbol(symbol,option);
128132
+ }
128133
+
127948
128134
  this.SetColumn=function(aryColumn, option)
127949
128135
  {
127950
128136
  if (this.JSChartContainer) this.JSChartContainer.SetColumn(aryColumn,option);
@@ -127955,7 +128141,7 @@ function JSKeyboardChart(divElement)
127955
128141
  {
127956
128142
  if(this.JSChartContainer && typeof(this.JSChartContainer.AddEventCallback)=='function')
127957
128143
  {
127958
- JSConsole.Chart.Log('[JSKeyboardChart:AddEventCallback] obj=', obj);
128144
+ JSConsole.Chart.Log('[JSTReportChart:AddEventCallback] obj=', obj);
127959
128145
  this.JSChartContainer.AddEventCallback(obj);
127960
128146
  }
127961
128147
  }
@@ -127965,7 +128151,7 @@ function JSKeyboardChart(divElement)
127965
128151
  {
127966
128152
  if(this.JSChartContainer && typeof(this.JSChartContainer.ReloadResource)=='function')
127967
128153
  {
127968
- JSConsole.Chart.Log('[JSKeyboardChart:ReloadResource] ');
128154
+ JSConsole.Chart.Log('[JSTReportChart:ReloadResource] ');
127969
128155
  this.JSChartContainer.ReloadResource(option);
127970
128156
  }
127971
128157
  }
@@ -127982,173 +128168,126 @@ function JSKeyboardChart(divElement)
127982
128168
  {
127983
128169
  if(this.JSChartContainer && typeof(this.JSChartContainer.Draw)=='function')
127984
128170
  {
127985
- JSConsole.Chart.Log('[JSKeyboardChart:Draw] ');
128171
+ JSConsole.Chart.Log('[JSTReportChart:Draw] ');
127986
128172
  this.JSChartContainer.Draw();
127987
128173
  }
127988
128174
  }
127989
-
127990
- this.SetSymbolData=function(arySymbol)
127991
- {
127992
- if(this.JSChartContainer && typeof(this.JSChartContainer.Draw)=='function')
127993
- {
127994
- JSConsole.Chart.Log('[JSKeyboardChart:SetSymbolData] ', arySymbol);
127995
- this.JSChartContainer.SetSymbolData(arySymbol);
127996
- }
127997
- }
127998
-
127999
- this.Search=function(strText)
128000
- {
128001
- if(this.JSChartContainer && typeof(this.JSChartContainer.Search)=='function')
128002
- {
128003
- JSConsole.Chart.Log('[JSKeyboardChart:Search] ', strText);
128004
- this.JSChartContainer.Search(strText);
128005
- }
128006
- }
128007
-
128008
- this.OnKeyDown=function(event)
128009
- {
128010
- if(this.JSChartContainer && typeof(this.JSChartContainer.OnKeyDown)=='function')
128011
- {
128012
- JSConsole.Chart.Log('[JSKeyboardChart:OnKeyDown] ', event);
128013
- this.JSChartContainer.OnKeyDown(event);
128014
- }
128015
- }
128016
-
128017
- this.ClearSearch=function(option)
128018
- {
128019
- if(this.JSChartContainer && typeof(this.JSChartContainer.ClearSearch)=='function')
128020
- {
128021
- JSConsole.Chart.Log('[JSKeyboardChart:ClearSearch] ', option);
128022
- this.JSChartContainer.ClearSearch(option);
128023
- }
128024
- }
128025
128175
  }
128026
128176
 
128027
- JSKeyboardChart.Init=function(divElement)
128177
+ JSTReportChart.Init=function(divElement)
128028
128178
  {
128029
- var jsChartControl=new JSKeyboardChart(divElement);
128179
+ var jsChartControl=new JSTReportChart(divElement);
128030
128180
  jsChartControl.OnSize();
128031
128181
 
128032
128182
  return jsChartControl;
128033
128183
  }
128034
128184
 
128035
128185
  //自定义风格
128036
- JSKeyboardChart.SetStyle=function(option)
128186
+ JSTReportChart.SetStyle=function(option)
128037
128187
  {
128038
128188
  if (option) g_JSChartResource.SetStyle(option);
128039
128189
  }
128040
128190
 
128041
-
128042
- function JSKeyboardChartContainer(uielement)
128191
+ //获取颜色配置 (设置配必须啊在JSChart.Init()之前)
128192
+ JSTReportChart.GetResource=function()
128043
128193
  {
128044
- this.ClassName='JSKeyboardChartContainer';
128045
- this.Frame; //框架画法
128046
- this.ChartPaint=[]; //图形画法
128047
- this.Canvas=uielement.getContext("2d"); //画布
128048
- this.ShowCanvas=null;
128049
-
128050
- this.NetworkFilter; //数据回调接口
128051
- this.Data={ XOffset:0, YOffset:0, Data:[] }; //股票列表
128052
- this.MapSymbol=new Map();
128053
- this.SourceData={ Data:[] } //码表数据 Data:[ { Symbol:, Spell, Name:, Color:}]
128194
+ return g_JSChartResource;
128195
+ }
128054
128196
 
128055
- //事件回调
128056
- this.mapEvent=new Map(); //通知外部调用 key:JSCHART_EVENT_ID value:{Callback:回调,}
128197
+ function HQTReportItem()
128198
+ {
128199
+ this.Symbol;
128200
+ this.Name;
128201
+ this.YClose;
128202
+ this.Open;
128203
+ this.Price;
128204
+ this.High;
128205
+ this.Low;
128206
+ this.Amount;
128207
+ this.Vol;
128208
+ this.Positon; //持仓量
128057
128209
 
128058
- this.UIElement=uielement;
128059
- this.LastPoint=new Point(); //鼠标位置
128060
-
128061
- //拖拽滚动条
128062
- this.DragYScroll=null; //{Start:{x,y}, End:{x, y}}
128063
- this.IsDestroy=false; //是否已经销毁了
128210
+ this.Increase; //涨幅
128211
+ this.UpDown; //涨跌
128212
+ this.Exchange; //换手
128213
+ this.Amplitude; //振幅
128064
128214
 
128065
- this.ChartDestory=function() //销毁
128066
- {
128067
- this.IsDestroy=true;
128068
- }
128215
+ this.BuyPrice; //买价/量
128216
+ this.BuyVol;
128217
+ this.SellPrice; //卖价/量
128218
+ this.SellVol;
128069
128219
 
128070
- this.ClearSearch=function(option)
128071
- {
128072
- this.Data.Data=[];
128073
- this.Data.XOffset=0;
128074
- this.Data.YOffset=0;
128220
+ this.AvPrice; //均价
128075
128221
 
128076
- if (option && option.Redraw==true) this.Draw();
128077
- }
128222
+ this.LimitHigh; //涨停价
128223
+ this.LimitLow; //跌停价
128078
128224
 
128079
- this.Search=function(strText)
128080
- {
128081
- var aryExactQuery=[]; //精确查询
128082
- var aryFuzzyQuery=[]; //模糊查询
128083
- this.MapSymbol.clear();
128084
- this.Data.Data=[];
128085
- this.Data.XOffset=0;
128086
- this.Data.YOffset=0;
128225
+ this.CloseLine; //{Data:[], Max:, Min:, Count: }
128087
128226
 
128088
- var strSearch=strText.trim();
128089
- if (strSearch.length>0)
128090
- {
128091
- for(var i=0;i<this.SourceData.Data.length;++i)
128092
- {
128093
- var item=this.SourceData.Data[i];
128094
- if (this.SearchSymbol(item, strSearch, aryExactQuery, aryFuzzyQuery)) continue;
128095
- else if (this.SearchSpell(item, strSearch, aryExactQuery, aryFuzzyQuery)) continue;
128096
- }
128097
- }
128098
-
128099
- if (IFrameSplitOperator.IsNonEmptyArray(aryExactQuery) || IFrameSplitOperator.IsNonEmptyArray(aryFuzzyQuery))
128100
- this.Data.Data=aryExactQuery.concat(aryFuzzyQuery);
128227
+ this.ExtendData; //扩展数据
128228
+ }
128101
128229
 
128102
- this.ChartPaint[0].SelectedRow=0;
128230
+ function JSTReportChartContainer(uielement)
128231
+ {
128232
+ this.ClassName='JSTReportChartContainer';
128233
+ this.Frame; //框架画法
128234
+ this.ChartPaint=[]; //图形画法
128235
+ this.ChartSplashPaint=null; //等待提示
128236
+ this.LoadDataSplashTitle="数据加载中"; //下载数据提示信息
128103
128237
 
128104
- JSConsole.Chart.Log(`[JSKeyboardChart:Search] search=${strSearch}, source=${this.SourceData.Data.length} match=${this.Data.Data.length}`);
128238
+ this.SplashTitle={ StockList:"下载码表中....." } ;
128239
+ this.Canvas=uielement.getContext("2d"); //画布
128105
128240
 
128106
- this.Draw();
128107
- }
128241
+ this.Tooltip=document.createElement("div");
128242
+ this.Tooltip.className='jstreport-tooltip';
128243
+ this.Tooltip.style.background=g_JSChartResource.TooltipBGColor;
128244
+ this.Tooltip.style.opacity=g_JSChartResource.TooltipAlpha;
128245
+ this.Tooltip.style["pointer-events"]="none";
128246
+ this.Tooltip.id=Guid();
128247
+ uielement.parentNode.appendChild(this.Tooltip);
128108
128248
 
128109
- this.SearchSymbol=function(item, strText, aryExactQuery, aryFuzzyQuery)
128110
- {
128111
- var find=item.Symbol.indexOf(strText);
128112
- if (find<0) return false;
128249
+ this.Symbol; //期权对应的品种代码
128250
+ this.Name; //期权对应的品种名称
128251
+ this.NetworkFilter; //数据回调接口
128252
+ this.Data={ XOffset:0, YOffset:0, Data:[], BaseExePrice:null }; //股票列表 BaseExePrice=基准
128253
+ this.BorderData={ MapData:null }; //key=Field Value:[null, {ExePrice} ,{ExePrice} ]
128254
+ this.SourceData={ Data:[] } ; //原始股票顺序(排序还原用) {ExePrice=行权价格 LeftData:, RightData}
128113
128255
 
128114
- if (find==0) aryExactQuery.push(item.Symbol);
128115
- else aryFuzzyQuery.push(item.Symbol);
128256
+ this.DelayUpdateTimer=null; //延迟更新
128257
+ this.DelayUpdateFrequency=500; //延迟更新时间
128116
128258
 
128117
- this.MapSymbol.set(item.Symbol, item);
128118
-
128119
- return true;
128120
- }
128259
+ this.MapStockData;
128260
+ this.MapExePriceData;
128121
128261
 
128122
- this.SearchSpell=function(item, strText, aryExactQuery, aryFuzzyQuery)
128123
- {
128124
- if (!IFrameSplitOperator.IsString(item.Spell)) return false;
128262
+ this.FlashBG=new Map();
128263
+ this.FlashBGTimer=null; //闪烁背景 Value:{ LastTime:数据最后的时间, Data: { Key:ID, BGColor:, Time: , Count: 次数 } };
128264
+ this.GlobalOption={ FlashBGCount:0 }
128125
128265
 
128126
- var find=item.Spell.indexOf(strText);
128266
+ this.SortInfo={ Field:-1, Sort:0 }; //排序信息 {Field:排序字段id, Sort:0 不排序 1升序 2降序 }
128127
128267
 
128128
- if (find!=0) return false;
128268
+ //事件回调
128269
+ this.mapEvent=new Map(); //通知外部调用 key:JSCHART_EVENT_ID value:{Callback:回调,}
128129
128270
 
128130
- aryExactQuery.push(item.Symbol);
128131
- this.MapSymbol.set(item.Symbol, item);
128271
+ this.AutoUpdateTimer=null;
128272
+ this.AutoUpdateFrequency=15000; //15秒更新一次数据
128132
128273
 
128133
- return true;
128134
- }
128274
+ this.UIElement=uielement;
128275
+ this.LastPoint=new Point(); //鼠标位置
128276
+ this.IsOnTouch=false;
128277
+ this.TouchDrag;
128278
+ this.TouchMoveMinAngle=70; //左右移动最小角度
128279
+ this.YStepPixel=5*GetDevicePixelRatio();
128280
+ this.XStepPixel=10*GetDevicePixelRatio();
128281
+
128282
+ //拖拽滚动条
128283
+ this.DragXScroll=null; //{Start:{x,y}, End:{x, y}}
128135
128284
 
128285
+ this.IsDestroy=false; //是否已经销毁了
128136
128286
 
128137
- this.SetSymbolData=function(arySymbol)
128287
+ this.ChartDestory=function() //销毁
128138
128288
  {
128139
- this.SourceData.Data=arySymbol;
128140
-
128141
- /*
128142
- //测试
128143
- this.MapSymbol.clear();
128144
- for(var i=0;i<this.SourceData.Data.length && i<3050 ;++i)
128145
- {
128146
- var item=this.SourceData.Data[i];
128147
- this.Data.Data.push(item.Symbol);
128148
- this.MapSymbol.set(item.Symbol, item);
128149
- }
128150
- this.ChartPaint[0].SelectedRow=0;
128151
- */
128289
+ this.IsDestroy=true;
128290
+ this.StopAutoUpdate();
128152
128291
  }
128153
128292
 
128154
128293
  //创建
@@ -128156,8 +128295,14 @@ function JSKeyboardChartContainer(uielement)
128156
128295
  {
128157
128296
  this.UIElement.JSChartContainer=this;
128158
128297
 
128298
+ //创建等待提示
128299
+ this.ChartSplashPaint = new ChartSplashPaint();
128300
+ this.ChartSplashPaint.Canvas = this.Canvas;
128301
+ this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);
128302
+ this.ChartSplashPaint.IsEnableSplash=true;
128303
+
128159
128304
  //创建框架
128160
- this.Frame=new JSKeyboardFrame();
128305
+ this.Frame=new JSTReportFrame();
128161
128306
  this.Frame.ChartBorder=new ChartBorder();
128162
128307
  this.Frame.ChartBorder.UIElement=this.UIElement;
128163
128308
  this.Frame.ChartBorder.Top=30;
@@ -128165,20 +128310,32 @@ function JSKeyboardChartContainer(uielement)
128165
128310
  this.Frame.ChartBorder.Bottom=20;
128166
128311
  this.Frame.Canvas=this.Canvas;
128167
128312
 
128313
+ this.ChartSplashPaint.Frame = this.Frame;
128314
+
128168
128315
  //创建表格
128169
- var chart=new ChartSymbolList();
128316
+ var chart=new ChartTReport();
128170
128317
  chart.Frame=this.Frame;
128171
128318
  chart.ChartBorder=this.Frame.ChartBorder;
128172
128319
  chart.Canvas=this.Canvas;
128173
128320
  chart.UIElement=this.UIElement;
128174
128321
  chart.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
128175
- chart.GetStockDataCallback=(symbol)=>{ return this.GetStockData(symbol);}
128322
+ chart.GetExePriceDataCallback=(exePrice)=>{ return this.GetExePriceData(exePrice);}
128323
+ chart.GetFlashBGDataCallback=(symbol, time)=>{ return this.GetFlashBGData(symbol, time); }
128176
128324
  chart.Data=this.Data;
128325
+ chart.BorderData=this.BorderData;
128326
+ chart.GlobalOption=this.GlobalOption;
128327
+ chart.SortInfo=this.SortInfo;
128177
128328
  this.ChartPaint[0]=chart;
128178
128329
 
128330
+
128179
128331
  if (option)
128180
128332
  {
128181
-
128333
+ if (IFrameSplitOperator.IsBool(option.IsShowHeader)) chart.IsShowHeader=option.IsShowHeader; //是否显示表头
128334
+ if (IFrameSplitOperator.IsNumber(option.FixedColumn)) chart.FixedColumn=option.FixedColumn; //固定列
128335
+
128336
+ if (IFrameSplitOperator.IsNumber(option.BorderLine)) this.Frame.BorderLine=option.BorderLine; //边框
128337
+ if (IFrameSplitOperator.IsBool(option.ItemBorder)) chart.IsDrawBorder=option.ItemBorder; //单元格边框
128338
+ if (IFrameSplitOperator.IsNumber(option.SelectedModel)) chart.SelectedModel=option.SelectedModel;
128182
128339
  }
128183
128340
 
128184
128341
  var bRegisterKeydown=true;
@@ -128189,13 +128346,13 @@ function JSKeyboardChartContainer(uielement)
128189
128346
  if (option.KeyDown===false)
128190
128347
  {
128191
128348
  bRegisterKeydown=false;
128192
- JSConsole.Chart.Log('[JSKeyboardChartContainer::Create] not register keydown event.');
128349
+ JSConsole.Chart.Log('[JSTReportChartContainer::Create] not register keydown event.');
128193
128350
  }
128194
128351
 
128195
128352
  if (option.Wheel===false)
128196
128353
  {
128197
128354
  bRegisterWheel=false;
128198
- JSConsole.Chart.Log('[JSKeyboardChartContainer::Create] not register wheel event.');
128355
+ JSConsole.Chart.Log('[JSTReportChartContainer::Create] not register wheel event.');
128199
128356
  }
128200
128357
  }
128201
128358
 
@@ -128205,10 +128362,20 @@ function JSKeyboardChartContainer(uielement)
128205
128362
 
128206
128363
  this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
128207
128364
  this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
128365
+
128366
+ /*
128367
+ this.UIElement.onmouseup=(e)=>{ this.UIOnMounseUp(e); }
128208
128368
  this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
128209
128369
  this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
128210
128370
  this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
128211
128371
  this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
128372
+
128373
+
128374
+ //手机拖拽
128375
+ this.UIElement.ontouchstart=(e)=> { this.OnTouchStart(e); }
128376
+ this.UIElement.ontouchmove=(e)=> {this.OnTouchMove(e); }
128377
+ this.UIElement.ontouchend=(e)=> {this.OnTouchEnd(e); }
128378
+ */
128212
128379
  }
128213
128380
 
128214
128381
  this.Draw=function()
@@ -128219,6 +128386,13 @@ function JSKeyboardChartContainer(uielement)
128219
128386
  var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
128220
128387
  this.Canvas.lineWidth=pixelTatio; //手机端需要根据分辨率比调整线段宽度
128221
128388
 
128389
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash)
128390
+ {
128391
+ this.Frame.Draw( { IsEnableSplash:this.ChartSplashPaint.IsEnableSplash} );
128392
+ this.ChartSplashPaint.Draw();
128393
+ return;
128394
+ }
128395
+
128222
128396
  this.Frame.Draw();
128223
128397
  this.Frame.DrawLogo();
128224
128398
 
@@ -128236,30 +128410,2411 @@ function JSKeyboardChartContainer(uielement)
128236
128410
  if (!item.IsDrawFirst)
128237
128411
  item.Draw();
128238
128412
  }
128413
+
128414
+ if (this.GlobalOption.FlashBGCount>0)
128415
+ {
128416
+ this.DelayDraw(500);
128417
+ }
128239
128418
  }
128240
128419
 
128241
- this.GetStockData=function(symbol)
128420
+ this.DelayDraw=function(frequency)
128242
128421
  {
128243
- if (!this.MapSymbol.has(symbol)) return null;
128244
-
128245
- return this.MapSymbol.get(symbol);
128246
- }
128422
+ if (typeof (this.FlashBGTimer) == 'number')
128423
+ {
128424
+ clearTimeout(this.FlashBGTimer);
128425
+ this.FlashBGTimer = null;
128426
+ }
128247
128427
 
128428
+ this.FlashBGTimer=setTimeout(()=>
128429
+ {
128430
+ this.Draw();
128431
+ },frequency);
128432
+ }
128248
128433
 
128249
- this.ResetStatus=function()
128434
+ this.ClearData=function()
128250
128435
  {
128251
- this.Data.XOffset=0;
128252
- this.Data.YOffset=0;
128436
+ this.SourceData.Data=[];
128437
+ this.Data.Data=[];
128438
+ this.Data.BaseExePrice=null;
128439
+ this.MapStockData=null;
128440
+ this.MapExePriceData=null;
128441
+ this.BorderData.MapData=null;
128253
128442
  }
128254
128443
 
128255
- this.ResetSelectStatus=function()
128444
+ this.StopAutoUpdate=function()
128256
128445
  {
128257
- var chart=this.GetReportChart();
128258
- if (chart)
128259
- {
128260
- chart.SelectedRow=-1;
128261
- chart.SelectedFixedRow=-1;
128262
- }
128446
+ this.CancelAutoUpdate();
128447
+ this.AutoUpdateEvent(false,'JSTReportChartContainer::StopAutoUpdate');
128448
+ if (!this.IsAutoUpdate) return;
128449
+ this.IsAutoUpdate=false;
128450
+ }
128451
+
128452
+ //设置事件回调
128453
+ //{event:事件id, callback:回调函数}
128454
+ this.AddEventCallback=function(object)
128455
+ {
128456
+ if (!object || !object.event || !object.callback) return;
128457
+
128458
+ var data={Callback:object.callback, Source:object};
128459
+ this.mapEvent.set(object.event,data);
128460
+ }
128461
+
128462
+ this.RemoveEventCallback=function(eventid)
128463
+ {
128464
+ if (!this.mapEvent.has(eventid)) return;
128465
+
128466
+ this.mapEvent.delete(eventid);
128467
+ }
128468
+
128469
+ this.GetEventCallback=function(id) //获取事件回调
128470
+ {
128471
+ if (!this.mapEvent.has(id)) return null;
128472
+ var item=this.mapEvent.get(id);
128473
+ return item;
128474
+ }
128475
+
128476
+ this.OnSize=function()
128477
+ {
128478
+ if (!this.Frame) return;
128479
+
128480
+ this.SetSizeChange(true);
128481
+ this.Draw();
128482
+ this.DelayUpdateStockData();
128483
+ }
128484
+
128485
+ this.SetSizeChange=function(bChanged)
128486
+ {
128487
+ for(var i=0;i<this.ChartPaint.length;++i)
128488
+ {
128489
+ var chart=this.ChartPaint[i];
128490
+ if (chart) chart.SizeChange=bChanged;
128491
+ }
128492
+ }
128493
+
128494
+ this.ChangeSymbol=function(symbol, option)
128495
+ {
128496
+ this.CancelAutoUpdate();
128497
+ this.ClearData();
128498
+ this.Symbol=symbol;
128499
+ this.Name=symbol;
128500
+ if (option)
128501
+ {
128502
+ if (option.Name) this.Name=option.Name;
128503
+ }
128504
+
128505
+ this.RequestStockListData();
128506
+ }
128507
+
128508
+ this.CancelAutoUpdate=function() //关闭停止更新
128509
+ {
128510
+ if (typeof (this.AutoUpdateTimer) == 'number')
128511
+ {
128512
+ clearTimeout(this.AutoUpdateTimer);
128513
+ this.AutoUpdateTimer = null;
128514
+ }
128515
+ }
128516
+
128517
+ this.SetColumn=function(aryColunm, option)
128518
+ {
128519
+ var chart=this.ChartPaint[0];
128520
+ if (!chart) return;
128521
+
128522
+ chart.SetColumn(aryColunm);
128523
+ chart.SizeChange=true;
128524
+
128525
+ if (option && option.Redraw) this.Draw();
128526
+ }
128527
+
128528
+ //请求列表
128529
+ this.RequestStockListData=function()
128530
+ {
128531
+ this.ChartSplashPaint.SetTitle(this.SplashTitle.StockList);
128532
+ this.ChartSplashPaint.EnableSplash(true);
128533
+ this.Draw();
128534
+
128535
+ var self=this;
128536
+ if (this.NetworkFilter)
128537
+ {
128538
+ var obj=
128539
+ {
128540
+ Name:'JSTReportChartContainer::RequestStockListData', //类名::
128541
+ Explain:'T型报价列表数据',
128542
+ Self:this,
128543
+ PreventDefault:false
128544
+ };
128545
+
128546
+ this.NetworkFilter(obj, function(data)
128547
+ {
128548
+ if (!data) return;
128549
+ if (data.symbol!=self.Symbol) return;
128550
+
128551
+ self.ChartSplashPaint.EnableSplash(false);
128552
+ self.RecvStockListData(data);
128553
+ });
128554
+
128555
+ if (obj.PreventDefault==true) return; //已被上层替换,不调用默认的网络请求
128556
+ }
128557
+
128558
+ throw { Name:'JSTReportChartContainer::RequestStockListData', Error:'(T型报价列表数据)不提供内置测试数据' };
128559
+ }
128560
+
128561
+ this.RecvStockListData=function(data)
128562
+ {
128563
+ if (IFrameSplitOperator.IsNonEmptyArray(data.data))
128564
+ {
128565
+ this.MapExePriceData=new Map();
128566
+ this.MapStockData=new Map();
128567
+ //0=行权价格 1=左边期权代码 2=右侧期权代码 3=左侧期权名称 4=右侧期权名称
128568
+ for(var i=0;i<data.data.length;++i)
128569
+ {
128570
+ var item=data.data[i];
128571
+ var exePrice=item[0];
128572
+
128573
+ var leftData=new HQTReportItem();
128574
+ leftData.Symbol=leftData.Name=item[1];
128575
+ if (item[3]) leftData.Name=item[3];
128576
+
128577
+ var rightData=new HQTReportItem();
128578
+ rightData.Symbol=rightData.Name=item[2];
128579
+ if (item[4]) rightData.Name=item[4];
128580
+
128581
+ this.MapStockData.set(leftData.Symbol, leftData);
128582
+ this.MapStockData.set(rightData.Symbol, rightData);
128583
+
128584
+ var dataItem={ ExePrice:exePrice, LeftData:leftData, RightData:rightData };
128585
+ this.MapExePriceData.set(dataItem.ExePrice, dataItem);
128586
+
128587
+ this.SourceData.Data.push(exePrice);
128588
+ this.Data.Data.push(exePrice);
128589
+ }
128590
+ }
128591
+
128592
+ if (IFrameSplitOperator.IsNumber(data.baseExePrice))
128593
+ {
128594
+ this.Data.BaseExePrice=data.baseExePrice;
128595
+ }
128596
+
128597
+ this.Draw();
128598
+
128599
+ this.UpdateStockData();
128600
+ }
128601
+
128602
+ this.GetExePriceData=function(exePrice)
128603
+ {
128604
+ if (!this.MapExePriceData) return null;
128605
+ if (!this.MapExePriceData.has(exePrice)) return null;
128606
+
128607
+ return this.MapExePriceData.get(exePrice);
128608
+ }
128609
+
128610
+ this.UpdateStockData=function()
128611
+ {
128612
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
128613
+ if (this.MapStockData.size<=0) return;
128614
+
128615
+ var arySymbol=[];
128616
+ for(var mapItem of this.MapStockData)
128617
+ {
128618
+ arySymbol.push(mapItem[0]);
128619
+ }
128620
+
128621
+ if (!IFrameSplitOperator.IsNonEmptyArray(arySymbol)) return;
128622
+ this.RequestStockData(arySymbol);
128623
+ }
128624
+
128625
+ //下载期权数据
128626
+ this.RequestStockData=function(arySymbol)
128627
+ {
128628
+ var self=this;
128629
+ if (this.NetworkFilter)
128630
+ {
128631
+ var obj=
128632
+ {
128633
+ Name:'JSTReportChartContainer::RequestStockData', //类名::函数名
128634
+ Explain:'T型报价列表期权数据',
128635
+ Request:{ Data: { stocks: arySymbol, symbol:this.Symbol } },
128636
+ Self:this,
128637
+ PreventDefault:false
128638
+ };
128639
+
128640
+ this.NetworkFilter(obj, function(data)
128641
+ {
128642
+ self.RecvStockData(data);
128643
+ self.AutoUpdate();
128644
+ });
128645
+
128646
+ if (obj.PreventDefault==true) return;
128647
+ }
128648
+
128649
+ throw { Name:'JSTReportChartContainer::RequestStockData', Error:'(T型报价列表期权数据)不提供内置测试数据' };
128650
+ }
128651
+
128652
+ this.RecvStockData=function(data)
128653
+ {
128654
+ var setUpdateSymbol=new Set(); //更新的股票列表
128655
+ if (IFrameSplitOperator.IsNonEmptyArray(data.data))
128656
+ {
128657
+ for(var i=0;i<data.data.length;++i)
128658
+ {
128659
+ var item=data.data[i];
128660
+ var symbol=item[0]; //0=证券代码;
128661
+ if (!symbol) continue;
128662
+ var stock=null;
128663
+ if (this.MapStockData.has(symbol))
128664
+ {
128665
+ stock=this.MapStockData.get(symbol);
128666
+ }
128667
+ else
128668
+ {
128669
+ stock=new HQTReportItem();
128670
+ stock.Symbol=symbol;
128671
+ this.MapStockData.set(symbol, stock);
128672
+ }
128673
+
128674
+ this.ReadStockJsonData(stock, item);
128675
+
128676
+ if (!setUpdateSymbol.has(symbol)) setUpdateSymbol.add(symbol);
128677
+ }
128678
+ }
128679
+
128680
+ //实时数据排序
128681
+ var chart=this.ChartPaint[0];
128682
+ if (chart && (this.SortInfo.Sort==1 || this.SortInfo.Sort==2 ) && IFrameSplitOperator.IsNumber(this.SortInfo.Field) && this.SortInfo.Field>=0)
128683
+ {
128684
+ var column=chart.Column[this.SortInfo.Field];
128685
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_TREPORT_LOCAL_SORT);
128686
+ if (event && event.Callback)
128687
+ {
128688
+ var sendData={ Column:column, SortInfo:this.SortInfo, SymbolList:this.Data.Data, Result:null };
128689
+ event.Callback (event, sendData, this);
128690
+ if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
128691
+ }
128692
+ else
128693
+ {
128694
+ this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, column, this.SortInfo.Sort, this.SortInfo.CellType); });
128695
+ }
128696
+ }
128697
+
128698
+ this.CalculateData();
128699
+
128700
+ this.Draw();
128701
+ }
128702
+
128703
+ //计算统计数据
128704
+ this.CalculateData=function()
128705
+ {
128706
+ if (!this.MapExePriceData || this.MapExePriceData.size<=0) return;
128707
+
128708
+ var leftMaxPosition={ Max:null, ExePrice:null, CellType:1 };
128709
+ var rightMaxPosition={ Max:null,ExePrice:null, CellType:2 };
128710
+ this.BorderData.MapData=new Map();
128711
+ for(var mapItem of this.MapExePriceData)
128712
+ {
128713
+ var item=mapItem[1];
128714
+ var leftData=item.LeftData;
128715
+ var rightData=item.RightData;
128716
+ if (leftData && IFrameSplitOperator.IsNumber(leftData.Position))
128717
+ {
128718
+ if (leftMaxPosition.Max==null || leftMaxPosition.Max<leftData.Position)
128719
+ {
128720
+ leftMaxPosition.Max=leftData.Position;
128721
+ leftMaxPosition.ExePrice=mapItem[0];
128722
+ }
128723
+ }
128724
+
128725
+ if (rightData && IFrameSplitOperator.IsNumber(rightData.Position))
128726
+ {
128727
+ if (leftMaxPosition.Max==null || leftMaxPosition.Max<rightData.Position)
128728
+ {
128729
+ rightMaxPosition.Max=rightData.Position;
128730
+ rightMaxPosition.ExePrice=mapItem[0];
128731
+ }
128732
+ }
128733
+ }
128734
+
128735
+ var aryData=[null, null, null];
128736
+ if (leftMaxPosition.ExePrice) aryData[1]=leftMaxPosition;
128737
+ if (rightMaxPosition.ExePrice) aryData[2]=rightMaxPosition;
128738
+
128739
+ this.BorderData.MapData.set(TREPORT_COLUMN_ID.POSITION_ID, { Data:aryData });
128740
+ }
128741
+
128742
+ //读取单条股票json数据
128743
+ this.ReadStockJsonData=function(stock, item)
128744
+ {
128745
+ //0=证券代码 1=股票名称 2=昨收 3=开 4=高 5=低 6=收 7=成交量 8=成交金额, 9=买价 10=买量 11=卖价 12=卖量 13=均价 14=持仓 16=涨停价 17=跌停价
128746
+ //21=涨幅% 22=涨跌 24=振幅%
128747
+ //30=全局扩展数据 31=当前板块扩展数据
128748
+
128749
+ if (IFrameSplitOperator.IsString(item[1])) stock.Name=item[1];
128750
+ if (IFrameSplitOperator.IsNumber(item[2])) stock.YClose=item[2];
128751
+ if (IFrameSplitOperator.IsNumber(item[3])) stock.Open=item[3];
128752
+ if (IFrameSplitOperator.IsNumber(item[4])) stock.High=item[4];
128753
+ if (IFrameSplitOperator.IsNumber(item[5])) stock.Low=item[5];
128754
+ if (IFrameSplitOperator.IsNumber(item[6])) stock.Price=item[6];
128755
+ if (IFrameSplitOperator.IsNumber(item[7])) stock.Vol=item[7];
128756
+ if (IFrameSplitOperator.IsNumber(item[8])) stock.Amount=item[8];
128757
+ if (IFrameSplitOperator.IsNumber(item[9])) stock.BuyPrice=item[9];
128758
+ if (IFrameSplitOperator.IsNumber(item[10])) stock.BuyVol=item[10];
128759
+ if (IFrameSplitOperator.IsNumber(item[11])) stock.SellPrice=item[11];
128760
+ if (IFrameSplitOperator.IsNumber(item[12])) stock.SellVol=item[12];
128761
+ if (IFrameSplitOperator.IsNumber(item[13])) stock.AvPrice=item[13]; //均价
128762
+ if (IFrameSplitOperator.IsNumber(item[14])) stock.Position=item[14]; //持仓
128763
+
128764
+ if (IFrameSplitOperator.IsNumber(item[16])) stock.LimitHigh=item[16]; //涨停价
128765
+ if (IFrameSplitOperator.IsNumber(item[17])) stock.LimitLow=item[17]; //跌停价
128766
+
128767
+ if (IFrameSplitOperator.IsNumber(item[21])) stock.Increase=item[21]; //涨幅%
128768
+ if (IFrameSplitOperator.IsNumber(item[22])) stock.UpDown=item[22]; //涨跌
128769
+
128770
+ if (IFrameSplitOperator.IsNumber(item[24])) stock.Amplitude=item[24]; //振幅%
128771
+
128772
+ if (item[27]) stock.NameEx=item[27]; //扩展名字
128773
+
128774
+ //衍生数据计算
128775
+ if (!IFrameSplitOperator.IsNumber(item[21])) //涨幅%
128776
+ {
128777
+ if (IFrameSplitOperator.IsNumber(stock.Price) && IFrameSplitOperator.IsNumber(stock.YClose) && stock.YClose!=0)
128778
+ stock.Increase=(stock.Price-stock.YClose)/stock.YClose*100;
128779
+ }
128780
+
128781
+ if (!IFrameSplitOperator.IsNumber(item[22])) //涨跌
128782
+ {
128783
+ if (IFrameSplitOperator.IsNumber(stock.Price) && IFrameSplitOperator.IsNumber(stock.YClose))
128784
+ stock.UpDown=stock.Price-stock.YClose;
128785
+ }
128786
+
128787
+ if (!IFrameSplitOperator.IsNumber(item[24])) //振幅%
128788
+ {
128789
+ if (IFrameSplitOperator.IsNumber(stock.High) && IFrameSplitOperator.IsNumber(stock.Low) && IFrameSplitOperator.IsNumber(stock.YClose) && stock.YClose!=0)
128790
+ stock.Amplitude=(stock.High-stock.Low)/stock.YClose*100;
128791
+ }
128792
+
128793
+ if (item[30])
128794
+ stock.ExtendData=item[30]; //30=全局扩展数据
128795
+
128796
+ if (item[32]) stock.CloseLine=item[32]; //32=收盘价线
128797
+ if (item[33]) stock.KLine=item[33]; //33=K线
128798
+ }
128799
+
128800
+
128801
+ this.AutoUpdate=function(waitTime) //waitTime 更新时间
128802
+ {
128803
+ this.CancelAutoUpdate();
128804
+ if (!this.IsAutoUpdate) return;
128805
+
128806
+ var self = this;
128807
+ var marketStatus=2;
128808
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_TREPORT_MARKET_STATUS);
128809
+ if (event && event.Callback)
128810
+ {
128811
+ var sendData={ MarketStatus:2 };
128812
+ event.Callback(event, sendData, this);
128813
+ if (IFrameSplitOperator.IsNumber(sendData.MarketStatus)) marketStatus=sendData.MarketStatus;
128814
+ }
128815
+
128816
+ if (marketStatus==0 || marketStatus==3) return; //闭市,盘后
128817
+
128818
+ var frequency=this.AutoUpdateFrequency;
128819
+ if (marketStatus==1) //盘前
128820
+ {
128821
+ this.AutoUpdateTimer=setTimeout(function()
128822
+ {
128823
+ self.AutoUpdate();
128824
+ },frequency);
128825
+ }
128826
+ else if (marketStatus==2) //盘中
128827
+ {
128828
+ this.AutoUpdateTimer=setTimeout(function()
128829
+ {
128830
+ self.UpdateStockData();
128831
+ },frequency);
128832
+ }
128833
+ }
128834
+
128835
+ //delay=是否延迟
128836
+ this.DelayUpdateStockData=function()
128837
+ {
128838
+ if (this.DelayUpdateTimer!=null)
128839
+ {
128840
+ clearTimeout(this.DelayUpdateTimer);
128841
+ this.DelayUpdateTimer = null;
128842
+ }
128843
+
128844
+ var frequency=this.DelayUpdateFrequency;
128845
+ this.DelayUpdateTimer=setTimeout(()=>
128846
+ {
128847
+ this.UpdateStockData();
128848
+
128849
+ },frequency);
128850
+ }
128851
+
128852
+ this.UIOnDblClick=function(e)
128853
+ {
128854
+ var pixelTatio = GetDevicePixelRatio();
128855
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
128856
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
128857
+
128858
+ var chart=this.GetTReportChart();
128859
+ if (chart) chart.OnDblClick(x,y,e);
128860
+ }
128861
+
128862
+ this.UIOnMouseDown=function(e)
128863
+ {
128864
+ var pixelTatio = GetDevicePixelRatio();
128865
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
128866
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
128867
+
128868
+ var chart=this.ChartPaint[0];
128869
+ if (!chart) return;
128870
+
128871
+ var clickData=chart.OnMouseDown(x,y,e);
128872
+ if (!clickData) return;
128873
+
128874
+ if ((clickData.Type==2) && (e.button==0 || e.button==2)) //点击行
128875
+ {
128876
+ if (clickData.Redraw==true) this.Draw();
128877
+ }
128878
+ else if (clickData.Type==3 && e.button==0) //表头
128879
+ {
128880
+ this.OnClickHeader(clickData, e);
128881
+ }
128882
+
128883
+ //document.onmousemove=(e)=>{ this.DocOnMouseMove(e); }
128884
+ //document.onmouseup=(e)=> { this.DocOnMouseUp(e); }
128885
+ }
128886
+
128887
+ //点表头
128888
+ this.OnClickHeader=function(clickData, e)
128889
+ {
128890
+ var header=clickData.Header;
128891
+
128892
+ if (header.Column && header.Column.Sort==1)
128893
+ {
128894
+ var data={ CellType:header.CellType, ColumnIndex:header.ColumnIndex }
128895
+ this.SortHeader(header.Column, data);
128896
+ }
128897
+
128898
+ }
128899
+
128900
+ //排序
128901
+ this.SortHeader=function(column, sortData)
128902
+ {
128903
+ var sortInfo={ Field:this.SortInfo.Field, Sort:this.SortInfo.Sort, CellType:this.SortInfo.CellType };
128904
+ var arySortType=column.SortType;
128905
+
128906
+ if (sortInfo.Field!=sortData.ColumnIndex || sortInfo.CellType!=sortData.CellType)
128907
+ {
128908
+ sortInfo.Field=sortData.ColumnIndex;
128909
+ sortInfo.CellType=sortData.CellType;
128910
+ sortInfo.Sort=arySortType[0]
128911
+ }
128912
+ else
128913
+ {
128914
+ if (arySortType.length==1)
128915
+ {
128916
+ sortInfo.Sort=arySortType[0];
128917
+ }
128918
+ else
128919
+ {
128920
+ for(var i=0;i<arySortType.length;++i)
128921
+ {
128922
+ if (sortInfo.Sort==arySortType[i])
128923
+ {
128924
+ sortInfo.Sort=arySortType[(i+1)%arySortType.length];
128925
+ break;
128926
+ }
128927
+ }
128928
+ }
128929
+ }
128930
+
128931
+ if (sortInfo.Sort==0) //还原
128932
+ {
128933
+ this.Data.Data=[];
128934
+ for(var i=0;i<this.SourceData.Data.length;++i)
128935
+ {
128936
+ this.Data.Data.push(this.SourceData.Data[i]);
128937
+ }
128938
+ }
128939
+ else
128940
+ {
128941
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_TREPORT_LOCAL_SORT);
128942
+ if (event && event.Callback)
128943
+ {
128944
+ var sendData={ Column:column, SortInfo:sortInfo, SymbolList:this.Data.Data, Result:null };
128945
+ event.Callback (event, sendData, this);
128946
+ if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
128947
+ }
128948
+ else
128949
+ {
128950
+ this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, column, sortInfo.Sort, sortInfo.CellType); });
128951
+ }
128952
+ }
128953
+
128954
+ this.Data.YOffset=0;
128955
+ this.SortInfo.Field=sortInfo.Field;
128956
+ this.SortInfo.Sort=sortInfo.Sort;
128957
+ this.SortInfo.CellType=sortInfo.CellType;
128958
+ this.Draw();
128959
+ this.DelayUpdateStockData();
128960
+ }
128961
+
128962
+ //本地排序
128963
+ this.LocalSort=function(left, right, column, sortType, cellType)
128964
+ {
128965
+ switch(column.Type)
128966
+ {
128967
+ case TREPORT_COLUMN_ID.SYMBOL_ID:
128968
+ case TREPORT_COLUMN_ID.NAME_ID:
128969
+ return this.LocalStringSort(left, right, column, sortType, cellType);
128970
+
128971
+ case TREPORT_COLUMN_ID.PRICE_ID:
128972
+ case TREPORT_COLUMN_ID.VOL_ID:
128973
+ case TREPORT_COLUMN_ID.UPDOWN_ID:
128974
+ case TREPORT_COLUMN_ID.BUY_PRICE_ID:
128975
+ case TREPORT_COLUMN_ID.SELL_PRICE_ID:
128976
+ case TREPORT_COLUMN_ID.AMOUNT_ID:
128977
+ case TREPORT_COLUMN_ID.BUY_VOL_ID:
128978
+ case TREPORT_COLUMN_ID.SELL_VOL_ID:
128979
+ case TREPORT_COLUMN_ID.YCLOSE_ID:
128980
+ case TREPORT_COLUMN_ID.OPEN_ID:
128981
+ case TREPORT_COLUMN_ID.HIGH_ID:
128982
+ case TREPORT_COLUMN_ID.LOW_ID:
128983
+ case TREPORT_COLUMN_ID.AVERAGE_PRICE_ID:
128984
+ case TREPORT_COLUMN_ID.EXE_PRICE_ID: //行权价格
128985
+ case TREPORT_COLUMN_ID.POSITION_ID: //持仓量
128986
+ case TREPORT_COLUMN_ID.AMPLITUDE_ID:
128987
+ case TREPORT_COLUMN_ID.INCREASE_ID:
128988
+ return this.LocalNumberSort(left, right, column, sortType, cellType);
128989
+
128990
+ default:
128991
+
128992
+ return 0;
128993
+ }
128994
+ }
128995
+
128996
+ this.LocalNumberSort=function(left, right, column, sortType, cellType)
128997
+ {
128998
+ var leftStock=this.GetExePriceData(left);
128999
+ var rightStock=this.GetExePriceData(right);
129000
+
129001
+ var leftValue=-99999999999999, rightValue=-99999999999999;
129002
+ if (sortType==2) leftValue=rightValue=99999999999999;
129003
+
129004
+ var filedName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);
129005
+
129006
+ if (cellType==0) //行权价格
129007
+ {
129008
+ if (leftStock && IFrameSplitOperator.IsNumber(leftStock.ExePrice)) leftValue=leftStock.ExePrice;
129009
+ if (rightStock && IFrameSplitOperator.IsNumber(rightStock.ExePrice)) rightValue=rightStock.ExePrice;
129010
+ }
129011
+ else if (cellType==1)
129012
+ {
129013
+ if (leftStock && leftStock.LeftData)
129014
+ {
129015
+ var value=leftStock.LeftData[filedName];
129016
+ if (IFrameSplitOperator.IsNumber(value)) leftValue=value;
129017
+ }
129018
+ if (rightStock && rightStock.LeftData)
129019
+ {
129020
+ var value=rightStock.LeftData[filedName];
129021
+ if (IFrameSplitOperator.IsNumber(value)) rightValue=value;
129022
+ }
129023
+ }
129024
+ else if (cellType==2)
129025
+ {
129026
+ if (leftStock && leftStock.RightData)
129027
+ {
129028
+ var value=leftStock.RightData[filedName];
129029
+ if (IFrameSplitOperator.IsNumber(value)) leftValue=value;
129030
+ }
129031
+ if (rightStock && rightStock.RightData)
129032
+ {
129033
+ var value=rightStock.RightData[filedName]
129034
+ if (IFrameSplitOperator.IsNumber(value)) rightValue=value;
129035
+ }
129036
+ }
129037
+
129038
+ if (sortType==1)
129039
+ {
129040
+ if (rightValue<leftValue) return -1;
129041
+ else if (rightValue<leftValue) return 1;
129042
+ else return 0;
129043
+ }
129044
+ else
129045
+ {
129046
+ if (leftValue<rightValue) return -1;
129047
+ else if (leftValue>rightValue) return 1;
129048
+ else return 0;
129049
+ }
129050
+ }
129051
+
129052
+ this.GetTReportChart=function()
129053
+ {
129054
+ var chart=this.ChartPaint[0];
129055
+ return chart;
129056
+ }
129057
+
129058
+ this.OnWheel=function(e) //滚轴
129059
+ {
129060
+ JSConsole.Chart.Log('[JSTReportChartContainer::OnWheel]',e);
129061
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
129062
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
129063
+
129064
+ var x = e.clientX-this.UIElement.getBoundingClientRect().left;
129065
+ var y = e.clientY-this.UIElement.getBoundingClientRect().top;
129066
+
129067
+ var isInClient=false;
129068
+ this.Canvas.beginPath();
129069
+ this.Canvas.rect(this.Frame.ChartBorder.GetLeft(),this.Frame.ChartBorder.GetTop(),this.Frame.ChartBorder.GetWidth(),this.Frame.ChartBorder.GetHeight());
129070
+ isInClient=this.Canvas.isPointInPath(x,y);
129071
+ if (!isInClient) return;
129072
+
129073
+ var chart=this.GetTReportChart();
129074
+ if (!chart) return;
129075
+
129076
+ var wheelValue=e.wheelDelta;
129077
+ if (!IFrameSplitOperator.IsObjectExist(e.wheelDelta))
129078
+ wheelValue=e.deltaY* -0.01;
129079
+
129080
+ if (wheelValue<0) //下
129081
+ {
129082
+ var result=this.MoveSelectedRow(1)
129083
+ if (result)
129084
+ {
129085
+ if (result.Redraw) this.Draw();
129086
+ if (result.Update) this.DelayUpdateStockData();
129087
+ }
129088
+ }
129089
+ else if (wheelValue>0) //上
129090
+ {
129091
+ var result=this.MoveSelectedRow(-1);
129092
+ if (result)
129093
+ {
129094
+ if (result.Redraw) this.Draw();
129095
+ if (result.Update) this.DelayUpdateStockData();
129096
+ }
129097
+ }
129098
+
129099
+ if(e.preventDefault) e.preventDefault();
129100
+ else e.returnValue = false;
129101
+ }
129102
+
129103
+ this.OnKeyDown=function(e)
129104
+ {
129105
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
129106
+ var reportChart=this.GetTReportChart();
129107
+ if (!reportChart) return;
129108
+
129109
+ var keyID = e.keyCode ? e.keyCode :e.which;
129110
+ switch(keyID)
129111
+ {
129112
+ /*
129113
+ case 33: //page up
129114
+ if (this.GotoPreviousPage(this.PageUpDownCycle))
129115
+ {
129116
+ this.Draw();
129117
+ this.DelayUpdateStockData();
129118
+ }
129119
+ break;
129120
+ case 34: //page down
129121
+ if (this.GotoNextPage(this.PageUpDownCycle))
129122
+ {
129123
+ this.Draw();
129124
+ this.DelayUpdateStockData();
129125
+ }
129126
+ break;
129127
+ */
129128
+ case 38: //up
129129
+ var result=this.MoveSelectedRow(-1);
129130
+ if (result)
129131
+ {
129132
+ if (result.Redraw) this.Draw();
129133
+ if (result.Update) this.DelayUpdateStockData();
129134
+ }
129135
+ break;
129136
+ case 40: //down
129137
+ var result=this.MoveSelectedRow(1)
129138
+ if (result)
129139
+ {
129140
+ if (result.Redraw) this.Draw();
129141
+ if (result.Update) this.DelayUpdateStockData();
129142
+ }
129143
+ break;
129144
+ }
129145
+
129146
+ //不让滚动条滚动
129147
+ if(e.preventDefault) e.preventDefault();
129148
+ else e.returnValue = false;
129149
+ }
129150
+
129151
+ this.MoveSelectedRow=function(step)
129152
+ {
129153
+ var chart=this.ChartPaint[0];
129154
+ if (!chart) return null;
129155
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return null;
129156
+
129157
+ var result={ Redraw:false, Update:false }; //Redraw=重绘, Update=更新数据
129158
+
129159
+ var pageStatus=chart.GetCurrentPageStatus();
129160
+ var pageSize=pageStatus.PageSize;
129161
+
129162
+ var selectedIndex=pageStatus.Start;
129163
+ var cellType=1;
129164
+ if (pageStatus.SelectedRow)
129165
+ {
129166
+ cellType=pageStatus.SelectedRow.CellType;
129167
+ for(var i=0;i<this.Data.Data.length;++i)
129168
+ {
129169
+ if (pageStatus.SelectedRow.ExePrice==this.Data.Data[i])
129170
+ {
129171
+ selectedIndex=i;
129172
+ break;
129173
+ }
129174
+ }
129175
+ }
129176
+
129177
+ if (step>0)
129178
+ {
129179
+ if (selectedIndex<0 || selectedIndex<pageStatus.Start || selectedIndex>pageStatus.End)
129180
+ {
129181
+ chart.SelectedRow={ ExePrice:this.Data.Data[pageStatus.Start], CellType:cellType };
129182
+ result.Redraw=true;
129183
+ return result;
129184
+ }
129185
+
129186
+ var offset=this.Data.YOffset;
129187
+ for(var i=0;i<step;++i)
129188
+ {
129189
+ ++selectedIndex;
129190
+ if (selectedIndex>pageStatus.End) ++offset;
129191
+
129192
+ if (selectedIndex>=this.Data.Data.length)
129193
+ {
129194
+ selectedIndex=0;
129195
+ offset=0;
129196
+ }
129197
+ }
129198
+
129199
+ result.Redraw=true;
129200
+ result.Update=(offset!=this.Data.YOffset);
129201
+
129202
+ chart.SelectedRow={ ExePrice:this.Data.Data[selectedIndex], CellType:cellType };
129203
+ this.Data.YOffset=offset;
129204
+
129205
+ return result;
129206
+ }
129207
+ else if (step<0)
129208
+ {
129209
+ if (selectedIndex<0 || selectedIndex<pageStatus.Start || selectedIndex>pageStatus.End)
129210
+ {
129211
+ chart.SelectedRow={ ExePrice:this.Data.Data[pageStatus.End], CellType:cellType };
129212
+ result.Redraw=true;
129213
+ return result;
129214
+ }
129215
+
129216
+ step=Math.abs(step);
129217
+ var offset=this.Data.YOffset;
129218
+ for(var i=0;i<step;++i)
129219
+ {
129220
+ --selectedIndex;
129221
+ if (selectedIndex<pageStatus.Start) --offset;
129222
+
129223
+ if (selectedIndex<0)
129224
+ {
129225
+ selectedIndex=this.Data.Data.length-1;
129226
+ offset=this.Data.Data.length-pageSize;
129227
+ if (offset<0) offset=0;
129228
+ }
129229
+ }
129230
+
129231
+ result.Redraw=true;
129232
+ result.Update=(offset!=this.Data.YOffset);
129233
+
129234
+ chart.SelectedRow={ ExePrice:this.Data.Data[selectedIndex], CellType:cellType };
129235
+ this.Data.YOffset=offset;
129236
+
129237
+ return result;
129238
+ }
129239
+
129240
+ return null;
129241
+ }
129242
+
129243
+ //obj={ ID:, Color: , Time:, Count: }
129244
+ this.SetFlashBGItem=function(symbol, obj)
129245
+ {
129246
+ var item={ ID:obj.ID, Color:obj.Color, Count:1 };
129247
+ if (IFrameSplitOperator.IsNumber(obj.Count)) item.Count=obj.Count;
129248
+ if (IFrameSplitOperator.IsNumber(obj.Time)) item.Time=obj.Time;
129249
+ else item.Time=Date.now();
129250
+
129251
+ if (this.FlashBG.has(symbol))
129252
+ {
129253
+ var stockItem=this.FlashBG.get(symbol);
129254
+ stockItem.LastTime=item.Time;
129255
+ stockItem.Data.set(item.ID, item);
129256
+ }
129257
+ else
129258
+ {
129259
+ var stockItem={ LastTime:item.Time, Data:new Map([ [item.ID, item ] ]) };
129260
+ this.FlashBG.set(symbol, stockItem);
129261
+ }
129262
+ }
129263
+
129264
+ this.GetFlashBGData=function(symbol, time)
129265
+ {
129266
+ if (!this.FlashBG) return null;
129267
+ if (!this.FlashBG.has(symbol)) return null;
129268
+
129269
+ var timeDiff=3*1000;
129270
+ var stockItem=this.FlashBG.get(symbol);
129271
+ if (time-stockItem.LastTime>=timeDiff) //超时的删除
129272
+ {
129273
+ this.FlashBG.delete(symbol);
129274
+ return null;
129275
+ }
129276
+
129277
+ if (!stockItem.Data || stockItem.Data.size<=0)
129278
+ {
129279
+ this.FlashBG.delete(symbol);
129280
+ return null;
129281
+ }
129282
+
129283
+ var aryDelID=[]; //超时需要参数的
129284
+ for(var mapItem of stockItem.Data)
129285
+ {
129286
+ var item=mapItem[1];
129287
+ if (time-item.Time>=timeDiff || item.Count<=0)
129288
+ aryDelID.push(item.ID);
129289
+ }
129290
+
129291
+ if (IFrameSplitOperator.IsNonEmptyArray(aryDelID))
129292
+ {
129293
+ for(var i=0; i<aryDelID.length; ++i)
129294
+ {
129295
+ stockItem.Data.delete(aryDelID[i]);
129296
+ }
129297
+
129298
+ if (stockItem.Data.size<=0)
129299
+ {
129300
+ this.FlashBG.delete(symbol);
129301
+ return null;
129302
+ }
129303
+ }
129304
+
129305
+ return stockItem;
129306
+ }
129307
+ }
129308
+
129309
+ function JSTReportFrame()
129310
+ {
129311
+ this.ChartBorder;
129312
+ this.Canvas; //画布
129313
+
129314
+ this.BorderLine=null; //1=上 2=下 4=左 8=右
129315
+ this.ClassName="JSTReportFrame";
129316
+
129317
+ this.BorderColor=g_JSChartResource.TReport.BorderColor; //边框线
129318
+
129319
+ this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;
129320
+ this.LogoTextFont=g_JSChartResource.FrameLogo.Font;
129321
+
129322
+ this.ReloadResource=function(resource)
129323
+ {
129324
+ this.BorderColor=g_JSChartResource.TReport.BorderColor; //边框线
129325
+ this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;
129326
+ this.LogoTextFont=g_JSChartResource.FrameLogo.Font;
129327
+ }
129328
+
129329
+ this.Draw=function()
129330
+ {
129331
+ var left=ToFixedPoint(this.ChartBorder.GetLeft());
129332
+ var top=ToFixedPoint(this.ChartBorder.GetTop());
129333
+ var right=ToFixedPoint(this.ChartBorder.GetRight());
129334
+ var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
129335
+ var width=right-left;
129336
+ var height=bottom-top;
129337
+
129338
+ if (!IFrameSplitOperator.IsNumber(this.BorderLine))
129339
+ {
129340
+ this.Canvas.strokeStyle=this.BorderColor;
129341
+ this.Canvas.strokeRect(left,top,width,height);
129342
+ }
129343
+ else
129344
+ {
129345
+ this.Canvas.strokeStyle=this.BorderColor;
129346
+ this.Canvas.beginPath();
129347
+
129348
+ if ((this.BorderLine&1)>0) //上
129349
+ {
129350
+ this.Canvas.moveTo(left,top);
129351
+ this.Canvas.lineTo(right,top);
129352
+ }
129353
+
129354
+ if ((this.BorderLine&2)>0) //下
129355
+ {
129356
+ this.Canvas.moveTo(left,bottom);
129357
+ this.Canvas.lineTo(right,bottom);
129358
+ }
129359
+
129360
+ if ((this.BorderLine&4)>0) //左
129361
+ {
129362
+ this.Canvas.moveTo(left,top);
129363
+ this.Canvas.lineTo(left,bottom);
129364
+ }
129365
+
129366
+ if ((this.BorderLine&8)>0) //右
129367
+ {
129368
+ this.Canvas.moveTo(right,top);
129369
+ this.Canvas.lineTo(right,bottom);
129370
+ }
129371
+
129372
+ this.Canvas.stroke();
129373
+ }
129374
+ }
129375
+
129376
+ this.DrawLogo=function()
129377
+ {
129378
+ var text=g_JSChartResource.FrameLogo.Text;
129379
+ if (!IFrameSplitOperator.IsString(text)) return;
129380
+
129381
+ this.Canvas.fillStyle=this.LogoTextColor;
129382
+ this.Canvas.font=this.LogoTextFont;
129383
+ this.Canvas.textAlign = 'right';
129384
+ this.Canvas.textBaseline = 'bottom';
129385
+
129386
+ var x=this.ChartBorder.GetRight()-30;
129387
+ var y=this.ChartBorder.GetBottom()-5;
129388
+ this.Canvas.fillText(text,x,y);
129389
+ }
129390
+ }
129391
+
129392
+ var TREPORT_COLUMN_ID=
129393
+ {
129394
+ SYMBOL_ID:0,
129395
+ NAME_ID:1,
129396
+ PRICE_ID:2, //成交价格
129397
+ VOL_ID:3, //成交量
129398
+ INCREASE_ID:4, //涨幅
129399
+ UPDOWN_ID:5, //涨跌
129400
+ BUY_PRICE_ID:6, //买价
129401
+ SELL_PRICE_ID:7, //卖价
129402
+ AMOUNT_ID:8, //总金额
129403
+ BUY_VOL_ID:9, //买量
129404
+ SELL_VOL_ID:10, //卖量
129405
+ YCLOSE_ID:11, //昨收
129406
+ OPEN_ID:12,
129407
+ HIGH_ID:13,
129408
+ LOW_ID:14,
129409
+ AVERAGE_PRICE_ID:15,//均价
129410
+ INDEX_ID:16, //序号 从1开始
129411
+ EXE_PRICE_ID:17, //行权价格
129412
+ POSITION_ID:18, //持仓量
129413
+
129414
+ AMPLITUDE_ID:22, //振幅
129415
+
129416
+ LIMIT_HIGH_ID:23, //涨停价
129417
+ LIMIT_LOW_ID:24, //跌停价
129418
+
129419
+ VOL_IN_ID:25, //内盘
129420
+ VOL_OUT_ID:26, //外盘
129421
+ NAME_EX_ID:27, //扩展名字
129422
+ CLOSE_LINE_ID:28, //收盘价线
129423
+ KLINE_ID:29, //K线
129424
+
129425
+ CUSTOM_STRING_TEXT_ID:100, //自定义字符串文本
129426
+ CUSTOM_NUMBER_TEXT_ID:101, //自定义数值型
129427
+ CUSTOM_DATETIME_TEXT_ID:102, //自定义日期类型
129428
+ CUSTOM_ICON_ID:103, //自定义图标
129429
+ }
129430
+
129431
+ var MAP_TREPORT_COLUMN_FIELD=new Map(
129432
+ [
129433
+ [TREPORT_COLUMN_ID.SYMBOL_ID, "Symbol"],
129434
+ [TREPORT_COLUMN_ID.NAME_ID, "Name"],
129435
+ [TREPORT_COLUMN_ID.PRICE_ID, "Price"],
129436
+ [TREPORT_COLUMN_ID.INCREASE_ID, "Increase"],
129437
+ [TREPORT_COLUMN_ID.UPDOWN_ID, "UpDown"],
129438
+ [TREPORT_COLUMN_ID.VOL_ID, "Vol"],
129439
+ [TREPORT_COLUMN_ID.BUY_PRICE_ID, "BuyPrice"],
129440
+ [TREPORT_COLUMN_ID.SELL_PRICE_ID, "SellPrice"],
129441
+ [TREPORT_COLUMN_ID.AMOUNT_ID, "Amount"],
129442
+ [TREPORT_COLUMN_ID.BUY_VOL_ID, "BuyVol"],
129443
+ [TREPORT_COLUMN_ID.SELL_VOL_ID, "SellVol"],
129444
+ [TREPORT_COLUMN_ID.YCLOSE_ID, "YClose"],
129445
+ [TREPORT_COLUMN_ID.OPEN_ID, "Open"],
129446
+ [TREPORT_COLUMN_ID.HIGH_ID, "High"],
129447
+ [TREPORT_COLUMN_ID.LOW_ID, "Low"],
129448
+ [TREPORT_COLUMN_ID.AVERAGE_PRICE_ID,"AvPrice"],
129449
+ [TREPORT_COLUMN_ID.POSITION_ID,"Position"],
129450
+ ]);
129451
+
129452
+
129453
+ function ChartTReport()
129454
+ {
129455
+ this.Canvas; //画布
129456
+ this.ChartBorder; //边框信息
129457
+ this.ChartFrame; //框架画法
129458
+ this.Name; //名称
129459
+ this.ClassName='ChartTReport'; //类名
129460
+ this.UIElement;
129461
+ this.IsDrawFirst=false;
129462
+ this.GetEventCallback; //获取事件
129463
+ this.GetExePriceDataCallback; //获取行权价格数据
129464
+ this.GetFlashBGDataCallback; //获取闪烁背景
129465
+ this.GetBlockDataCallback; //获取当前板块的数据
129466
+ this.Data; //数据 { XOffset:0, YOffset:0, Data:[ 50000.0, 500025.0] }
129467
+ this.BorderData;
129468
+ this.FixedRowData; //固定行
129469
+ this.SortInfo; //排序信息 { Field:排序字段id, Sort:0 不排序 1升序 2降序, CellType: }
129470
+ this.FixedColumn=2; //固定列
129471
+ this.FixedRowCount=0; //固定行
129472
+
129473
+ this.IsShowHeader=true; //是否显示表头
129474
+ this.SizeChange=true;
129475
+
129476
+ this.SelectedRow; //{ ExePrice:exePrice, CellType:0 }
129477
+ this.RectSelectedRow;
129478
+ this.IsDrawBorder=1; //是否绘制单元格边框
129479
+
129480
+ this.ShowSymbol=[]; //显示的列表 { ExePrice:行权价格 }
129481
+
129482
+ this.GlobalOption;
129483
+
129484
+ //涨跌颜色
129485
+ this.UpColor=g_JSChartResource.TReport.UpTextColor;
129486
+ this.DownColor=g_JSChartResource.TReport.DownTextColor;
129487
+ this.UnchangeColor=g_JSChartResource.TReport.UnchangeTextColor;
129488
+
129489
+ this.BorderColor=g_JSChartResource.TReport.BorderColor; //边框线
129490
+ this.SelectedColor=g_JSChartResource.TReport.SelectedColor; //选中行
129491
+
129492
+ this.UpBGColor=g_JSChartResource.TReport.UpBGColor;
129493
+ this.DownBGColor=g_JSChartResource.TReport.DownBGColor;
129494
+
129495
+ //表头配置
129496
+ this.HeaderFontConfig={ Size:g_JSChartResource.TReport.Header.Font.Size, Name:g_JSChartResource.TReport.Header.Font.Name };
129497
+ this.HeaderColor=g_JSChartResource.TReport.Header.Color;
129498
+ this.SortColor=g_JSChartResource.TReport.Header.SortColor; //排序箭头颜色
129499
+ this.HeaderMergin=
129500
+ {
129501
+ Left:g_JSChartResource.TReport.Header.Mergin.Left,
129502
+ Right:g_JSChartResource.TReport.Header.Mergin.Right,
129503
+ Top:g_JSChartResource.TReport.Header.Mergin.Top,
129504
+ Bottom:g_JSChartResource.TReport.Header.Mergin.Bottom
129505
+ };
129506
+
129507
+ this.MarkBorderConfig={ MaxPositionColor: g_JSChartResource.TReport.MarkBorder.MaxPositionColor };
129508
+
129509
+ //表格内容配置
129510
+ this.ItemFontConfig={ Size:g_JSChartResource.TReport.Item.Font.Size, Name:g_JSChartResource.TReport.Item.Font.Name };
129511
+ this.ItemMergin=
129512
+ {
129513
+ Left:g_JSChartResource.TReport.Item.Mergin.Left,
129514
+ Right:g_JSChartResource.TReport.Item.Mergin.Right,
129515
+ Top:g_JSChartResource.TReport.Item.Mergin.Top,
129516
+ Bottom:g_JSChartResource.TReport.Item.Mergin.Bottom
129517
+ };
129518
+
129519
+ this.CenterItemConfig=
129520
+ {
129521
+ TextColor:g_JSChartResource.TReport.CenterItem.TextColor,
129522
+ BaseTextColor:g_JSChartResource.TReport.CenterItem.BaseTextColor,
129523
+ BGColor: g_JSChartResource.TReport.CenterItem.BGColor
129524
+ };
129525
+
129526
+ //缓存
129527
+ this.HeaderFont=12*GetDevicePixelRatio() +"px 微软雅黑";
129528
+ this.ItemFont=15*GetDevicePixelRatio() +"px 微软雅黑";
129529
+ this.ItemFixedFont=15*GetDevicePixelRatio() +"px 微软雅黑";
129530
+ this.ItemSymbolFont=12*GetDevicePixelRatio() +"px 微软雅黑";
129531
+ this.ItemNameFont=15*GetDevicePixelRatio() +"px 微软雅黑";
129532
+ this.ItemNameHeight=0;
129533
+ this.RowCount=0; //一屏显示行数
129534
+ this.HeaderHeight=0; //表头高度
129535
+ this.RowHeight=0; //行高度
129536
+ this.IsShowAllColumn=false; //是否已显示所有列
129537
+ this.ItemExtraWidth=0; //每列额外的宽度
129538
+
129539
+ this.Column= //{ Type:列id, Title:标题, TextAlign:文字对齐方式, MaxText:文字最大宽度 , TextColor:文字颜色, Sort:0=不支持排序 1=本地排序 0=远程排序 }
129540
+ [
129541
+ { Type:TREPORT_COLUMN_ID.PRICE_ID, Title:"现价", TextAlign:"right", Width:null, MaxText:"-888.88" },
129542
+ { Type:TREPORT_COLUMN_ID.INCREASE_ID, Title:"涨幅%", TextAlign:"right", Width:null, MaxText:"-888.88" },
129543
+ { Type:TREPORT_COLUMN_ID.BUY_PRICE_ID, Title:"买价", TextAlign:"right", Width:null, MaxText:"-888.88" },
129544
+ { Type:TREPORT_COLUMN_ID.BUY_VOL_ID, Title:"买量", TextAlign:"right", Width:null, MaxText:"88888", TextColor:g_JSChartResource.TReport.FieldColor.Vol },
129545
+
129546
+ //{ Type:TREPORT_COLUMN_ID.SELL_PRICE_ID, Title:"卖价", TextAlign:"right", Width:null, MaxText:"-888.88" },
129547
+ //{ Type:TREPORT_COLUMN_ID.SELL_VOL_ID, Title:"卖量", TextAlign:"right", Width:null, MaxText:"88888", TextColor:g_JSChartResource.TReport.FieldColor.Vol },
129548
+
129549
+ //{ Type:TREPORT_COLUMN_ID.POSITION_ID, Title:"持仓量", TextAlign:"right", Width:null, MaxText:"88888", TextColor:g_JSChartResource.TReport.FieldColor.Position },
129550
+
129551
+ { Type:TREPORT_COLUMN_ID.NAME_ID, Title:"合约代码", TextAlign:"right", Width:null, TextColor:g_JSChartResource.TReport.FieldColor.Name, MaxText:"AAAAAA-A-AAAA"},
129552
+
129553
+ ];
129554
+
129555
+ this.CenterColumn={ Type:TREPORT_COLUMN_ID.EXE_PRICE_ID, Title:"购<行权价>沽", TextAlign:"center", Width:null, MaxText:"99999.99", Sort:1, SortType:[1,2] }
129556
+
129557
+ this.RectClient={};
129558
+
129559
+ this.TooltipRect=[];
129560
+
129561
+ this.ReloadResource=function(resource)
129562
+ {
129563
+ }
129564
+
129565
+ this.SetColumn=function(aryColumn)
129566
+ {
129567
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryColumn)) return;
129568
+
129569
+ this.Column=[];
129570
+ for(var i=0;i<aryColumn.length;++i)
129571
+ {
129572
+ var item=aryColumn[i];
129573
+ var colItem=this.GetDefaultColunm(item.Type);
129574
+ if (!colItem) continue;
129575
+
129576
+ if (item.Title) colItem.Title=item.Title;
129577
+ if (item.TextAlign) colItem.TextAlign=item.TextAlign;
129578
+ if (item.TextColor) colItem.TextColor=item.TextColor;
129579
+ if (item.MaxText) colItem.MaxText=item.MaxText;
129580
+ if (item.ID) colItem.ID=item.ID;
129581
+ if (IFrameSplitOperator.IsNumber(item.Sort)) colItem.Sort=item.Sort;
129582
+ if (IFrameSplitOperator.IsBool(item.EnableTooltip)) colItem.EnableTooltip=item.EnableTooltip;
129583
+ if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
129584
+
129585
+ if (item.Sort==1) //1本地排序 2=远程排序
129586
+ {
129587
+ colItem.SortType=[1,2]; //默认 降序 ,升序
129588
+ if (IFrameSplitOperator.IsNonEmptyArray(item.SortType)) colItem.SortType=item.SortType.slice();
129589
+ }
129590
+
129591
+ this.Column.push(colItem);
129592
+ }
129593
+ }
129594
+
129595
+ this.GetDefaultColunm=function(id)
129596
+ {
129597
+ var DEFAULT_COLUMN=
129598
+ [
129599
+ { Type:TREPORT_COLUMN_ID.INDEX_ID, Title:"序号", TextAlign:"center", Width:null, TextColor:g_JSChartResource.TReport.FieldColor.Index, MaxText:"8888"},
129600
+ { Type:TREPORT_COLUMN_ID.SYMBOL_ID, Title:"代码", TextAlign:"right", Width:null, TextColor:g_JSChartResource.TReport.FieldColor.Symbol, MaxText:"888888"},
129601
+ { Type:TREPORT_COLUMN_ID.NAME_ID, Title:"合约名称", TextAlign:"right", Width:null, TextColor:g_JSChartResource.TReport.FieldColor.Name, MaxText:"AAAAAA-A-AAAA" },
129602
+
129603
+ { Type:TREPORT_COLUMN_ID.INCREASE_ID, Title:"涨幅%", TextAlign:"right", Width:null, MaxText:"-888.88", Sort:1, SortType:[1,2,0] },
129604
+ { Type:TREPORT_COLUMN_ID.PRICE_ID, Title:"现价", TextAlign:"right", Width:null, MaxText:"88888.88", Sort:1, SortType:[1,2,0] },
129605
+ { Type:TREPORT_COLUMN_ID.UPDOWN_ID, Title:"涨跌", TextAlign:"right", Width:null, MaxText:"-888.88", Sort:1, SortType:[1,2,0] },
129606
+ { Type:TREPORT_COLUMN_ID.AMPLITUDE_ID, Title:"振幅%", TextAlign:"right", Width:null, MaxText:"888.88", Sort:1, SortType:[1,2,0] },
129607
+ { Type:TREPORT_COLUMN_ID.BUY_PRICE_ID, Title:"买价", TextAlign:"right", Width:null, MaxText:"88888.88", Sort:1, SortType:[1,2,0] },
129608
+ { Type:TREPORT_COLUMN_ID.SELL_PRICE_ID, Title:"卖价", TextAlign:"right", Width:null, MaxText:"88888.88", Sort:1, SortType:[1,2,0] },
129609
+ { Type:TREPORT_COLUMN_ID.AVERAGE_PRICE_ID, Title:"均价", TextAlign:"right", Width:null, MaxText:"88888.88", Sort:1, SortType:[1,2,0] },
129610
+ { Type:TREPORT_COLUMN_ID.OPEN_ID, Title:"今开", TextAlign:"right", Width:null, MaxText:"88888.88", Sort:1, SortType:[1,2,0] },
129611
+ { Type:TREPORT_COLUMN_ID.HIGH_ID, Title:"最高", TextAlign:"right", Width:null, MaxText:"88888.88", Sort:1, SortType:[1,2,0] },
129612
+ { Type:TREPORT_COLUMN_ID.LOW_ID, Title:"最低", TextAlign:"right", Width:null, MaxText:"88888.88", Sort:1, SortType:[1,2,0] },
129613
+ { Type:TREPORT_COLUMN_ID.YCLOSE_ID, Title:"昨收", TextAlign:"right", Width:null, MaxText:"88888.88", Sort:1, SortType:[1,2,0] },
129614
+
129615
+ { Type:TREPORT_COLUMN_ID.POSITION_ID, Title:"持仓量", TextAlign:"right", Width:null, MaxText:"88888", Sort:1, SortType:[1,2,0], TextColor:g_JSChartResource.TReport.FieldColor.Position },
129616
+
129617
+ { Type:TREPORT_COLUMN_ID.VOL_ID, Title:"总量", TextAlign:"right", TextColor:g_JSChartResource.TReport.FieldColor.Vol, Width:null, MaxText:"88888", Sort:1, SortType:[1,2,0] },
129618
+ { Type:TREPORT_COLUMN_ID.AMOUNT_ID, Title:"总金额", TextAlign:"right", TextColor:g_JSChartResource.TReport.FieldColor.Amount, Width:null, MaxText:"8888.8擎", Sort:1, SortType:[1,2,0] },
129619
+
129620
+ { Type:TREPORT_COLUMN_ID.BUY_VOL_ID, Title:"买量", TextAlign:"right", TextColor:g_JSChartResource.TReport.FieldColor.Vol, Width:null, MaxText:"88888", Sort:1, SortType:[1,2,0] },
129621
+ { Type:TREPORT_COLUMN_ID.SELL_VOL_ID, Title:"卖量", TextAlign:"right", TextColor:g_JSChartResource.TReport.FieldColor.Vol, Width:null, MaxText:"88888", Sort:1, SortType:[1,2,0] },
129622
+ ];
129623
+
129624
+ for(var i=0;i<DEFAULT_COLUMN.length;++i)
129625
+ {
129626
+ var item=DEFAULT_COLUMN[i];
129627
+ if (item.Type==id) return item;
129628
+ }
129629
+
129630
+ return null;
129631
+ }
129632
+
129633
+ this.Draw=function()
129634
+ {
129635
+ this.ShowSymbol=[];
129636
+ this.TooltipRect=[];
129637
+ this.RectSelectedRow=null;
129638
+
129639
+ if (this.GlobalOption) this.GlobalOption.FlashBGCount=0;
129640
+
129641
+ if (this.SizeChange) this.CalculateSize();
129642
+ else this.UpdateCacheData();
129643
+
129644
+ this.Canvas.save();
129645
+
129646
+ this.Canvas.beginPath();
129647
+ this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-this.RectClient.Top));
129648
+ //this.Canvas.stroke(); //调试用
129649
+ this.Canvas.clip();
129650
+
129651
+ this.DrawHeader();
129652
+ this.DrawBody();
129653
+ this.Canvas.restore();
129654
+
129655
+ //this.DrawBorder();
129656
+
129657
+ this.SizeChange=false;
129658
+ }
129659
+
129660
+ //更新缓存变量
129661
+ this.UpdateCacheData=function()
129662
+ {
129663
+ this.RectClient.Left=this.ChartBorder.GetLeft();
129664
+ this.RectClient.Right=this.ChartBorder.GetRight();
129665
+ this.RectClient.Top=this.ChartBorder.GetTop();
129666
+ this.RectClient.Bottom=this.ChartBorder.GetBottom();
129667
+ }
129668
+
129669
+ this.CalculateSize=function() //计算大小
129670
+ {
129671
+ this.UpdateCacheData();
129672
+
129673
+ var pixelRatio=GetDevicePixelRatio();
129674
+ this.HeaderFont=`${this.HeaderFontConfig.Size*pixelRatio}px ${ this.HeaderFontConfig.Name}`;
129675
+ this.ItemFont=`${this.ItemFontConfig.Size*pixelRatio}px ${ this.ItemFontConfig.Name}`;
129676
+
129677
+ this.RowHeight=this.GetFontHeight(this.ItemFont,"擎")+ this.ItemMergin.Top+ this.ItemMergin.Bottom;
129678
+
129679
+ this.Canvas.font=this.ItemFont;
129680
+ var itemWidth=0;
129681
+ for(var i=0;i<this.Column.length;++i)
129682
+ {
129683
+ var item=this.Column[i];
129684
+ if (IFrameSplitOperator.IsNumber(item.FixedWidth)) itemWidth=item.FixedWidth;
129685
+ else itemWidth=this.Canvas.measureText(item.MaxText).width;
129686
+
129687
+ item.Width=itemWidth+4+this.ItemMergin.Left+this.ItemMergin.Right;
129688
+ }
129689
+
129690
+ //表头中间列
129691
+ var item=this.CenterColumn;
129692
+ if (IFrameSplitOperator.IsNumber(item.FixedWidth)) itemWidth=item.FixedWidth;
129693
+ else itemWidth=this.Canvas.measureText(item.MaxText).width;
129694
+ item.Width=itemWidth+4+this.ItemMergin.Left+this.ItemMergin.Right;
129695
+
129696
+ this.Canvas.font=this.HeaderFont;
129697
+ for(var i=0;i<this.Column.length;++i)
129698
+ {
129699
+ var item=this.Column[i];
129700
+ if (!item.Title || item.Title.length<=0) continue;
129701
+ var text=item.Title;
129702
+ if (item.Sort>0) text+="↓";
129703
+ itemWidth=this.Canvas.measureText(text).width;
129704
+ itemWidth+=(4+this.HeaderMergin.Left+this.HeaderMergin.Right);
129705
+ if (item.Width<itemWidth) item.Width=itemWidth;
129706
+ }
129707
+
129708
+ //表头中间列
129709
+ var item=this.CenterColumn;
129710
+ if (!item.Title || item.Title.length>0)
129711
+ {
129712
+ var text=item.Title;
129713
+ if (item.Sort>0) text+="↓";
129714
+ itemWidth=this.Canvas.measureText(text).width;
129715
+ itemWidth+=(4+this.HeaderMergin.Left+this.HeaderMergin.Right);
129716
+ if (item.Width<itemWidth) item.Width=itemWidth;
129717
+ }
129718
+
129719
+
129720
+ this.HeaderHeight=this.GetFontHeight(this.HeaderFont,"擎")+ this.HeaderMergin.Top+ this.HeaderMergin.Bottom;
129721
+ if (!this.IsShowHeader) this.HeaderHeight=0;
129722
+
129723
+ this.RowCount=parseInt((this.RectClient.Bottom-this.RectClient.Top-this.HeaderHeight)/this.RowHeight);
129724
+
129725
+ var subWidth=this.CenterColumn.Width;
129726
+ var reportWidth=this.RectClient.Right-this.RectClient.Left;
129727
+ for(var i=0;i<this.Column.length;++i)
129728
+ {
129729
+ var item=this.Column[i];
129730
+ subWidth+=item.Width*2;
129731
+ }
129732
+
129733
+ if (subWidth<reportWidth)
129734
+ {
129735
+ this.IsShowAllColumn=true;
129736
+ this.ItemExtraWidth=0;
129737
+ if (reportWidth-subWidth-4>0)
129738
+ this.ItemExtraWidth=(reportWidth-subWidth-4)/(this.Column.length*2+1);
129739
+ }
129740
+ else
129741
+ {
129742
+ this.IsShowAllColumn=false;
129743
+ this.ItemExtraWidth=0;
129744
+ }
129745
+ }
129746
+
129747
+ this.DrawHeader=function()
129748
+ {
129749
+ if (!this.IsShowHeader) return;
129750
+
129751
+ var left=this.RectClient.Left;
129752
+ var top=this.RectClient.Top;
129753
+ var y=top+this.HeaderMergin.Top+(this.HeaderHeight-this.HeaderMergin.Top-this.HeaderMergin.Bottom)/2;
129754
+ var xCenter=(this.RectClient.Right-this.RectClient.Left)/2+this.RectClient.Left;
129755
+
129756
+ this.Canvas.font=this.HeaderFont;
129757
+ this.Canvas.fillStyle=this.HeaderColor;
129758
+
129759
+ var reportleft=this.RectClient.Left;
129760
+ var reportRight=this.RectClient.Right;
129761
+
129762
+ //中间列
129763
+ var item=this.CenterColumn;
129764
+ var rtCenterItem=this.GetCenterItemRect();
129765
+ if (this.SortInfo && this.SortInfo.Sort>0 && this.SortInfo.CellType==0)
129766
+ this.DrawSortHeader(item.Title,item.TextAlign,rtCenterItem.Left,y,rtCenterItem.TextWidth,this.SortInfo.Sort);
129767
+ else
129768
+ this.DrawText(item.Title,item.TextAlign,rtCenterItem.Left,y,rtCenterItem.TextWidth);
129769
+
129770
+ var xLeft=rtCenterItem.Left; //左边
129771
+ var xRight=rtCenterItem.Right;//右边
129772
+ for(var i=this.Data.XOffset;i<this.Column.length;++i)
129773
+ {
129774
+ var item=this.Column[i];
129775
+ var itemWidth=item.Width+this.ItemExtraWidth;
129776
+ var textWidth=itemWidth-this.HeaderMergin.Left-this.HeaderMergin.Right;
129777
+ var x=xLeft-itemWidth+this.HeaderMergin.Left;
129778
+
129779
+ if (xLeft-itemWidth<reportleft) break;
129780
+
129781
+ var bSort=(this.SortInfo && this.SortInfo.Field==i && this.SortInfo.Sort>0);
129782
+ if (bSort && this.SortInfo.CellType==1) this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort);
129783
+ else this.DrawText(item.Title,item.TextAlign,x,y,textWidth);
129784
+ xLeft-=itemWidth;
129785
+
129786
+ var x=xRight+this.HeaderMergin.Left;
129787
+ if (bSort && this.SortInfo.CellType==2) this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort);
129788
+ else this.DrawText(item.Title,item.TextAlign,x,y,textWidth);
129789
+ xRight+=itemWidth;
129790
+ }
129791
+ }
129792
+
129793
+ this.DrawSortHeader=function(text, textAlign, x, y, width, sortType)
129794
+ {
129795
+ var sortText=sortType==1?"↓":"↑";
129796
+ var sortTextWidth=this.Canvas.measureText(sortText).width;
129797
+ var textWidth=this.Canvas.measureText(text).width+2;
129798
+ this.Canvas.textBaseline="middle";
129799
+ this.Canvas.textAlign="left";
129800
+
129801
+ if (textAlign=='center')
129802
+ {
129803
+ x=x+width/2-(sortTextWidth+textWidth)/2;
129804
+ }
129805
+ else if (textAlign=='right')
129806
+ {
129807
+ x=(x+width)-sortTextWidth-textWidth;
129808
+ }
129809
+ else
129810
+ {
129811
+
129812
+ }
129813
+
129814
+ this.Canvas.fillText(text,x,y);
129815
+ this.Canvas.fillStyle=this.SortColor;
129816
+ this.Canvas.fillText(sortText,x+textWidth,y);
129817
+ this.Canvas.fillStyle=this.HeaderColor;
129818
+ }
129819
+
129820
+ this.DrawText=function(text, textAlign, x, y, textWidth)
129821
+ {
129822
+ if (textAlign=='center')
129823
+ {
129824
+ x=x+textWidth/2;
129825
+ this.Canvas.textAlign="center";
129826
+ }
129827
+ else if (textAlign=='right')
129828
+ {
129829
+ x=x+textWidth;
129830
+ this.Canvas.textAlign="right";
129831
+ }
129832
+ else
129833
+ {
129834
+ this.Canvas.textAlign="left";
129835
+ }
129836
+
129837
+ this.Canvas.textBaseline="middle";
129838
+ this.Canvas.fillText(text,x,y);
129839
+ }
129840
+
129841
+ this.GetFontHeight=function(font,word)
129842
+ {
129843
+ return GetFontHeight(this.Canvas, font, word);
129844
+ }
129845
+
129846
+ this.DrawBody=function()
129847
+ {
129848
+ if (!this.Data) return;
129849
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
129850
+
129851
+ this.Canvas.font=this.ItemFont;
129852
+ var top=this.RectClient.Top+this.HeaderHeight;
129853
+ var left=this.RectClient.Left;
129854
+ var rowWidth=this.RectClient.Right-this.RectClient.Left;
129855
+
129856
+ var textTop=top;
129857
+ this.Canvas.font=this.ItemFont;
129858
+ for(var i=this.Data.YOffset, j=0; i<this.Data.Data.length && j<this.RowCount ;++i, ++j)
129859
+ {
129860
+ var exePrice=this.Data.Data[i];
129861
+
129862
+ this.DrawRow(exePrice, textTop, i);
129863
+
129864
+ this.ShowSymbol.push( { Index:i, ExePrice:exePrice } );
129865
+
129866
+ textTop+=this.RowHeight;
129867
+ }
129868
+
129869
+ if (this.RectSelectedRow)
129870
+ {
129871
+ this.Canvas.fillStyle=this.SelectedColor;
129872
+ var lineWidth=2;
129873
+ this.Canvas.fillRect(this.RectSelectedRow.Left,this.RectSelectedRow.Bottom-lineWidth, (this.RectSelectedRow.Right-this.RectSelectedRow.Left), lineWidth);
129874
+ }
129875
+ }
129876
+
129877
+ this.GetCenterItemRect=function()
129878
+ {
129879
+ var xCenter=(this.RectClient.Right-this.RectClient.Left)/2+this.RectClient.Left;
129880
+
129881
+ //中间列
129882
+ var item=this.CenterColumn;
129883
+ var itemWidth=item.Width+this.ItemExtraWidth;
129884
+ var left=xCenter-itemWidth/2;
129885
+ var right=xCenter+itemWidth/2;
129886
+ var textWidth=itemWidth-this.HeaderMergin.Left-this.HeaderMergin.Right;
129887
+
129888
+ return { Left:left, Right:right, TextWidth:textWidth, Width:itemWidth };
129889
+ }
129890
+
129891
+ this.DrawRow=function(exePrice, top, dataIndex)
129892
+ {
129893
+ var rtCenterItem=this.GetCenterItemRect();
129894
+
129895
+ var xLeft=rtCenterItem.Left; //左边
129896
+ var xRight=rtCenterItem.Right; //右边
129897
+
129898
+ var reportleft=this.RectClient.Left;
129899
+ var reportRight=this.RectClient.Right;
129900
+
129901
+ var data= { ExePrice:exePrice , TData:null };
129902
+ if (this.GetExePriceDataCallback) data.TData=this.GetExePriceDataCallback(exePrice);
129903
+ if (this.GetFlashBGDataCallback && data.TData)
129904
+ {
129905
+ if (data.TData.LeftData) //左侧
129906
+ {
129907
+ var item=data.TData.LeftData;
129908
+ data.TData.LeftFlashBG=this.GetFlashBGDataCallback(item.Symbol, Date.now());
129909
+ }
129910
+
129911
+ if (data.TData.RightData) //右侧
129912
+ {
129913
+ var item=data.TData.RightData;
129914
+ data.TData.RightFlashBG=this.GetFlashBGDataCallback(item.Symbol, Date.now());
129915
+ }
129916
+ }
129917
+
129918
+ data.Decimal=2;
129919
+
129920
+ var bSelected=false;
129921
+ if (this.SelectedRow && this.SelectedRow.ExePrice==exePrice) bSelected=true;
129922
+
129923
+ var rtItem={ Left:xLeft, Right:xRight, Top:top, Height:this.RowHeight };
129924
+ rtItem.Bottom=rtItem.Top+rtItem.Height;
129925
+ rtItem.Width=rtItem.Right-rtItem.Left;
129926
+ this.DrawCenterItem(dataIndex, data, this.CenterColumn, rtItem, 0);
129927
+ if (bSelected && this.SelectedRow.CellType==0) this.RectSelectedRow=rtItem;
129928
+
129929
+ if (IFrameSplitOperator.IsNumber(this.Data.BaseExePrice))
129930
+ {
129931
+ var leftBGColor=null, rightBGColor=null;
129932
+ if (exePrice>this.Data.BaseExePrice)
129933
+ {
129934
+ leftBGColor=this.UpBGColor;
129935
+ rightBGColor=this.DownBGColor;
129936
+ }
129937
+ else
129938
+ {
129939
+ leftBGColor=this.DownBGColor;
129940
+ rightBGColor=this.UpBGColor;
129941
+ }
129942
+
129943
+ if (leftBGColor)
129944
+ {
129945
+ var rtBG={Left:reportleft+1, Right:rtCenterItem.Left, Top:top, Height:this.RowHeight };
129946
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
129947
+ rtBG.Width=rtBG.Right-rtBG.Left;
129948
+ this.Canvas.fillStyle=leftBGColor;
129949
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
129950
+ }
129951
+
129952
+ if (rightBGColor)
129953
+ {
129954
+ var rtBG={Left:rtCenterItem.Right, Right:reportRight, Top:top, Height:this.RowHeight };
129955
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
129956
+ rtBG.Width=rtBG.Right-rtBG.Left;
129957
+ this.Canvas.fillStyle=rightBGColor;
129958
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
129959
+ }
129960
+ }
129961
+
129962
+ for(var i=this.Data.XOffset;i<this.Column.length;++i)
129963
+ {
129964
+ var item=this.Column[i];
129965
+ var itemWidth=item.Width+this.ItemExtraWidth;
129966
+ xLeft-=itemWidth;
129967
+ if (xLeft<reportleft) break;
129968
+
129969
+ var leftData=null, rightData=null;
129970
+ if (data.TData) leftData=data.TData.LeftData;
129971
+ if (data.TData) rightData=data.TData.RightData;
129972
+
129973
+ rtItem={ Left:xLeft, Right:xLeft+itemWidth, Top:top, Height:this.RowHeight, Width:itemWidth };
129974
+ rtItem.Bottom=rtItem.Top+rtItem.Height;
129975
+
129976
+ this.DrawItem(dataIndex, data, leftData, item, rtItem, 1);
129977
+
129978
+ if (bSelected && this.SelectedRow.CellType==1)
129979
+ {
129980
+ if (!this.RectSelectedRow) this.RectSelectedRow=rtItem;
129981
+ else this.RectSelectedRow.Left=rtItem.Left;
129982
+ }
129983
+
129984
+ rtItem={ Left:xRight, Right:xRight+itemWidth, Top:top, Height:this.RowHeight, Width:itemWidth };
129985
+ rtItem.Bottom=rtItem.Top+rtItem.Height;
129986
+
129987
+ this.DrawItem(dataIndex, data, rightData, item, rtItem, 2);
129988
+ xRight+=itemWidth;
129989
+
129990
+ if (bSelected && this.SelectedRow.CellType==2)
129991
+ {
129992
+ if (!this.RectSelectedRow) this.RectSelectedRow=rtItem;
129993
+ else this.RectSelectedRow.Right=rtItem.Right;
129994
+ }
129995
+ }
129996
+ }
129997
+
129998
+ this.DrawCenterItem=function(index, data, column, rtItem, cellType) //cellType 0=中间字段 1=左侧 2=右侧
129999
+ {
130000
+ //tooltip提示
130001
+ if (column.EnableTooltip===true) this.TooltipRect.push({ Rect:rtItem, data:data, Index:index, Column:column, CellType:cellType });
130002
+
130003
+ var rtText={ Left:rtItem.Left+this.ItemMergin.Left, Right:rtItem.Right-this.ItemMergin.Right, Top:rtItem.Top+this.ItemMergin.Top, Bottom:rtItem.Bottom-this.ItemMergin.Bottom };
130004
+ rtText.Width=rtText.Right-rtText.Left;
130005
+ rtText.Height=rtText.Bottom-rtText.Top;
130006
+
130007
+ var drawInfo={ Text:null, TextColor:this.CenterItemConfig.TextColor, BGColor:this.CenterItemConfig.BGColor, TextAlign:column.TextAlign, Rect:rtItem, RectText:rtText };
130008
+ drawInfo.Text=`${data.ExePrice.toFixed(data.Decimal)}`;
130009
+
130010
+ this.DrawCell(drawInfo);
130011
+ }
130012
+
130013
+ this.DrawItem=function(index, exePriceData, data, column, rtItem, cellType)
130014
+ {
130015
+ if (column.EnableTooltip===true) this.TooltipRect.push({ Rect:rtItem, data:data, Index:index, Column:column, CellType:cellType });
130016
+
130017
+ var rtText={ Left:rtItem.Left+this.ItemMergin.Left, Right:rtItem.Right-this.ItemMergin.Right, Top:rtItem.Top+this.ItemMergin.Top, Bottom:rtItem.Bottom-this.ItemMergin.Bottom };
130018
+ rtText.Width=rtText.Right-rtText.Left;
130019
+ rtText.Height=rtText.Bottom-rtText.Top;
130020
+
130021
+ var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign, Rect:rtItem, RectText:rtText };
130022
+
130023
+ if (data)
130024
+ {
130025
+ switch(column.Type)
130026
+ {
130027
+ case TREPORT_COLUMN_ID.SYMBOL_ID:
130028
+ case TREPORT_COLUMN_ID.NAME_ID:
130029
+ var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);
130030
+ if (fieldName) drawInfo.Text=data[fieldName];
130031
+ break;
130032
+
130033
+ case TREPORT_COLUMN_ID.PRICE_ID: //最新价格
130034
+ case TREPORT_COLUMN_ID.BUY_PRICE_ID: //买价
130035
+ case TREPORT_COLUMN_ID.SELL_PRICE_ID: //卖价
130036
+ var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);
130037
+ if (fieldName) this.GetPriceDrawInfo(data[fieldName], data, exePriceData, drawInfo);
130038
+ break;
130039
+
130040
+ case TREPORT_COLUMN_ID.SELL_VOL_ID: //卖量
130041
+ case TREPORT_COLUMN_ID.BUY_VOL_ID: //买量
130042
+ case TREPORT_COLUMN_ID.POSITION_ID: //持仓量
130043
+ var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);
130044
+ if (fieldName) drawInfo.Text=this.FormatVolString(data[fieldName]);
130045
+ break;
130046
+ case TREPORT_COLUMN_ID.INCREASE_ID:
130047
+ case TREPORT_COLUMN_ID.UPDOWN_ID:
130048
+ case TREPORT_COLUMN_ID.AMPLITUDE_ID:
130049
+ var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);
130050
+ if (fieldName)
130051
+ {
130052
+ var value=data[fieldName];
130053
+ if (IFrameSplitOperator.IsNumber(value))
130054
+ {
130055
+ drawInfo.Text=value.toFixed(2);
130056
+ drawInfo.TextColor=this.GetUpDownColor(value,0);
130057
+ }
130058
+ else
130059
+ {
130060
+ this.GetNullDrawInfo(drawInfo);
130061
+ }
130062
+ }
130063
+ break;
130064
+
130065
+ default:
130066
+ drawInfo.Text=`-----`;
130067
+ }
130068
+
130069
+ this.GetMarkBorderData(drawInfo, exePriceData.ExePrice, column.Type, cellType);
130070
+ this.GetFlashBGData(drawInfo, exePriceData, column.Type, cellType);
130071
+ }
130072
+
130073
+ this.DrawCell(drawInfo, exePriceData, column.Type, cellType);
130074
+ }
130075
+
130076
+ this.GetFlashBGData=function(drawInfo, exePriceData, columnType, cellType)
130077
+ {
130078
+ if (!exePriceData.TData) return;
130079
+
130080
+ var data=null;
130081
+ if (cellType==1) data=exePriceData.TData.LeftFlashBG;
130082
+ else if (cellType==2) data=exePriceData.TData.RightFlashBG;
130083
+
130084
+ if (!data || !data.Data) return;
130085
+
130086
+ if (data.Data.has(columnType))
130087
+ {
130088
+ var item=data.Data.get(columnType);
130089
+ drawInfo.FlashBGColor=item.Color;
130090
+ --item.Count;
130091
+
130092
+ if (this.GlobalOption) ++this.GlobalOption.FlashBGCount;
130093
+ }
130094
+ }
130095
+
130096
+ this.GetMarkBorderData=function(drawInfo, exePrice, columnType, cellType)
130097
+ {
130098
+ if (!this.BorderData || !this.BorderData.MapData) return;
130099
+ if (!this.BorderData.MapData.has(columnType)) return;
130100
+ var borderData=this.BorderData.MapData.get(columnType);
130101
+ if (!IFrameSplitOperator.IsNonEmptyArray(borderData.Data)) return;
130102
+
130103
+ if (cellType==1)
130104
+ {
130105
+ var leftBorder=borderData.Data[1];
130106
+ if (!leftBorder) return;
130107
+
130108
+ if (leftBorder.ExePrice==exePrice)
130109
+ {
130110
+ drawInfo.BorderColor=this.MarkBorderConfig.MaxPositionColor;
130111
+ }
130112
+
130113
+ }
130114
+ else if (cellType==2)
130115
+ {
130116
+ var rightBorder=borderData.Data[2];
130117
+ if (!rightBorder) return;
130118
+ if (rightBorder.ExePrice==exePrice)
130119
+ {
130120
+ drawInfo.BorderColor=this.MarkBorderConfig.MaxPositionColor;
130121
+ }
130122
+ }
130123
+ }
130124
+
130125
+ this.GetNullDrawInfo=function(drawInfo)
130126
+ {
130127
+ drawInfo.Text="--";
130128
+ drawInfo.TextColor=this.UnchangeColor;
130129
+ }
130130
+
130131
+ this.GetPriceDrawInfo=function(price, stock, data, drawInfo)
130132
+ {
130133
+ if (!IFrameSplitOperator.IsNumber(price))
130134
+ {
130135
+ this.GetNullDrawInfo(drawInfo);
130136
+ return;
130137
+ }
130138
+
130139
+ drawInfo.Text=price.toFixed(data.Decimal);
130140
+ if (!IFrameSplitOperator.IsNumber(stock.YClose))
130141
+ drawInfo.TextColor=this.UnchangeColor;
130142
+ else
130143
+ drawInfo.TextColor=this.GetUpDownColor(price, stock.YClose);
130144
+ }
130145
+
130146
+ //单独处理成交量显示
130147
+ this.FormatVolString=function(value,languageID)
130148
+ {
130149
+ if (!IFrameSplitOperator.IsNumber(value)) return null;
130150
+
130151
+ return IFrameSplitOperator.FormatVolString(value, languageID);
130152
+ }
130153
+
130154
+ this.GetUpDownColor=function(price, price2)
130155
+ {
130156
+ if (price>price2) return this.UpColor;
130157
+ else if (price<price2) return this.DownColor;
130158
+ else return this.UnchangeColor;
130159
+ }
130160
+
130161
+ this.DrawCell=function(drawInfo)
130162
+ {
130163
+ var rtText=drawInfo.RectText;
130164
+ var yCenter=rtText.Top+(rtText.Height/2);
130165
+
130166
+ if (drawInfo.BGColor) //背景
130167
+ {
130168
+ var rtItem=drawInfo.Rect;
130169
+ this.Canvas.fillStyle=drawInfo.BGColor;
130170
+ this.Canvas.fillRect(rtItem.Left,rtItem.Top,rtItem.Width,rtItem.Height);
130171
+ }
130172
+
130173
+ if (drawInfo.FlashBGColor) //闪动背景
130174
+ {
130175
+ var rtItem=drawInfo.Rect;
130176
+ this.Canvas.fillStyle=drawInfo.FlashBGColor;
130177
+ this.Canvas.fillRect(rtItem.Left,rtItem.Top,rtItem.Width,rtItem.Height);
130178
+ }
130179
+
130180
+ if (drawInfo.BorderColor) //边框
130181
+ {
130182
+ var rtItem=drawInfo.Rect;
130183
+ this.Canvas.strokeStyle=drawInfo.BorderColor;
130184
+ this.Canvas.strokeRect(ToFixedPoint(rtItem.Left),ToFixedPoint(rtItem.Top+1),ToFixedRect(rtItem.Width),ToFixedRect(rtItem.Height-3));
130185
+ }
130186
+
130187
+ if (drawInfo.Text) //文字
130188
+ {
130189
+ if(drawInfo.TextColor) this.Canvas.fillStyle=drawInfo.TextColor;
130190
+ this.DrawText(drawInfo.Text, drawInfo.TextAlign, rtText.Left, yCenter, rtText.Width);
130191
+ }
130192
+ }
130193
+
130194
+ this.OnMouseDown=function(x,y,e) //Type: 2=行 3=表头
130195
+ {
130196
+ if (!this.Data) return null;
130197
+
130198
+ var pixelTatio = GetDevicePixelRatio();
130199
+ var insidePoint={X:x/pixelTatio, Y:y/pixelTatio};
130200
+
130201
+ if (this.UIElement)
130202
+ var uiElement={Left:this.UIElement.getBoundingClientRect().left, Top:this.UIElement.getBoundingClientRect().top};
130203
+ else
130204
+ var uiElement={Left:null, Top:null};
130205
+
130206
+ var row=this.PtInBody(x,y);
130207
+ if (row)
130208
+ {
130209
+ var bRedraw=false;
130210
+ if (!this.SelectedRow)
130211
+ {
130212
+ this.SelectedRow={ ExePrice:row.ExePrice, CellType:row.CellType };
130213
+ bRedraw=true;
130214
+ }
130215
+ else if (this.SelectedRow.ExePrice!=row.ExePrice || this.SelectedRow.CellType!=row.CellType)
130216
+ {
130217
+ this.SelectedRow.ExePrice=row.ExePrice;
130218
+ this.SelectedRow.CellType=row.CellType;
130219
+ bRedraw=true;
130220
+ }
130221
+
130222
+ var eventID=JSCHART_EVENT_ID.ON_CLICK_TREPORT_ROW;
130223
+ if (e.button==2) eventID=JSCHART_EVENT_ID.ON_RCLICK_TREPORT_ROW;
130224
+
130225
+ this.SendClickEvent(eventID, { Data:row, X:x, Y:y, e:e, Inside:insidePoint, UIElement:uiElement });
130226
+
130227
+ return { Type:2, Redraw:bRedraw, Row:row }; //行
130228
+ }
130229
+
130230
+ var header=this.PtInHeader(x,y);
130231
+ if (header)
130232
+ {
130233
+ var eventID=JSCHART_EVENT_ID.ON_CLICK_TREPORT_HEADER;
130234
+ if (e.button==2)
130235
+ {
130236
+ eventID=JSCHART_EVENT_ID.ON_RCLICK_TREPORT_HEADER;
130237
+ }
130238
+ else if (e.button==0)
130239
+ {
130240
+ eventID=JSCHART_EVENT_ID.ON_CLICK_TREPORT_HEADER;
130241
+ }
130242
+
130243
+ this.SendClickEvent(eventID, { Data:header, X:x, Y:y , e:e, Inside:insidePoint, UIElement:uiElement});
130244
+ return { Type:3, Redraw:bRedraw, Header:header }; //表头
130245
+ }
130246
+
130247
+ return null;
130248
+ }
130249
+
130250
+ this.PtInBody=function(x,y)
130251
+ {
130252
+ if (!this.Data) return null;
130253
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return null;
130254
+
130255
+ var top=this.RectClient.Top+this.HeaderHeight;
130256
+ var left=this.RectClient.Left;
130257
+ var right=this.RectClient.Right;
130258
+
130259
+ var textTop=top;
130260
+ for(var i=this.Data.YOffset, j=0; i<this.Data.Data.length && j<this.RowCount ;++i, ++j)
130261
+ {
130262
+ var exePrice=this.Data.Data[i];
130263
+ var rtRow={ Left:left, Top:textTop, Right:right, Bottom: textTop+this.RowHeight };
130264
+ rtRow.Height=rtRow.Bottom-rtRow.Top;
130265
+ rtRow.Width=rtRow.Right-rtRow.Left;
130266
+ if (x>=rtRow.Left && x<=rtRow.Right && y>=rtRow.Top && y<=rtRow.Bottom)
130267
+ {
130268
+ var data={ RectRow:rtRow, DataIndex:i, Index:j, ExePrice:exePrice };
130269
+ return this.PtInItem(x,y, data);
130270
+ }
130271
+
130272
+ textTop+=this.RowHeight;
130273
+ }
130274
+
130275
+ return null;
130276
+ }
130277
+
130278
+ this.PtInItem=function(x, y, info, exePrice)
130279
+ {
130280
+ var rtCenterItem=this.GetCenterItemRect();
130281
+ var rtRow=info.RectRow;
130282
+ var rtCenter={Left:rtCenterItem.Left, Right:rtCenterItem.Right, Top:rtRow.Top, Height:rtRow.Height, Bottom:rtRow.Bottom };
130283
+
130284
+ if (x>=rtCenter.Left && x<=rtCenter.Right && y>=rtCenter.Top && y<=rtCenter.Bottom)
130285
+ {
130286
+ var data={ Rect:rtCenter, DataIndex:info.DataIndex, Index:info.Index , ExePrice:info.ExePrice, CellType:0, Column:this.CenterColumn };
130287
+ data.Item=this.GetExePriceDataCallback(info.ExePrice);
130288
+ return data;
130289
+ }
130290
+
130291
+ var xLeft=rtCenterItem.Left; //左边
130292
+ var xRight=rtCenterItem.Right; //右边
130293
+
130294
+ var reportleft=this.RectClient.Left;
130295
+ var reportRight=this.RectClient.Right;
130296
+
130297
+ for(var i=this.Data.XOffset;i<this.Column.length;++i)
130298
+ {
130299
+ var item=this.Column[i];
130300
+ var itemWidth=item.Width+this.ItemExtraWidth;
130301
+ xLeft-=itemWidth;
130302
+ if (xLeft<reportleft) break;
130303
+
130304
+ var rtItem={ Left:xLeft, Right:xLeft+itemWidth, Top:rtRow.Top, Height:rtRow.Height, Bottom:rtRow.Bottom, Width:itemWidth };
130305
+ if (x>=rtItem.Left && x<=rtItem.Right && y>=rtItem.Top && y<=rtItem.Bottom)
130306
+ {
130307
+ var data={ Rect:rtCenter, DataIndex:info.DataIndex, Index:info.Index , ExePrice:info.ExePrice, CellType:1, ColumnIndex:i, Column:item };
130308
+ data.Item=this.GetExePriceDataCallback(info.ExePrice);
130309
+ return data;
130310
+ }
130311
+
130312
+ rtItem={ Left:xRight, Right:xRight+itemWidth, Top:rtRow.Top, Height:rtRow.Height, Bottom:rtRow.Bottom, Width:itemWidth };
130313
+ if (x>=rtItem.Left && x<=rtItem.Right && y>=rtItem.Top && y<=rtItem.Bottom)
130314
+ {
130315
+ var data={ Rect:rtCenter, DataIndex:info.DataIndex, Index:info.Index , ExePrice:info.ExePrice, CellType:2, ColumnIndex:i, Column:item };
130316
+ data.Item=this.GetExePriceDataCallback(info.ExePrice);
130317
+ return data;
130318
+ }
130319
+
130320
+ xRight+=itemWidth;
130321
+ }
130322
+
130323
+ return null;
130324
+ }
130325
+
130326
+ this.PtInHeader=function(x,y)
130327
+ {
130328
+ if (!this.IsShowHeader) return null;
130329
+
130330
+ var left=this.RectClient.Left;
130331
+ var right=this.RectClient.Right;
130332
+ var top=this.RectClient.Top;
130333
+ var bottom=top+this.HeaderHeight;
130334
+
130335
+ if (!(x>=left && x<=right && y>=top && y<=bottom)) return null;
130336
+
130337
+ var rtHeader={Left:left, Right:right, Top:top, Bottom:bottom};
130338
+ rtHeader.Width=rtHeader.Right-rtHeader.Left;
130339
+ rtHeader.Height=rtHeader.Bottom-rtHeader.Top;
130340
+ var data={ RectRow:rtHeader, DataIndex:-1, Index:-1, ExePrice:null };
130341
+ return this.PtInItem(x,y, data);
130342
+ }
130343
+
130344
+ this.SendClickEvent=function(id, data)
130345
+ {
130346
+ var event=this.GetEventCallback(id);
130347
+ if (event && event.Callback)
130348
+ {
130349
+ event.Callback(event,data,this);
130350
+ }
130351
+ }
130352
+
130353
+
130354
+ this.GetCurrentPageStatus=function() //{ Start:起始索引, End:结束索引(数据), PageSize:页面可以显示几条记录, IsEnd:是否是最后一页, IsSinglePage:是否只有一页数据}
130355
+ {
130356
+ var result={ Start:this.Data.YOffset, PageSize:this.RowCount, IsEnd:false, SelectedRow:this.SelectedRow, IsSinglePage:false, DataCount:0 };
130357
+ if (IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))
130358
+ {
130359
+ result.End=this.Data.YOffset+this.RowCount-1;
130360
+ result.IsSinglePage=this.Data.Data.length<=this.RowCount;
130361
+ result.DataCount=this.Data.Data.length;
130362
+ if (result.End>=this.Data.Data.length-1) result.IsEnd=true;
130363
+ if (result.End>=this.Data.Data.length) result.End=this.Data.Data.length-1;
130364
+ }
130365
+ else
130366
+ {
130367
+ result.Start=0;
130368
+ result.End=0;
130369
+ result.IsEnd=true;
130370
+ result.IsSinglePage=true;
130371
+ }
130372
+
130373
+ return result;
130374
+ }
130375
+
130376
+ this.OnDblClick=function(x,y,e)
130377
+ {
130378
+ if (!this.Data) return false;
130379
+
130380
+ var row=this.PtInBody(x,y);
130381
+ if (row)
130382
+ {
130383
+ this.SendClickEvent(JSCHART_EVENT_ID.ON_DBCLICK_TREPORT_ROW, { Data:row, X:x, Y:y });
130384
+ return true;
130385
+ }
130386
+
130387
+ return false;
130388
+ }
130389
+
130390
+ }
130391
+
130392
+
130393
+ /*
130394
+ Copyright (c) 2018 jones
130395
+
130396
+ http://www.apache.org/licenses/LICENSE-2.0
130397
+
130398
+ 开源项目 https://github.com/jones2000/HQChart
130399
+
130400
+ jones_2000@163.com
130401
+
130402
+ 封装键盘精灵控件 (页面版 不支持手机)
130403
+ */
130404
+
130405
+
130406
+
130407
+ function JSKeyboardChart(divElement)
130408
+ {
130409
+ this.DivElement=divElement;
130410
+ this.JSChartContainer; //表格控件
130411
+
130412
+ //h5 canvas
130413
+ this.CanvasElement=document.createElement("canvas");
130414
+ this.CanvasElement.className='jskeyboard-drawing';
130415
+ this.CanvasElement.id=Guid();
130416
+ this.CanvasElement.setAttribute("tabindex",0);
130417
+ if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
130418
+ if(divElement.hasChildNodes())
130419
+ {
130420
+ JSConsole.Chart.Log("[JSKeyboardChart::JSRepoJSKeyboardChartrtChart] divElement hasChildNodes", divElement.childNodes);
130421
+ }
130422
+ divElement.appendChild(this.CanvasElement);
130423
+
130424
+
130425
+ this.OnSize=function()
130426
+ {
130427
+ //画布大小通过div获取
130428
+ var height=parseInt(this.DivElement.style.height.replace("px",""));
130429
+ this.CanvasElement.height=height;
130430
+ this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
130431
+ this.CanvasElement.style.width=this.CanvasElement.width+'px';
130432
+ this.CanvasElement.style.height=this.CanvasElement.height+'px';
130433
+
130434
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
130435
+ this.CanvasElement.height*=pixelTatio;
130436
+ this.CanvasElement.width*=pixelTatio;
130437
+
130438
+ JSConsole.Chart.Log(`[JSKeyboardChart::OnSize] devicePixelRatio=${window.devicePixelRatio}, height=${this.CanvasElement.height}, width=${this.CanvasElement.width}`);
130439
+
130440
+ if (this.JSChartContainer && this.JSChartContainer.OnSize)
130441
+ {
130442
+ this.JSChartContainer.OnSize();
130443
+ }
130444
+ }
130445
+
130446
+ this.SetOption=function(option)
130447
+ {
130448
+ var chart=this.CreateJSKeyboardChartContainer(option);
130449
+
130450
+ if (!chart) return false;
130451
+
130452
+ if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
130453
+
130454
+ this.JSChartContainer=chart;
130455
+ this.DivElement.JSChart=this; //div中保存一份
130456
+
130457
+ chart.Draw();
130458
+ }
130459
+
130460
+ this.CreateJSKeyboardChartContainer=function(option)
130461
+ {
130462
+ var chart=new JSKeyboardChartContainer(this.CanvasElement);
130463
+ chart.Create(option);
130464
+
130465
+ if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
130466
+ if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) chart.SetColumn(option.Column);
130467
+ if (IFrameSplitOperator.IsNumber(option.BorderLine)) chart.Frame.BorderLine=option.BorderLine;
130468
+
130469
+ this.SetChartBorder(chart, option);
130470
+
130471
+ //注册事件
130472
+ if (option.EventCallback)
130473
+ {
130474
+ for(var i=0;i<option.EventCallback.length;++i)
130475
+ {
130476
+ var item=option.EventCallback[i];
130477
+ chart.AddEventCallback(item);
130478
+ }
130479
+ }
130480
+
130481
+ return chart;
130482
+ }
130483
+
130484
+ this.SetChartBorder=function(chart, option)
130485
+ {
130486
+ if (!option.Border) return;
130487
+
130488
+ var item=option.Border;
130489
+ if (IFrameSplitOperator.IsNumber(option.Border.Left)) chart.Frame.ChartBorder.Left=option.Border.Left;
130490
+ if (IFrameSplitOperator.IsNumber(option.Border.Right)) chart.Frame.ChartBorder.Right=option.Border.Right;
130491
+ if (IFrameSplitOperator.IsNumber(option.Border.Top)) chart.Frame.ChartBorder.Top=option.Border.Top;
130492
+ if (IFrameSplitOperator.IsNumber(option.Border.Bottom)) chart.Frame.ChartBorder.Bottom=option.Border.Bottom;
130493
+
130494
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
130495
+ chart.Frame.ChartBorder.Left*=pixelTatio;
130496
+ chart.Frame.ChartBorder.Right*=pixelTatio;
130497
+ chart.Frame.ChartBorder.Top*=pixelTatio;
130498
+ chart.Frame.ChartBorder.Bottom*=pixelTatio;
130499
+ }
130500
+
130501
+ /////////////////////////////////////////////////////////////////////////////
130502
+ //对外接口
130503
+ this.SetColumn=function(aryColumn, option)
130504
+ {
130505
+ if (this.JSChartContainer) this.JSChartContainer.SetColumn(aryColumn,option);
130506
+ }
130507
+
130508
+ //事件回调
130509
+ this.AddEventCallback=function(obj)
130510
+ {
130511
+ if(this.JSChartContainer && typeof(this.JSChartContainer.AddEventCallback)=='function')
130512
+ {
130513
+ JSConsole.Chart.Log('[JSKeyboardChart:AddEventCallback] obj=', obj);
130514
+ this.JSChartContainer.AddEventCallback(obj);
130515
+ }
130516
+ }
130517
+
130518
+ //重新加载配置
130519
+ this.ReloadResource=function(option)
130520
+ {
130521
+ if(this.JSChartContainer && typeof(this.JSChartContainer.ReloadResource)=='function')
130522
+ {
130523
+ JSConsole.Chart.Log('[JSKeyboardChart:ReloadResource] ');
130524
+ this.JSChartContainer.ReloadResource(option);
130525
+ }
130526
+ }
130527
+
130528
+ this.ChartDestory=function()
130529
+ {
130530
+ if (this.JSChartContainer && typeof (this.JSChartContainer.ChartDestory) == 'function')
130531
+ {
130532
+ this.JSChartContainer.ChartDestory();
130533
+ }
130534
+ }
130535
+
130536
+ this.Draw=function()
130537
+ {
130538
+ if(this.JSChartContainer && typeof(this.JSChartContainer.Draw)=='function')
130539
+ {
130540
+ JSConsole.Chart.Log('[JSKeyboardChart:Draw] ');
130541
+ this.JSChartContainer.Draw();
130542
+ }
130543
+ }
130544
+
130545
+ this.SetSymbolData=function(arySymbol)
130546
+ {
130547
+ if(this.JSChartContainer && typeof(this.JSChartContainer.Draw)=='function')
130548
+ {
130549
+ JSConsole.Chart.Log('[JSKeyboardChart:SetSymbolData] ', arySymbol);
130550
+ this.JSChartContainer.SetSymbolData(arySymbol);
130551
+ }
130552
+ }
130553
+
130554
+ this.Search=function(strText)
130555
+ {
130556
+ if(this.JSChartContainer && typeof(this.JSChartContainer.Search)=='function')
130557
+ {
130558
+ JSConsole.Chart.Log('[JSKeyboardChart:Search] ', strText);
130559
+ this.JSChartContainer.Search(strText);
130560
+ }
130561
+ }
130562
+
130563
+ this.OnKeyDown=function(event)
130564
+ {
130565
+ if(this.JSChartContainer && typeof(this.JSChartContainer.OnKeyDown)=='function')
130566
+ {
130567
+ JSConsole.Chart.Log('[JSKeyboardChart:OnKeyDown] ', event);
130568
+ this.JSChartContainer.OnKeyDown(event);
130569
+ }
130570
+ }
130571
+
130572
+ this.ClearSearch=function(option)
130573
+ {
130574
+ if(this.JSChartContainer && typeof(this.JSChartContainer.ClearSearch)=='function')
130575
+ {
130576
+ JSConsole.Chart.Log('[JSKeyboardChart:ClearSearch] ', option);
130577
+ this.JSChartContainer.ClearSearch(option);
130578
+ }
130579
+ }
130580
+ }
130581
+
130582
+ JSKeyboardChart.Init=function(divElement)
130583
+ {
130584
+ var jsChartControl=new JSKeyboardChart(divElement);
130585
+ jsChartControl.OnSize();
130586
+
130587
+ return jsChartControl;
130588
+ }
130589
+
130590
+ //自定义风格
130591
+ JSKeyboardChart.SetStyle=function(option)
130592
+ {
130593
+ if (option) g_JSChartResource.SetStyle(option);
130594
+ }
130595
+
130596
+
130597
+ function JSKeyboardChartContainer(uielement)
130598
+ {
130599
+ this.ClassName='JSKeyboardChartContainer';
130600
+ this.Frame; //框架画法
130601
+ this.ChartPaint=[]; //图形画法
130602
+ this.Canvas=uielement.getContext("2d"); //画布
130603
+ this.ShowCanvas=null;
130604
+
130605
+ this.NetworkFilter; //数据回调接口
130606
+ this.Data={ XOffset:0, YOffset:0, Data:[] }; //股票列表
130607
+ this.MapSymbol=new Map();
130608
+ this.SourceData={ Data:[] } //码表数据 Data:[ { Symbol:, Spell, Name:, Color:}]
130609
+
130610
+ //事件回调
130611
+ this.mapEvent=new Map(); //通知外部调用 key:JSCHART_EVENT_ID value:{Callback:回调,}
130612
+
130613
+ this.UIElement=uielement;
130614
+ this.LastPoint=new Point(); //鼠标位置
130615
+
130616
+ //拖拽滚动条
130617
+ this.DragYScroll=null; //{Start:{x,y}, End:{x, y}}
130618
+ this.IsDestroy=false; //是否已经销毁了
130619
+
130620
+ this.ChartDestory=function() //销毁
130621
+ {
130622
+ this.IsDestroy=true;
130623
+ }
130624
+
130625
+ this.ClearSearch=function(option)
130626
+ {
130627
+ this.Data.Data=[];
130628
+ this.Data.XOffset=0;
130629
+ this.Data.YOffset=0;
130630
+
130631
+ if (option && option.Redraw==true) this.Draw();
130632
+ }
130633
+
130634
+ this.Search=function(strText)
130635
+ {
130636
+ var aryExactQuery=[]; //精确查询
130637
+ var aryFuzzyQuery=[]; //模糊查询
130638
+ this.MapSymbol.clear();
130639
+ this.Data.Data=[];
130640
+ this.Data.XOffset=0;
130641
+ this.Data.YOffset=0;
130642
+
130643
+ var strSearch=strText.trim();
130644
+ if (strSearch.length>0)
130645
+ {
130646
+ for(var i=0;i<this.SourceData.Data.length;++i)
130647
+ {
130648
+ var item=this.SourceData.Data[i];
130649
+ if (this.SearchSymbol(item, strSearch, aryExactQuery, aryFuzzyQuery)) continue;
130650
+ else if (this.SearchSpell(item, strSearch, aryExactQuery, aryFuzzyQuery)) continue;
130651
+ }
130652
+ }
130653
+
130654
+ if (IFrameSplitOperator.IsNonEmptyArray(aryExactQuery) || IFrameSplitOperator.IsNonEmptyArray(aryFuzzyQuery))
130655
+ this.Data.Data=aryExactQuery.concat(aryFuzzyQuery);
130656
+
130657
+ this.ChartPaint[0].SelectedRow=0;
130658
+
130659
+ JSConsole.Chart.Log(`[JSKeyboardChart:Search] search=${strSearch}, source=${this.SourceData.Data.length} match=${this.Data.Data.length}`);
130660
+
130661
+ this.Draw();
130662
+ }
130663
+
130664
+ this.SearchSymbol=function(item, strText, aryExactQuery, aryFuzzyQuery)
130665
+ {
130666
+ var find=item.Symbol.indexOf(strText);
130667
+ if (find<0) return false;
130668
+
130669
+ if (find==0) aryExactQuery.push(item.Symbol);
130670
+ else aryFuzzyQuery.push(item.Symbol);
130671
+
130672
+ this.MapSymbol.set(item.Symbol, item);
130673
+
130674
+ return true;
130675
+ }
130676
+
130677
+ this.SearchSpell=function(item, strText, aryExactQuery, aryFuzzyQuery)
130678
+ {
130679
+ if (!IFrameSplitOperator.IsString(item.Spell)) return false;
130680
+
130681
+ var find=item.Spell.indexOf(strText);
130682
+
130683
+ if (find!=0) return false;
130684
+
130685
+ aryExactQuery.push(item.Symbol);
130686
+ this.MapSymbol.set(item.Symbol, item);
130687
+
130688
+ return true;
130689
+ }
130690
+
130691
+
130692
+ this.SetSymbolData=function(arySymbol)
130693
+ {
130694
+ this.SourceData.Data=arySymbol;
130695
+
130696
+ /*
130697
+ //测试
130698
+ this.MapSymbol.clear();
130699
+ for(var i=0;i<this.SourceData.Data.length && i<3050 ;++i)
130700
+ {
130701
+ var item=this.SourceData.Data[i];
130702
+ this.Data.Data.push(item.Symbol);
130703
+ this.MapSymbol.set(item.Symbol, item);
130704
+ }
130705
+ this.ChartPaint[0].SelectedRow=0;
130706
+ */
130707
+ }
130708
+
130709
+ //创建
130710
+ this.Create=function(option)
130711
+ {
130712
+ this.UIElement.JSChartContainer=this;
130713
+
130714
+ //创建框架
130715
+ this.Frame=new JSKeyboardFrame();
130716
+ this.Frame.ChartBorder=new ChartBorder();
130717
+ this.Frame.ChartBorder.UIElement=this.UIElement;
130718
+ this.Frame.ChartBorder.Top=30;
130719
+ this.Frame.ChartBorder.Left=5;
130720
+ this.Frame.ChartBorder.Bottom=20;
130721
+ this.Frame.Canvas=this.Canvas;
130722
+
130723
+ //创建表格
130724
+ var chart=new ChartSymbolList();
130725
+ chart.Frame=this.Frame;
130726
+ chart.ChartBorder=this.Frame.ChartBorder;
130727
+ chart.Canvas=this.Canvas;
130728
+ chart.UIElement=this.UIElement;
130729
+ chart.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
130730
+ chart.GetStockDataCallback=(symbol)=>{ return this.GetStockData(symbol);}
130731
+ chart.Data=this.Data;
130732
+ this.ChartPaint[0]=chart;
130733
+
130734
+ if (option)
130735
+ {
130736
+
130737
+ }
130738
+
130739
+ var bRegisterKeydown=true;
130740
+ var bRegisterWheel=true;
130741
+
130742
+ if (option)
130743
+ {
130744
+ if (option.KeyDown===false)
130745
+ {
130746
+ bRegisterKeydown=false;
130747
+ JSConsole.Chart.Log('[JSKeyboardChartContainer::Create] not register keydown event.');
130748
+ }
130749
+
130750
+ if (option.Wheel===false)
130751
+ {
130752
+ bRegisterWheel=false;
130753
+ JSConsole.Chart.Log('[JSKeyboardChartContainer::Create] not register wheel event.');
130754
+ }
130755
+ }
130756
+
130757
+ if (bRegisterKeydown) this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
130758
+ if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
130759
+
130760
+
130761
+ this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
130762
+ this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
130763
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
130764
+ this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
130765
+ this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
130766
+ this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
130767
+ }
130768
+
130769
+ this.Draw=function()
130770
+ {
130771
+ if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
130772
+
130773
+ this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);
130774
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
130775
+ this.Canvas.lineWidth=pixelTatio; //手机端需要根据分辨率比调整线段宽度
130776
+
130777
+ this.Frame.Draw();
130778
+ this.Frame.DrawLogo();
130779
+
130780
+ //框架内图形
130781
+ for(var i=0;i<this.ChartPaint.length;++i)
130782
+ {
130783
+ var item=this.ChartPaint[i];
130784
+ if (item.IsDrawFirst)
130785
+ item.Draw();
130786
+ }
130787
+
130788
+ for(var i=0; i<this.ChartPaint.length; ++i)
130789
+ {
130790
+ var item=this.ChartPaint[i];
130791
+ if (!item.IsDrawFirst)
130792
+ item.Draw();
130793
+ }
130794
+ }
130795
+
130796
+ this.GetStockData=function(symbol)
130797
+ {
130798
+ if (!this.MapSymbol.has(symbol)) return null;
130799
+
130800
+ return this.MapSymbol.get(symbol);
130801
+ }
130802
+
130803
+
130804
+ this.ResetStatus=function()
130805
+ {
130806
+ this.Data.XOffset=0;
130807
+ this.Data.YOffset=0;
130808
+ }
130809
+
130810
+ this.ResetSelectStatus=function()
130811
+ {
130812
+ var chart=this.GetReportChart();
130813
+ if (chart)
130814
+ {
130815
+ chart.SelectedRow=-1;
130816
+ chart.SelectedFixedRow=-1;
130817
+ }
128263
130818
  }
128264
130819
 
128265
130820
  //设置事件回调
@@ -130967,7 +133522,7 @@ function HQChartScriptWorker()
130967
133522
 
130968
133523
 
130969
133524
 
130970
- var HQCHART_VERSION="1.1.13080";
133525
+ var HQCHART_VERSION="1.1.13089";
130971
133526
 
130972
133527
  function PrintHQChartVersion()
130973
133528
  {
@@ -131048,6 +133603,10 @@ export default {
131048
133603
  JSReportChart:JSReportChart,
131049
133604
  REPORT_COLUMN_ID:REPORT_COLUMN_ID,
131050
133605
 
133606
+ //T型报价
133607
+ JSTReportChart:JSTReportChart,
133608
+ TREPORT_COLUMN_ID:TREPORT_COLUMN_ID,
133609
+
131051
133610
  //键盘精灵
131052
133611
  JSKeyboardChart:JSKeyboardChart,
131053
133612
  KEYBOARD_COLUMN_ID:KEYBOARD_COLUMN_ID,