hqchart 1.1.13658 → 1.1.13666

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.
@@ -871,3 +871,24 @@ HQData.Report_RequestStockSortData=function(data, callback)
871
871
  }
872
872
 
873
873
 
874
+
875
+ HQData.Keyboard_RequestSymbolList=function(data, callback)
876
+ {
877
+ //加载数据
878
+ var recv={ symbollist:SYMBOL_LIST };
879
+ var arySymbol=[];
880
+ for(var i=0;i<recv.symbollist.length;++i)
881
+ {
882
+ var item=recv.symbollist[i];
883
+ var shortSymbol=item[0];
884
+ shortSymbol=shortSymbol.replace(".sh", "");
885
+ shortSymbol=shortSymbol.replace(".sz", "");
886
+ var symbolItem={ Symbol:item[0], Name:item[1], ShortSymbol:shortSymbol, Spell:item[3], Type:item[2] };
887
+ if (i%5==0) symbolItem.Color="rgb(255,0,0)";
888
+ arySymbol.push(symbolItem);
889
+ }
890
+
891
+ callback(arySymbol);
892
+ }
893
+
894
+
@@ -84501,6 +84501,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84501
84501
 
84502
84502
  if (!bRefreshData)
84503
84503
  {
84504
+ if (!this.SourceData) //无数据 不需要执行指标
84505
+ {
84506
+ this.Draw();
84507
+ return;
84508
+ }
84509
+
84504
84510
  var bindData=this.SourceData;
84505
84511
  for(var i=0;i<count;++i)
84506
84512
  {
@@ -126214,6 +126220,7 @@ function JSReportChart(divElement)
126214
126220
  {
126215
126221
  this.DivElement=divElement;
126216
126222
  this.JSChartContainer; //表格控件
126223
+ this.ResizeListener; //大小变动监听
126217
126224
 
126218
126225
  //h5 canvas
126219
126226
  this.CanvasElement=document.createElement("canvas");
@@ -126340,6 +126347,16 @@ function JSReportChart(divElement)
126340
126347
  this.JSChartContainer=chart;
126341
126348
  this.DivElement.JSChart=this; //div中保存一份
126342
126349
 
126350
+ //注册事件
126351
+ if (option.EventCallback)
126352
+ {
126353
+ for(var i=0;i<option.EventCallback.length;++i)
126354
+ {
126355
+ var item=option.EventCallback[i];
126356
+ chart.AddEventCallback(item);
126357
+ }
126358
+ }
126359
+
126343
126360
  if (option.EnableResize==true) this.CreateResizeListener();
126344
126361
 
126345
126362
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
@@ -134297,6 +134314,7 @@ function JSKeyboardChart(divElement)
134297
134314
  {
134298
134315
  this.DivElement=divElement;
134299
134316
  this.JSChartContainer; //表格控件
134317
+ this.ResizeListener; //大小变动监听
134300
134318
 
134301
134319
  //h5 canvas
134302
134320
  this.CanvasElement=document.createElement("canvas");
@@ -134314,9 +134332,18 @@ function JSKeyboardChart(divElement)
134314
134332
  this.OnSize=function()
134315
134333
  {
134316
134334
  //画布大小通过div获取
134317
- var height=parseInt(this.DivElement.style.height.replace("px",""));
134335
+ var height=this.DivElement.offsetHeight;
134336
+ var width=this.DivElement.offsetWidth;
134337
+ if (this.DivElement.style.height && this.DivElement.style.width)
134338
+ {
134339
+ if (this.DivElement.style.height.includes("px"))
134340
+ height=parseInt(this.DivElement.style.height.replace("px",""));
134341
+ if (this.DivElement.style.width.includes("px"))
134342
+ width=parseInt(this.DivElement.style.width.replace("px",""));
134343
+ }
134344
+
134318
134345
  this.CanvasElement.height=height;
134319
- this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
134346
+ this.CanvasElement.width=width;
134320
134347
  this.CanvasElement.style.width=this.CanvasElement.width+'px';
134321
134348
  this.CanvasElement.style.height=this.CanvasElement.height+'px';
134322
134349
 
@@ -134343,6 +134370,18 @@ function JSKeyboardChart(divElement)
134343
134370
  this.JSChartContainer=chart;
134344
134371
  this.DivElement.JSChart=this; //div中保存一份
134345
134372
 
134373
+ //注册事件
134374
+ if (option.EventCallback)
134375
+ {
134376
+ for(var i=0;i<option.EventCallback.length;++i)
134377
+ {
134378
+ var item=option.EventCallback[i];
134379
+ chart.AddEventCallback(item);
134380
+ }
134381
+ }
134382
+
134383
+ if (option.EnableResize==true) this.CreateResizeListener();
134384
+
134346
134385
  chart.Draw();
134347
134386
  }
134348
134387
 
@@ -134387,6 +134426,18 @@ function JSKeyboardChart(divElement)
134387
134426
  chart.Frame.ChartBorder.Bottom*=pixelTatio;
134388
134427
  }
134389
134428
 
134429
+ this.CreateResizeListener=function()
134430
+ {
134431
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
134432
+ this.ResizeListener.observe(this.DivElement);
134433
+ }
134434
+
134435
+ this.OnDivResize=function(entries)
134436
+ {
134437
+ JSConsole.Chart.Log("[JSKeyboardChart::OnDivResize] entries=", entries);
134438
+ this.OnSize();
134439
+ }
134440
+
134390
134441
  /////////////////////////////////////////////////////////////////////////////
134391
134442
  //对外接口
134392
134443
  this.SetColumn=function(aryColumn, option)
@@ -137416,7 +137467,7 @@ function ScrollBarBGChart()
137416
137467
 
137417
137468
 
137418
137469
 
137419
- var HQCHART_VERSION="1.1.13657";
137470
+ var HQCHART_VERSION="1.1.13665";
137420
137471
 
137421
137472
  function PrintHQChartVersion()
137422
137473
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13657";
8
+ var HQCHART_VERSION="1.1.13665";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -49547,6 +49547,27 @@ HQData.Report_RequestStockSortData=function(data, callback)
49547
49547
 
49548
49548
 
49549
49549
 
49550
+ HQData.Keyboard_RequestSymbolList=function(data, callback)
49551
+ {
49552
+ //加载数据
49553
+ var recv={ symbollist:SYMBOL_LIST };
49554
+ var arySymbol=[];
49555
+ for(var i=0;i<recv.symbollist.length;++i)
49556
+ {
49557
+ var item=recv.symbollist[i];
49558
+ var shortSymbol=item[0];
49559
+ shortSymbol=shortSymbol.replace(".sh", "");
49560
+ shortSymbol=shortSymbol.replace(".sz", "");
49561
+ var symbolItem={ Symbol:item[0], Name:item[1], ShortSymbol:shortSymbol, Spell:item[3], Type:item[2] };
49562
+ if (i%5==0) symbolItem.Color="rgb(255,0,0)";
49563
+ arySymbol.push(symbolItem);
49564
+ }
49565
+
49566
+ callback(arySymbol);
49567
+ }
49568
+
49569
+
49570
+
49550
49571
 
49551
49572
  /*暴露外部用的方法*/
49552
49573
  export default
@@ -84545,6 +84545,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84545
84545
 
84546
84546
  if (!bRefreshData)
84547
84547
  {
84548
+ if (!this.SourceData) //无数据 不需要执行指标
84549
+ {
84550
+ this.Draw();
84551
+ return;
84552
+ }
84553
+
84548
84554
  var bindData=this.SourceData;
84549
84555
  for(var i=0;i<count;++i)
84550
84556
  {
@@ -126258,6 +126264,7 @@ function JSReportChart(divElement)
126258
126264
  {
126259
126265
  this.DivElement=divElement;
126260
126266
  this.JSChartContainer; //表格控件
126267
+ this.ResizeListener; //大小变动监听
126261
126268
 
126262
126269
  //h5 canvas
126263
126270
  this.CanvasElement=document.createElement("canvas");
@@ -126384,6 +126391,16 @@ function JSReportChart(divElement)
126384
126391
  this.JSChartContainer=chart;
126385
126392
  this.DivElement.JSChart=this; //div中保存一份
126386
126393
 
126394
+ //注册事件
126395
+ if (option.EventCallback)
126396
+ {
126397
+ for(var i=0;i<option.EventCallback.length;++i)
126398
+ {
126399
+ var item=option.EventCallback[i];
126400
+ chart.AddEventCallback(item);
126401
+ }
126402
+ }
126403
+
126387
126404
  if (option.EnableResize==true) this.CreateResizeListener();
126388
126405
 
126389
126406
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
@@ -136747,6 +136764,7 @@ function JSKeyboardChart(divElement)
136747
136764
  {
136748
136765
  this.DivElement=divElement;
136749
136766
  this.JSChartContainer; //表格控件
136767
+ this.ResizeListener; //大小变动监听
136750
136768
 
136751
136769
  //h5 canvas
136752
136770
  this.CanvasElement=document.createElement("canvas");
@@ -136764,9 +136782,18 @@ function JSKeyboardChart(divElement)
136764
136782
  this.OnSize=function()
136765
136783
  {
136766
136784
  //画布大小通过div获取
136767
- var height=parseInt(this.DivElement.style.height.replace("px",""));
136785
+ var height=this.DivElement.offsetHeight;
136786
+ var width=this.DivElement.offsetWidth;
136787
+ if (this.DivElement.style.height && this.DivElement.style.width)
136788
+ {
136789
+ if (this.DivElement.style.height.includes("px"))
136790
+ height=parseInt(this.DivElement.style.height.replace("px",""));
136791
+ if (this.DivElement.style.width.includes("px"))
136792
+ width=parseInt(this.DivElement.style.width.replace("px",""));
136793
+ }
136794
+
136768
136795
  this.CanvasElement.height=height;
136769
- this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
136796
+ this.CanvasElement.width=width;
136770
136797
  this.CanvasElement.style.width=this.CanvasElement.width+'px';
136771
136798
  this.CanvasElement.style.height=this.CanvasElement.height+'px';
136772
136799
 
@@ -136793,6 +136820,18 @@ function JSKeyboardChart(divElement)
136793
136820
  this.JSChartContainer=chart;
136794
136821
  this.DivElement.JSChart=this; //div中保存一份
136795
136822
 
136823
+ //注册事件
136824
+ if (option.EventCallback)
136825
+ {
136826
+ for(var i=0;i<option.EventCallback.length;++i)
136827
+ {
136828
+ var item=option.EventCallback[i];
136829
+ chart.AddEventCallback(item);
136830
+ }
136831
+ }
136832
+
136833
+ if (option.EnableResize==true) this.CreateResizeListener();
136834
+
136796
136835
  chart.Draw();
136797
136836
  }
136798
136837
 
@@ -136837,6 +136876,18 @@ function JSKeyboardChart(divElement)
136837
136876
  chart.Frame.ChartBorder.Bottom*=pixelTatio;
136838
136877
  }
136839
136878
 
136879
+ this.CreateResizeListener=function()
136880
+ {
136881
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
136882
+ this.ResizeListener.observe(this.DivElement);
136883
+ }
136884
+
136885
+ this.OnDivResize=function(entries)
136886
+ {
136887
+ JSConsole.Chart.Log("[JSKeyboardChart::OnDivResize] entries=", entries);
136888
+ this.OnSize();
136889
+ }
136890
+
136840
136891
  /////////////////////////////////////////////////////////////////////////////
136841
136892
  //对外接口
136842
136893
  this.SetColumn=function(aryColumn, option)
@@ -141532,6 +141583,274 @@ JSPopMinuteChart.GetMinuteOption=function()
141532
141583
 
141533
141584
 
141534
141585
 
141586
+ /*
141587
+ Copyright (c) 2018 jones
141588
+
141589
+ http://www.apache.org/licenses/LICENSE-2.0
141590
+
141591
+ 开源项目 https://github.com/jones2000/HQChart
141592
+
141593
+ jones_2000@163.com
141594
+
141595
+ 内置弹出键盘精灵
141596
+ */
141597
+
141598
+ function JSPopKeyboard()
141599
+ {
141600
+ this.DivDialog=null;
141601
+ this.DragTitle=null;
141602
+ this.InputDOM=null;
141603
+ this.Title="HQChart 键盘精灵"
141604
+ this.ID=Guid();
141605
+
141606
+ this.Keyboard=
141607
+ {
141608
+ Option:JSPopKeyboard.GetOption(),
141609
+ JSChart:null,
141610
+ }
141611
+
141612
+ this.Inital=function()
141613
+ {
141614
+ window.addEventListener('mousedown', (e)=>{ this.OnWindowMouseDown(e)});
141615
+ }
141616
+
141617
+ this.OnWindowMouseDown=function(e)
141618
+ {
141619
+ if (!this.DivDialog) return;
141620
+
141621
+ console.log("[JSPopKeyboard::OnWindowMouseDown] e=", e);
141622
+
141623
+ if (!this.DivDialog.contains(e.target))
141624
+ {
141625
+ this.Hide();
141626
+ }
141627
+ }
141628
+
141629
+ this.Create=function()
141630
+ {
141631
+ var divDom=document.createElement('div');
141632
+ divDom.className='jchart_pop_keyboard_dailog';
141633
+ divDom.id=this.ID;
141634
+
141635
+ var divTitle=document.createElement("div");
141636
+ divTitle.className='jschart_keyboard_Title_Div';
141637
+ divTitle.innerText=this.Title;
141638
+ divTitle.onmousedown=(e)=>{ this.OnMouseDownTitle(e); }
141639
+ divDom.appendChild(divTitle);
141640
+
141641
+ var divInput=document.createElement("div");
141642
+ divInput.className='jschart_keyboard_Input_Div';
141643
+ divDom.appendChild(divInput);
141644
+
141645
+ var input=document.createElement("input");
141646
+ input.className="jschart_keyboard_input";
141647
+ input.addEventListener("keydown", (event)=>{ this.OnKeydown(event); });
141648
+ input.addEventListener("keyup", (event)=>{ this.OnKeyup(event); });
141649
+
141650
+ divInput.appendChild(input);
141651
+
141652
+ var divChart=document.createElement("div");
141653
+ divChart.className="jschart_keyboard_Chart_Div";
141654
+ divDom.appendChild(divChart);
141655
+
141656
+ this.DivDialog=divDom;
141657
+ this.InputDOM=input;
141658
+
141659
+ var chart=JSKeyboardChart.Init(divChart);
141660
+ this.Keyboard.JSChart=chart;
141661
+
141662
+ this.Keyboard.Option.OnCreatedCallback=(chart)=>{ this.OnCreateHQChart(chart); }
141663
+ chart.SetOption(this.Keyboard.Option); //设置K线配置
141664
+
141665
+ chart.AddEventCallback(
141666
+ {
141667
+ event:JSCHART_EVENT_ID.ON_KEYBOARD_MOUSEUP,
141668
+ callback:(event, data, chart)=>{ this.OnChartMouseUp(event, data, chart);}
141669
+ }
141670
+ )
141671
+
141672
+ document.body.appendChild(divDom);
141673
+ }
141674
+
141675
+ this.OnCreateHQChart=function(chart)
141676
+ {
141677
+
141678
+ }
141679
+
141680
+ this.OnKeydown=function(event)
141681
+ {
141682
+ var aryKey=new Set([
141683
+ 40,
141684
+ 38,
141685
+ 13,
141686
+ 33,
141687
+ 34
141688
+ ]);
141689
+
141690
+ if (aryKey.has(event.keyCode))
141691
+ {
141692
+ this.Keyboard.JSChart.OnKeyDown(event);
141693
+ }
141694
+
141695
+ if (event.keyCode==27)
141696
+ {
141697
+ this.Hide();
141698
+ }
141699
+ }
141700
+
141701
+ this.OnKeyup=function(event)
141702
+ {
141703
+ var code=event.keyCode;
141704
+ if ((code>=48 && code<=57) || (code>=65 && code<=90) || (code>=97 && code<=122) || code==8)
141705
+ {
141706
+ var strText=this.InputDOM.value;
141707
+ strText=strText.toUpperCase();
141708
+ if (strText.length==0)
141709
+ {
141710
+ this.Hide();
141711
+ }
141712
+ else
141713
+ {
141714
+ this.Keyboard.JSChart.Search(strText);
141715
+ }
141716
+ }
141717
+ }
141718
+
141719
+
141720
+ this.OnMouseDownTitle=function(e)
141721
+ {
141722
+ if (!this.DivDialog) return;
141723
+
141724
+ var dragData={ X:e.clientX, Y:e.clientY };
141725
+ dragData.YOffset=e.clientX - this.DivDialog.offsetLeft;
141726
+ dragData.XOffset=e.clientY - this.DivDialog.offsetTop;
141727
+ this.DragTitle=dragData;
141728
+
141729
+ document.onmousemove=(e)=>{ this.DocOnMouseMoveTitle(e); }
141730
+ document.onmouseup=(e)=>{ this.DocOnMouseUpTitle(e); }
141731
+ }
141732
+
141733
+ this.DocOnMouseMoveTitle=function(e)
141734
+ {
141735
+ if (!this.DragTitle) return;
141736
+
141737
+ var left = e.clientX - this.DragTitle.YOffset;
141738
+ var top = e.clientY - this.DragTitle.XOffset;
141739
+
141740
+ var right=left+this.DivDialog.offsetWidth;
141741
+ var bottom=top+ this.DivDialog.offsetHeight;
141742
+
141743
+ if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
141744
+ if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
141745
+
141746
+ this.DivDialog.style.left = left + 'px';
141747
+ this.DivDialog.style.top = top + 'px';
141748
+
141749
+ if(e.preventDefault) e.preventDefault();
141750
+ }
141751
+
141752
+ this.DocOnMouseUpTitle=function(e)
141753
+ {
141754
+ this.DragTitle=null;
141755
+ this.onmousemove = null;
141756
+ this.onmouseup = null;
141757
+ }
141758
+
141759
+ this.SetSymbolData=function(data)
141760
+ {
141761
+ if (!this.Keyboard.JSChart) return false;
141762
+ this.Keyboard.JSChart.SetSymbolData(data);
141763
+ }
141764
+
141765
+ this.Show=function()
141766
+ {
141767
+ if (!this.DivDialog) return;
141768
+
141769
+ //显示在右下方
141770
+ var height=this.DivDialog.offsetHeight;
141771
+ var width=this.DivDialog.offsetWidth;
141772
+ var xRight=window.innerWidth-5;
141773
+ var ybottom=window.innerHeight-5;
141774
+ var x=xRight-width;
141775
+ var y=ybottom-height;
141776
+
141777
+ this.DivDialog.style.visibility='visible';
141778
+ this.DivDialog.style.top = y + "px";
141779
+ this.DivDialog.style.left = x + "px";
141780
+ }
141781
+
141782
+ this.Hide=function()
141783
+ {
141784
+ if (!this.DivDialog) return;
141785
+
141786
+ this.DivDialog.style.visibility='hidden';
141787
+ this.InputDOM.value="";
141788
+ this.Keyboard.JSChart.ClearSearch();
141789
+ }
141790
+
141791
+ this.IsShow=function()
141792
+ {
141793
+ if (!this.DivDialog) return false;
141794
+ return this.DivDialog.style.visibility==='visible';
141795
+ }
141796
+
141797
+ this.OnGlobalKeydown=function(event)
141798
+ {
141799
+ if (!this.DivDialog) return;
141800
+
141801
+ var code=event.keyCode;
141802
+ if (!this.IsShow() && (code>=48 && code<=57) || (code>=65 && code<=90) || (code>=97 && code<=122))
141803
+ {
141804
+ this.Show();
141805
+ this.InputDOM.focus();
141806
+ }
141807
+ else if (code==27 && this.IsShow())
141808
+ {
141809
+ this.Hide();
141810
+ }
141811
+ }
141812
+
141813
+ this.OnGlobalMouseDown=function(event)
141814
+ {
141815
+ if (!this.DivDialog) return;
141816
+
141817
+ if (this.DivDialog.style.display=='none') return;
141818
+
141819
+ if (!this.DivDialog.contains(event.target))
141820
+ {
141821
+ this.Hide();
141822
+ }
141823
+ }
141824
+
141825
+ this.OnChartMouseUp=function(event, data, chart)
141826
+ {
141827
+ this.InputDOM.focus();
141828
+ }
141829
+ }
141830
+
141831
+ JSPopKeyboard.GetOption=function()
141832
+ {
141833
+ var option=
141834
+ {
141835
+ Type:'键盘精灵', //创建图形类型
141836
+
141837
+ Border: //边框
141838
+ {
141839
+ Left:1, //左边间距
141840
+ Right:1, //右边间距
141841
+ Bottom:1, //底部间距
141842
+ Top:1 //顶部间距
141843
+ },
141844
+
141845
+ BorderLine:0,
141846
+ EnableResize:true
141847
+ };
141848
+
141849
+ return option;
141850
+ }
141851
+
141852
+
141853
+
141535
141854
  ///////////////////////////////////////////////////////////////////////////////////
141536
141855
  // 工作线程计算指标示例
141537
141856
  //
@@ -141653,7 +141972,7 @@ function HQChartScriptWorker()
141653
141972
 
141654
141973
 
141655
141974
 
141656
- var HQCHART_VERSION="1.1.13657";
141975
+ var HQCHART_VERSION="1.1.13665";
141657
141976
 
141658
141977
  function PrintHQChartVersion()
141659
141978
  {
@@ -141771,6 +142090,7 @@ export default {
141771
142090
  //键盘精灵
141772
142091
  JSKeyboardChart:JSKeyboardChart,
141773
142092
  KEYBOARD_COLUMN_ID:KEYBOARD_COLUMN_ID,
142093
+ JSPopKeyboard:JSPopKeyboard,
141774
142094
 
141775
142095
  //X轴滚动条
141776
142096
  JSScrollBarChart:JSScrollBarChart,