hqchart 1.1.14919 → 1.1.14922

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.14919",
3
+ "version": "1.1.14922",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -2829,6 +2829,8 @@ var JSCHART_EVENT_ID=
2829
2829
  GET_DEFAULT_INDEX_PARAM:172, //获取指标默认参数
2830
2830
 
2831
2831
  ON_RELOAD_RESOURCE:173,
2832
+
2833
+ ON_REPORT_DATA_FILTER:174, //数据筛选
2832
2834
  }
2833
2835
 
2834
2836
  var JSCHART_OPERATOR_ID=
@@ -229,7 +229,13 @@ function JSReportChart(divElement)
229
229
  //是否自动更新
230
230
  if (option.IsAutoUpdate!=null) chart.IsAutoUpdate=option.IsAutoUpdate;
231
231
  if (option.AutoUpdateFrequency>0) chart.AutoUpdateFrequency=option.AutoUpdateFrequency;
232
- if (IFrameSplitOperator.IsBool(option.EnableFilter)) chart.EnableFilter=option.EnableFilter;
232
+
233
+ //数据筛选
234
+ if (option.DataFilter)
235
+ {
236
+ var item=option.DataFilter;
237
+ if (IFrameSplitOperator.IsBool(item.Enable)) chart.DataFilterConfig.Enable=item.Enable;
238
+ }
233
239
 
234
240
  //注册事件
235
241
  if (option.EventCallback)
@@ -303,9 +309,9 @@ function JSReportChart(divElement)
303
309
  if (this.JSChartContainer) this.JSChartContainer.AddSymbol(arySymbol, option);
304
310
  }
305
311
 
306
- this.EnableFilter=function(bEnable, option) //启动|关闭筛选
312
+ this.EnableDataFilter=function(bEnable, option) //启动|关闭筛选
307
313
  {
308
- if (this.JSChartContainer) this.JSChartContainer.EnableFilter(bEnable, option);
314
+ if (this.JSChartContainer) this.JSChartContainer.EnableDataFilter(bEnable, option);
309
315
  }
310
316
 
311
317
  //事件回调
@@ -495,6 +501,8 @@ function JSReportChartContainer(uielement)
495
501
  //MouseOnStatus:{ RowIndex:行, ColumnIndex:列}
496
502
  this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null, MouseOnStatus:null };
497
503
  this.RequestStatus={ IsFinishStockList:false, IsFinishMemberList:false }; //下载状态
504
+
505
+ this.DataFilterConfig={ Enable:false, }; //数据筛选
498
506
 
499
507
  this.ChartDestroy=function() //销毁
500
508
  {
@@ -1207,26 +1215,14 @@ function JSReportChartContainer(uielement)
1207
1215
 
1208
1216
  this.RequestStatus.IsFinishMemberList=true;
1209
1217
 
1218
+ this.DataFilter();
1219
+
1210
1220
  //实时本地数据排序
1211
1221
  var chart=this.GetReportChart();
1212
1222
  if (chart && (this.SortInfo.Sort==1 || this.SortInfo.Sort==2) && IFrameSplitOperator.IsNumber(this.SortInfo.Field) && this.SortInfo.Field>=0)
1213
1223
  {
1214
1224
  var column=chart.Column[this.SortInfo.Field];
1215
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);
1216
-
1217
- var bLocalSrot=true;
1218
- if (event && event.Callback)
1219
- {
1220
- var sendData={ Column:column, SortInfo:this.SortInfo, SymbolList:this.Data.Data, Result:null, PreventDefault:false };
1221
- event.Callback (event, sendData, this);
1222
- if (event.PreventDefault)
1223
- {
1224
- bLocalSrot=false;
1225
- if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
1226
- }
1227
- }
1228
-
1229
- if (bLocalSrot) this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, column, this.SortInfo.Sort); });
1225
+ this.LocalDataSort(column, this.SortInfo);
1230
1226
  }
1231
1227
 
1232
1228
  this.Draw();
@@ -1640,31 +1636,21 @@ function JSReportChartContainer(uielement)
1640
1636
  var chart=this.ChartPaint[0];
1641
1637
  if (!chart) return;
1642
1638
 
1639
+
1640
+
1643
1641
  var bUpdate=false;
1642
+ if (this.DataFilter()) bUpdate=true; //过滤数据每次都刷新
1643
+
1644
1644
  //实时本地数据排序
1645
1645
  var chart=this.ChartPaint[0];
1646
1646
  if (chart && (this.SortInfo.Sort==1 || this.SortInfo.Sort==2) && IFrameSplitOperator.IsNumber(this.SortInfo.Field) && this.SortInfo.Field>=0)
1647
1647
  {
1648
- var column=chart.Column[this.SortInfo.Field];
1649
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);
1650
-
1651
1648
  //当前选中的股票
1652
1649
  var selectedSymbol=null;
1653
1650
  if (chart.SelectedRowData && chart.SelectedModel==1) selectedSymbol=chart.SelectedRowData.Symbol;
1654
1651
 
1655
- var bLocalSrot=true;
1656
- if (event && event.Callback)
1657
- {
1658
- var sendData={ Column:column, SortInfo:this.SortInfo, SymbolList:this.Data.Data, Result:null, PreventDefault:false };
1659
- event.Callback (event, sendData, this);
1660
- if (event.PreventDefault)
1661
- {
1662
- bLocalSrot=false;
1663
- if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
1664
- }
1665
- }
1666
-
1667
- if (bLocalSrot) this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, column, this.SortInfo.Sort); });
1652
+ var column=chart.Column[this.SortInfo.Field];
1653
+ this.LocalDataSort(column, this.SortInfo);
1668
1654
 
1669
1655
  if (selectedSymbol)
1670
1656
  {
@@ -3729,33 +3715,15 @@ function JSReportChartContainer(uielement)
3729
3715
  {
3730
3716
  if (sortInfo.Sort==0)
3731
3717
  {
3732
- this.Data.Data=[];
3733
- for(var i=0;i<this.SourceData.Data.length;++i)
3734
- {
3735
- this.Data.Data.push(this.SourceData.Data[i]);
3736
- }
3718
+ this.Data.Data=this.SourceData.Data.slice();
3719
+ this.DataFilter();
3737
3720
  }
3738
3721
  else
3739
3722
  {
3740
3723
  if (header.Column.Sort==1) //本地排序
3741
3724
  {
3742
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);
3743
- var bLocalSort=true;
3744
- if (event && event.Callback)
3745
- {
3746
- var sendData={ Column:header.Column, SortInfo:sortInfo, SymbolList:this.Data.Data, Result:null, PreventDefault:false};
3747
- event.Callback (event, sendData, this);
3748
- if (sendData.PreventDefault)
3749
- {
3750
- if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
3751
- bLocalSort=false;
3752
- }
3753
-
3754
- }
3755
-
3756
-
3757
- if (bLocalSort) this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, header.Column, sortInfo.Sort); });
3758
-
3725
+ this.DataFilter();
3726
+ this.LocalDataSort(header.Column, sortInfo);
3759
3727
  }
3760
3728
  else if (header.Column.Sort==2) //远程排序
3761
3729
  {
@@ -3780,6 +3748,70 @@ function JSReportChartContainer(uielement)
3780
3748
  }
3781
3749
  }
3782
3750
 
3751
+ this.LocalDataSort=function(column, sortInfo)
3752
+ {
3753
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);
3754
+ var bLocalSort=true;
3755
+ if (event && event.Callback)
3756
+ {
3757
+ var sendData={ Column:header.Column, SortInfo:sortInfo, SymbolList:this.Data.Data, Result:null, PreventDefault:false};
3758
+ event.Callback (event, sendData, this);
3759
+ if (sendData.PreventDefault)
3760
+ {
3761
+ if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
3762
+ bLocalSort=false;
3763
+ }
3764
+ }
3765
+
3766
+ if (bLocalSort) this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, column, sortInfo.Sort); });
3767
+ }
3768
+
3769
+ //数据筛选
3770
+ this.DataFilter=function()
3771
+ {
3772
+ if (!this.DataFilterConfig.Enable) return false;
3773
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data)) return false;
3774
+
3775
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_DATA_FILTER);
3776
+ if (!event || !event.Callback) return false;
3777
+
3778
+ var aryData=this.SourceData.Data.slice(); //原始数据
3779
+
3780
+ var sendData={ AryData:aryData, PreventDefault:false };
3781
+ event.Callback(event, sendData, this);
3782
+ if (!sendData.PreventDefault) return false;
3783
+
3784
+ this.Data.Data=sendData.AryData;
3785
+
3786
+ return true;
3787
+ }
3788
+
3789
+ this.EnableDataFilter=function(enable, option)
3790
+ {
3791
+ if (!IFrameSplitOperator.IsBool(enable)) return false;
3792
+
3793
+ this.DataFilterConfig.Enable=enable;
3794
+ if (enable)
3795
+ {
3796
+ this.DataFilter();
3797
+ }
3798
+ else
3799
+ {
3800
+ this.Data.Data=this.SourceData.Data.slice();
3801
+ }
3802
+
3803
+ //排序
3804
+ var chart=this.GetReportChart();
3805
+ if (chart && (this.SortInfo.Sort==1 || this.SortInfo.Sort==2) && IFrameSplitOperator.IsNumber(this.SortInfo.Field) && this.SortInfo.Field>=0)
3806
+ {
3807
+ var column=chart.Column[this.SortInfo.Field];
3808
+ this.LocalDataSort(column, this.SortInfo);
3809
+ }
3810
+
3811
+ this.ResetReportStatus();
3812
+ this.Draw();
3813
+ }
3814
+
3783
3815
  this.PopupHeaderMenu=function(clickData, e)
3784
3816
  {
3785
3817
  if (!this.JSPopMenu) return;
@@ -6925,6 +6925,8 @@ var JSCHART_EVENT_ID=
6925
6925
  GET_DEFAULT_INDEX_PARAM:172, //获取指标默认参数
6926
6926
 
6927
6927
  ON_RELOAD_RESOURCE:173,
6928
+
6929
+ ON_REPORT_DATA_FILTER:174, //数据筛选
6928
6930
  }
6929
6931
 
6930
6932
  var JSCHART_OPERATOR_ID=
@@ -137928,7 +137930,13 @@ function JSReportChart(divElement)
137928
137930
  //是否自动更新
137929
137931
  if (option.IsAutoUpdate!=null) chart.IsAutoUpdate=option.IsAutoUpdate;
137930
137932
  if (option.AutoUpdateFrequency>0) chart.AutoUpdateFrequency=option.AutoUpdateFrequency;
137931
- if (IFrameSplitOperator.IsBool(option.EnableFilter)) chart.EnableFilter=option.EnableFilter;
137933
+
137934
+ //数据筛选
137935
+ if (option.DataFilter)
137936
+ {
137937
+ var item=option.DataFilter;
137938
+ if (IFrameSplitOperator.IsBool(item.Enable)) chart.DataFilterConfig.Enable=item.Enable;
137939
+ }
137932
137940
 
137933
137941
  //注册事件
137934
137942
  if (option.EventCallback)
@@ -138002,9 +138010,9 @@ function JSReportChart(divElement)
138002
138010
  if (this.JSChartContainer) this.JSChartContainer.AddSymbol(arySymbol, option);
138003
138011
  }
138004
138012
 
138005
- this.EnableFilter=function(bEnable, option) //启动|关闭筛选
138013
+ this.EnableDataFilter=function(bEnable, option) //启动|关闭筛选
138006
138014
  {
138007
- if (this.JSChartContainer) this.JSChartContainer.EnableFilter(bEnable, option);
138015
+ if (this.JSChartContainer) this.JSChartContainer.EnableDataFilter(bEnable, option);
138008
138016
  }
138009
138017
 
138010
138018
  //事件回调
@@ -138194,6 +138202,8 @@ function JSReportChartContainer(uielement)
138194
138202
  //MouseOnStatus:{ RowIndex:行, ColumnIndex:列}
138195
138203
  this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null, MouseOnStatus:null };
138196
138204
  this.RequestStatus={ IsFinishStockList:false, IsFinishMemberList:false }; //下载状态
138205
+
138206
+ this.DataFilterConfig={ Enable:false, }; //数据筛选
138197
138207
 
138198
138208
  this.ChartDestroy=function() //销毁
138199
138209
  {
@@ -138906,26 +138916,14 @@ function JSReportChartContainer(uielement)
138906
138916
 
138907
138917
  this.RequestStatus.IsFinishMemberList=true;
138908
138918
 
138919
+ this.DataFilter();
138920
+
138909
138921
  //实时本地数据排序
138910
138922
  var chart=this.GetReportChart();
138911
138923
  if (chart && (this.SortInfo.Sort==1 || this.SortInfo.Sort==2) && IFrameSplitOperator.IsNumber(this.SortInfo.Field) && this.SortInfo.Field>=0)
138912
138924
  {
138913
138925
  var column=chart.Column[this.SortInfo.Field];
138914
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);
138915
-
138916
- var bLocalSrot=true;
138917
- if (event && event.Callback)
138918
- {
138919
- var sendData={ Column:column, SortInfo:this.SortInfo, SymbolList:this.Data.Data, Result:null, PreventDefault:false };
138920
- event.Callback (event, sendData, this);
138921
- if (event.PreventDefault)
138922
- {
138923
- bLocalSrot=false;
138924
- if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
138925
- }
138926
- }
138927
-
138928
- if (bLocalSrot) this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, column, this.SortInfo.Sort); });
138926
+ this.LocalDataSort(column, this.SortInfo);
138929
138927
  }
138930
138928
 
138931
138929
  this.Draw();
@@ -139339,31 +139337,21 @@ function JSReportChartContainer(uielement)
139339
139337
  var chart=this.ChartPaint[0];
139340
139338
  if (!chart) return;
139341
139339
 
139340
+
139341
+
139342
139342
  var bUpdate=false;
139343
+ if (this.DataFilter()) bUpdate=true; //过滤数据每次都刷新
139344
+
139343
139345
  //实时本地数据排序
139344
139346
  var chart=this.ChartPaint[0];
139345
139347
  if (chart && (this.SortInfo.Sort==1 || this.SortInfo.Sort==2) && IFrameSplitOperator.IsNumber(this.SortInfo.Field) && this.SortInfo.Field>=0)
139346
139348
  {
139347
- var column=chart.Column[this.SortInfo.Field];
139348
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);
139349
-
139350
139349
  //当前选中的股票
139351
139350
  var selectedSymbol=null;
139352
139351
  if (chart.SelectedRowData && chart.SelectedModel==1) selectedSymbol=chart.SelectedRowData.Symbol;
139353
139352
 
139354
- var bLocalSrot=true;
139355
- if (event && event.Callback)
139356
- {
139357
- var sendData={ Column:column, SortInfo:this.SortInfo, SymbolList:this.Data.Data, Result:null, PreventDefault:false };
139358
- event.Callback (event, sendData, this);
139359
- if (event.PreventDefault)
139360
- {
139361
- bLocalSrot=false;
139362
- if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
139363
- }
139364
- }
139365
-
139366
- if (bLocalSrot) this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, column, this.SortInfo.Sort); });
139353
+ var column=chart.Column[this.SortInfo.Field];
139354
+ this.LocalDataSort(column, this.SortInfo);
139367
139355
 
139368
139356
  if (selectedSymbol)
139369
139357
  {
@@ -141428,33 +141416,15 @@ function JSReportChartContainer(uielement)
141428
141416
  {
141429
141417
  if (sortInfo.Sort==0)
141430
141418
  {
141431
- this.Data.Data=[];
141432
- for(var i=0;i<this.SourceData.Data.length;++i)
141433
- {
141434
- this.Data.Data.push(this.SourceData.Data[i]);
141435
- }
141419
+ this.Data.Data=this.SourceData.Data.slice();
141420
+ this.DataFilter();
141436
141421
  }
141437
141422
  else
141438
141423
  {
141439
141424
  if (header.Column.Sort==1) //本地排序
141440
141425
  {
141441
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);
141442
- var bLocalSort=true;
141443
- if (event && event.Callback)
141444
- {
141445
- var sendData={ Column:header.Column, SortInfo:sortInfo, SymbolList:this.Data.Data, Result:null, PreventDefault:false};
141446
- event.Callback (event, sendData, this);
141447
- if (sendData.PreventDefault)
141448
- {
141449
- if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
141450
- bLocalSort=false;
141451
- }
141452
-
141453
- }
141454
-
141455
-
141456
- if (bLocalSort) this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, header.Column, sortInfo.Sort); });
141457
-
141426
+ this.DataFilter();
141427
+ this.LocalDataSort(header.Column, sortInfo);
141458
141428
  }
141459
141429
  else if (header.Column.Sort==2) //远程排序
141460
141430
  {
@@ -141479,6 +141449,70 @@ function JSReportChartContainer(uielement)
141479
141449
  }
141480
141450
  }
141481
141451
 
141452
+ this.LocalDataSort=function(column, sortInfo)
141453
+ {
141454
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);
141455
+ var bLocalSort=true;
141456
+ if (event && event.Callback)
141457
+ {
141458
+ var sendData={ Column:header.Column, SortInfo:sortInfo, SymbolList:this.Data.Data, Result:null, PreventDefault:false};
141459
+ event.Callback (event, sendData, this);
141460
+ if (sendData.PreventDefault)
141461
+ {
141462
+ if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
141463
+ bLocalSort=false;
141464
+ }
141465
+ }
141466
+
141467
+ if (bLocalSort) this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, column, sortInfo.Sort); });
141468
+ }
141469
+
141470
+ //数据筛选
141471
+ this.DataFilter=function()
141472
+ {
141473
+ if (!this.DataFilterConfig.Enable) return false;
141474
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data)) return false;
141475
+
141476
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_DATA_FILTER);
141477
+ if (!event || !event.Callback) return false;
141478
+
141479
+ var aryData=this.SourceData.Data.slice(); //原始数据
141480
+
141481
+ var sendData={ AryData:aryData, PreventDefault:false };
141482
+ event.Callback(event, sendData, this);
141483
+ if (!sendData.PreventDefault) return false;
141484
+
141485
+ this.Data.Data=sendData.AryData;
141486
+
141487
+ return true;
141488
+ }
141489
+
141490
+ this.EnableDataFilter=function(enable, option)
141491
+ {
141492
+ if (!IFrameSplitOperator.IsBool(enable)) return false;
141493
+
141494
+ this.DataFilterConfig.Enable=enable;
141495
+ if (enable)
141496
+ {
141497
+ this.DataFilter();
141498
+ }
141499
+ else
141500
+ {
141501
+ this.Data.Data=this.SourceData.Data.slice();
141502
+ }
141503
+
141504
+ //排序
141505
+ var chart=this.GetReportChart();
141506
+ if (chart && (this.SortInfo.Sort==1 || this.SortInfo.Sort==2) && IFrameSplitOperator.IsNumber(this.SortInfo.Field) && this.SortInfo.Field>=0)
141507
+ {
141508
+ var column=chart.Column[this.SortInfo.Field];
141509
+ this.LocalDataSort(column, this.SortInfo);
141510
+ }
141511
+
141512
+ this.ResetReportStatus();
141513
+ this.Draw();
141514
+ }
141515
+
141482
141516
  this.PopupHeaderMenu=function(clickData, e)
141483
141517
  {
141484
141518
  if (!this.JSPopMenu) return;
@@ -151128,7 +151162,7 @@ function ScrollBarBGChart()
151128
151162
 
151129
151163
 
151130
151164
 
151131
- var HQCHART_VERSION="1.1.14918";
151165
+ var HQCHART_VERSION="1.1.14921";
151132
151166
 
151133
151167
  function PrintHQChartVersion()
151134
151168
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14918";
8
+ var HQCHART_VERSION="1.1.14921";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {