hqchart 1.1.15449 → 1.1.15451

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.
@@ -162323,26 +162323,52 @@ function JSTooltipMinuteChart()
162323
162323
  }
162324
162324
  else if (data.Rect)
162325
162325
  {
162326
- var rtCell=data.Rect;
162327
- var pixelRatio=GetDevicePixelRatio();
162328
- var rtItem={ Left:rtCell.Left/pixelRatio, Right:rtCell.Right/pixelRatio, Bottom:rtCell.Bottom/pixelRatio, Top:rtCell.Top/pixelRatio };
162329
- rtItem.Width=rtItem.Right-rtItem.Left;
162330
- rtItem.Height=rtItem.Bottom-rtItem.Top;
162326
+ if (data.Position===1) //上左位置
162327
+ {
162328
+ var rtCell=data.Rect;
162329
+ var pixelRatio=GetDevicePixelRatio();
162330
+ var rtItem={ Left:rtCell.Left/pixelRatio, Right:rtCell.Right/pixelRatio, Bottom:rtCell.Bottom/pixelRatio, Top:rtCell.Top/pixelRatio };
162331
+ rtItem.Width=rtItem.Right-rtItem.Left;
162332
+ rtItem.Height=rtItem.Bottom-rtItem.Top;
162331
162333
 
162332
- //超出窗口调整位置
162333
- var height=this.DivDialog.offsetHeight;
162334
- var width=this.DivDialog.offsetWidth;
162335
- var x=rtItem.Right+data.Offset.Left;
162336
- var y=rtItem.Bottom+data.Offset.Top;
162334
+ //超出窗口调整位置
162335
+ var height=this.DivDialog.offsetHeight;
162336
+ var width=this.DivDialog.offsetWidth;
162337
+ var x=rtItem.Left+data.Offset.Left;
162338
+ var y=rtItem.Top+data.Offset.Top;
162337
162339
 
162338
- var xRight=window.innerWidth-5;
162339
- var ybottom=window.innerHeight-5;
162340
- if (x+width>xRight) x=(rtItem.Left+data.Offset.Left)-width;
162341
- if (y+height>ybottom) y=(rtItem.Top+data.Offset.Top)-height;
162340
+ var xRight=window.innerWidth-5;
162341
+ var ybottom=window.innerHeight-5;
162342
+ if (x+width>xRight) x=(rtItem.Left+data.Offset.Left)-width;
162343
+ if (y+height>ybottom) y=(rtItem.Top+data.Offset.Top)-height;
162342
162344
 
162343
- this.DivDialog.style.visibility='visible';
162344
- this.DivDialog.style.top = y + "px";
162345
- this.DivDialog.style.left = x + "px";
162345
+ this.DivDialog.style.visibility='visible';
162346
+ this.DivDialog.style.top = y + "px";
162347
+ this.DivDialog.style.left = x + "px";
162348
+ }
162349
+ else
162350
+ {
162351
+ var rtCell=data.Rect;
162352
+ var pixelRatio=GetDevicePixelRatio();
162353
+ var rtItem={ Left:rtCell.Left/pixelRatio, Right:rtCell.Right/pixelRatio, Bottom:rtCell.Bottom/pixelRatio, Top:rtCell.Top/pixelRatio };
162354
+ rtItem.Width=rtItem.Right-rtItem.Left;
162355
+ rtItem.Height=rtItem.Bottom-rtItem.Top;
162356
+
162357
+ //超出窗口调整位置
162358
+ var height=this.DivDialog.offsetHeight;
162359
+ var width=this.DivDialog.offsetWidth;
162360
+ var x=rtItem.Right+data.Offset.Left;
162361
+ var y=rtItem.Bottom+data.Offset.Top;
162362
+
162363
+ var xRight=window.innerWidth-5;
162364
+ var ybottom=window.innerHeight-5;
162365
+ if (x+width>xRight) x=(rtItem.Left+data.Offset.Left)-width;
162366
+ if (y+height>ybottom) y=(rtItem.Top+data.Offset.Top)-height;
162367
+
162368
+ this.DivDialog.style.visibility='visible';
162369
+ this.DivDialog.style.top = y + "px";
162370
+ this.DivDialog.style.left = x + "px";
162371
+ }
162346
162372
  }
162347
162373
  }
162348
162374
 
@@ -168592,135 +168618,2531 @@ function HQChartScriptWorker()
168592
168618
  }
168593
168619
  }
168594
168620
 
168595
- /********************************************************************************
168596
- * 版本信息输出
168597
- *
168598
- */
168599
-
168621
+ /*
168622
+ Copyright (c) 2018 jones
168623
+
168624
+ http://www.apache.org/licenses/LICENSE-2.0
168600
168625
 
168626
+ 开源项目 https://github.com/jones2000/HQChart
168627
+
168628
+ jones_2000@163.com
168601
168629
 
168602
- var HQCHART_VERSION="1.1.15448";
168630
+ 底部状态栏 (H5版本)
168631
+ 不提供内置测试数据
168632
+ */
168603
168633
 
168604
- function PrintHQChartVersion()
168634
+ function JSStatusBarChart(divElement)
168605
168635
  {
168606
- var logo=`
168636
+ this.DivElement=divElement;
168637
+ this.JSChartContainer; //表格控件
168638
+ this.ResizeListener; //大小变动监听
168607
168639
 
168608
- ***************************************************************************************************************************************************************************
168609
- *
168610
- * :%@@-
168611
- * :@@@@-
168612
- * =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@.
168613
- * :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@*
168614
- * +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+
168615
- * %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@=
168616
- * @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@-
168617
- * @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%%
168618
- * .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@
168619
- * :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@#
168620
- * -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@.
168621
- * +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#::
168622
- * #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+
168623
- * %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@-
168624
- * @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@.
168625
- * .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@.
168626
- * -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@
168627
- * =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@
168628
- * +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@#
168629
- * *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+
168630
- * %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@-
168631
- * @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+
168632
- * .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+-
168633
- * :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@-
168634
- * =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@#
168635
- * *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@*
168636
- * =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:.
168637
- *
168638
- *
168639
- * HQChart
168640
- * Ver: ${HQCHART_VERSION}
168641
- * License: Apache License 2.0
168642
- * Source: https://github.com/jones2000/HQChart
168643
- *
168644
- **************************************************************************************************************************************************************************
168645
- `;
168646
-
168647
- console.log(logo);
168648
- }
168640
+ //h5 canvas
168641
+ this.CanvasElement=document.createElement("canvas");
168642
+ this.CanvasElement.className='jsstatusbar-drawing';
168643
+ this.CanvasElement.id=Guid();
168644
+ this.CanvasElement.setAttribute("tabindex",0);
168645
+ if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
168646
+ if(divElement.hasChildNodes())
168647
+ {
168648
+ JSConsole.Chart.Log("[JSStatusBarChart::JSStatusBarChart] divElement hasChildNodes", divElement.childNodes);
168649
+ }
168650
+ divElement.appendChild(this.CanvasElement);
168649
168651
 
168650
168652
 
168651
- PrintHQChartVersion();
168653
+ this.OnSize=function()
168654
+ {
168655
+ //画布大小通过div获取 如果有style里的大小 使用style里的
168656
+ var height=this.DivElement.offsetHeight;
168657
+ var width=this.DivElement.offsetWidth;
168658
+ if (this.DivElement.style.height && this.DivElement.style.width)
168659
+ {
168660
+ if (this.DivElement.style.height.includes("px"))
168661
+ height=parseInt(this.DivElement.style.height.replace("px",""));
168662
+ if (this.DivElement.style.width.includes("px"))
168663
+ width=parseInt(this.DivElement.style.width.replace("px",""));
168664
+ }
168652
168665
 
168666
+ this.CanvasElement.height=height;
168667
+ this.CanvasElement.width=width;
168668
+ this.CanvasElement.style.width=this.CanvasElement.width+'px';
168669
+ this.CanvasElement.style.height=this.CanvasElement.height+'px';
168653
168670
 
168671
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
168672
+ this.CanvasElement.height*=pixelTatio;
168673
+ this.CanvasElement.width*=pixelTatio;
168654
168674
 
168655
- import $ from 'jquery'
168675
+ JSConsole.Chart.Log(`[JSStatusBarChart::OnSize] devicePixelRatio=${window.devicePixelRatio}, height=${this.CanvasElement.height}, width=${this.CanvasElement.width}`);
168656
168676
 
168657
- //把给外界调用的方法暴露出来
168658
- export default {
168659
- jsChartInit: JSChart.Init,
168660
- jsChartStyle:JSChart.SetStyle,
168661
- // IsIndexSymbol:IsIndexSymbol,
168662
- // BaseIndex:BaseIndex,
168663
- // ChartLine:ChartLine,
168664
- // ChartKLine:ChartKLine,
168665
- // ChartMACD:ChartMACD,
168666
- // DynamicTitleData:DynamicTitleData,
168667
- // ChartVolStick:ChartVolStick,
168668
- // SingleData:SingleData,
168669
- // ChartData:ChartData
168677
+ if (this.JSChartContainer && this.JSChartContainer.OnSize)
168678
+ {
168679
+ this.JSChartContainer.OnSize();
168680
+ }
168681
+ }
168670
168682
 
168671
- //类导出
168672
- JSChart:JSChart, //行情图形库
168673
- ChartData:ChartData, //数据类
168674
- SingleData:SingleData,
168675
- HistoryData:HistoryData, //K线数据结构
168676
- MARKET_SUFFIX_NAME:MARKET_SUFFIX_NAME, // 判断股票属性
168677
- IFrameSplitOperator:IFrameSplitOperator,//格式化字符串方法
168678
- FrameSplitKLinePriceY:FrameSplitKLinePriceY,
168679
- FrameSplitKLineX:FrameSplitKLineX,
168680
- JSKLineInfoMap:JSKLineInfoMap,
168681
- JSCHART_EVENT_ID:JSCHART_EVENT_ID, //可以订阅的事件类型
168682
- JSCHART_OPERATOR_ID:JSCHART_OPERATOR_ID, //图形控制类型
168683
- JSCHART_DATA_FIELD_ID:JSCHART_DATA_FIELD_ID,//图形字段
168684
- JSCHART_CUSTOM_YCOORDINATE_ID:JSCHART_CUSTOM_YCOORDINATE_ID, //自定义刻度类型
168685
- JSAlgorithm:JSAlgorithm, //算法类
168686
- JSComplier:JSComplier, //指标编译器
168687
- JSIndexScript:JSIndexScript, //系统指标库
168688
- GetDevicePixelRatio,GetDevicePixelRatio,
168689
-
168690
- ScriptIndexConsole:ScriptIndexConsole, //指标执行 无UI
168691
- //style.js相关
168692
- STYLE_TYPE_ID:STYLE_TYPE_ID,
168693
- HQChartStyle:HQChartStyle, //预定义全局的配色 黑
168683
+ this.SetOption=function(option)
168684
+ {
168685
+ var chart=this.CreateJSStatusBarChartContainer(option);
168694
168686
 
168695
- JSConsole:JSConsole, //日志输出
168687
+ if (!chart) return false;
168696
168688
 
168697
- KLineTooltipPaint:KLineTooltipPaint, //K线tooltip
168698
- MinuteTooltipPaint:MinuteTooltipPaint, //走势图tooltip
168689
+ if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
168699
168690
 
168700
- ChartDrawTwoPointDemo:ChartDrawTwoPointDemo, //画图工具2个点例子
168701
- ChartDrawThreePointDemo:ChartDrawThreePointDemo, //画图工具3个点例子
168691
+ this.JSChartContainer=chart;
168692
+ this.DivElement.JSChart=this; //div中保存一份
168702
168693
 
168703
- CoordinateInfo:CoordinateInfo,
168694
+ if (option.EnableResize==true) this.CreateResizeListener();
168704
168695
 
168705
- //成交明细
168706
- JSDealChart:JSDealChart,
168707
- DEAL_COLUMN_ID:DEAL_COLUMN_ID,
168696
+ if (option.MinuteChartTooltip && option.MinuteChartTooltip.Enable) chart.InitalMinuteChartTooltip(option.MinuteChartTooltip);
168708
168697
 
168709
- //报价列表
168710
- JSReportChart:JSReportChart,
168711
- REPORT_COLUMN_ID:REPORT_COLUMN_ID,
168698
+ chart.Draw();
168699
+ chart.RequestData();
168700
+ }
168712
168701
 
168713
- //T型报价
168714
- JSTReportChart:JSTReportChart,
168715
- TREPORT_COLUMN_ID:TREPORT_COLUMN_ID,
168702
+ this.CreateResizeListener=function()
168703
+ {
168704
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
168705
+ this.ResizeListener.observe(this.DivElement);
168706
+ }
168716
168707
 
168717
- //键盘精灵
168718
- JSKeyboardChart:JSKeyboardChart,
168719
- KEYBOARD_COLUMN_ID:KEYBOARD_COLUMN_ID,
168720
- JSPopKeyboard:JSPopKeyboard,
168708
+ this.OnDivResize=function(entries)
168709
+ {
168710
+ JSConsole.Chart.Log("[JSStatusBarChart::OnDivResize] entries=", entries);
168721
168711
 
168722
- //X轴滚动条
168723
- JSScrollBarChart:JSScrollBarChart,
168712
+ this.OnSize();
168713
+ }
168714
+
168715
+ this.CreateJSStatusBarChartContainer=function(option)
168716
+ {
168717
+ var chart=new JSStatusBarChartContainer(this.CanvasElement);
168718
+ chart.Create(option);
168719
+
168720
+ this.SetChartBorder(chart, option);
168721
+
168722
+ if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) chart.SetColumn(option.Column);
168723
+ if (option.RightToolbar) chart.SetRightToolbar(option.RightToolbar);
168724
+
168725
+ //是否自动更新
168726
+ if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
168727
+
168728
+ if (option.IsAutoUpdate!=null) chart.IsAutoUpdate=option.IsAutoUpdate;
168729
+ if (option.AutoUpdateFrequency>0) chart.AutoUpdateFrequency=option.AutoUpdateFrequency;
168730
+
168731
+ //注册事件
168732
+ if (option.EventCallback)
168733
+ {
168734
+ for(var i=0;i<option.EventCallback.length;++i)
168735
+ {
168736
+ var item=option.EventCallback[i];
168737
+ chart.AddEventCallback(item);
168738
+ }
168739
+ }
168740
+
168741
+ return chart;
168742
+ }
168743
+
168744
+ this.SetChartBorder=function(chart, option)
168745
+ {
168746
+ if (!option.Border) return;
168747
+
168748
+ var item=option.Border;
168749
+ if (IFrameSplitOperator.IsNumber(option.Border.Left)) chart.Frame.ChartBorder.Left=option.Border.Left;
168750
+ if (IFrameSplitOperator.IsNumber(option.Border.Right)) chart.Frame.ChartBorder.Right=option.Border.Right;
168751
+ if (IFrameSplitOperator.IsNumber(option.Border.Top)) chart.Frame.ChartBorder.Top=option.Border.Top;
168752
+ if (IFrameSplitOperator.IsNumber(option.Border.Bottom)) chart.Frame.ChartBorder.Bottom=option.Border.Bottom;
168753
+
168754
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
168755
+ chart.Frame.ChartBorder.Left*=pixelTatio;
168756
+ chart.Frame.ChartBorder.Right*=pixelTatio;
168757
+ chart.Frame.ChartBorder.Top*=pixelTatio;
168758
+ chart.Frame.ChartBorder.Bottom*=pixelTatio;
168759
+ }
168760
+
168761
+ //事件回调
168762
+ this.AddEventCallback=function(obj)
168763
+ {
168764
+ if(this.JSChartContainer && typeof(this.JSChartContainer.AddEventCallback)=='function')
168765
+ {
168766
+ JSConsole.Chart.Log('[JSStatusBarChart:AddEventCallback] obj=', obj);
168767
+ this.JSChartContainer.AddEventCallback(obj);
168768
+ }
168769
+ }
168770
+
168771
+ //重新加载配置
168772
+ this.ReloadResource=function(option)
168773
+ {
168774
+ if(this.JSChartContainer && typeof(this.JSChartContainer.ReloadResource)=='function')
168775
+ {
168776
+ JSConsole.Chart.Log('[JSStatusBarChart:ReloadResource] ');
168777
+ this.JSChartContainer.ReloadResource(option);
168778
+ }
168779
+ }
168780
+
168781
+ this.ChartDestroy=function()
168782
+ {
168783
+ if (this.JSChartContainer && typeof (this.JSChartContainer.ChartDestroy) == 'function')
168784
+ {
168785
+ this.JSChartContainer.ChartDestroy();
168786
+ }
168787
+ }
168788
+
168789
+ this.Draw=function()
168790
+ {
168791
+ if(this.JSChartContainer && typeof(this.JSChartContainer.Draw)=='function')
168792
+ {
168793
+ JSConsole.Chart.Log('[JSStatusBarChart:Draw] ');
168794
+ this.JSChartContainer.Draw();
168795
+ }
168796
+ }
168797
+ }
168798
+
168799
+ JSStatusBarChart.Init=function(divElement)
168800
+ {
168801
+ var jsChartControl=new JSStatusBarChart(divElement);
168802
+ jsChartControl.OnSize();
168803
+
168804
+ return jsChartControl;
168805
+ }
168806
+
168807
+ //自定义风格
168808
+ JSStatusBarChart.SetStyle=function(option)
168809
+ {
168810
+ if (option) g_JSChartResource.SetStyle(option);
168811
+ }
168812
+
168813
+ //获取颜色配置 (JSStatusBarChart.Init()之前)
168814
+ JSStatusBarChart.GetResource=function()
168815
+ {
168816
+ return g_JSChartResource;
168817
+ }
168818
+
168819
+ JSStatusBarChart.GetfloatPrecision=function(symbol)
168820
+ {
168821
+ return GetfloatPrecision(symbol);
168822
+ }
168823
+
168824
+
168825
+ function JSStatusBarChartContainer(uielement)
168826
+ {
168827
+ this.ClassName='JSStatusBarChartContainer';
168828
+ this.Frame; //框架画法
168829
+ this.ChartPaint=[]; //图形画法
168830
+
168831
+ this.Canvas=uielement.getContext("2d"); //画布
168832
+
168833
+ this.NetworkFilter; //数据回调接口
168834
+ this.Data=
168835
+ {
168836
+ MapSymbol:new Map(), //key=symbol, { Value:, Text:, } 股票数据
168837
+ };
168838
+
168839
+ //事件回调
168840
+ this.mapEvent=new Map(); //通知外部调用 key:JSCHART_EVENT_ID value:{ Callback:回调,}
168841
+
168842
+ this.AutoUpdateTimer=null;
168843
+ this.AutoUpdateFrequency=15000; //15秒更新一次数据
168844
+
168845
+ this.ToolbarTimer=null;
168846
+
168847
+ this.TooltipMinuteChart; //分时图
168848
+
168849
+ this.UIElement=uielement;
168850
+
168851
+ this.IsDestroy=false; //是否已经销毁了
168852
+
168853
+ this.ChartDestroy=function() //销毁
168854
+ {
168855
+ this.IsDestroy=true;
168856
+ this.StopAutoUpdate();
168857
+
168858
+ if (this.ToolbarTimer)
168859
+ {
168860
+ clearInterval(this.ToolbarTimer);
168861
+ this.ToolbarTimer=null;
168862
+ }
168863
+
168864
+ this.DestroyMinuteChartTooltip();
168865
+ }
168866
+
168867
+ this.InitalMinuteChartTooltip=function(option)
168868
+ {
168869
+ if (this.TooltipMinuteChart) return;
168870
+
168871
+ this.TooltipMinuteChart=new JSTooltipMinuteChart();
168872
+ this.TooltipMinuteChart.Inital(this, option);
168873
+ this.TooltipMinuteChart.Create();
168874
+ }
168875
+
168876
+ this.DestroyMinuteChartTooltip=function()
168877
+ {
168878
+ if (!this.TooltipMinuteChart) return;
168879
+
168880
+ this.TooltipMinuteChart.Destroy();
168881
+ this.TooltipMinuteChart=null;
168882
+ }
168883
+
168884
+ //设置事件回调
168885
+ //{event:事件id, callback:回调函数}
168886
+ this.AddEventCallback=function(object)
168887
+ {
168888
+ if (!object || !object.event || !object.callback) return;
168889
+
168890
+ var data={Callback:object.callback, Source:object};
168891
+ this.mapEvent.set(object.event,data);
168892
+ }
168893
+
168894
+ this.RemoveEventCallback=function(eventid)
168895
+ {
168896
+ if (!this.mapEvent.has(eventid)) return;
168897
+
168898
+ this.mapEvent.delete(eventid);
168899
+ }
168900
+
168901
+ this.GetEventCallback=function(id) //获取事件回调
168902
+ {
168903
+ if (!this.mapEvent.has(id)) return null;
168904
+ var item=this.mapEvent.get(id);
168905
+ return item;
168906
+ }
168907
+
168908
+ this.ClearData=function()
168909
+ {
168910
+ this.Data.MapSymbol=new Map();
168911
+ }
168912
+
168913
+ this.RequestData=function(option)
168914
+ {
168915
+ this.CancelAutoUpdate();
168916
+ this.ClearData();
168917
+
168918
+ if (option)
168919
+ {
168920
+ if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) this.SetColumn(option.Column);
168921
+ }
168922
+
168923
+ this.Draw();
168924
+ this.RequestStockData();
168925
+
168926
+ if (this.IsAutoUpdate)
168927
+ {
168928
+ var frequency=this.AutoUpdateFrequency;
168929
+ setInterval(()=>
168930
+ {
168931
+ var marketStatus=MARKET_SUFFIX_NAME.GetMarketStatus(this.Symbol);
168932
+ if (marketStatus==0 || marketStatus==3) //闭市,盘后
168933
+ return;
168934
+
168935
+ this.RequestStockData();
168936
+ }, frequency)
168937
+ }
168938
+ }
168939
+
168940
+ this.CancelAutoUpdate=function() //关闭停止更新
168941
+ {
168942
+ if (this.AutoUpdateTimer)
168943
+ {
168944
+ clearInterval(this.AutoUpdateTimer);
168945
+ this.AutoUpdateTimer = null;
168946
+ }
168947
+ }
168948
+
168949
+ this.StopAutoUpdate=function()
168950
+ {
168951
+ this.CancelAutoUpdate();
168952
+ if (!this.IsAutoUpdate) return;
168953
+ this.IsAutoUpdate=false;
168954
+ }
168955
+
168956
+ this.RequestStockData=function()
168957
+ {
168958
+ if (!this.NetworkFilter) return;
168959
+
168960
+ var chart=this.ChartPaint[0];
168961
+ if (!chart) return;
168962
+ if (!IFrameSplitOperator.IsNonEmptyArray(chart.Column)) return;
168963
+
168964
+ var arySymbol=[];
168965
+ for(var i=0;i<chart.Column.length;++i)
168966
+ {
168967
+ var item=chart.Column[i];
168968
+ var newItem={ Symbol:item.Symbol, Fields:[] };
168969
+ arySymbol.push(newItem);
168970
+ }
168971
+
168972
+ var obj=
168973
+ {
168974
+ Name:'JSStatusBarChartContainer::RequestStockData', //类名::函数名
168975
+ Explain:'工具栏股票数据',
168976
+ Request: { Data:{ stocks:arySymbol } },
168977
+ Self:this,
168978
+ PreventDefault:false
168979
+ };
168980
+
168981
+ this.NetworkFilter(obj, (data)=>
168982
+ {
168983
+ this.RecvStockData(data);
168984
+ });
168985
+
168986
+ if (obj.PreventDefault==true) return; //已被上层替换,不调用默认的网络请求
168987
+
168988
+ }
168989
+
168990
+ this.RecvStockData=function(recv)
168991
+ {
168992
+ if (!recv) return;
168993
+ if (!IFrameSplitOperator.IsNonEmptyArray(recv.data)) return;
168994
+
168995
+ for(var i=0;i<recv.data.length;++i)
168996
+ {
168997
+ var item=recv.data[i];
168998
+ if (!item.Symbol) continue;
168999
+
169000
+ var stockItem=null;
169001
+ if (this.Data.MapSymbol.has(item.Symbol))
169002
+ {
169003
+ stockItem=this.Data.MapSymbol.get(item.Symbol);
169004
+ }
169005
+ else
169006
+ {
169007
+ stockItem={ Symbol:item.Symbol, MapData:new Map() };
169008
+ stockItem.YClose=item.YClose;
169009
+ if (IFrameSplitOperator.IsNumber(item.FYClose)) stockItem.YClose=item.FYClose;
169010
+ this.Data.MapSymbol.set(item.Symbol,stockItem);
169011
+ }
169012
+
169013
+ for(var j=0;j<item.Data.length;++j)
169014
+ {
169015
+ var itemData=item.Data[j];
169016
+ stockItem.MapData.set(itemData.Key,itemData.Value);
169017
+ }
169018
+ }
169019
+
169020
+ if (!this.ToolbarTimer) this.Draw();
169021
+ }
169022
+
169023
+ //创建
169024
+ this.Create=function(option)
169025
+ {
169026
+ this.UIElement.JSChartContainer=this;
169027
+
169028
+ //创建框架
169029
+ this.Frame=new JSStatusBarFrame();
169030
+ this.Frame.ChartBorder=new ChartBorder();
169031
+ this.Frame.ChartBorder.UIElement=this.UIElement;
169032
+ this.Frame.ChartBorder.Top=30;
169033
+ this.Frame.ChartBorder.Left=5;
169034
+ this.Frame.ChartBorder.Bottom=20;
169035
+ this.Frame.Canvas=this.Canvas;
169036
+
169037
+ //创建表格
169038
+ var chart=new ChartStatusBarStockData();
169039
+ chart.Frame=this.Frame;
169040
+ chart.ChartBorder=this.Frame.ChartBorder;
169041
+ chart.Canvas=this.Canvas;
169042
+ chart.UIElement=this.UIElement;
169043
+ chart.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
169044
+ chart.Data=this.Data;
169045
+ chart.BorderData=this.BorderData;
169046
+ chart.GlobalOption=this.GlobalOption;
169047
+ chart.FixedRowData=this.FixedRowData;
169048
+ chart.SortInfo=this.SortInfo;
169049
+ this.ChartPaint[0]=chart;
169050
+
169051
+
169052
+ if (option)
169053
+ {
169054
+
169055
+ }
169056
+
169057
+ this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
169058
+ this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e); }
169059
+ this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
169060
+
169061
+ /*
169062
+ this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
169063
+ this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
169064
+
169065
+
169066
+ this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
169067
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
169068
+ */
169069
+
169070
+ var frequency=500;
169071
+ this.ToolbarTimer=setInterval(()=>
169072
+ {
169073
+ this.Draw();
169074
+ }, frequency)
169075
+ }
169076
+
169077
+ this.UIOnMouseDown=function(e)
169078
+ {
169079
+ var pixelTatio = GetDevicePixelRatio();
169080
+ this.ClickDownPoint={ X:e.clientX, Y:e.clientY };
169081
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
169082
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
169083
+
169084
+ var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
169085
+ this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STATUSBAR_ITEM, ptClick, e);
169086
+ }
169087
+
169088
+ this.GetChartTooltipData=function(x,y,option)
169089
+ {
169090
+ var toolTip=new TooltipData();
169091
+ for(var i=0;i<this.ChartPaint.length;++i)
169092
+ {
169093
+ var item=this.ChartPaint[i];
169094
+ if (item.GetTooltipData(x,y,toolTip))
169095
+ {
169096
+ return toolTip;
169097
+ }
169098
+ }
169099
+
169100
+ return null;
169101
+ }
169102
+
169103
+ this.UIOnMouseMove=function(e)
169104
+ {
169105
+ var pixelTatio = GetDevicePixelRatio();
169106
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
169107
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
169108
+
169109
+ //var bShowKLineTooltip=false;
169110
+ var bShowMinuteTooltip=false;
169111
+ var chartTooltipData=null;
169112
+ var tooltipData=this.GetChartTooltipData(x,y);
169113
+
169114
+ if (tooltipData)
169115
+ {
169116
+ if (tooltipData.Type==121)
169117
+ {
169118
+ var item=tooltipData.Data;
169119
+ if (item && item.Data && item.Data.Symbol)
169120
+ {
169121
+ bShowMinuteTooltip=true;
169122
+ chartTooltipData={ Symbol:item.Data.Symbol, Rect:item.Rect, Position:1 };
169123
+ }
169124
+ }
169125
+ }
169126
+
169127
+ //if (!bShowKLineTooltip) this.HideKLineChartTooltip();
169128
+ if (!bShowMinuteTooltip) this.HideMinuteChartTooltip();
169129
+
169130
+ if (bShowMinuteTooltip) this.ShowMinuteChartTooltip(null, null, chartTooltipData);
169131
+ //if (bShowKLineTooltip) this.ShowKLineChartTooltip(null, null, chartTooltipData);
169132
+ }
169133
+
169134
+ this.UIOnMounseOut=function(e)
169135
+ {
169136
+ this.HideAllTooltip();
169137
+ }
169138
+
169139
+
169140
+
169141
+ this.TryClickPaintEvent=function(eventID, ptClick, e)
169142
+ {
169143
+ var event=this.GetEventCallback(eventID);
169144
+ if (!event) return false;
169145
+
169146
+ if (ptClick.X==e.clientX && ptClick.Y==e.clientY)
169147
+ {
169148
+ var pixelTatio = GetDevicePixelRatio();
169149
+ var x = (e.clientX-uielement.getBoundingClientRect().left)*pixelTatio;
169150
+ var y = (e.clientY-uielement.getBoundingClientRect().top)*pixelTatio;
169151
+
169152
+ var toolTip=new TooltipData();
169153
+ for(var i=0;i<this.ChartPaint.length;++i)
169154
+ {
169155
+ var item=this.ChartPaint[i];
169156
+ if (item.GetTooltipData(x,y,toolTip))
169157
+ {
169158
+ if (toolTip.Data)
169159
+ {
169160
+ var data= { X:e.clientX, Y:e.clientY, Tooltip:toolTip };
169161
+ event.Callback(event, data, this);
169162
+ return true;
169163
+ }
169164
+ }
169165
+ }
169166
+ }
169167
+
169168
+ return false;
169169
+ }
169170
+
169171
+ this.Draw=function()
169172
+ {
169173
+ if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
169174
+
169175
+ this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);
169176
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
169177
+ this.Canvas.lineWidth=pixelTatio; //手机端需要根据分辨率比调整线段宽度
169178
+
169179
+ this.Frame.Draw();
169180
+ this.Frame.DrawLogo();
169181
+
169182
+ //框架内图形
169183
+ for(var i=0;i<this.ChartPaint.length;++i)
169184
+ {
169185
+ var item=this.ChartPaint[i];
169186
+ item.Draw();
169187
+ }
169188
+ }
169189
+
169190
+ this.OnSize=function()
169191
+ {
169192
+ if (!this.Frame) return;
169193
+
169194
+ this.SetSizeChange(true);
169195
+ this.Draw();
169196
+ }
169197
+
169198
+ this.SetSizeChange=function(bChanged)
169199
+ {
169200
+ for(var i=0;i<this.ChartPaint.length;++i)
169201
+ {
169202
+ var chart=this.ChartPaint[i];
169203
+ if (chart) chart.SizeChange=bChanged;
169204
+ }
169205
+ }
169206
+
169207
+ this.ReloadResource=function(option)
169208
+ {
169209
+ this.Frame.ReloadResource(option);
169210
+
169211
+ for(var i=0;i<this.ChartPaint.length;++i)
169212
+ {
169213
+ var item=this.ChartPaint[i];
169214
+ if (item.ReloadResource) item.ReloadResource(option);
169215
+ }
169216
+
169217
+ if (option && (option.Redraw || option.Draw))
169218
+ {
169219
+ this.SetSizeChange(true);
169220
+ this.Draw();
169221
+ }
169222
+
169223
+ if (this.TooltipMinuteChart) this.TooltipMinuteChart.ReloadResource(option); //分时图
169224
+ }
169225
+
169226
+ this.SetColumn=function(aryColunm, option)
169227
+ {
169228
+ var chart=this.ChartPaint[0];
169229
+ if (!chart) return;
169230
+
169231
+ chart.SetColumn(aryColunm);
169232
+ chart.SizeChange=true;
169233
+
169234
+ if (option && option.Redraw) this.Draw();
169235
+ }
169236
+
169237
+ this.SetRightToolbar=function(toolbar, option)
169238
+ {
169239
+ var chart=this.ChartPaint[0];
169240
+ if (!chart) return;
169241
+
169242
+ chart.SetRightToolbar(toolbar);
169243
+ chart.SizeChange=true;
169244
+
169245
+ if (option && option.Redraw) this.Draw();
169246
+ }
169247
+
169248
+ this.GetStatusBarChart=function()
169249
+ {
169250
+ var chart=this.ChartPaint[0];
169251
+ if (!chart) return null;
169252
+
169253
+ return chart;
169254
+ }
169255
+
169256
+ //data={ Symbol }
169257
+ this.ShowMinuteChartTooltip=function(x,y, data)
169258
+ {
169259
+ if (!this.TooltipMinuteChart) return;
169260
+
169261
+ var rtClient=this.UIElement.getBoundingClientRect();
169262
+ var rtScroll=GetScrollPosition();
169263
+
169264
+ var offsetLeft=rtClient.left+rtScroll.Left;
169265
+ var offsetTop=rtClient.top+rtScroll.Top;
169266
+
169267
+ data.Offset={ Left:offsetLeft, Top:offsetTop };
169268
+
169269
+ this.TooltipMinuteChart.Show(data, x,y);
169270
+ }
169271
+
169272
+ this.HideMinuteChartTooltip=function()
169273
+ {
169274
+ if (!this.TooltipMinuteChart) return;
169275
+
169276
+ this.TooltipMinuteChart.Hide();
169277
+ }
169278
+
169279
+ this.HideAllTooltip=function()
169280
+ {
169281
+ //this.HideKLineChartTooltip();
169282
+ this.HideMinuteChartTooltip();
169283
+ }
169284
+
169285
+ }
169286
+
169287
+ function JSStatusBarFrame()
169288
+ {
169289
+ this.ChartBorder;
169290
+ this.Canvas; //画布
169291
+
169292
+ this.BorderLine=null; //1=上 2=下 4=左 8=右
169293
+ this.ClassName="JSStatusBarFrame";
169294
+
169295
+ this.BorderColor=g_JSChartResource.StatusBar.BorderColor; //边框线
169296
+
169297
+ this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;
169298
+ this.LogoTextFont=g_JSChartResource.FrameLogo.Font;
169299
+
169300
+ this.ReloadResource=function(resource)
169301
+ {
169302
+ this.BorderColor=g_JSChartResource.StatusBar.BorderColor; //边框线
169303
+ this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;
169304
+ this.LogoTextFont=g_JSChartResource.FrameLogo.Font;
169305
+ }
169306
+
169307
+ this.Draw=function()
169308
+ {
169309
+ var left=ToFixedPoint(this.ChartBorder.GetLeft());
169310
+ var top=ToFixedPoint(this.ChartBorder.GetTop());
169311
+ var right=ToFixedPoint(this.ChartBorder.GetRight());
169312
+ var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
169313
+ var width=right-left;
169314
+ var height=bottom-top;
169315
+
169316
+ if (!IFrameSplitOperator.IsNumber(this.BorderLine))
169317
+ {
169318
+ this.Canvas.strokeStyle=this.BorderColor;
169319
+ this.Canvas.strokeRect(left,top,width,height);
169320
+ }
169321
+ else
169322
+ {
169323
+ this.Canvas.strokeStyle=this.BorderColor;
169324
+ this.Canvas.beginPath();
169325
+
169326
+ if ((this.BorderLine&1)>0) //上
169327
+ {
169328
+ this.Canvas.moveTo(left,top);
169329
+ this.Canvas.lineTo(right,top);
169330
+ }
169331
+
169332
+ if ((this.BorderLine&2)>0) //下
169333
+ {
169334
+ this.Canvas.moveTo(left,bottom);
169335
+ this.Canvas.lineTo(right,bottom);
169336
+ }
169337
+
169338
+ if ((this.BorderLine&4)>0) //左
169339
+ {
169340
+ this.Canvas.moveTo(left,top);
169341
+ this.Canvas.lineTo(left,bottom);
169342
+ }
169343
+
169344
+ if ((this.BorderLine&8)>0) //右
169345
+ {
169346
+ this.Canvas.moveTo(right,top);
169347
+ this.Canvas.lineTo(right,bottom);
169348
+ }
169349
+
169350
+ this.Canvas.stroke();
169351
+ }
169352
+ }
169353
+
169354
+ this.DrawLogo=function()
169355
+ {
169356
+ /*
169357
+ var text=g_JSChartResource.FrameLogo.Text;
169358
+ if (!IFrameSplitOperator.IsString(text)) return;
169359
+
169360
+ this.Canvas.fillStyle=this.LogoTextColor;
169361
+ this.Canvas.font=this.LogoTextFont;
169362
+ this.Canvas.textAlign = 'right';
169363
+ this.Canvas.textBaseline = 'bottom';
169364
+
169365
+ var x=this.ChartBorder.GetRight()-30;
169366
+ var y=this.ChartBorder.GetBottom()-5;
169367
+ this.Canvas.fillText(text,x,y);
169368
+ */
169369
+ }
169370
+ }
169371
+
169372
+
169373
+ function ChartStatusBarStockData()
169374
+ {
169375
+ this.Canvas; //画布
169376
+ this.ChartBorder; //边框信息
169377
+ this.ChartFrame; //框架画法
169378
+ this.Name; //名称
169379
+ this.ClassName='ChartStatusBarStockData'; //类名
169380
+ this.UIElement;
169381
+ this.GetEventCallback; //获取事件
169382
+ this.Data; //数据
169383
+ this.SizeChange=true;
169384
+
169385
+ this.UpColor=g_JSChartResource.StatusBar.UpTextColor;
169386
+ this.DownColor=g_JSChartResource.StatusBar.DownTextColor;
169387
+ this.UnchangeColor=g_JSChartResource.StatusBar.UnchangeTextColor;
169388
+
169389
+ this.TableConfig=CloneData(g_JSChartResource.StatusBar.Table);
169390
+ this.DateTimeConfig=CloneData(g_JSChartResource.StatusBar.DateTime);
169391
+
169392
+ //显示的字段
169393
+ this.Column=
169394
+ [
169395
+ {
169396
+ Symbol:"000001.sh",
169397
+ Column:
169398
+ [
169399
+ { Name:"名称", Key:"Name", Text:"000001", },
169400
+ { Name:"现价", Key:"Price", ColorType:3, FloatPrecision:-1, MaxText:"88888.88" },
169401
+ { Name:"涨幅", Key:"Increase", ColorType:1, FloatPrecision:2, StringFormat:"{Value}%", MaxText:"888.88%" },
169402
+ { Name:"涨跌", Key:"UpDown",ColorType:1, FloatPrecision:-1 },
169403
+ { Name:"总额", Key:"Amount", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 }, ColorID:1 }
169404
+ ]
169405
+ },
169406
+
169407
+ {
169408
+ Symbol:"600000.sh",
169409
+ Column:
169410
+ [
169411
+ { Name:"名称", Key:"Name", Text:"600000", },
169412
+ { Name:"现价", Key:"Price", ColorType:3, FloatPrecision:-1 },
169413
+ { Name:"涨幅", Key:"Increase", ColorType:1, FloatPrecision:2, StringFormat:"{Value}%" },
169414
+ { Name:"涨跌", Key:"UpDown",ColorType:1, FloatPrecision:-1 },
169415
+ { Name:"总额", Key:"Amount", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }
169416
+ ]
169417
+ }
169418
+ ]
169419
+
169420
+ this.RightToolbarConfig=CloneData(g_JSChartResource.StatusBar.RightToolbar);
169421
+ this.MapToolbarFlash=new Map(); //key=id, Value:{ Counter:, Enable: }
169422
+
169423
+
169424
+ //右侧工具栏
169425
+ this.RightToolbar=
169426
+ {
169427
+ /*
169428
+ AryButton:
169429
+ [
169430
+ { ID:2, Type:1, Icon:[{ Symbol:"\ue609", Color:"rgb(180,180,180)"} ] },
169431
+
169432
+ {
169433
+ ID:1, Type:2, Icon:[{ Symbol:"\ue6d0", Color:"rgb(180,180,180)"} ],
169434
+ Flash:
169435
+ {
169436
+ AryIcon:
169437
+ [
169438
+ [{ Symbol:"\ue6cb", Color:"rgb(0,191,255)"}],
169439
+ [{ Symbol:"\ue6cb", Color:"rgb(255,165,0)"}],
169440
+ [{ Symbol:"\ue6cb", Color:"rgb(255,215,0)"}],
169441
+ ]
169442
+ }
169443
+ },
169444
+ ]
169445
+ */
169446
+ }
169447
+
169448
+ this.AryRectCell=[];
169449
+ this.AryRectButton=[];
169450
+
169451
+ this.ReloadResource=function(resource)
169452
+ {
169453
+ this.UpColor=g_JSChartResource.StatusBar.UpTextColor;
169454
+ this.DownColor=g_JSChartResource.StatusBar.DownTextColor;
169455
+ this.UnchangeColor=g_JSChartResource.StatusBar.UnchangeTextColor;
169456
+
169457
+ this.TableConfig=CloneData(g_JSChartResource.StatusBar.Table);
169458
+ this.DateTimeConfig=CloneData(g_JSChartResource.StatusBar.DateTime);
169459
+ }
169460
+
169461
+ this.SetColumn=function(aryColumn)
169462
+ {
169463
+ this.Column=[];
169464
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryColumn)) return;
169465
+
169466
+ for(var i=0;i<aryColumn.length;++i)
169467
+ {
169468
+ var item=aryColumn[i];
169469
+ if (!item) continue;
169470
+ this.Column.push(CloneData(item));
169471
+ }
169472
+ }
169473
+
169474
+ this.SetRightToolbar=function(toolbar, option)
169475
+ {
169476
+ if (IFrameSplitOperator.IsNonEmptyArray(toolbar.AryButton))
169477
+ {
169478
+ this.RightToolbar.AryButton=toolbar.AryButton.slice();
169479
+ for(var i=0;i<this.RightToolbar.AryButton.length;++i)
169480
+ {
169481
+ var item=this.RightToolbar.AryButton[i];
169482
+ if (item.Type===2)
169483
+ {
169484
+ var value={ Counter:1, Enable:true };
169485
+ if (IFrameSplitOperator.IsBool(item.Enable)) value.Enable=item.Enable;
169486
+ this.MapToolbarFlash.set(item.ID, value)
169487
+ }
169488
+ }
169489
+
169490
+ }
169491
+
169492
+
169493
+ }
169494
+
169495
+ this.Draw=function()
169496
+ {
169497
+ this.AryRectCell=[];
169498
+ this.AryRectButton=[];
169499
+
169500
+ var border=this.ChartBorder.GetBorder();
169501
+ var position = { Left:border.Left, Right:border.Right, Top:border.Top, Bottom:border.Bottom, Width:border.Right-border.Left, Border:border };
169502
+ this.DrawRightToolbar(position);
169503
+ this.DrawTable(position);
169504
+ }
169505
+
169506
+ this.DrawTable=function(position)
169507
+ {
169508
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Column)) return;
169509
+
169510
+ var config=this.TableConfig;
169511
+ var top=position.Top;
169512
+ var left=position.Left+config.Margin.Left;
169513
+
169514
+ var yText=top+config.Margin.Top;
169515
+ var xText=left;
169516
+
169517
+ this.Canvas.font=config.Font;
169518
+ this.Canvas.textAlign = 'left';
169519
+ this.Canvas.textBaseline = 'bottom';
169520
+ var cellHeight=this.Canvas.measureText("擎").width+config.CellMargin.Top+config.CellMargin.Bottom;
169521
+ var itemPos={ Left:xText, Right:position.Right, Top:yText, Height:cellHeight, Bottom:yText+cellHeight, IsBreak:false, CellCount:0 };
169522
+
169523
+ for(var i=0;i<this.Column.length;++i)
169524
+ {
169525
+ var item=this.Column[i];
169526
+ if (!item || !item.Symbol) continue;
169527
+
169528
+ var rtCell={ Left:itemPos.Left, Top:itemPos.Top, Bottom:itemPos.Bottom, Right:itemPos.Left };
169529
+ if (i>0) rtCell.Left-=config.Separator.Right;
169530
+ this.DrawCellItem(item, itemPos );
169531
+ if (itemPos.CellCount>0)
169532
+ {
169533
+ rtCell.Right=itemPos.Left;
169534
+ rtCell.Width=rtCell.Right-itemPos.Left;
169535
+ rtCell.Height=rtCell.Bottom-rtCell.Top;
169536
+
169537
+ this.AryRectCell.push({ Rect:rtCell, Data:item, Type:1 });
169538
+ }
169539
+
169540
+ if (itemPos.IsBreak)
169541
+ {
169542
+ break;
169543
+ }
169544
+
169545
+ itemPos.Left+=config.Separator.Left;
169546
+ if (config.Separator.Line && config.Separator.Line.Color) //分割线
169547
+ {
169548
+ if (itemPos.Left>=itemPos.Right) break;
169549
+
169550
+ var subConfig=config.Separator.Line;
169551
+ var lineWidth=1*GetDevicePixelRatio();
169552
+ if (IFrameSplitOperator.IsNumber(subConfig.Width)) lineWidth=subConfig.Width;
169553
+
169554
+ this.Canvas.strokeStyle=subConfig.Color;
169555
+ this.Canvas.beginPath();
169556
+ this.Canvas.moveTo(ToFixedPoint(itemPos.Left),itemPos.Top+subConfig.Top);
169557
+ this.Canvas.lineTo(ToFixedPoint(itemPos.Left),itemPos.Bottom-subConfig.Bottom);
169558
+ this.Canvas.stroke();
169559
+ }
169560
+
169561
+ itemPos.Left+=config.Separator.Right;
169562
+ }
169563
+ }
169564
+
169565
+ this.DrawCellItem=function(cellItem, itemPos)
169566
+ {
169567
+ var config=this.TableConfig;
169568
+ var xText=itemPos.Left;
169569
+ var yBottom=itemPos.Top+itemPos.Height-config.CellMargin.Bottom+config.CellMargin.YOffset;
169570
+ var text=null;
169571
+
169572
+ var stockItem=null;
169573
+ if (this.Data.MapSymbol.has(cellItem.Symbol)) stockItem=this.Data.MapSymbol.get(cellItem.Symbol);
169574
+
169575
+ for(var i=0;i<cellItem.Column.length ;++i)
169576
+ {
169577
+ var item=cellItem.Column[i];
169578
+ if (!item) continue;
169579
+
169580
+ var color=config.AryTextColor[0];
169581
+ var text=null;
169582
+ if (stockItem && stockItem.MapData.has(item.Key))
169583
+ {
169584
+ var dataItem=stockItem.MapData.get(item.Key);
169585
+ text=this.FormatValue(item, dataItem, stockItem);
169586
+
169587
+ if (IFrameSplitOperator.IsNumber(item.ColorID) && item.ColorID>=0 && item.ColorID<config.AryTextColor.length)
169588
+ color=config.AryTextColor[item.ColorID];
169589
+
169590
+ if (item.ColorType===3 && IFrameSplitOperator.IsNumber(dataItem.Value))
169591
+ color=this.GetPriceColor(dataItem.Value, stockItem);
169592
+ else if (item.ColorType==1 && IFrameSplitOperator.IsNumber(dataItem.Value))
169593
+ color=this.GetUpDownColor(dataItem.Value,0);
169594
+ else if (item.ColorType==4)
169595
+ color=this.UpColor;
169596
+ else if (item.ColorType==5)
169597
+ color=this.DownColor;
169598
+
169599
+ if (item.TextColor) color=item.TextColor;
169600
+ }
169601
+
169602
+ if (!text && item.Text) text=item.Text;
169603
+
169604
+ if (text)
169605
+ {
169606
+ var textWidth=this.Canvas.measureText(text).width;
169607
+ if (xText+textWidth+config.CellMargin.Left+config.CellMargin.Right>itemPos.Right)
169608
+ {
169609
+ itemPos.IsBreak=true;
169610
+ break;
169611
+ }
169612
+ this.Canvas.fillStyle=color;
169613
+ this.Canvas.fillText(text,xText+config.CellMargin.Left,yBottom);
169614
+ xText+=(textWidth+config.CellMargin.Left+config.CellMargin.Right);
169615
+ }
169616
+ else if (item.MaxText)
169617
+ {
169618
+ text=item.MaxText;
169619
+ var textWidth=this.Canvas.measureText(text).width;
169620
+ xText+=(textWidth+config.CellMargin.Left+config.CellMargin.Right);
169621
+ if (xText>itemPos.Right)
169622
+ {
169623
+ itemPos.IsBreak=true;
169624
+ break;
169625
+ }
169626
+ }
169627
+
169628
+ ++itemPos.CellCount;
169629
+ }
169630
+
169631
+ itemPos.Left=xText;
169632
+
169633
+ }
169634
+
169635
+
169636
+ this.FormatValue=function(column, data, stockItem)
169637
+ {
169638
+ var dec=0; //小数位数
169639
+ if (IFrameSplitOperator.IsNumber(column.FloatPrecision))
169640
+ {
169641
+ if (column.FloatPrecision===-1) dec=GetfloatPrecision(stockItem.Symbol);
169642
+ else dec=column.FloatPrecision;
169643
+ }
169644
+
169645
+ var text=null;
169646
+ if (!data) return text;
169647
+
169648
+ if (data.Text)
169649
+ {
169650
+ text=data.Text;
169651
+ }
169652
+ else if (IFrameSplitOperator.IsNumber(data.Value))
169653
+ {
169654
+ var value=data.Value;
169655
+ text=value.toFixed(dec);
169656
+
169657
+ //格式化
169658
+ if (column.Format && IFrameSplitOperator.IsNumber(column.Format.Type))
169659
+ {
169660
+ var format=column.Format;
169661
+ switch(format.Type)
169662
+ {
169663
+ case 1: //原始数据
169664
+ text=value.toFixed(dec);
169665
+ break;
169666
+ case 2: //千分位分割
169667
+ text=IFrameSplitOperator.FormatValueThousandsString(value, dec);
169668
+ break;
169669
+ case 3:
169670
+ var exfloatPrecision=1;
169671
+ if (IFrameSplitOperator.IsNumber(format.ExFloatPrecision)) exfloatPrecision=format.ExFloatPrecision;
169672
+ text=IFrameSplitOperator.FormatValueStringV2(value, dec,exfloatPrecision);
169673
+ break;
169674
+ }
169675
+ }
169676
+ }
169677
+
169678
+ if (column.StringFormat && text) text=column.StringFormat.replace('{Value}',text);
169679
+
169680
+ return text;
169681
+ }
169682
+
169683
+ this.GetPriceColor=function(price, stockItem)
169684
+ {
169685
+ var upperSymbol=null;
169686
+ if (stockItem.Symbol) upperSymbol=stockItem.Symbol.toUpperCase();
169687
+ if (MARKET_SUFFIX_NAME.IsChinaFutures(upperSymbol))
169688
+ {
169689
+ if (!IFrameSplitOperator.IsNumber(stockItem.YFClose)) return this.UnchangeColor;
169690
+ return this.GetUpDownColor(price, stockItem.YFClose);
169691
+ }
169692
+ else
169693
+ {
169694
+ if (!IFrameSplitOperator.IsNumber(stockItem.YClose)) return this.UnchangeColor;
169695
+ return this.GetUpDownColor(price, stockItem.YClose);
169696
+ }
169697
+ }
169698
+
169699
+ this.GetUpDownColor=function(price, price2)
169700
+ {
169701
+ if (price>price2) return this.UpColor;
169702
+ else if (price<price2) return this.DownColor;
169703
+ else return this.UnchangeColor;
169704
+ }
169705
+
169706
+ this.DrawRightToolbar=function(position)
169707
+ {
169708
+ var config=this.DateTimeConfig;
169709
+ var top=position.Top;
169710
+ var right=position.Right;
169711
+
169712
+ this.Canvas.font=config.Font;
169713
+ this.Canvas.textAlign = 'left';
169714
+ this.Canvas.textBaseline = 'bottom';
169715
+ var cellHeight=this.Canvas.measureText("擎").width+config.Margin.Top+config.Margin.Bottom;
169716
+
169717
+ var yBottom=top+cellHeight-config.Margin.Bottom+config.Margin.YOffset;
169718
+ var xText=right;
169719
+
169720
+ //时间
169721
+ var datetime=new Date();
169722
+ var text=IFrameSplitOperator.FormatDateTimeStringV2(datetime, config.Format);
169723
+ var textWidth=this.Canvas.measureText(config.MaxText).width+config.Margin.Left+config.Margin.Right;
169724
+ xText-=textWidth;
169725
+ this.Canvas.fillStyle=config.TitleColor;
169726
+ this.Canvas.fillText(text,xText+config.Margin.Left,yBottom);
169727
+
169728
+ position.Right=xText;
169729
+
169730
+ if (this.RightToolbar && IFrameSplitOperator.IsNonEmptyArray(this.RightToolbar.AryButton))
169731
+ {
169732
+ var config=this.RightToolbarConfig;
169733
+
169734
+ xText-=config.Margin.Right;
169735
+ for(var i=this.RightToolbar.AryButton.length-1;i>=0;--i)
169736
+ {
169737
+ var item=this.RightToolbar.AryButton[i];
169738
+ var aryItem=null;
169739
+ if (item.Type==2) aryItem=this.GetFlashToolbarItem(item);
169740
+ else aryItem=item.Icon;
169741
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryItem)) continue;
169742
+ var iconFont=`${config.Icon.Size}px ${config.Icon.Family}`;
169743
+ this.Canvas.font=iconFont;
169744
+ var textWidth=config.Icon.Size+config.CellMargin.Left+config.CellMargin.Right;
169745
+ xText-=textWidth;
169746
+ yBottom=top+config.Margin.Top+(config.Icon.Size+config.CellMargin.Top+config.CellMargin.Bottom)-config.CellMargin.Bottom+config.CellMargin.YOffset;
169747
+ for(var j=0;j<aryItem.length;++j)
169748
+ {
169749
+ var iconItem=aryItem[j];
169750
+ var text=iconItem.Symbol;
169751
+ this.Canvas.fillStyle=iconItem.Color;
169752
+ this.Canvas.fillText(text,xText+config.CellMargin.Left,yBottom);
169753
+ }
169754
+
169755
+ var rtButton={ Left:xText, Bottom:yBottom, Height:config.Icon.Size, Width:config.Icon.Size };
169756
+ rtButton.Right=rtButton.Left+rtButton.Width;
169757
+ rtButton.Top=rtButton.Bottom-rtButton.Height;
169758
+ this.AryRectButton.push({ Rect:rtButton, Data:item, Type:2 });
169759
+ }
169760
+ }
169761
+
169762
+ position.Right=xText;
169763
+ }
169764
+
169765
+ this.GetFlashToolbarItem=function(btnItem)
169766
+ {
169767
+ if (!btnItem.Flash || !IFrameSplitOperator.IsNonEmptyArray(btnItem.Flash.AryIcon)) return btnItem.Icon;
169768
+ if (!this.MapToolbarFlash.has(btnItem.ID)) return btnItem.Icon;
169769
+
169770
+ var item=this.MapToolbarFlash.get(btnItem.ID);
169771
+ if (!item.Enable) return btnItem.Icon;
169772
+
169773
+ item.Counter++;
169774
+
169775
+ var index=item.Counter%btnItem.Flash.AryIcon.length;
169776
+
169777
+ return btnItem.Flash.AryIcon[index];
169778
+ }
169779
+
169780
+ this.GetTooltipData=function(x,y,tooltip)
169781
+ {
169782
+ for(var i=0;i<this.AryRectCell.length;++i)
169783
+ {
169784
+ var item=this.AryRectCell[i];
169785
+ if (Path2DHelper.PtInRect(x,y, item.Rect))
169786
+ {
169787
+ tooltip.Data=item;
169788
+ tooltip.ChartPaint=this;
169789
+ tooltip.Type=121;
169790
+ return true;
169791
+ }
169792
+ }
169793
+
169794
+ for(var i=0;i<this.AryRectButton.length;++i)
169795
+ {
169796
+ var item=this.AryRectButton[i];
169797
+ if (Path2DHelper.PtInRect(x,y, item.Rect))
169798
+ {
169799
+ tooltip.Data=item;
169800
+ tooltip.ChartPaint=this;
169801
+ tooltip.Type=122;
169802
+ return true;
169803
+ }
169804
+ }
169805
+
169806
+ return false;
169807
+ }
169808
+ }
169809
+
169810
+
169811
+
169812
+
169813
+
169814
+
169815
+ /*
169816
+ Copyright (c) 2018 jones
169817
+
169818
+ http://www.apache.org/licenses/LICENSE-2.0
169819
+
169820
+ 开源项目 https://github.com/jones2000/HQChart
169821
+
169822
+ jones_2000@163.com
169823
+
169824
+ 股票买卖5档 (H5版本)
169825
+ 不提供内置测试数据
169826
+ */
169827
+
169828
+ function JSStockInfoChart(divElement)
169829
+ {
169830
+ this.DivElement=divElement;
169831
+ this.JSChartContainer; //表格控件
169832
+ this.ResizeListener; //大小变动监听
169833
+
169834
+ //h5 canvas
169835
+ this.CanvasElement=document.createElement("canvas");
169836
+ this.CanvasElement.className='jsstockinfo-drawing';
169837
+ this.CanvasElement.id=Guid();
169838
+ this.CanvasElement.setAttribute("tabindex",0);
169839
+ if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
169840
+ if(divElement.hasChildNodes())
169841
+ {
169842
+ JSConsole.Chart.Log("[JSStockInfoChart::JSStockInfoChart] divElement hasChildNodes", divElement.childNodes);
169843
+ }
169844
+ divElement.appendChild(this.CanvasElement);
169845
+
169846
+
169847
+ this.OnSize=function()
169848
+ {
169849
+ //画布大小通过div获取 如果有style里的大小 使用style里的
169850
+ var height=this.DivElement.offsetHeight;
169851
+ var width=this.DivElement.offsetWidth;
169852
+ if (this.DivElement.style.height && this.DivElement.style.width)
169853
+ {
169854
+ if (this.DivElement.style.height.includes("px"))
169855
+ height=parseInt(this.DivElement.style.height.replace("px",""));
169856
+ if (this.DivElement.style.width.includes("px"))
169857
+ width=parseInt(this.DivElement.style.width.replace("px",""));
169858
+ }
169859
+
169860
+ this.CanvasElement.height=height;
169861
+ this.CanvasElement.width=width;
169862
+ this.CanvasElement.style.width=this.CanvasElement.width+'px';
169863
+ this.CanvasElement.style.height=this.CanvasElement.height+'px';
169864
+
169865
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
169866
+ this.CanvasElement.height*=pixelTatio;
169867
+ this.CanvasElement.width*=pixelTatio;
169868
+
169869
+ JSConsole.Chart.Log(`[JSStockInfoChart::OnSize] devicePixelRatio=${window.devicePixelRatio}, height=${this.CanvasElement.height}, width=${this.CanvasElement.width}`);
169870
+
169871
+ if (this.JSChartContainer && this.JSChartContainer.OnSize)
169872
+ {
169873
+ this.JSChartContainer.OnSize();
169874
+ }
169875
+ }
169876
+
169877
+ this.SetOption=function(option)
169878
+ {
169879
+ var chart=this.CreateJSStockInfoChartContainer(option);
169880
+
169881
+ if (!chart) return false;
169882
+
169883
+ if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
169884
+
169885
+ this.JSChartContainer=chart;
169886
+ this.DivElement.JSChart=this; //div中保存一份
169887
+
169888
+ if (option.EnableResize==true) this.CreateResizeListener();
169889
+
169890
+ if (option.Symbol)
169891
+ {
169892
+ chart.ChangeSymbol(option.Symbol); //下载列表码表
169893
+ }
169894
+ else
169895
+ {
169896
+ chart.Draw();
169897
+ }
169898
+ }
169899
+
169900
+ this.CreateResizeListener=function()
169901
+ {
169902
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
169903
+ this.ResizeListener.observe(this.DivElement);
169904
+ }
169905
+
169906
+ this.OnDivResize=function(entries)
169907
+ {
169908
+ JSConsole.Chart.Log("[JSStockInfoChart::OnDivResize] entries=", entries);
169909
+
169910
+ this.OnSize();
169911
+ }
169912
+
169913
+ //切换股票代码接口
169914
+ this.ChangeSymbol=function(symbol, option)
169915
+ {
169916
+ if (this.JSChartContainer) this.JSChartContainer.ChangeSymbol(symbol,option);
169917
+ }
169918
+
169919
+ this.CreateJSStockInfoChartContainer=function(option)
169920
+ {
169921
+ var chart=new JSStockInfoChartContainer(this.CanvasElement);
169922
+ chart.Create(option);
169923
+
169924
+ this.SetChartBorder(chart, option);
169925
+
169926
+ if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) chart.SetColumn(option.Column);
169927
+ if (IFrameSplitOperator.IsNonEmptyArray(option.HeaderColumn)) chart.SetHeaderColumn(option.HeaderColumn);
169928
+ //是否自动更新
169929
+ if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
169930
+
169931
+ if (option.IsAutoUpdate!=null) chart.IsAutoUpdate=option.IsAutoUpdate;
169932
+ if (option.AutoUpdateFrequency>0) chart.AutoUpdateFrequency=option.AutoUpdateFrequency;
169933
+
169934
+ //注册事件
169935
+ if (option.EventCallback)
169936
+ {
169937
+ for(var i=0;i<option.EventCallback.length;++i)
169938
+ {
169939
+ var item=option.EventCallback[i];
169940
+ chart.AddEventCallback(item);
169941
+ }
169942
+ }
169943
+
169944
+ return chart;
169945
+ }
169946
+
169947
+ this.SetChartBorder=function(chart, option)
169948
+ {
169949
+ if (!option.Border) return;
169950
+
169951
+ var item=option.Border;
169952
+ if (IFrameSplitOperator.IsNumber(option.Border.Left)) chart.Frame.ChartBorder.Left=option.Border.Left;
169953
+ if (IFrameSplitOperator.IsNumber(option.Border.Right)) chart.Frame.ChartBorder.Right=option.Border.Right;
169954
+ if (IFrameSplitOperator.IsNumber(option.Border.Top)) chart.Frame.ChartBorder.Top=option.Border.Top;
169955
+ if (IFrameSplitOperator.IsNumber(option.Border.Bottom)) chart.Frame.ChartBorder.Bottom=option.Border.Bottom;
169956
+
169957
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
169958
+ chart.Frame.ChartBorder.Left*=pixelTatio;
169959
+ chart.Frame.ChartBorder.Right*=pixelTatio;
169960
+ chart.Frame.ChartBorder.Top*=pixelTatio;
169961
+ chart.Frame.ChartBorder.Bottom*=pixelTatio;
169962
+ }
169963
+
169964
+ //事件回调
169965
+ this.AddEventCallback=function(obj)
169966
+ {
169967
+ if(this.JSChartContainer && typeof(this.JSChartContainer.AddEventCallback)=='function')
169968
+ {
169969
+ JSConsole.Chart.Log('[JSStockInfoChart:AddEventCallback] obj=', obj);
169970
+ this.JSChartContainer.AddEventCallback(obj);
169971
+ }
169972
+ }
169973
+
169974
+ //重新加载配置
169975
+ this.ReloadResource=function(option)
169976
+ {
169977
+ if(this.JSChartContainer && typeof(this.JSChartContainer.ReloadResource)=='function')
169978
+ {
169979
+ JSConsole.Chart.Log('[JSStockInfoChart:ReloadResource] ');
169980
+ this.JSChartContainer.ReloadResource(option);
169981
+ }
169982
+ }
169983
+
169984
+ this.ChartDestroy=function()
169985
+ {
169986
+ if (this.JSChartContainer && typeof (this.JSChartContainer.ChartDestroy) == 'function')
169987
+ {
169988
+ this.JSChartContainer.ChartDestroy();
169989
+ }
169990
+ }
169991
+
169992
+ this.Draw=function()
169993
+ {
169994
+ if(this.JSChartContainer && typeof(this.JSChartContainer.Draw)=='function')
169995
+ {
169996
+ JSConsole.Chart.Log('[JSStockInfoChart:Draw] ');
169997
+ this.JSChartContainer.Draw();
169998
+ }
169999
+ }
170000
+ }
170001
+
170002
+ JSStockInfoChart.Init=function(divElement)
170003
+ {
170004
+ var jsChartControl=new JSStockInfoChart(divElement);
170005
+ jsChartControl.OnSize();
170006
+
170007
+ return jsChartControl;
170008
+ }
170009
+
170010
+ //自定义风格
170011
+ JSStockInfoChart.SetStyle=function(option)
170012
+ {
170013
+ if (option) g_JSChartResource.SetStyle(option);
170014
+ }
170015
+
170016
+ //获取颜色配置 (JSStockInfoChart.Init()之前)
170017
+ JSStockInfoChart.GetResource=function()
170018
+ {
170019
+ return g_JSChartResource;
170020
+ }
170021
+
170022
+ JSStockInfoChart.GetfloatPrecision=function(symbol)
170023
+ {
170024
+ return GetfloatPrecision(symbol);
170025
+ }
170026
+
170027
+
170028
+ function JSStockInfoChartContainer(uielement)
170029
+ {
170030
+ this.ClassName='JSStockInfoChartContainer';
170031
+ this.Frame; //框架画法
170032
+ this.ChartPaint=[]; //图形画法
170033
+ this.ChartSplashPaint=null; //等待提示
170034
+ this.LoadDataSplashTitle="数据加载中"; //下载数据提示信息
170035
+
170036
+ this.Canvas=uielement.getContext("2d"); //画布
170037
+
170038
+ this.Symbol; //代码
170039
+ this.NetworkFilter; //数据回调接口
170040
+ this.Data=
170041
+ {
170042
+ Name:null,
170043
+ YClose:null, //昨收盘
170044
+ YFClose:null, //昨计算价
170045
+ Symbol:null,
170046
+
170047
+ Buys:
170048
+ [
170049
+ { Name:"买一", Price:null, Vol:null, Amount:null },
170050
+ { Name:"买二", Price:null, Vol:null, Amount:null },
170051
+ { Name:"买三", Price:null, Vol:null, Amount:null },
170052
+ { Name:"买四", Price:null, Vol:null, Amount:null },
170053
+ { Name:"买五", Price:null, Vol:null, Amount:null },
170054
+ { Name:"买六", Price:null, Vol:null, Amount:null },
170055
+ { Name:"买七", Price:null, Vol:null, Amount:null },
170056
+ { Name:"买八", Price:null, Vol:null, Amount:null },
170057
+ { Name:"买九", Price:null, Vol:null, Amount:null },
170058
+ { Name:"买十", Price:null, Vol:null, Amount:null },
170059
+ ],
170060
+
170061
+ Sells:
170062
+ [
170063
+ { Name:"卖一", Price:null, Vol:null, Amount:null },
170064
+ { Name:"卖二", Price:null, Vol:null, Amount:null },
170065
+ { Name:"卖三", Price:null, Vol:null, Amount:null },
170066
+ { Name:"卖四", Price:null, Vol:null, Amount:null },
170067
+ { Name:"卖五", Price:null, Vol:null, Amount:null },
170068
+ { Name:"卖六", Price:null, Vol:null, Amount:null },
170069
+ { Name:"卖七", Price:null, Vol:null, Amount:null },
170070
+ { Name:"卖八", Price:null, Vol:null, Amount:null },
170071
+ { Name:"卖九", Price:null, Vol:null, Amount:null },
170072
+ { Name:"卖十", Price:null, Vol:null, Amount:null },
170073
+ ],
170074
+
170075
+ MapData:new Map(), //key=, { Value:, Text:, }
170076
+ };
170077
+ //股票数据
170078
+ this.BorderData={ MapData:null }; //key=Field Value:[null, {ExePrice} ,{ExePrice} ]
170079
+
170080
+ this.MapStockData;
170081
+
170082
+ //事件回调
170083
+ this.mapEvent=new Map(); //通知外部调用 key:JSCHART_EVENT_ID value:{Callback:回调,}
170084
+
170085
+ this.AutoUpdateTimer=null;
170086
+ this.AutoUpdateFrequency=15000; //15秒更新一次数据
170087
+
170088
+ this.UIElement=uielement;
170089
+
170090
+ this.IsDestroy=false; //是否已经销毁了
170091
+
170092
+ this.ChartDestroy=function() //销毁
170093
+ {
170094
+ this.IsDestroy=true;
170095
+ this.StopAutoUpdate();
170096
+ }
170097
+
170098
+ //设置事件回调
170099
+ //{event:事件id, callback:回调函数}
170100
+ this.AddEventCallback=function(object)
170101
+ {
170102
+ if (!object || !object.event || !object.callback) return;
170103
+
170104
+ var data={Callback:object.callback, Source:object};
170105
+ this.mapEvent.set(object.event,data);
170106
+ }
170107
+
170108
+ this.ClearData=function()
170109
+ {
170110
+ this.Data.Name=null;
170111
+ this.Data.YClose=null;
170112
+ this.Data.YFClose=null;
170113
+
170114
+ this.Data.Buys=
170115
+ [
170116
+ { Name:"买一", Price:null, Vol:null, Amount:null },
170117
+ { Name:"买二", Price:null, Vol:null, Amount:null },
170118
+ { Name:"买三", Price:null, Vol:null, Amount:null },
170119
+ { Name:"买四", Price:null, Vol:null, Amount:null },
170120
+ { Name:"买五", Price:null, Vol:null, Amount:null },
170121
+ { Name:"买六", Price:null, Vol:null, Amount:null },
170122
+ { Name:"买七", Price:null, Vol:null, Amount:null },
170123
+ { Name:"买八", Price:null, Vol:null, Amount:null },
170124
+ { Name:"买九", Price:null, Vol:null, Amount:null },
170125
+ { Name:"买十", Price:null, Vol:null, Amount:null },
170126
+ ];
170127
+
170128
+ this.Data.Sells=
170129
+ [
170130
+ { Name:"卖一", Price:null, Vol:null, Amount:null },
170131
+ { Name:"卖二", Price:null, Vol:null, Amount:null },
170132
+ { Name:"卖三", Price:null, Vol:null, Amount:null },
170133
+ { Name:"卖四", Price:null, Vol:null, Amount:null },
170134
+ { Name:"卖五", Price:null, Vol:null, Amount:null },
170135
+ { Name:"卖六", Price:null, Vol:null, Amount:null },
170136
+ { Name:"卖七", Price:null, Vol:null, Amount:null },
170137
+ { Name:"卖八", Price:null, Vol:null, Amount:null },
170138
+ { Name:"卖九", Price:null, Vol:null, Amount:null },
170139
+ { Name:"卖十", Price:null, Vol:null, Amount:null },
170140
+ ];
170141
+
170142
+ this.Data.MapData=new Map();
170143
+ }
170144
+
170145
+ this.ChangeSymbol=function(symbol, option)
170146
+ {
170147
+ this.CancelAutoUpdate();
170148
+ this.ClearData();
170149
+ this.Symbol=symbol;
170150
+ this.Data.Symbol=symbol;
170151
+
170152
+ if (option)
170153
+ {
170154
+ if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) this.SetColumn(option.Column);
170155
+ if (IFrameSplitOperator.IsNumber(option.BuySellCount)) this.SetBuySellCount(option.BuySellCount);
170156
+ }
170157
+
170158
+ this.Draw();
170159
+ this.RequestStockData();
170160
+
170161
+ if (this.IsAutoUpdate)
170162
+ {
170163
+ var frequency=this.AutoUpdateFrequency;
170164
+ setInterval(()=>
170165
+ {
170166
+ var marketStatus=MARKET_SUFFIX_NAME.GetMarketStatus(this.Symbol);
170167
+ if (marketStatus==0 || marketStatus==3) //闭市,盘后
170168
+ return;
170169
+
170170
+ this.RequestStockData();
170171
+ }, frequency)
170172
+ }
170173
+ }
170174
+
170175
+ this.CancelAutoUpdate=function() //关闭停止更新
170176
+ {
170177
+ if (this.AutoUpdateTimer)
170178
+ {
170179
+ clearInterval(this.AutoUpdateTimer);
170180
+ this.AutoUpdateTimer = null;
170181
+ }
170182
+ }
170183
+
170184
+ this.StopAutoUpdate=function()
170185
+ {
170186
+ this.CancelAutoUpdate();
170187
+ if (!this.IsAutoUpdate) return;
170188
+ this.IsAutoUpdate=false;
170189
+ }
170190
+
170191
+ this.RequestStockData=function()
170192
+ {
170193
+ if (this.NetworkFilter)
170194
+ {
170195
+ var obj=
170196
+ {
170197
+ Name:'JSStockInfoChartContainer::RequestStockData', //类名::函数名
170198
+ Explain:'股票5档实时数据',
170199
+ Request: { Data:{symbol:this.Symbol} },
170200
+ Self:this,
170201
+ PreventDefault:false
170202
+ };
170203
+
170204
+ this.NetworkFilter(obj, (data)=>
170205
+ {
170206
+ this.RecvStockData(data);
170207
+ });
170208
+
170209
+ if (obj.PreventDefault==true) return; //已被上层替换,不调用默认的网络请求
170210
+ }
170211
+ }
170212
+
170213
+ this.RecvStockData=function(recv)
170214
+ {
170215
+ if (!recv) return;
170216
+
170217
+ if (recv.name) this.Data.Name=recv.Name;
170218
+ if (IFrameSplitOperator.IsNumber(recv.yclose)) this.Data.YClose=recv.yclose;
170219
+ if (IFrameSplitOperator.IsNumber(recv.yfclose)) this.Data.YFClose=recv.yfclose;
170220
+
170221
+ if (recv.name) this.Data.Name=recv.name;
170222
+
170223
+ if (IFrameSplitOperator.IsNonEmptyArray(recv.data))
170224
+ {
170225
+ for(var i=0;i<recv.data.length;++i)
170226
+ {
170227
+ var item=recv.data[i];
170228
+ if (item.Name=="Buys")
170229
+ {
170230
+ if (IFrameSplitOperator.IsNonEmptyArray(item.Value))
170231
+ {
170232
+ for(var j=0;j<item.Value.length && j<this.Data.Buys.length;++j)
170233
+ {
170234
+ var srcItem=item.Value[j];
170235
+ var destItem=this.Data.Buys[j];
170236
+ destItem.Price=srcItem.Price;
170237
+ destItem.Vol=srcItem.Vol;
170238
+ }
170239
+ }
170240
+ }
170241
+ else if (item.Name=="Sells")
170242
+ {
170243
+ if (IFrameSplitOperator.IsNonEmptyArray(item.Value))
170244
+ {
170245
+ for(var j=0;j<item.Value.length && j<this.Data.Sells.length;++j)
170246
+ {
170247
+ var srcItem=item.Value[j];
170248
+ var destItem=this.Data.Sells[j];
170249
+ destItem.Price=srcItem.Price;
170250
+ destItem.Vol=srcItem.Vol;
170251
+ }
170252
+ }
170253
+ }
170254
+ else if (item.Name=="Symbol")
170255
+ {
170256
+ this.Data.Symbol=item.Value.Text;
170257
+ }
170258
+ else
170259
+ {
170260
+ this.Data.MapData.set(item.Name, item.Value);
170261
+ }
170262
+ }
170263
+ }
170264
+
170265
+ this.Draw();
170266
+ }
170267
+
170268
+ //创建
170269
+ this.Create=function(option)
170270
+ {
170271
+ this.UIElement.JSChartContainer=this;
170272
+
170273
+ //创建框架
170274
+ this.Frame=new JSStockInfoFrame();
170275
+ this.Frame.ChartBorder=new ChartBorder();
170276
+ this.Frame.ChartBorder.UIElement=this.UIElement;
170277
+ this.Frame.ChartBorder.Top=30;
170278
+ this.Frame.ChartBorder.Left=5;
170279
+ this.Frame.ChartBorder.Bottom=20;
170280
+ this.Frame.Canvas=this.Canvas;
170281
+
170282
+ //创建表格
170283
+ var chart=new ChartStockData();
170284
+ chart.Frame=this.Frame;
170285
+ chart.ChartBorder=this.Frame.ChartBorder;
170286
+ chart.Canvas=this.Canvas;
170287
+ chart.UIElement=this.UIElement;
170288
+ chart.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
170289
+ chart.Data=this.Data;
170290
+ chart.BorderData=this.BorderData;
170291
+ chart.GlobalOption=this.GlobalOption;
170292
+ chart.FixedRowData=this.FixedRowData;
170293
+ chart.SortInfo=this.SortInfo;
170294
+ this.ChartPaint[0]=chart;
170295
+
170296
+
170297
+ if (option)
170298
+ {
170299
+
170300
+ }
170301
+
170302
+
170303
+
170304
+ /*
170305
+ this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
170306
+ this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
170307
+ this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
170308
+ this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
170309
+ this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
170310
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
170311
+ */
170312
+ }
170313
+
170314
+ this.Draw=function()
170315
+ {
170316
+ if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
170317
+
170318
+ this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);
170319
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
170320
+ this.Canvas.lineWidth=pixelTatio; //手机端需要根据分辨率比调整线段宽度
170321
+
170322
+ this.Frame.Draw();
170323
+ this.Frame.DrawLogo();
170324
+
170325
+ //框架内图形
170326
+ for(var i=0;i<this.ChartPaint.length;++i)
170327
+ {
170328
+ var item=this.ChartPaint[i];
170329
+ item.Draw();
170330
+ }
170331
+ }
170332
+
170333
+ this.OnSize=function()
170334
+ {
170335
+ if (!this.Frame) return;
170336
+
170337
+ this.SetSizeChange(true);
170338
+ this.Draw();
170339
+ }
170340
+
170341
+ this.SetSizeChange=function(bChanged)
170342
+ {
170343
+ for(var i=0;i<this.ChartPaint.length;++i)
170344
+ {
170345
+ var chart=this.ChartPaint[i];
170346
+ if (chart) chart.SizeChange=bChanged;
170347
+ }
170348
+ }
170349
+
170350
+ this.ReloadResource=function(option)
170351
+ {
170352
+ this.Frame.ReloadResource(option);
170353
+
170354
+ for(var i=0;i<this.ChartPaint.length;++i)
170355
+ {
170356
+ var item=this.ChartPaint[i];
170357
+ if (item.ReloadResource) item.ReloadResource(option);
170358
+ }
170359
+
170360
+ if (option && (option.Redraw || option.Draw))
170361
+ {
170362
+ this.SetSizeChange(true);
170363
+ this.Draw();
170364
+ }
170365
+ }
170366
+
170367
+ this.SetColumn=function(aryColunm, option)
170368
+ {
170369
+ var chart=this.ChartPaint[0];
170370
+ if (!chart) return;
170371
+
170372
+ chart.SetColumn(aryColunm);
170373
+ chart.SizeChange=true;
170374
+
170375
+ if (option && option.Redraw) this.Draw();
170376
+ }
170377
+
170378
+ this.SetHeaderColumn=function(aryColunm, option)
170379
+ {
170380
+ var chart=this.ChartPaint[0];
170381
+ if (!chart) return;
170382
+
170383
+ chart.SetHeaderColumn(aryColunm);
170384
+ chart.SizeChange=true;
170385
+
170386
+ if (option && option.Redraw) this.Draw();
170387
+ }
170388
+
170389
+ this.SetBuySellCount=function(count, option)
170390
+ {
170391
+ var chart=this.ChartPaint[0];
170392
+ if (!chart) return;
170393
+
170394
+ chart.BuySellCount=count;
170395
+ chart.SizeChange=true;
170396
+
170397
+ if (option && option.Redraw) this.Draw();
170398
+ }
170399
+ }
170400
+
170401
+ function JSStockInfoFrame()
170402
+ {
170403
+ this.ChartBorder;
170404
+ this.Canvas; //画布
170405
+
170406
+ this.BorderLine=null; //1=上 2=下 4=左 8=右
170407
+ this.ClassName="JSStockInfoFrame";
170408
+
170409
+ this.BorderColor=g_JSChartResource.StockInfo.BorderColor; //边框线
170410
+
170411
+ this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;
170412
+ this.LogoTextFont=g_JSChartResource.FrameLogo.Font;
170413
+
170414
+ this.ReloadResource=function(resource)
170415
+ {
170416
+ this.BorderColor=g_JSChartResource.StockInfo.BorderColor; //边框线
170417
+ this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;
170418
+ this.LogoTextFont=g_JSChartResource.FrameLogo.Font;
170419
+ }
170420
+
170421
+ this.Draw=function()
170422
+ {
170423
+ var left=ToFixedPoint(this.ChartBorder.GetLeft());
170424
+ var top=ToFixedPoint(this.ChartBorder.GetTop());
170425
+ var right=ToFixedPoint(this.ChartBorder.GetRight());
170426
+ var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
170427
+ var width=right-left;
170428
+ var height=bottom-top;
170429
+
170430
+ if (!IFrameSplitOperator.IsNumber(this.BorderLine))
170431
+ {
170432
+ this.Canvas.strokeStyle=this.BorderColor;
170433
+ this.Canvas.strokeRect(left,top,width,height);
170434
+ }
170435
+ else
170436
+ {
170437
+ this.Canvas.strokeStyle=this.BorderColor;
170438
+ this.Canvas.beginPath();
170439
+
170440
+ if ((this.BorderLine&1)>0) //上
170441
+ {
170442
+ this.Canvas.moveTo(left,top);
170443
+ this.Canvas.lineTo(right,top);
170444
+ }
170445
+
170446
+ if ((this.BorderLine&2)>0) //下
170447
+ {
170448
+ this.Canvas.moveTo(left,bottom);
170449
+ this.Canvas.lineTo(right,bottom);
170450
+ }
170451
+
170452
+ if ((this.BorderLine&4)>0) //左
170453
+ {
170454
+ this.Canvas.moveTo(left,top);
170455
+ this.Canvas.lineTo(left,bottom);
170456
+ }
170457
+
170458
+ if ((this.BorderLine&8)>0) //右
170459
+ {
170460
+ this.Canvas.moveTo(right,top);
170461
+ this.Canvas.lineTo(right,bottom);
170462
+ }
170463
+
170464
+ this.Canvas.stroke();
170465
+ }
170466
+ }
170467
+
170468
+ this.DrawLogo=function()
170469
+ {
170470
+ var text=g_JSChartResource.FrameLogo.Text;
170471
+ if (!IFrameSplitOperator.IsString(text)) return;
170472
+
170473
+ this.Canvas.fillStyle=this.LogoTextColor;
170474
+ this.Canvas.font=this.LogoTextFont;
170475
+ this.Canvas.textAlign = 'right';
170476
+ this.Canvas.textBaseline = 'bottom';
170477
+
170478
+ var x=this.ChartBorder.GetRight()-30;
170479
+ var y=this.ChartBorder.GetBottom()-5;
170480
+ this.Canvas.fillText(text,x,y);
170481
+ }
170482
+ }
170483
+
170484
+
170485
+ function ChartStockData()
170486
+ {
170487
+ this.Canvas; //画布
170488
+ this.ChartBorder; //边框信息
170489
+ this.ChartFrame; //框架画法
170490
+ this.Name; //名称
170491
+ this.ClassName='ChartStockData'; //类名
170492
+ this.UIElement;
170493
+ this.GetEventCallback; //获取事件
170494
+ this.Data; //数据
170495
+ this.BorderData;
170496
+ this.SizeChange=true;
170497
+ this.Decimal=2; //价格小数位数
170498
+
170499
+ this.UpColor=g_JSChartResource.StockInfo.UpTextColor;
170500
+ this.DownColor=g_JSChartResource.StockInfo.DownTextColor;
170501
+ this.UnchangeColor=g_JSChartResource.StockInfo.UnchangeTextColor;
170502
+
170503
+ this.HeaderConfig=CloneData(g_JSChartResource.StockInfo.Header);
170504
+ this.HeaderColumn=
170505
+ [
170506
+ { Name:"现价", Key:"Price", ColorType:3, FloatPrecision:-1, DefaultText:"--.--" },
170507
+ { Name:"涨幅", Key:"Increase", ColorType:1, FloatPrecision:2, StringFormat:"{Value}%", DefaultText:"--.--%" },
170508
+ { Name:"涨跌", Key:"UpDown",ColorType:1, FloatPrecision:-1, DefaultText:"--.--" }
170509
+ ]
170510
+
170511
+ //买卖5档配置
170512
+ this.BuySellConfig=CloneData(g_JSChartResource.StockInfo.BuySell);
170513
+ this.BuySellCount=5; //显示几档买卖盘
170514
+
170515
+ this.TableConfig=CloneData(g_JSChartResource.StockInfo.Table);
170516
+
170517
+ //显示的字段
170518
+ this.Column=
170519
+ [
170520
+ [{ Name:"涨停价", Key:"UpLimit",ColorType:3, FloatPrecision:-1 }, { Name:"跌停价", Key:"DownLimit" , ColorType:3, FloatPrecision:-1 }],
170521
+ [{ Name:"现价", Key:"Price", ColorType:3, FloatPrecision:-1 }, { Name:"今开", Key:"Open",ColorType:3, FloatPrecision:-1 }],
170522
+ [{ Name:"最高", Key:"High",ColorType:3, FloatPrecision:-1 }, { Name:"最低", Key:"Low",ColorType:3, FloatPrecision:-1 }],
170523
+ [{ Name:"涨幅", Key:"Increase", ColorType:1, FloatPrecision:2, StringFormat:"{Value}%" }, { Name:"涨跌", Key:"UpDown",ColorType:1, FloatPrecision:-1 }],
170524
+ [{ Name:"振幅", Key:"Amplitude", FloatPrecision:2, StringFormat:"{Value}%" }, { Name:"换手率", Key:"Exchange", FloatPrecision:2, StringFormat:"{Value}%" }],
170525
+
170526
+ [{ Name:"总量", Key:"Vol", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }, { Name:"总额", Key:"Amount", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }],
170527
+ [{ Name:"内盘", Key:"InVol", ColorType:4, FloatPrecision:0 }, { Name:"外盘", Key:"OutVol",ColorType:5, FloatPrecision:0 }],
170528
+ [{ Name:"TTM", Key:"PE_TTM", FloatPrecision:2 }, { Name:"市净率", Key:"PB", FloatPrecision:2 }],
170529
+ [{ Name:"流通市值", Key:"FlowMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }, { Name:"总市值", Key:"TotalMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }],
170530
+ ]
170531
+
170532
+ this.ReloadResource=function(resource)
170533
+ {
170534
+ this.UpColor=g_JSChartResource.StockInfo.UpTextColor;
170535
+ this.DownColor=g_JSChartResource.StockInfo.DownTextColor;
170536
+ this.UnchangeColor=g_JSChartResource.StockInfo.UnchangeTextColor;
170537
+
170538
+ this.HeaderConfig=CloneData(g_JSChartResource.StockInfo.Header);
170539
+
170540
+ //买卖5档配置
170541
+ this.BuySellConfig=CloneData(g_JSChartResource.StockInfo.BuySell);
170542
+
170543
+ this.TableConfig=CloneData(g_JSChartResource.StockInfo.Table);
170544
+ }
170545
+
170546
+ this.SetColumn=function(aryColumn)
170547
+ {
170548
+ this.Column=[];
170549
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryColumn)) return;
170550
+
170551
+ for(var i=0;i<aryColumn.length;++i)
170552
+ {
170553
+ var item=aryColumn[i];
170554
+ if (!item) continue;
170555
+ this.Column.push(CloneData(item));
170556
+ }
170557
+ }
170558
+
170559
+ this.SetHeaderColumn=function(aryColumn)
170560
+ {
170561
+ this.HeaderColumn=[];
170562
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryColumn)) return;
170563
+
170564
+ for(var i=0;i<aryColumn.length;++i)
170565
+ {
170566
+ var item=aryColumn[i];
170567
+ if (!item) continue;
170568
+ this.HeaderColumn.push(CloneData(item));
170569
+ }
170570
+ }
170571
+
170572
+ this.Draw=function()
170573
+ {
170574
+ this.Decimal=GetfloatPrecision(this.Data.Symbol);
170575
+ var border=this.ChartBorder.GetBorder();
170576
+ var position = { Left:border.Left, Right:border.Right, Top:border.Top, Width:border.Right-border.Left, Border:border };
170577
+ this.DrawHeader(position);
170578
+ this.DrawBuySell(position);
170579
+ this.DrawTable(position);
170580
+ }
170581
+
170582
+ this.DrawHeader=function(position)
170583
+ {
170584
+ var config=this.HeaderConfig;
170585
+ var top=position.Top;
170586
+ var left=position.Left;
170587
+ var xText=left;
170588
+ var yText=top;
170589
+
170590
+ this.Canvas.font=config.Name.Font;
170591
+ var nameHeight=this.Canvas.measureText("擎").width;
170592
+ nameHeight+=config.Name.Margin.Top+config.Name.Margin.Bottom;
170593
+
170594
+ this.Canvas.font=config.Symbol.Font;
170595
+ var symbolHeight=this.Canvas.measureText("擎").width;
170596
+ symbolHeight+=config.Symbol.Margin.Top+config.Symbol.Margin.Bottom;
170597
+
170598
+ var lineHeight=Math.max(symbolHeight, nameHeight);
170599
+
170600
+ this.Canvas.textAlign = 'left';
170601
+ this.Canvas.textBaseline = 'bottom';
170602
+ if (this.Data.Name)
170603
+ {
170604
+ var text=this.Data.Name;
170605
+ xText+=config.Name.Margin.Left;
170606
+ var yBottom=yText+lineHeight-config.Name.Margin.Bottom+config.Name.Margin.YOffset;
170607
+
170608
+ this.Canvas.font=config.Name.Font;
170609
+ this.Canvas.fillStyle=config.Name.Color;
170610
+ this.Canvas.fillText(text,xText,yBottom);
170611
+ var textWidth=this.Canvas.measureText(text).width;
170612
+
170613
+ xText+=textWidth+config.Name.Margin.Right;
170614
+ }
170615
+
170616
+ if (this.Data.Symbol)
170617
+ {
170618
+ var text=MARKET_SUFFIX_NAME.GetShortSymbol(this.Data.Symbol);
170619
+ xText+=config.Symbol.Margin.Left;
170620
+ var yBottom=yText+lineHeight-config.Symbol.Margin.Bottom+config.Symbol.Margin.YOffset;
170621
+
170622
+ this.Canvas.font=config.Symbol.Font;
170623
+ this.Canvas.fillStyle=config.Symbol.Color;
170624
+ this.Canvas.fillText(text,xText,yBottom);
170625
+ var textWidth=this.Canvas.measureText(text).width;
170626
+
170627
+ xText+=textWidth+config.Symbol.Margin.Right;
170628
+ }
170629
+
170630
+ yText+=lineHeight;
170631
+
170632
+ if (IFrameSplitOperator.IsNonEmptyArray(this.HeaderColumn))
170633
+ {
170634
+ lineHeight=0;
170635
+ for(var i=0;i<this.HeaderColumn.length && i<config.AryCell.length;++i)
170636
+ {
170637
+ var subConfig=config.AryCell[i];
170638
+ this.Canvas.font=subConfig.Font;
170639
+ var textHeight=this.Canvas.measureText("擎").width;
170640
+ textHeight+=subConfig.Margin.Top+subConfig.Margin.Bottom;
170641
+ if (lineHeight<textHeight) lineHeight=textHeight;
170642
+ }
170643
+
170644
+ var xText=left;
170645
+ for(var i=0;i<this.HeaderColumn.length && i<config.AryCell.length;++i)
170646
+ {
170647
+ var item=this.HeaderColumn[i];
170648
+ var text="--.--";
170649
+ color=config.TextColor;
170650
+ if (item.DefaultText) text=item.DefaultText;
170651
+ var subConfig=config.AryCell[i];
170652
+ if (this.Data.MapData && this.Data.MapData.has(item.Key))
170653
+ {
170654
+ var dataItem=this.Data.MapData.get(item.Key);
170655
+ var text=this.FormatValue(item, dataItem);
170656
+
170657
+ if (item.ColorType===3 && IFrameSplitOperator.IsNumber(dataItem.Value))
170658
+ color=this.GetPriceColor(dataItem.Value);
170659
+ else if (item.ColorType==1 && IFrameSplitOperator.IsNumber(dataItem.Value))
170660
+ color=this.GetUpDownColor(dataItem.Value,0);
170661
+ else if (item.ColorType==4)
170662
+ color=this.UpColor;
170663
+ else if (item.ColorType==5)
170664
+ color=this.DownColor;
170665
+ }
170666
+
170667
+ if (item.TextColor) color=item.TextColor;
170668
+
170669
+ if (text)
170670
+ {
170671
+ this.Canvas.font=subConfig.Font;
170672
+ var textWidth=this.Canvas.measureText(text).width;
170673
+ var x=xText+subConfig.Margin.Left;
170674
+ this.Canvas.fillStyle=color;
170675
+ var yBottom=yText+lineHeight-subConfig.Margin.Bottom+subConfig.Margin.YOffset;
170676
+ this.Canvas.fillText(text,x,yBottom);
170677
+
170678
+ xText+=subConfig.Margin.Left+subConfig.Margin.Right+textWidth;
170679
+ }
170680
+ }
170681
+
170682
+ yText+=lineHeight;
170683
+ }
170684
+
170685
+ position.Top=yText;
170686
+
170687
+ if (config.BottomLine && config.BottomLine.Enable)
170688
+ {
170689
+ var xLeft=position.Border.Left, xRight=position.Border.Right;
170690
+ this.Canvas.strokeStyle=config.BottomLine.Color;
170691
+ this.Canvas.lineWidth=1*GetDevicePixelRatio();
170692
+ this.Canvas.beginPath();
170693
+ this.Canvas.moveTo(xLeft,ToFixedPoint(yText));
170694
+ this.Canvas.lineTo(xRight,ToFixedPoint(yText));
170695
+ this.Canvas.stroke();
170696
+ }
170697
+ }
170698
+
170699
+ //买卖5档
170700
+ this.DrawBuySell=function(position)
170701
+ {
170702
+ if (this.BuySellCount<=0) return;
170703
+
170704
+ var config=this.BuySellConfig;
170705
+ var top=position.Top;
170706
+ var left=position.Left+config.Margin.Left;
170707
+ var cellWidth=(position.Width-config.Margin.Left-config.Margin.Right)/4;
170708
+
170709
+ var yText=top+config.Margin.Top;
170710
+ var xText=left;
170711
+
170712
+ this.Canvas.font=config.Font;
170713
+ this.Canvas.textAlign = 'left';
170714
+ this.Canvas.textBaseline = 'bottom';
170715
+ var cellHeight=this.Canvas.measureText("擎").width+config.CellMargin.Top+config.CellMargin.Bottom;
170716
+ var count=this.BuySellCount;
170717
+ var sellVol=0, buyVol=0;
170718
+ for(var i=count-1;i>=0;--i)
170719
+ {
170720
+ xText=left;
170721
+ var item=this.Data.Sells[i];
170722
+ this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
170723
+ if (IFrameSplitOperator.IsNumber(item.Vol)) sellVol+=item.Vol;
170724
+ yText+=cellHeight;
170725
+ }
170726
+
170727
+ var yCenter=null;
170728
+ if (config.CenterLine) //留出画线的位置
170729
+ {
170730
+ yCenter=yText;
170731
+ var lineConfig=config.CenterLine;
170732
+ var lineWidth=lineConfig.Width;
170733
+ yText+=lineWidth;
170734
+ }
170735
+
170736
+
170737
+ for(var i=0;i<count && i<this.Data.Buys.length;++i)
170738
+ {
170739
+ xText=left;
170740
+ var item=this.Data.Buys[i];
170741
+ this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
170742
+ if (IFrameSplitOperator.IsNumber(item.Vol)) buyVol+=item.Vol;
170743
+ yText+=cellHeight;
170744
+ }
170745
+
170746
+ position.Top=yText;
170747
+
170748
+ if (IFrameSplitOperator.IsNumber(yCenter) && config.CenterLine)
170749
+ {
170750
+ var lineConfig=config.CenterLine;
170751
+ var xLeft=position.Border.Left, xRight=position.Border.Right;
170752
+ var lineWidth=lineConfig.Width;
170753
+ if (buyVol+sellVol>0)
170754
+ {
170755
+ var buyRate=buyVol/(buyVol+sellVol);
170756
+ var barWidth=xRight-xLeft;
170757
+ var buyWidth=barWidth*buyRate;
170758
+ var xCenter=xLeft+buyWidth;
170759
+ this.Canvas.lineWidth=lineWidth;
170760
+ this.Canvas.strokeStyle=lineConfig.BuyColor;
170761
+ this.Canvas.beginPath();
170762
+ this.Canvas.moveTo(xLeft,ToFixedPoint2(lineWidth,yCenter));
170763
+ this.Canvas.lineTo(xCenter,ToFixedPoint2(lineWidth,yCenter));
170764
+ this.Canvas.stroke();
170765
+
170766
+ this.Canvas.strokeStyle=lineConfig.SellColor;
170767
+ this.Canvas.beginPath();
170768
+ this.Canvas.moveTo(xCenter,ToFixedPoint2(lineWidth,yCenter,));
170769
+ this.Canvas.lineTo(xRight,ToFixedPoint2(lineWidth,yCenter));
170770
+ this.Canvas.stroke();
170771
+ }
170772
+ else
170773
+ {
170774
+ this.Canvas.strokeStyle=lineConfig.NoneColor;
170775
+ this.Canvas.lineWidth=lineWidth;
170776
+ this.Canvas.beginPath();
170777
+ this.Canvas.moveTo(xLeft,ToFixedPoint2(lineWidth,yCenter));
170778
+ this.Canvas.lineTo(xRight,ToFixedPoint2(lineWidth,yCenter));
170779
+ this.Canvas.stroke();
170780
+ }
170781
+ }
170782
+
170783
+ if (config.BottomLine && config.BottomLine.Enable)
170784
+ {
170785
+ var xLeft=position.Border.Left, xRight=position.Border.Right;
170786
+ this.Canvas.strokeStyle=config.BottomLine.Color;
170787
+ this.Canvas.lineWidth=1*GetDevicePixelRatio();
170788
+ this.Canvas.beginPath();
170789
+ this.Canvas.moveTo(xLeft,ToFixedPoint(yText));
170790
+ this.Canvas.lineTo(xRight,ToFixedPoint(yText));
170791
+ this.Canvas.stroke();
170792
+ }
170793
+
170794
+ if (config.TopLine && config.TopLine.Enable)
170795
+ {
170796
+ var xLeft=position.Border.Left, xRight=position.Border.Right;
170797
+ this.Canvas.strokeStyle=config.BottomLine.Color;
170798
+ this.Canvas.lineWidth=1*GetDevicePixelRatio();
170799
+ this.Canvas.beginPath();
170800
+ this.Canvas.moveTo(xLeft,ToFixedPoint(top));
170801
+ this.Canvas.lineTo(xRight,ToFixedPoint(top));
170802
+ this.Canvas.stroke();
170803
+ }
170804
+ }
170805
+
170806
+ this.DrawBuySellItem=function(item, left, top, cellWidth, cellHeight)
170807
+ {
170808
+ var config=this.BuySellConfig;
170809
+ var xText=left;
170810
+ var yBottom=top+cellHeight-config.CellMargin.Bottom+config.CellMargin.YOffset;
170811
+
170812
+ if (item.Name)
170813
+ {
170814
+ this.Canvas.fillStyle=config.TitleColor;
170815
+ this.Canvas.fillText(item.Name,xText+config.CellMargin.Left,yBottom);
170816
+ }
170817
+ xText+=cellWidth;
170818
+
170819
+ if (IFrameSplitOperator.IsNumber(item.Price))
170820
+ {
170821
+ var text=item.Price.toFixed(this.Decimal);
170822
+ var textWidth=this.Canvas.measureText(text).width;
170823
+ var x=xText+cellWidth-textWidth-config.CellMargin.Right;
170824
+ this.Canvas.fillStyle=this.GetPriceColor(item.Price);
170825
+ this.Canvas.fillText(text,x,yBottom);
170826
+ }
170827
+ xText+=cellWidth;
170828
+
170829
+ xText+=cellWidth;
170830
+
170831
+ if (IFrameSplitOperator.IsNumber(item.Vol))
170832
+ {
170833
+ var text=item.Vol.toFixed(0);
170834
+ var textWidth=this.Canvas.measureText(text).width;
170835
+ var x=xText+cellWidth-textWidth-config.CellMargin.Right;
170836
+ this.Canvas.fillStyle=config.VolColor;
170837
+ this.Canvas.fillText(text,x,yBottom);
170838
+ }
170839
+ }
170840
+
170841
+
170842
+ this.DrawTable=function(position)
170843
+ {
170844
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Column)) return;
170845
+
170846
+ var config=this.TableConfig;
170847
+ var top=position.Top;
170848
+ var left=position.Left+config.Margin.Left;
170849
+ var cellWidth=(position.Width-config.Margin.Left-config.Margin.Right)/4;
170850
+
170851
+ var yText=top+config.Margin.Top;
170852
+ var xText=left;
170853
+
170854
+ this.Canvas.font=config.Font;
170855
+ this.Canvas.textAlign = 'left';
170856
+ this.Canvas.textBaseline = 'bottom';
170857
+ var cellHeight=this.Canvas.measureText("擎").width+config.CellMargin.Top+config.CellMargin.Bottom;
170858
+
170859
+ for(var i=0;i<this.Column.length;++i)
170860
+ {
170861
+ xText=left;
170862
+ var item=this.Column[i];
170863
+ if (!item || !IFrameSplitOperator.IsNonEmptyArray(item)) continue;
170864
+ this.DrawRowItem(item, xText, yText, cellWidth, cellHeight);
170865
+
170866
+ yText+=cellHeight;
170867
+ }
170868
+ }
170869
+
170870
+ this.DrawRowItem=function(aryData, left, top, cellWidth, cellHeight)
170871
+ {
170872
+ var config=this.TableConfig;
170873
+ var xText=left;
170874
+ var yBottom=top+cellHeight-config.CellMargin.Bottom+config.CellMargin.YOffset;
170875
+
170876
+ for(var i=0;i<aryData.length && i<2;++i)
170877
+ {
170878
+ var item=aryData[i];
170879
+ if (item)
170880
+ {
170881
+ if (item.Name)
170882
+ {
170883
+ this.Canvas.fillStyle=config.TitleColor;
170884
+ this.Canvas.fillText(item.Name,xText+config.CellMargin.Left,yBottom);
170885
+ }
170886
+ xText+=cellWidth;
170887
+
170888
+ if (this.Data.MapData && this.Data.MapData.has(item.Key))
170889
+ {
170890
+ var dataItem=this.Data.MapData.get(item.Key);
170891
+ color=config.TextColor;
170892
+
170893
+ var text=this.FormatValue(item, dataItem);
170894
+
170895
+ if (item.ColorType===3 && IFrameSplitOperator.IsNumber(dataItem.Value))
170896
+ color=this.GetPriceColor(dataItem.Value);
170897
+ else if (item.ColorType==1 && IFrameSplitOperator.IsNumber(dataItem.Value))
170898
+ color=this.GetUpDownColor(dataItem.Value,0);
170899
+ else if (item.ColorType==4)
170900
+ color=this.UpColor;
170901
+ else if (item.ColorType==5)
170902
+ color=this.DownColor;
170903
+
170904
+ if (item.TextColor) color=item.TextColor;
170905
+
170906
+ if (text)
170907
+ {
170908
+ if (i==0 && item.ShowType==1) //整行显示
170909
+ {
170910
+ var textWidth=this.Canvas.measureText(text).width;
170911
+ var x=xText+(cellWidth*3)-textWidth-config.CellMargin.Right;
170912
+ this.Canvas.fillStyle=color;
170913
+ this.Canvas.fillText(text,x,yBottom);
170914
+ break;
170915
+ }
170916
+ else
170917
+ {
170918
+ var textWidth=this.Canvas.measureText(text).width;
170919
+ var x=xText+cellWidth-textWidth-config.CellMargin.Right;
170920
+ this.Canvas.fillStyle=color;
170921
+ this.Canvas.fillText(text,x,yBottom);
170922
+ }
170923
+
170924
+ }
170925
+ }
170926
+ xText+=cellWidth;
170927
+ }
170928
+ else
170929
+ {
170930
+ xText+=cellWidth+cellWidth;
170931
+ }
170932
+ }
170933
+
170934
+ }
170935
+
170936
+
170937
+ this.FormatValue=function(column, data)
170938
+ {
170939
+ var dec=0; //小数位数
170940
+ if (IFrameSplitOperator.IsNumber(column.FloatPrecision))
170941
+ {
170942
+ if (column.FloatPrecision===-1) dec=this.Decimal;
170943
+ else dec=column.FloatPrecision;
170944
+ }
170945
+
170946
+ var text=null;
170947
+ if (!data) return text;
170948
+
170949
+ if (data.Text)
170950
+ {
170951
+ text=data.Text;
170952
+ }
170953
+ else if (IFrameSplitOperator.IsNumber(data.Value))
170954
+ {
170955
+ var value=data.Value;
170956
+ text=value.toFixed(dec);
170957
+
170958
+ //格式化
170959
+ if (column.Format && IFrameSplitOperator.IsNumber(column.Format.Type))
170960
+ {
170961
+ var format=column.Format;
170962
+ switch(format.Type)
170963
+ {
170964
+ case 1: //原始数据
170965
+ text=value.toFixed(dec);
170966
+ break;
170967
+ case 2: //千分位分割
170968
+ text=IFrameSplitOperator.FormatValueThousandsString(value, dec);
170969
+ break;
170970
+ case 3:
170971
+ var exfloatPrecision=1;
170972
+ if (IFrameSplitOperator.IsNumber(format.ExFloatPrecision)) exfloatPrecision=format.ExFloatPrecision;
170973
+ text=IFrameSplitOperator.FormatValueStringV2(value, dec,exfloatPrecision);
170974
+ break;
170975
+ }
170976
+ }
170977
+ }
170978
+
170979
+ if (column.StringFormat && text) text=column.StringFormat.replace('{Value}',text);
170980
+
170981
+ return text;
170982
+ }
170983
+
170984
+ this.GetPriceColor=function(price)
170985
+ {
170986
+ var upperSymbol=null;
170987
+ if (this.Data.Symbol) upperSymbol=this.Data.Symbol.toUpperCase();
170988
+ if (MARKET_SUFFIX_NAME.IsChinaFutures(upperSymbol))
170989
+ {
170990
+ if (!IFrameSplitOperator.IsNumber(this.Data.YFClose)) return this.UnchangeColor;
170991
+ return this.GetUpDownColor(price, this.Data.YFClose);
170992
+ }
170993
+ else
170994
+ {
170995
+ if (!IFrameSplitOperator.IsNumber(this.Data.YClose)) return this.UnchangeColor;
170996
+ return this.GetUpDownColor(price, this.Data.YClose);
170997
+ }
170998
+ }
170999
+
171000
+ this.GetUpDownColor=function(price, price2)
171001
+ {
171002
+ if (price>price2) return this.UpColor;
171003
+ else if (price<price2) return this.DownColor;
171004
+ else return this.UnchangeColor;
171005
+ }
171006
+ }
171007
+
171008
+
171009
+
171010
+
171011
+
171012
+
171013
+
171014
+ /********************************************************************************
171015
+ * 版本信息输出
171016
+ *
171017
+ */
171018
+
171019
+
171020
+
171021
+ var HQCHART_VERSION="1.1.15450";
171022
+
171023
+ function PrintHQChartVersion()
171024
+ {
171025
+ var logo=`
171026
+
171027
+ ***************************************************************************************************************************************************************************
171028
+ *
171029
+ * :%@@-
171030
+ * :@@@@-
171031
+ * =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@.
171032
+ * :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@*
171033
+ * +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+
171034
+ * %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@=
171035
+ * @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@-
171036
+ * @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%%
171037
+ * .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@
171038
+ * :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@#
171039
+ * -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@.
171040
+ * +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#::
171041
+ * #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+
171042
+ * %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@-
171043
+ * @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@.
171044
+ * .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@.
171045
+ * -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@
171046
+ * =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@
171047
+ * +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@#
171048
+ * *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+
171049
+ * %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@-
171050
+ * @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+
171051
+ * .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+-
171052
+ * :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@-
171053
+ * =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@#
171054
+ * *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@*
171055
+ * =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:.
171056
+ *
171057
+ *
171058
+ * HQChart
171059
+ * Ver: ${HQCHART_VERSION}
171060
+ * License: Apache License 2.0
171061
+ * Source: https://github.com/jones2000/HQChart
171062
+ *
171063
+ **************************************************************************************************************************************************************************
171064
+ `;
171065
+
171066
+ console.log(logo);
171067
+ }
171068
+
171069
+
171070
+ PrintHQChartVersion();
171071
+
171072
+
171073
+
171074
+ import $ from 'jquery'
171075
+
171076
+ //把给外界调用的方法暴露出来
171077
+ export default {
171078
+ jsChartInit: JSChart.Init,
171079
+ jsChartStyle:JSChart.SetStyle,
171080
+ // IsIndexSymbol:IsIndexSymbol,
171081
+ // BaseIndex:BaseIndex,
171082
+ // ChartLine:ChartLine,
171083
+ // ChartKLine:ChartKLine,
171084
+ // ChartMACD:ChartMACD,
171085
+ // DynamicTitleData:DynamicTitleData,
171086
+ // ChartVolStick:ChartVolStick,
171087
+ // SingleData:SingleData,
171088
+ // ChartData:ChartData
171089
+
171090
+ //类导出
171091
+ JSChart:JSChart, //行情图形库
171092
+ ChartData:ChartData, //数据类
171093
+ SingleData:SingleData,
171094
+ HistoryData:HistoryData, //K线数据结构
171095
+ MARKET_SUFFIX_NAME:MARKET_SUFFIX_NAME, // 判断股票属性
171096
+ IFrameSplitOperator:IFrameSplitOperator,//格式化字符串方法
171097
+ FrameSplitKLinePriceY:FrameSplitKLinePriceY,
171098
+ FrameSplitKLineX:FrameSplitKLineX,
171099
+ JSKLineInfoMap:JSKLineInfoMap,
171100
+ JSCHART_EVENT_ID:JSCHART_EVENT_ID, //可以订阅的事件类型
171101
+ JSCHART_OPERATOR_ID:JSCHART_OPERATOR_ID, //图形控制类型
171102
+ JSCHART_DATA_FIELD_ID:JSCHART_DATA_FIELD_ID,//图形字段
171103
+ JSCHART_CUSTOM_YCOORDINATE_ID:JSCHART_CUSTOM_YCOORDINATE_ID, //自定义刻度类型
171104
+ JSAlgorithm:JSAlgorithm, //算法类
171105
+ JSComplier:JSComplier, //指标编译器
171106
+ JSIndexScript:JSIndexScript, //系统指标库
171107
+ GetDevicePixelRatio,GetDevicePixelRatio,
171108
+
171109
+ ScriptIndexConsole:ScriptIndexConsole, //指标执行 无UI
171110
+ //style.js相关
171111
+ STYLE_TYPE_ID:STYLE_TYPE_ID,
171112
+ HQChartStyle:HQChartStyle, //预定义全局的配色 黑
171113
+
171114
+ JSConsole:JSConsole, //日志输出
171115
+
171116
+ KLineTooltipPaint:KLineTooltipPaint, //K线tooltip
171117
+ MinuteTooltipPaint:MinuteTooltipPaint, //走势图tooltip
171118
+
171119
+ ChartDrawTwoPointDemo:ChartDrawTwoPointDemo, //画图工具2个点例子
171120
+ ChartDrawThreePointDemo:ChartDrawThreePointDemo, //画图工具3个点例子
171121
+
171122
+ CoordinateInfo:CoordinateInfo,
171123
+
171124
+ //成交明细
171125
+ JSDealChart:JSDealChart,
171126
+ DEAL_COLUMN_ID:DEAL_COLUMN_ID,
171127
+
171128
+ //报价列表
171129
+ JSReportChart:JSReportChart,
171130
+ REPORT_COLUMN_ID:REPORT_COLUMN_ID,
171131
+
171132
+ //T型报价
171133
+ JSTReportChart:JSTReportChart,
171134
+ TREPORT_COLUMN_ID:TREPORT_COLUMN_ID,
171135
+
171136
+ //键盘精灵
171137
+ JSKeyboardChart:JSKeyboardChart,
171138
+ KEYBOARD_COLUMN_ID:KEYBOARD_COLUMN_ID,
171139
+ JSPopKeyboard:JSPopKeyboard,
171140
+
171141
+ //X轴滚动条
171142
+ JSScrollBarChart:JSScrollBarChart,
171143
+
171144
+ JSStockInfoChart:JSStockInfoChart, //5档买卖
171145
+ JSStatusBarChart:JSStatusBarChart, //底部状态栏
168724
171146
 
168725
171147
  //图形基类导出
168726
171148
  IChartPainting:IChartPainting, //图形