hqchart 1.1.13660 → 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
+
@@ -126220,6 +126220,7 @@ function JSReportChart(divElement)
126220
126220
  {
126221
126221
  this.DivElement=divElement;
126222
126222
  this.JSChartContainer; //表格控件
126223
+ this.ResizeListener; //大小变动监听
126223
126224
 
126224
126225
  //h5 canvas
126225
126226
  this.CanvasElement=document.createElement("canvas");
@@ -126346,6 +126347,16 @@ function JSReportChart(divElement)
126346
126347
  this.JSChartContainer=chart;
126347
126348
  this.DivElement.JSChart=this; //div中保存一份
126348
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
+
126349
126360
  if (option.EnableResize==true) this.CreateResizeListener();
126350
126361
 
126351
126362
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
@@ -134303,6 +134314,7 @@ function JSKeyboardChart(divElement)
134303
134314
  {
134304
134315
  this.DivElement=divElement;
134305
134316
  this.JSChartContainer; //表格控件
134317
+ this.ResizeListener; //大小变动监听
134306
134318
 
134307
134319
  //h5 canvas
134308
134320
  this.CanvasElement=document.createElement("canvas");
@@ -134320,9 +134332,18 @@ function JSKeyboardChart(divElement)
134320
134332
  this.OnSize=function()
134321
134333
  {
134322
134334
  //画布大小通过div获取
134323
- 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
+
134324
134345
  this.CanvasElement.height=height;
134325
- this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
134346
+ this.CanvasElement.width=width;
134326
134347
  this.CanvasElement.style.width=this.CanvasElement.width+'px';
134327
134348
  this.CanvasElement.style.height=this.CanvasElement.height+'px';
134328
134349
 
@@ -134349,6 +134370,18 @@ function JSKeyboardChart(divElement)
134349
134370
  this.JSChartContainer=chart;
134350
134371
  this.DivElement.JSChart=this; //div中保存一份
134351
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
+
134352
134385
  chart.Draw();
134353
134386
  }
134354
134387
 
@@ -134393,6 +134426,18 @@ function JSKeyboardChart(divElement)
134393
134426
  chart.Frame.ChartBorder.Bottom*=pixelTatio;
134394
134427
  }
134395
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
+
134396
134441
  /////////////////////////////////////////////////////////////////////////////
134397
134442
  //对外接口
134398
134443
  this.SetColumn=function(aryColumn, option)
@@ -137422,7 +137467,7 @@ function ScrollBarBGChart()
137422
137467
 
137423
137468
 
137424
137469
 
137425
- var HQCHART_VERSION="1.1.13659";
137470
+ var HQCHART_VERSION="1.1.13665";
137426
137471
 
137427
137472
  function PrintHQChartVersion()
137428
137473
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13659";
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
@@ -126264,6 +126264,7 @@ function JSReportChart(divElement)
126264
126264
  {
126265
126265
  this.DivElement=divElement;
126266
126266
  this.JSChartContainer; //表格控件
126267
+ this.ResizeListener; //大小变动监听
126267
126268
 
126268
126269
  //h5 canvas
126269
126270
  this.CanvasElement=document.createElement("canvas");
@@ -126390,6 +126391,16 @@ function JSReportChart(divElement)
126390
126391
  this.JSChartContainer=chart;
126391
126392
  this.DivElement.JSChart=this; //div中保存一份
126392
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
+
126393
126404
  if (option.EnableResize==true) this.CreateResizeListener();
126394
126405
 
126395
126406
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
@@ -136753,6 +136764,7 @@ function JSKeyboardChart(divElement)
136753
136764
  {
136754
136765
  this.DivElement=divElement;
136755
136766
  this.JSChartContainer; //表格控件
136767
+ this.ResizeListener; //大小变动监听
136756
136768
 
136757
136769
  //h5 canvas
136758
136770
  this.CanvasElement=document.createElement("canvas");
@@ -136770,9 +136782,18 @@ function JSKeyboardChart(divElement)
136770
136782
  this.OnSize=function()
136771
136783
  {
136772
136784
  //画布大小通过div获取
136773
- 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
+
136774
136795
  this.CanvasElement.height=height;
136775
- this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
136796
+ this.CanvasElement.width=width;
136776
136797
  this.CanvasElement.style.width=this.CanvasElement.width+'px';
136777
136798
  this.CanvasElement.style.height=this.CanvasElement.height+'px';
136778
136799
 
@@ -136799,6 +136820,18 @@ function JSKeyboardChart(divElement)
136799
136820
  this.JSChartContainer=chart;
136800
136821
  this.DivElement.JSChart=this; //div中保存一份
136801
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
+
136802
136835
  chart.Draw();
136803
136836
  }
136804
136837
 
@@ -136843,6 +136876,18 @@ function JSKeyboardChart(divElement)
136843
136876
  chart.Frame.ChartBorder.Bottom*=pixelTatio;
136844
136877
  }
136845
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
+
136846
136891
  /////////////////////////////////////////////////////////////////////////////
136847
136892
  //对外接口
136848
136893
  this.SetColumn=function(aryColumn, option)
@@ -141538,6 +141583,274 @@ JSPopMinuteChart.GetMinuteOption=function()
141538
141583
 
141539
141584
 
141540
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
+
141541
141854
  ///////////////////////////////////////////////////////////////////////////////////
141542
141855
  // 工作线程计算指标示例
141543
141856
  //
@@ -141659,7 +141972,7 @@ function HQChartScriptWorker()
141659
141972
 
141660
141973
 
141661
141974
 
141662
- var HQCHART_VERSION="1.1.13659";
141975
+ var HQCHART_VERSION="1.1.13665";
141663
141976
 
141664
141977
  function PrintHQChartVersion()
141665
141978
  {
@@ -141777,6 +142090,7 @@ export default {
141777
142090
  //键盘精灵
141778
142091
  JSKeyboardChart:JSKeyboardChart,
141779
142092
  KEYBOARD_COLUMN_ID:KEYBOARD_COLUMN_ID,
142093
+ JSPopKeyboard:JSPopKeyboard,
141780
142094
 
141781
142095
  //X轴滚动条
141782
142096
  JSScrollBarChart:JSScrollBarChart,