hqchart 1.1.15091 → 1.1.15106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/umychart.vue.js +133 -106
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +5 -0
- package/src/jscommon/umychart.js +218 -389
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +221 -391
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +225 -390
package/lib/umychart.vue.js
CHANGED
|
@@ -1563,9 +1563,7 @@ default:return null;}};//注册外部扩展图形
|
|
|
1563
1563
|
JSChart.RegisterExtendChartClass=function(name,option){return g_ExtendChartPaintFactory.Add(name,option);};JSChart.AddExtendCallbackDraw=function(className){return g_ExtendChartPaintFactory.AddCallbackDrawClassName(className);};//注册外部图形类
|
|
1564
1564
|
//option:{ Create:创建类方法 }
|
|
1565
1565
|
JSChart.RegisterChartPaintClass=function(name,option){return g_ChartPaintFactory.Add(name,option);};//注册外部指标图形
|
|
1566
|
-
JSChart.RegisterScriptIndexChart=function(name,option){return g_ScriptIndexChartFactory.Add(name,option);}
|
|
1567
|
-
//option:{ Create:创建类方法 }
|
|
1568
|
-
JSChart.RegisterDialogClass=function(name,option){return g_DialogFactory.Add(name,option);};//注册框架类
|
|
1566
|
+
JSChart.RegisterScriptIndexChart=function(name,option){return g_ScriptIndexChartFactory.Add(name,option);};//注册框架类
|
|
1569
1567
|
JSChart.RegisterChartFrameClass=function(name,option){return g_ChartFrameFactory.Add(name,option);};//一些公共函数
|
|
1570
1568
|
JSChart.ToFixedPoint=function(value){return ToFixedPoint(value);};JSChart.ToFixedPoint2=function(width,value){return ToFixedPoint2(width,value);};JSChart.ToFixedRect=function(value){return ToFixedRect(value);};JSChart.GetScrollPosition=function(){return GetScrollPosition();};//品种小数位数
|
|
1571
1569
|
JSChart.GetfloatPrecision=function(symbol){return GetfloatPrecision(symbol);};//获取不带后缀的代码
|
|
@@ -1703,7 +1701,9 @@ ON_CLICK_CHART_CELL:171,//点击图形单元
|
|
|
1703
1701
|
GET_DEFAULT_INDEX_PARAM:172,//获取指标默认参数
|
|
1704
1702
|
ON_RELOAD_RESOURCE:173,ON_REPORT_DATA_FILTER:174,//数据筛选
|
|
1705
1703
|
ON_REPORT_SHOW_TOOLTIP:175,//报价列表 提示信息\
|
|
1706
|
-
ON_FORMAT_TVLONGPOSITION_LABEL:176,ON_FORMAT_COUNTDOWN_TEXT:177
|
|
1704
|
+
ON_FORMAT_TVLONGPOSITION_LABEL:176,ON_FORMAT_COUNTDOWN_TEXT:177,//倒计时
|
|
1705
|
+
ON_CLICK_INDEX_LOCK:178,//点击指标锁
|
|
1706
|
+
ON_CORSSCURSOR_STATUS_CHANGE:179//十字光标状态改变
|
|
1707
1707
|
};var JSCHART_OPERATOR_ID={OP_SCROLL_LEFT:1,//往左移动
|
|
1708
1708
|
OP_SCROLL_RIGHT:2,//往右移动
|
|
1709
1709
|
OP_ZOOM_OUT:3,//缩小
|
|
@@ -1823,7 +1823,8 @@ CLOSE_ID:5000,//15:00 后,首先发 CLOSE 标志
|
|
|
1823
1823
|
ENDTR_ID:6000,//交易结束
|
|
1824
1824
|
//上面状态个位数 是停牌状态 如3001 连续交易时间段停牌
|
|
1825
1825
|
SUSP_ID:1//停牌
|
|
1826
|
-
|
|
1826
|
+
//十字光标状态
|
|
1827
|
+
};var JSCHART_CORSSCURSOR_STATUS_ID={NONE_ID:0,LINE_ID:1,LEFT_TEXT_ID:2,LEFT_INTER_TEXT_ID:4,RIGHT_TEXT_ID:8,RIGHT_INTER_TEXT_ID:16,BOTTOM_TEXT_ID:32};function PhoneDBClick(){this.Start=[];this.Clear=function(){this.Start=[];};this.AddTouchStart=function(x,y,time){if(this.Start.length>0){var item=this.Start[this.Start.length-1];var spanTime=time-item.Time;if(spanTime>0&&spanTime<300){this.Start.push({X:x,Y:y,Time:time});}else{this.Start=[];}}else{this.Start.push({X:x,Y:y,Time:time});}};this.IsVaildDBClick=function(){if(this.Start.length==2)return true;return false;};this.AddTouchEnd=function(time){if(this.Start.length<=0)return;var item=this.Start[this.Start.length-1];var spanTime=time-item.Time;if(spanTime>=0&&spanTime<150){}else{this.Start=[];}};}/*
|
|
1827
1828
|
图形控件
|
|
1828
1829
|
*/function JSChartContainer(uielement,OffscreenElement,cacheElement){var _this9=this;this.ClassName='JSChartContainer';var _self=this;this.Frame;//框架画法
|
|
1829
1830
|
this.ChartPaint=new Array();//图形画法
|
|
@@ -1904,7 +1905,8 @@ SelectedXBorder:{Mode:0,Date:null},//X边框选中模式 Mode:0=禁用 分时图
|
|
|
1904
1905
|
RightHorizontal:{//Show:true,
|
|
1905
1906
|
//Width:5
|
|
1906
1907
|
},//锁十字光标
|
|
1907
|
-
LockCorssCursor:{X:{Enable:false}}
|
|
1908
|
+
LockCorssCursor:{X:{Enable:false}},CorssCursorStatus:{Value:null},//十字光标状态 只读
|
|
1909
|
+
//图形中的单元选中状态
|
|
1908
1910
|
MapIndexChartCache:new _map2.default(),//key 指标GUID
|
|
1909
1911
|
TradeStatus:null,//当前交易状态 { Date, Time:数据最后更新的时间, Status: }
|
|
1910
1912
|
LatestPoint:null//最新的点位置 { X:, Y: }
|
|
@@ -1937,7 +1939,8 @@ this.KeyboardMove={Timer:null,Delay:100,PressTime:500,Enable:false,Event:null};/
|
|
|
1937
1939
|
this.MapEventListenerCache=new _map2.default();//addEventListener 监听事件 key=type:"keydown|keyup ....", value:{ Callback:, Option: }
|
|
1938
1940
|
this.AddEventListener=function(eventTarget,type,listener,option){if(!eventTarget||!type||!listener)return false;var callback=listener.bind(this);var item={Callback:callback,Option:option,Type:type,Element:eventTarget};eventTarget.addEventListener(type,callback,option);this.MapEventListenerCache.set(item.Type,item);return true;};this.RemoveEventListener=function(eventTarget,type){if(!eventTarget||!type)return false;if(!this.MapEventListenerCache.has(type))return false;var item=this.MapEventListenerCache.get(type);if(!item.Element||!item.Callback)return false;this.MapEventListenerCache.delete(item.Type);item.Element.removeEventListener(item.Type,item.Callback,item.Option);};//option={ KeyDown:, Wheel }
|
|
1939
1941
|
this.AddDefaultEventListener=function(option){var _this4=this;var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(IFrameSplitOperator.IsBool(option.KeyDown))bRegisterKeydown=option.KeyDown;if(IFrameSplitOperator.IsBool(option.Wheel))bRegisterWheel=option.Wheel;}if(bRegisterKeydown){this.AddEventListener(this.UIElement,"keydown",function(e){_this4.OnKeyDown(e);},true);this.AddEventListener(this.UIElement,"keyup",function(e){_this4.OnKeyUp(e);},true);}if(bRegisterWheel){this.AddEventListener(this.UIElement,"wheel",function(e){_this4.OnWheel(e);},true);}JSConsole.Chart.Log('[JSChartContainer::AddDefaultEventListener] [keydown,keyup]='+bRegisterKeydown+', [wheel]='+bRegisterWheel);};this.RemoveAllEventListener=function(){var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=(0,_getIterator3.default)(this.MapEventListenerCache),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var mapItem=_step2.value;var item=mapItem[1];if(!item.Element||!item.Callback)continue;item.Element.removeEventListener(item.Type,item.Callback,item.Option);}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}}finally{if(_didIteratorError2){throw _iteratorError2;}}}this.MapEventListenerCache.clear();};this.ClearGlobalOption=function(){if(!this.GlobalOption)return;this.GlobalOption.LatestPoint=null;this.GlobalOption.TradeStatus=null;this.GlobalOption.CountDown=null;};this.RestoreFocus=function(delay){var _this5=this;var value=1000;if(IFrameSplitOperator.IsNumber(delay))value=delay;this.ClearRestoreFocusTimer();this.RestoreFocusTimer=setTimeout(function(){_this5.SetFocus();},value);};this.ClearRestoreFocusTimer=function(){if(this.RestoreFocusTimer){clearTimeout(this.RestoreFocusTimer);this.RestoreFocusTimer=null;}};this.GetVolUnit=function()//成交量单位
|
|
1940
|
-
{var upperSymbol=this.Symbol?this.Symbol.toUpperCase():null;var unit=MARKET_SUFFIX_NAME.GetVolUnit(upperSymbol);return unit;};this.ClearStockCache=function(){this.StockCache.Data=null;this.BuySellData.AryBuy=null;this.BuySellData.ArySell=null;};this.
|
|
1942
|
+
{var upperSymbol=this.Symbol?this.Symbol.toUpperCase():null;var unit=MARKET_SUFFIX_NAME.GetVolUnit(upperSymbol);return unit;};this.ClearStockCache=function(){this.StockCache.Data=null;this.BuySellData.AryBuy=null;this.BuySellData.ArySell=null;};this.UpdateCorssCursorStatus=function(){if(!this.ChartCorssCursor)return false;if(!this.GlobalOption||!this.GlobalOption.CorssCursorStatus)return false;var status=this.ChartCorssCursor.Status;//状态改变了
|
|
1943
|
+
if(this.GlobalOption.CorssCursorStatus.Value!=status){this.GlobalOption.CorssCursorStatus.Value=status;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CORSSCURSOR_STATUS_CHANGE);if(event&&event.Callback){var sendData={Status:status,IsShowLine:(status&JSCHART_CORSSCURSOR_STATUS_ID.LINE_ID)>0};event.Callback(event,sendData,this);}}return true;};this.InitalPopMenu=function()//初始化弹出窗口
|
|
1941
1944
|
{if(this.JSPopMenu)return;this.JSPopMenu=new JSPopMenu();//内置菜单
|
|
1942
1945
|
this.JSPopMenu.Inital(this);};this.InitalDrawToolDialog=function(){if(this.DialogDrawTool)return;this.DialogDrawTool=new JSDialogDrawTool();this.DialogDrawTool.Inital(this);this.DialogDrawTool.Create();};this.InitalTooltipDialog=function(option){if(this.DialogTooltip)return;this.DialogTooltip=new JSDialogTooltip();this.DialogTooltip.Inital(this,option);this.DialogTooltip.Create();};this.InitalFloatTooltip=function(option){if(this.FloatTooltip)return;this.FloatTooltip=new JSFloatTooltip();this.FloatTooltip.Inital(this,option);this.FloatTooltip.Create();};this.InitalSmallFloatTooltip=function(option){if(this.SmallFloatTooltipGroup)return;this.SmallFloatTooltipGroup=new JSSmallFloatTooltipGroup();this.SmallFloatTooltipGroup.Inital(this,option);this.SmallFloatTooltipGroup.Create();};this.InitalModifyDrawDialog=function(){if(this.DialogModifyDraw)return;this.DialogModifyDraw=new JSDialogModifyDraw();this.DialogModifyDraw.Inital(this);this.DialogModifyDraw.Create();};this.InitalSelectRectDialog=function(option){if(this.DialogSelectRect)return;this.DialogSelectRect=new JSDialogSelectRect();this.DialogSelectRect.Inital(this,option);this.DialogSelectRect.Create();};this.InitalSearchIndexDialog=function(option){if(this.DialogSearchIndex)return;this.DialogSearchIndex=new JSDialogSearchIndex();this.DialogSearchIndex.Inital(this,option);this.DialogSearchIndex.Create();};this.InitalModifyIndexParamDialog=function(option){if(this.DialogModifyIndexParam)return;this.DialogModifyIndexParam=new JSDialogModifyIndexParam();this.DialogModifyIndexParam.Inital(this,option);this.DialogModifyIndexParam.Create();};this.ShowChangeIndexDialog=function(data){if(!data)return;if(!this.DialogSearchIndex)return;data.Title='\u5207\u6362\u6307\u6807 [\u7A97\u53E3'+(data.WindowIndex+1)+']';this.DialogSearchIndex.SetOpData(data);this.DialogSearchIndex.Show();};this.ShowAddOverlayIndexDialog=function(data){if(!data)return;if(!this.DialogSearchIndex)return;data.Title='\u6DFB\u52A0\u53E0\u52A0\u6307\u6807 [\u7A97\u53E3'+(data.WindowIndex+1)+']';this.DialogSearchIndex.SetOpData(data);this.DialogSearchIndex.Show();};//添加指标窗口
|
|
1943
1946
|
this.ShowAddIndexWindowDialog=function(option){if(!this.DialogSearchIndex)return;var data=option;if(!data)data={};data.OpType=3;data.Title='\u589E\u52A0\u6307\u6807\u7A97\u53E3';this.DialogSearchIndex.SetOpData(data);this.DialogSearchIndex.Show();};this.ShowModifyIndexParamDialog=function(data){if(!this.DialogModifyIndexParam)return;if(data.Type==1){var indexScript=this.WindowIndex[data.WindowIndex];if(!indexScript)return;data.IndexScript=indexScript;data.Title='['+indexScript.Name+']\u53C2\u6570\u4FEE\u6539 \u7A97\u53E3['+(data.WindowIndex+1)+']';}else if(data.Type==2){var overlayIndex=this.GetOverlayIndexByIdentify(data.Identify);if(!overlayIndex||!overlayIndex.OverlayItem.Script)return;var indexScript=overlayIndex.OverlayItem.Script;data.IndexScript=indexScript;data.Title='['+indexScript.Name+']\u53C2\u6570\u4FEE\u6539 \u53E0\u52A0\u7A97\u53E3['+(data.WindowIndex+1)+']';}this.DialogModifyIndexParam.SetIndexData(data);this.DialogModifyIndexParam.Show();};this.DrawSelectRectDialog=function(){};this.IsShowSelectRectDialog=function(){if(!this.DialogSelectRect)return false;return this.DialogSelectRect.IsShow();};this.ShowDrawToolDialog=function(x,y){if(!this.DialogDrawTool)return;var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();var top=this.UIElement.offsetTop+15;var left=this.UIElement.offsetWidth-this.DialogDrawTool.DivDialog.offsetWidth-15;left+=rtClient.left+rtScroll.Left;top+=rtClient.top+rtScroll.Top;this.DialogDrawTool.Show(left,top);};this.IsShowDrawToolDialog=function(){if(!this.DialogDrawTool)return false;return this.DialogDrawTool.IsShow();};this.ShowModifyDrawDialog=function(chart,x,y){if(!this.DialogModifyDraw)return;this.DialogModifyDraw.SetChartPicture(chart);if(this.DialogModifyDraw.IsShow())return;var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();var top=this.UIElement.offsetTop+15;var left=(this.UIElement.offsetWidth-this.DialogModifyDraw.DivDialog.offsetWidth)/2;left+=rtClient.left+rtScroll.Left;top+=rtClient.top+rtScroll.Top;this.DialogModifyDraw.Show(left,top);};this.CloseModifyDrawDialog=function(){if(!this.DialogModifyDraw)return;this.DialogModifyDraw.Close();};this.IsShowTooltipDialog=function(){if(!this.DialogTooltip)return false;return this.DialogTooltip.IsShow();};this.CloseTooltipDialog=function(){if(!this.DialogTooltip)return;this.DialogTooltip.Close();};this.HideFloatTooltip=function(){if(!this.FloatTooltip)return;this.FloatTooltip.Hide();};this.HideSmallFloatTooltip=function(){if(!this.SmallFloatTooltipGroup)return;this.SmallFloatTooltipGroup.Hide();};this.DestroyTooltipDialog=function(){if(!this.DialogTooltip)return;this.DialogTooltip.Destroy();this.DialogTooltip=null;};this.DestroyFloatTooltip=function(){if(!this.FloatTooltip)return;this.FloatTooltip.Destroy();this.FloatTooltip=null;};this.DestroySmallFloatTooltip=function(){if(!this.SmallFloatTooltipGroup)return;this.SmallFloatTooltipGroup.Destroy();this.SmallFloatTooltipGroup=null;};this.DestroySearchIndexDialog=function(){if(!this.DialogSearchIndex)return;this.DialogSearchIndex.Destroy();this.DialogSearchIndex=null;};this.DestroyDialogDrawTool=function(){if(!this.DialogDrawTool)return;this.DialogDrawTool.Destroy();this.DialogDrawTool=null;};this.DestroyDialogModifyIndexParam=function(){if(!this.DialogModifyIndexParam)return;this.DialogModifyIndexParam.Destroy();this.DialogModifyIndexParam=null;};this.DestroyDialogSelectRect=function(){if(!this.DialogSelectRect)return;this.DialogSelectRect.Destroy();this.DialogSelectRect=null;};this.DestroyDialogModifyDraw=function(){if(!this.DialogModifyDraw)return;this.DialogModifyDraw.Destroy();this.DialogModifyDraw=null;};this.DestroyPopMenu=function(){if(!this.JSPopMenu)return;this.JSPopMenu.Destroy();this.JSPopMenu=null;};//隐藏内置的弹框div
|
|
@@ -2114,7 +2117,7 @@ for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint
|
|
|
2114
2117
|
for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];item.Canvas=canvas;}};//清空画布
|
|
2115
2118
|
this.ClearCanvas=function(canvas){if(!canvas)return;if(!this.UIElement)return;canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);};this.ClearCorssCursorCanvas=function(){if(!this.CorssCursorCanvas)return;this.CorssCursorCanvas.clearRect(0,0,this.CorssCursorElement.width,this.CorssCursorElement.height);};this.Draw=function(){var _this14=this;if(this.ChartCorssCursor)this.ChartCorssCursor.Status=0;if(this.UIElement.width<=0||this.UIElement.height<=0)return;this.StopDrawDynamicInfo();this.ClearCorssCursorCanvas();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_BEFORE_DRAW);if(event&&event.Callback){var sendData={};event.Callback(event,sendData,this);}this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);if(this.CacheCanvas)this.CacheCanvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
2116
2119
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
2117
|
-
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){var data=this.InvokeBeforeDrawSplashScreenCallback();if(data&&data.PreventDefault===true)return;this.Frame.ClearCoordinateText();this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}if(this.CacheCanvas)this.SetCanvas(this.CacheCanvas);//框架
|
|
2120
|
+
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){var data=this.InvokeBeforeDrawSplashScreenCallback();if(data&&data.PreventDefault===true)return;this.Frame.ClearCoordinateText();this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();this.UpdateCorssCursorStatus();return;}if(this.CacheCanvas)this.SetCanvas(this.CacheCanvas);//框架
|
|
2118
2121
|
if(this.Frame.SetBeforeDrawXYCallback){this.Frame.SetBeforeDrawXYCallback(function(frame){_this14.BeforeDrawXYCoordinate(frame);});}this.Frame.Draw();if(this.Frame.DrawCustomVertical){var eventCVericalDraw=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_VERTICAL_DRAW);this.Frame.DrawCustomVertical(eventCVericalDraw);}this.Frame.CalculateLock();for(var i=0;i<this.ChartDrawPicture.length;++i){var item=this.ChartDrawPicture[i];if(!item.IsDrawMain)continue;if(item.IsDrawMain())item.MainDraw();}//框架内图形
|
|
2119
2122
|
for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.IsDrawFirst)item.Draw();}this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_5);if(this.Frame.DrawOveraly)this.Frame.DrawOveraly(true);//画叠加指标
|
|
2120
2123
|
for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.IsDrawFirst)item.Draw();}for(var i=0;i<this.ChartPaintEx.length;++i){var item=this.ChartPaintEx[i];item.Draw();}//叠加股票
|
|
@@ -2176,7 +2179,7 @@ item.Draw();}if(this.SelectChartDrawPicture)this.SelectChartDrawPicture.Draw();i
|
|
|
2176
2179
|
*/this.OffscreenToShowCanvas();//更新滚动条
|
|
2177
2180
|
if(typeof this.UpdateScrollBar=='function')this.UpdateScrollBar();if(this.LastMouseStatus.MouseOnToolbar)//工具栏按钮提示信息
|
|
2178
2181
|
{var frame=this.LastMouseStatus.MouseOnToolbar.Frame;if(frame&&frame.DrawToolbarTooltip)frame.DrawToolbarTooltip(this.LastMouseStatus.MouseOnToolbar);}if(bDrawDialogTooltip)this.DrawTooltipDialog();//发送图形状态给外部
|
|
2179
|
-
if(this.mapEvent.has(JSCHART_EVENT_ID.CHART_STATUS)){var event=this.mapEvent.get(JSCHART_EVENT_ID.CHART_STATUS);var data={};if(typeof this.GetChartStatus=='function')data=this.GetChartStatus();event.Callback(event,data,this);}++this.TouchDrawCount;};this.DrawExtendChartPaint=function(level,option){if(!IFrameSplitOperator.IsNonEmptyArray(this.ExtendChartPaint))return;//扩展图形
|
|
2182
|
+
if(this.mapEvent.has(JSCHART_EVENT_ID.CHART_STATUS)){var event=this.mapEvent.get(JSCHART_EVENT_ID.CHART_STATUS);var data={};if(typeof this.GetChartStatus=='function')data=this.GetChartStatus();event.Callback(event,data,this);}++this.TouchDrawCount;this.UpdateCorssCursorStatus();};this.DrawExtendChartPaint=function(level,option){if(!IFrameSplitOperator.IsNonEmptyArray(this.ExtendChartPaint))return;//扩展图形
|
|
2180
2183
|
for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.IsCallbackDraw)continue;var value=item.GetPriority();//绘图优先级
|
|
2181
2184
|
if(value!=level)continue;if(level==IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_20){item.Draw();if(item.DrawToolbar&&option)item.DrawToolbar(option.MoveonPoint,option.LastMouseStatus);}else if(level==IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_25&&option){if(item.ClassName=='KLineTooltipPaint'&&option){if(option.Tooltip==false)continue;if(option.Point)item.LatestPoint=option.Point;}else if(item.ClassName=="MinuteTooltipPaint"&&option){if(option.Point)item.LatestPoint=option.Point;}item.Draw(option.MoveonPoint,option.LastMouseStatus);}else{item.Draw();}}};this.PtInButton=function(x,y){var button=this.Frame.PtInButtons(x,y);if(button)return{Name:"FrameButton",Button:button};button=this.PtInExtendChartButtons(x,y);if(button)return{Name:"ExtendChartButton",Button:button};button=this.PtInDrawPictureButtons(x,y);if(button)return{Name:"DrawPictureButton",Button:button};button=this.PtInTitleButtons(x,y);if(button)return{Name:"TitleButton",Button:button};return null;};this.DrawDrawPictureXYCoordinate=function(){var actionDrawPicture=null;//当前激活的画图
|
|
2182
2185
|
if(this.CurrentChartDrawPicture)actionDrawPicture=this.CurrentChartDrawPicture;else if(this.SelectChartDrawPicture)actionDrawPicture=this.SelectChartDrawPicture;//画图工具显示点在Y轴的刻度
|
|
@@ -2207,43 +2210,9 @@ if(this.ChartCorssCursor){this.ChartCorssCursor.LastPoint=corssCursorPos.LastPoi
|
|
|
2207
2210
|
{this.ChartCorssCursor.Canvas=this.CorssCursorCanvas;this.ChartCorssCursor.Canvas.clearRect(0,0,this.CorssCursorElement.width,this.CorssCursorElement.height);bRestoreCanvas=true;}if(option&&option.Corss==false){}else if(this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID){if(this.TouchStatus.CorssCursorShow==true)this.ChartCorssCursor.Draw();}else if(this.EnableClickModel){if(this.ClickModel.IsShowCorssCursor===true)this.ChartCorssCursor.Draw();}else if(this.IsOnTouch===false&&this.CurrentChartDrawPicture&&this.CurrentChartDrawPicture.IsShowCorssCursor===true)//开始绘图
|
|
2208
2211
|
{this.ChartCorssCursor.Draw();}else if(!(this.IsOnTouch===false&&this.CorssCursorTouchEnd===true)&&!this.CurrentChartDrawPicture){this.ChartCorssCursor.Draw();}else if(this.IsOnTouch===true&&this.CurrentChartDrawPicture&&this.EnableShowCorssCursor&&this.EnableShowCorssCursor.DrawPicture==true){this.ChartCorssCursor.Draw();}if(bRestoreCanvas){this.ChartCorssCursor.Canvas=this.Canvas;}bDrawDialogTooltip=true;}var ptPosition=null;//鼠标位置 null 无效 -1 在外面 >=0 对应的指标窗口中ID
|
|
2209
2212
|
if(option&&option.Point&&(option.ParentFunction=='OnMouseMove'||option.ParentFunction=='MoveCorssCursorIndex')){ptPosition=this.Frame.PtInFrame(option.Point.X,option.Point.Y);}var drawStatus=this.GetDrawStatus();drawStatus.DrawName="DrawDynamicInfo";for(var i=0;i<this.TitlePaint.length;++i){var item=this.TitlePaint[i];if(!item.IsDynamic)continue;item.CursorIndex=corssCursorPos.CursorIndex;item.LastPoint=this.LastPoint;if(item.OnDrawEvent){item.OnDrawEvent.FunctionName='DrawDynamicInfo';item.OnDrawEvent.PointPosition=ptPosition;if(this.IsLockCorssCursor()){if(item.OnDrawEvent.PointPosition<0)item.OnDrawEvent.PointPosition=0;}}item.DrawStatus=drawStatus;var pointInfo=null;if(option&&IFrameSplitOperator.IsNumber(option.ClientPos)&&option.Point)//当前鼠标所在位置的详细信息 包含盘前盘后
|
|
2210
|
-
{pointInfo={ClientPos:option.ClientPos,Point:{X:option.Point.X,Y:option.Point.Y}};if(this.IsLockCorssCursor()){if(pointInfo.ClientPos<=0)pointInfo.ClientPos=1;}}item.PointInfo=pointInfo;item.Draw(moveonPoint,this.LastMouseStatus);}var exChartOption={MoveonPoint:moveonPoint,LastMouseStatus:this.LastMouseStatus};if(option){exChartOption.Tooltip=option.Tooltip;exChartOption.Point=option.Point;}this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_25,exChartOption)
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
var item=this.ExtendChartPaint[i];
|
|
2214
|
-
if (item.IsCallbackDraw) continue;
|
|
2215
|
-
if (item.DrawAfterPicture) continue;
|
|
2216
|
-
if (item.ClassName=='KLineTooltipPaint' && option)
|
|
2217
|
-
{
|
|
2218
|
-
if (option.Tooltip==false) continue;
|
|
2219
|
-
if (option.Point) item.LatestPoint=option.Point;
|
|
2220
|
-
}
|
|
2221
|
-
else if (item.ClassName=="MinuteTooltipPaint" && option)
|
|
2222
|
-
{
|
|
2223
|
-
if (option.Point) item.LatestPoint=option.Point;
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
if (item.IsDynamic && item.DrawAfterTitle===true) item.Draw(moveonPoint, this.LastMouseStatus);
|
|
2227
|
-
}
|
|
2228
|
-
*/if(this.EnableAnimation)this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_30);/*
|
|
2229
|
-
if (this.EnableAnimation)
|
|
2230
|
-
{
|
|
2231
|
-
for(var i=0;i<this.ExtendChartPaint.length;++i) //动画
|
|
2232
|
-
{
|
|
2233
|
-
var item=this.ExtendChartPaint[i];
|
|
2234
|
-
if (item.IsAnimation===true) item.Draw();
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
*/for(var i=0;i<this.ChartDrawPicture.length;++i){var item=this.ChartDrawPicture[i];if(item.IsDrawFirst)continue;if(item.IsDrawMain&&item.IsDrawMain()){if(item.MainPartDraw)item.MainPartDraw();continue;}if(this.SelectChartDrawPicture&&item.Guid==this.SelectChartDrawPicture.Guid)continue;//选中画图最后画 确保显示在最外面
|
|
2238
|
-
item.Draw(moveonPoint,this.LastMouseStatus);}if(this.SelectChartDrawPicture){this.SelectChartDrawPicture.Draw(moveonPoint,this.LastMouseStatus);}if(this.CurrentChartDrawPicture&&this.CurrentChartDrawPicture.Status!=10){this.CurrentChartDrawPicture.Draw();}this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_50);/*
|
|
2239
|
-
for(var i=0;i<this.ExtendChartPaint.length;++i) //动态扩展图形
|
|
2240
|
-
{
|
|
2241
|
-
var item=this.ExtendChartPaint[i];
|
|
2242
|
-
if (item.DrawAfterPicture)
|
|
2243
|
-
item.Draw();
|
|
2244
|
-
}
|
|
2245
|
-
*/if(this.LastMouseStatus.MouseOnToolbar)//工具栏按钮提示信息
|
|
2246
|
-
{var frame=this.LastMouseStatus.MouseOnToolbar.Frame;if(frame&&frame.DrawToolbarTooltip)frame.DrawToolbarTooltip(this.LastMouseStatus.MouseOnToolbar);}this.OffscreenToShowCanvas();if(bDrawDialogTooltip)this.DrawTooltipDialog();++this.TouchDrawCount;};this.DrawAnimation=function()//绘制动画 如弹幕
|
|
2213
|
+
{pointInfo={ClientPos:option.ClientPos,Point:{X:option.Point.X,Y:option.Point.Y}};if(this.IsLockCorssCursor()){if(pointInfo.ClientPos<=0)pointInfo.ClientPos=1;}}item.PointInfo=pointInfo;item.Draw(moveonPoint,this.LastMouseStatus);}var exChartOption={MoveonPoint:moveonPoint,LastMouseStatus:this.LastMouseStatus};if(option){exChartOption.Tooltip=option.Tooltip;exChartOption.Point=option.Point;}this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_25,exChartOption);if(this.EnableAnimation)this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_30);for(var i=0;i<this.ChartDrawPicture.length;++i){var item=this.ChartDrawPicture[i];if(item.IsDrawFirst)continue;if(item.IsDrawMain&&item.IsDrawMain()){if(item.MainPartDraw)item.MainPartDraw();continue;}if(this.SelectChartDrawPicture&&item.Guid==this.SelectChartDrawPicture.Guid)continue;//选中画图最后画 确保显示在最外面
|
|
2214
|
+
item.Draw(moveonPoint,this.LastMouseStatus);}if(this.SelectChartDrawPicture){this.SelectChartDrawPicture.Draw(moveonPoint,this.LastMouseStatus);}if(this.CurrentChartDrawPicture&&this.CurrentChartDrawPicture.Status!=10){this.CurrentChartDrawPicture.Draw();}this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_50);if(this.LastMouseStatus.MouseOnToolbar)//工具栏按钮提示信息
|
|
2215
|
+
{var frame=this.LastMouseStatus.MouseOnToolbar.Frame;if(frame&&frame.DrawToolbarTooltip)frame.DrawToolbarTooltip(this.LastMouseStatus.MouseOnToolbar);}this.OffscreenToShowCanvas();if(bDrawDialogTooltip)this.DrawTooltipDialog();++this.TouchDrawCount;this.UpdateCorssCursorStatus();};this.DrawAnimation=function()//绘制动画 如弹幕
|
|
2247
2216
|
{if(!this.EnableAnimation)return;if(this.Frame.ScreenImageData&&!this.IsOnTouch){for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.IsAnimation===true)item.IsMoveStep=true;//移动弹幕
|
|
2248
2217
|
}this.DrawDynamicInfo();}var self=this;window.requestAnimationFrame(function(){self.DrawAnimation();});};this.StartAnimation=function(option){var bCreated=false;//是否已经创建了弹幕画法
|
|
2249
2218
|
var barrageData=null;for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.ClassName==='BarragePaint'){bCreated=true;barrageData=item.BarrageList;break;}}if(!bCreated){var chart=new BarragePaint();chart.Canvas=this.Canvas;chart.ChartBorder=this.Frame.ChartBorder;chart.ChartFrame=this.Frame;chart.HQChart=this;chart.SetOption(option);this.ExtendChartPaint.push(chart);barrageData=chart.BarrageList;}this.EnableAnimation=true;var self=this;window.requestAnimationFrame(function(){self.DrawAnimation();});return barrageData;};this.StopAnimation=function(){this.EnableAnimation=false;this.DrawDynamicInfo();};this.GetChartTooltipData=function(x,y,option){var toolTip=new TooltipData();if(this.ChartInfoPaint){if(this.ChartInfoPaint.GetTooltipData(x,y,toolTip))return toolTip;}if(this.PtInChartPaintTooltip(x,y,toolTip))return toolTip;if(IFrameSplitOperator.IsNonEmptyArray(this.Frame.SubFrame)){for(var i=0;i<this.Frame.SubFrame.length;++i){var subFrame=this.Frame.SubFrame[i];for(var j=0;j<subFrame.OverlayIndex.length;++j){var overlayItem=subFrame.OverlayIndex[j];for(var k=0;k<overlayItem.ChartPaint.length;++k){var item=overlayItem.ChartPaint[k];if(item.GetTooltipData(x,y,toolTip))return toolTip;}}}}if(this.PtInOverlayChartPaintTooltip(x,y,toolTip))return toolTip;if(this.PtInExtendChartPaintTooltip(x,y,toolTip))return toolTip;return null;};this.GetCorssCursorTooltipData=function(option){if(!this.ChartCorssCursor)return null;if(this.ChartCorssCursor.Status===0)return null;if(!this.ChartCorssCursor.IsShowCorss)return null;var kItem=this.ChartCorssCursor.StringFormatX.KItem;if(!kItem)return null;//X轴取十字光标坐标
|
|
@@ -5022,21 +4991,19 @@ function ChartDrawFlagText(){this.newMethod=IChartPainting;//派生
|
|
|
5022
4991
|
this.newMethod();delete this.newMethod;this.ClassName="ChartDrawFlagText";this.MapCache=null;//key=date/date-time value={ Date:, Time:, Data:[ ] }
|
|
5023
4992
|
this.AryData=[];this.GetKValue=ChartData.GetKValue;this.BuildCacheData=function(){var mapData=new _map2.default();this.MapCache=mapData;if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;if(!IFrameSplitOperator.IsNonEmptyArray(this.AryData))return;for(var i=0;i<this.Data.Data.length;++i){var item=this.AryData[i];if(!item)continue;var kItem=this.Data.Data[i];item.Date=kItem.Date;item.Time=kItem.Time;var key=this.BuildKey(kItem);mapData.set(key,item);}};this.Draw=function(){};this.GetCorssCursorTooltipData=function(kItem,tooltip){if(!kItem)return null;if(!this.MapCache)return null;var key=this.BuildKey(kItem);if(!this.MapCache.has(key))return null;var item=this.MapCache.get(key);if(item.YValue>this.ChartFrame.HorizontalMax||item.YValue<this.ChartFrame.HorizontalMin)return null;var y=this.ChartFrame.GetYFromData(item.YValue,false);tooltip.AryData.push({Data:item,Y:y,ChartPaint:this,Type:1});return item;};this.GetMaxMin=function(){return{Min:null,Max:null};};}//锁 支持横屏
|
|
5024
4993
|
function ChartLock(){this.newMethod=IChartPainting;//派生
|
|
5025
|
-
this.newMethod();delete this.newMethod;this.ClassName="ChartLock";this.
|
|
5026
|
-
this.LockCount=20;// 锁最新的几个数据
|
|
4994
|
+
this.newMethod();delete this.newMethod;this.ClassName="ChartLock";this.LockCount=20;// 锁最新的几个数据
|
|
5027
4995
|
this.BGColor=g_JSChartResource.IndexLock.BGColor;this.TextColor=g_JSChartResource.IndexLock.TextColor;this.Font=g_JSChartResource.IndexLock.Font;this.Title=g_JSChartResource.IndexLock.Title;this.LockRect=null;//上锁区域
|
|
5028
4996
|
this.LockID;//锁ID
|
|
5029
4997
|
this.Callback;//回调
|
|
5030
4998
|
this.IndexName;//指标名字
|
|
5031
4999
|
this.IndexID;//指标ID
|
|
5032
|
-
this.
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
var bgColor=this.SetFillStyle(this.BGColor,rtBG.Left,rtBG.Top,rtBG.Left,rtBG.Bottom);this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
this.GetTooltipData=function(x,y,tooltip){if(this.LockRect==null)return false;this.Canvas.beginPath();this.Canvas.rect(this.LockRect.Left,this.LockRect.Top,this.LockRect.Width,this.LockRect.Height);if(this.Canvas.isPointInPath(x,y)){tooltip.Data={ID:this.LockID,Callback:this.Callback,IndexName:this.IndexName,IndexID:this.IndexID};tooltip.ChartPaint=this;return true;}return false;};}//买卖盘
|
|
5000
|
+
this.CalculateTextSize=function(aryText,defaultFont,out){if(!out||!IFrameSplitOperator.IsNonEmptyArray(aryText))return false;this.Canvas.font=defaultFont;var defaultLineHeight=this.Canvas.measureText("擎").width;//行高
|
|
5001
|
+
var lineHeight=defaultLineHeight;var height=0,width=0;out.AryText=[];for(var i=0;i<aryText.length;++i){var item=aryText[i];if(!item||!item.Text&&!item.Image)continue;if(item.Image){textWidth=item.Image.Width;lineHeight=item.Image.Height;}else{if(item.Font){this.Canvas.font=item.Font;lineHeight=this.Canvas.measureText("擎").width;}else{this.Canvas.font=defaultFont;lineHeight=defaultLineHeight;}var textWidth=this.Canvas.measureText(item.Text).width;}var lineItem={Text:item.Text,Width:textWidth,Height:lineHeight,Color:item.Color,TextMargin:{Top:0,Bottom:0,Left:0,Right:0},YOffset:0};if(IFrameSplitOperator.IsNumber(item.YOffset))lineItem.YOffset=item.YOffset;if(item.Font)lineItem.Font=item.Font;if(IFrameSplitOperator.IsNumber(item.Align))lineItem.Align=item.Align;//左右对齐 0=左 1=中 2=右
|
|
5002
|
+
if(item.Image)lineItem.Image=item.Image;if(item.TextMargin){var margin=item.TextMargin;if(IFrameSplitOperator.IsNumber(margin.Top))lineItem.TextMargin.Top=margin.Top;if(IFrameSplitOperator.IsNumber(margin.Bottom))lineItem.TextMargin.Bottom=margin.Bottom;if(IFrameSplitOperator.IsNumber(margin.Left))lineItem.TextMargin.Left=margin.Left;if(IFrameSplitOperator.IsNumber(margin.Right))lineItem.TextMargin.Right=margin.Right;}lineItem.Height+=lineItem.TextMargin.Top+lineItem.TextMargin.Bottom;lineItem.Width+=lineItem.TextMargin.Left+lineItem.TextMargin.Right;if(width<lineItem.Width)width=lineItem.Width;out.AryText.push(lineItem);height+=lineItem.Height;}out.Width=width;out.Height=height;return true;};this.Draw=function(bDraw){this.LockRect=null;if(!bDraw)return;if(this.NotSupportMessage){this.DrawNotSupportmessage();return;}var bHScreen=this.ChartFrame.IsHScreen;var bMinute=this.IsMinuteFrame();var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var xPointCount=this.ChartFrame.XPointCount;var border=this.ChartFrame.GetBorder();if(bHScreen){var chartright=border.BottomEx;var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;}else{var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.RightEx;}var kData=this.ChartFrame.Data;var left=xOffset;if(kData&&IFrameSplitOperator.IsNonEmptyArray(kData.Data)){for(var i=kData.DataOffset,j=0;i<kData.Data.length-this.LockCount&&j<xPointCount-this.LockCount;++i,++j,xOffset+=dataWidth+distanceWidth){var kItem=kData.Data[i];if(kItem.Open==null||kItem.High==null||kItem.Low==null||kItem.Close==null)continue;if(bMinute){left=this.ChartFrame.GetXFromIndex(j);}else{left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;}}}if(bHScreen){var rtBG={Left:border.Left,Right:border.RightEx,Top:left,Bottom:border.Bottom};rtBG.Width=rtBG.Right-rtBG.Left;rtBG.Height=rtBG.Bottom-rtBG.Top;var bgColor=this.SetFillStyle(this.BGColor,rtBG.Left,rtBG.Top,rtBG.Right,rtBG.Top);this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.LockRect=rtBG;//保存上锁区域
|
|
5003
|
+
}else{var rtBG={Left:left,Right:border.RightEx,Top:border.TopTitle,Bottom:border.Bottom};rtBG.Width=rtBG.Right-rtBG.Left;rtBG.Height=rtBG.Bottom-rtBG.Top;//上下渐变
|
|
5004
|
+
var bgColor=this.SetFillStyle(this.BGColor,rtBG.Left,rtBG.Top,rtBG.Left,rtBG.Bottom);this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.LockRect=rtBG;//保存上锁区域
|
|
5005
|
+
}var aryText=null;if(Array.isArray(this.Title))aryText=this.Title;else aryText=[{Text:this.Title}];var outSize={};if(!this.CalculateTextSize(aryText,this.Font,outSize))return;this.Canvas.textAlign='left';this.Canvas.textBaseline='bottom';this.Canvas.font=this.Font;if(bHScreen){var top=rtBG.Top+(rtBG.Height-outSize.Width)/2;if(outSize.Width>rtBG.Height)top=rtBG.Bottom-outSize.Width;var left=rtBG.Left+(rtBG.Width-outSize.Height)/2;this.Canvas.save();this.Canvas.translate(left,top);this.Canvas.rotate(90*Math.PI/180);var yText=0,xText=0;for(var i=0;i<outSize.AryText.length;++i){var item=outSize.AryText[i];if(item.Color)this.Canvas.fillStyle=item.Color;else this.Canvas.fillStyle=this.TextColor;if(item.Font)this.Canvas.font=item.Font;else this.Canvas.font=this.Font;yText+=item.Height;this.Canvas.fillText(item.Text,xText,yText+item.YOffset);}this.Canvas.restore();}else{var left=rtBG.Left+(rtBG.Width-outSize.Width)/2;if(outSize.Width>rtBG.Width)left=rtBG.Right-outSize.Width;var top=rtBG.Top+(rtBG.Height-outSize.Height)/2;var yText=top,xText=left;for(var i=0;i<outSize.AryText.length;++i){var item=outSize.AryText[i];if(item.Image){xText=left;if(item.Align===1){if(outSize.Width>item.Width)xText+=(outSize.Width-item.Width)/2;}this.Canvas.drawImage(item.Image.Data,xText,yText,item.Image.Width,item.Image.Height);yText+=item.Height;}else{if(item.Color)this.Canvas.fillStyle=item.Color;else this.Canvas.fillStyle=this.TextColor;if(item.Font)this.Canvas.font=item.Font;else this.Canvas.font=this.Font;yText+=item.Height;xText=left;if(item.Align===1){if(outSize.Width>item.Width)xText+=(outSize.Width-item.Width)/2;}this.Canvas.fillText(item.Text,xText,yText+item.YOffset);}}}};//x,y是否在上锁区域
|
|
5006
|
+
this.GetTooltipData=function(x,y,tooltip){if(!this.LockRect)return false;if(Path2DHelper.PtInRect(x,y,this.LockRect)){tooltip.Data={ID:this.LockID,Callback:this.Callback,IndexName:this.IndexName,IndexID:this.IndexID};tooltip.ChartPaint=this;return true;}return false;};}//买卖盘
|
|
5040
5007
|
function ChartBuySell(){this.newMethod=ChartSingleText;//派生
|
|
5041
5008
|
this.newMethod();delete this.newMethod;this.ClassName="ChartBuySell";this.TextFont=g_JSChartResource.KLineTrain.Font;//"bold 14px arial"; //买卖信息字体
|
|
5042
5009
|
this.LastDataIcon=g_JSChartResource.KLineTrain.LastDataIcon;//{Color:'rgb(0,0,205)',Text:'↓'};
|
|
@@ -6090,31 +6057,31 @@ this.BorderColor=g_JSChartResource.CorssCursorBorderColor;//边框颜色
|
|
|
6090
6057
|
this.XRangeBGColor=g_JSChartResource.CorssCursorXRangeBGColor;this.LineDash=g_JSChartResource.CorssCursorLineDash.slice();//虚线
|
|
6091
6058
|
this.RightButton.BGColor=g_JSChartResource.CorssCursor.RightButton.BGColor;this.RightButton.PenColor=g_JSChartResource.CorssCursor.RightButton.PenColor;this.RightButton.Icon=CloneData(g_JSChartResource.CorssCursor.RightButton.Icon);this.RightOverlayConfig=CloneData(g_JSChartResource.CorssCursor.RightOverlayText);this.CorssPointConfig.Center=CloneData(g_JSChartResource.CorssCursor.CorssPoint.Center);this.CorssPointConfig.Border=CloneData(g_JSChartResource.CorssCursor.CorssPoint.Border);};this.GetCloseYPoint=function(index){if(!this.StringFormatX.Data)return null;var data=this.StringFormatX.Data;if(!data.Data||data.Data.length<=0)return null;var dataIndex=data.DataOffset+index;if(dataIndex>=data.Data.length)dataIndex=data.Data.length-1;if(dataIndex<0)return null;var klineData=data.Data[dataIndex];if(!klineData)return null;this.Close=klineData.Close;var yPoint=this.Frame.GetYFromData(this.Close);return yPoint;};this.GetMinuteCloseYPoint=function(index){if(this.EnableNewIndex&&this.CorssCursorIndex){if(!this.StringFormatX||!this.StringFormatX.GetMinuteCloseYPoint)return null;var closeData=this.StringFormatX.GetMinuteCloseYPoint(this.CorssCursorIndex);if(!closeData)return null;this.Close=closeData.Price;return closeData.Y;}else{if(!IFrameSplitOperator.IsNumber(index))return null;index=parseInt(index.toFixed(0));//index=parseInt(index);
|
|
6092
6059
|
if(!this.StringFormatX.Data)return null;var data=this.StringFormatX.Data;if(!data.Data||data.Data.length<=0)return null;var dataIndex=data.DataOffset+index;if(dataIndex>=data.Data.length)dataIndex=data.Data.length-1;if(dataIndex<0)return null;var close=data.Data[dataIndex];if(!IFrameSplitOperator.IsNumber(index))return null;this.Close=close;var yPoint=this.Frame.GetYFromData(this.Close);return yPoint;}};this.GetDateTimeRange=function(index,option){if(!IFrameSplitOperator.IsNumber(index))return null;index=parseInt(index);var data=this.StringFormatX.Data;if(!data.Data||data.Data.length<=0)return null;var dataIndex=data.DataOffset+index;if(dataIndex>=data.Data.length||dataIndex<0)return null;if(!this.Frame||!this.Frame.SubFrame[0]||!this.Frame.SubFrame[0].Frame)return null;var frame=this.Frame.SubFrame[0].Frame;var dataWidth=frame.DataWidth;var distanceWidth=frame.DistanceWidth;var xPointCount=frame.XPointCount;var kItem=data.Data[dataIndex];if(!kItem)return null;var date=kItem.Date*1000000;var time=parseInt(kItem.Time/100)*100;var startTime=date+time;var endTime=date+time+59;var endIndex=dataIndex;for(var i=dataIndex;i<data.Data.length;++i){var item=data.Data[i];var dateTime=item.Date*1000000+item.Time;if(dateTime>endTime)break;if(i-data.DataOffset>=xPointCount)break;endIndex=i;}var startIndex=dataIndex;for(var i=dataIndex;i>=0&&i>=data.DataOffset;--i){var item=data.Data[i];var dateTime=item.Date*1000000+item.Time;if(dateTime<startTime)break;startIndex=i;}var range={StartIndex:startIndex,EndIndex:endIndex};range.XStart=this.Frame.GetXFromIndex(startIndex-data.DataOffset);range.XEnd=this.Frame.GetXFromIndex(endIndex-data.DataOffset);range.XStart-=(distanceWidth+dataWidth)/2;range.XEnd+=(distanceWidth+dataWidth)/2;return range;};this.FixMinuteLastTimeXPoint=function(index){if(!IFrameSplitOperator.IsNumber(index))return null;index=parseInt(index);if(!this.StringFormatX.Data)return null;var data=this.StringFormatX.Data;if(!data.Data||data.Data.length<=0)return null;var dataIndex=data.DataOffset+index;if(dataIndex<data.Data.length)return null;dataIndex=data.Data.length-1;dataIndex-=data.DataOffset;var xPoint=this.Frame.GetXFromIndex(dataIndex);return{X:xPoint,Index:dataIndex};};//返回 -1=不在客户区 1=在主区域 2=左边扩展 3=右边扩展
|
|
6093
|
-
this.PtInClient=function(x,y){this.Canvas.beginPath();if(this.Frame.IsHScreen===true){var border=this.Frame.ChartBorder.GetHScreenBorder();this.Canvas.rect(border.Left,border.TopEx,border.Right-border.Left,border.BottomEx-border.TopEx);}else{var border=this.Frame.ChartBorder.GetBorder();this.Canvas.rect(border.LeftEx,border.Top,border.RightEx-border.LeftEx,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 1;if(this.Frame.ChartBorder.LeftExtendWidth>10){this.Canvas.beginPath();if(this.Frame.IsHScreen===true){this.Canvas.rect(border.Left,border.Top,border.Right-border.Left,border.TopEx-border.Top);}else{this.Canvas.rect(border.Left,border.Top,border.LeftEx-border.Left,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 2;}if(this.Frame.ChartBorder.RightExtendWidth>10){this.Canvas.beginPath();if(this.Frame.IsHScreen===true){this.Canvas.rect(border.Left,border.BottomEx,border.Right-border.Left,border.Bottom-border.BottomEx);}else{this.Canvas.rect(border.RightEx,border.Top,border.Right-border.RightEx,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 3;}return-1;};this.GetFontHeight=function(font){return GetFontHeight(this.Canvas,font,"擎");};this.Draw=function(){this.Status=
|
|
6060
|
+
this.PtInClient=function(x,y){this.Canvas.beginPath();if(this.Frame.IsHScreen===true){var border=this.Frame.ChartBorder.GetHScreenBorder();this.Canvas.rect(border.Left,border.TopEx,border.Right-border.Left,border.BottomEx-border.TopEx);}else{var border=this.Frame.ChartBorder.GetBorder();this.Canvas.rect(border.LeftEx,border.Top,border.RightEx-border.LeftEx,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 1;if(this.Frame.ChartBorder.LeftExtendWidth>10){this.Canvas.beginPath();if(this.Frame.IsHScreen===true){this.Canvas.rect(border.Left,border.Top,border.Right-border.Left,border.TopEx-border.Top);}else{this.Canvas.rect(border.Left,border.Top,border.LeftEx-border.Left,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 2;}if(this.Frame.ChartBorder.RightExtendWidth>10){this.Canvas.beginPath();if(this.Frame.IsHScreen===true){this.Canvas.rect(border.Left,border.BottomEx,border.Right-border.Left,border.Bottom-border.BottomEx);}else{this.Canvas.rect(border.RightEx,border.Top,border.Right-border.RightEx,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 3;}return-1;};this.GetFontHeight=function(font){return GetFontHeight(this.Canvas,font,"擎");};this.Draw=function(){this.Status=JSCHART_CORSSCURSOR_STATUS_ID.NONE_ID;this.RightButton.Rect=null;this.BottomButton.Rect=null;this.LastValue=null;if(!this.LastPoint)return;if(!this.IsShow)return;this.Close=null;var x=this.LastPoint.X;var y=this.LastPoint.Y;var clientPos=this.PtInClient(x,y);this.PointY=null;this.PointY==null;this.ClientPos=clientPos;if(clientPos<=0)return;if(this.Frame.IsHScreen===true){this.HScreenDraw();return;}var border=this.Frame.ChartBorder.GetBorder();var left=border.Left;var right=border.Right;var top=border.TopTitle;var bottom=border.Bottom;var rightWidth=this.Frame.ChartBorder.Right;var chartRight=border.ChartWidth;if(this.IsOnlyDrawKLine)//手机端 十字只能画在K线上
|
|
6094
6061
|
{x=this.Frame.GetXFromIndex(this.CursorIndex);if(this.IsShowClose){var yPoint=this.GetCloseYPoint(this.CursorIndex);if(yPoint!=null)y=yPoint;}}else if(this.IsOnlyDrawMinute){var yPoint=this.GetMinuteCloseYPoint(this.CursorIndex);if(yPoint!=null)y=yPoint;}if(this.CallAcutionXOperator){this.CallAcutionXOperator.Value=x;this.CallAcutionXOperator.Point={X:x,Y:y};this.CallAcutionXOperator.ClientPos=clientPos;if(this.CallAcutionXOperator.Operator()){x=this.CallAcutionXOperator.X;}}if(this.IsFixXLastTime){var value=this.FixMinuteLastTimeXPoint(this.CursorIndex);if(value){x=value.X;this.CursorIndex=value.Index;}}this.PointY=[[left,y],[right,y]];this.PointX=[[x,top],[x,bottom]];//十字线
|
|
6095
6062
|
if(this.IsShowCorss){var rangeBG=null;if(this.IsDrawXRangeBG){rangeBG=this.GetDateTimeRange(this.CursorIndex);}var pixel=GetDevicePixelRatio();if(this.HPenType==1||this.HPenType==0)//0=虚线 1=实线
|
|
6096
6063
|
{this.Canvas.strokeStyle=this.HPenColor;if(this.HPenType==0)this.Canvas.setLineDash(this.LineDash);//虚线
|
|
6097
6064
|
//this.Canvas.lineWidth=0.5
|
|
6098
6065
|
this.Canvas.beginPath();this.Canvas.moveTo(left,ToFixedPoint(y));this.Canvas.lineTo(right,ToFixedPoint(y));this.Canvas.stroke();if(this.HPenType==0)this.Canvas.setLineDash([]);}this.Canvas.save();this.Canvas.strokeStyle=this.VPenColor;if(this.VPenType==0){this.Canvas.setLineDash(this.LineDash);//虚线
|
|
6099
6066
|
}else if(this.VPenType==2){var barWidth=this.Frame.SubFrame[0].Frame.DataWidth;//和K线一样宽度
|
|
6100
|
-
if(barWidth>2*pixel)this.Canvas.lineWidth=barWidth;}this.Canvas.beginPath();if(this.VLineType==1){if(rangeBG){this.Canvas.fillStyle=this.XRangeBGColor;this.Canvas.fillRect(rangeBG.XStart,border.Top,rangeBG.XEnd-rangeBG.XStart,border.Bottom-border.Top);}this.Canvas.moveTo(ToFixedPoint(x),border.Top);this.Canvas.lineTo(ToFixedPoint(x),border.Bottom);}else{if(this.Frame.SubFrame.length>0){for(var i in this.Frame.SubFrame){var frame=this.Frame.SubFrame[i].Frame;var subBorder=frame.ChartBorder.GetBorder();top=subBorder.TopTitle;bottom=subBorder.Bottom;if(rangeBG){this.Canvas.fillStyle=this.XRangeBGColor;this.Canvas.fillRect(rangeBG.XStart,top,rangeBG.XEnd-rangeBG.XStart,bottom-top);}this.Canvas.moveTo(ToFixedPoint(x),top);this.Canvas.lineTo(ToFixedPoint(x),bottom);}}else{this.Canvas.moveTo(ToFixedPoint(x),top);this.Canvas.lineTo(ToFixedPoint(x),bottom);}}this.Canvas.stroke();this.Canvas.restore();this.Canvas.save();this.DrawCorssPoint(x,y);this.Canvas.restore();}var xValue=this.Frame.GetXData(x);var yValueExtend={};var yValue=this.Frame.GetYData(y,yValueExtend);if((this.IsOnlyDrawMinute||this.IsShowClose)&&this.Close!=null)yValue=this.Close;this.LastValue={Y:{Value:yValue,Extend:yValueExtend}};//缓存十字光标对应的数值
|
|
6067
|
+
if(barWidth>2*pixel)this.Canvas.lineWidth=barWidth;}this.Canvas.beginPath();if(this.VLineType==1){if(rangeBG){this.Canvas.fillStyle=this.XRangeBGColor;this.Canvas.fillRect(rangeBG.XStart,border.Top,rangeBG.XEnd-rangeBG.XStart,border.Bottom-border.Top);}this.Canvas.moveTo(ToFixedPoint(x),border.Top);this.Canvas.lineTo(ToFixedPoint(x),border.Bottom);}else{if(this.Frame.SubFrame.length>0){for(var i in this.Frame.SubFrame){var frame=this.Frame.SubFrame[i].Frame;var subBorder=frame.ChartBorder.GetBorder();top=subBorder.TopTitle;bottom=subBorder.Bottom;if(rangeBG){this.Canvas.fillStyle=this.XRangeBGColor;this.Canvas.fillRect(rangeBG.XStart,top,rangeBG.XEnd-rangeBG.XStart,bottom-top);}this.Canvas.moveTo(ToFixedPoint(x),top);this.Canvas.lineTo(ToFixedPoint(x),bottom);}}else{this.Canvas.moveTo(ToFixedPoint(x),top);this.Canvas.lineTo(ToFixedPoint(x),bottom);}}this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LINE_ID;this.Canvas.stroke();this.Canvas.restore();this.Canvas.save();this.DrawCorssPoint(x,y);this.Canvas.restore();}var xValue=this.Frame.GetXData(x);var yValueExtend={};var yValue=this.Frame.GetYData(y,yValueExtend);if((this.IsOnlyDrawMinute||this.IsShowClose)&&this.Close!=null)yValue=this.Close;this.LastValue={Y:{Value:yValue,Extend:yValueExtend}};//缓存十字光标对应的数值
|
|
6101
6068
|
//this.StringFormatX.Value=xValue;
|
|
6102
6069
|
this.StringFormatX.Value=this.CursorIndex;this.StringFormatX.Point={X:x,Y:y};this.StringFormatX.ClientPos=clientPos;this.StringFormatY.Value=yValue;this.StringFormatY.RValue=yValueExtend.RightYValue;//右侧子坐标
|
|
6103
6070
|
this.StringFormatY.FrameID=yValueExtend.FrameID;this.StringFormatY.Point={X:x,Y:y};this.StringFormatY.ClientPos=clientPos;this.Canvas.font=this.Font;var textHeight=this.GetFontHeight();if(textHeight>this.TextHeight)this.TextHeight=textHeight;//Y轴
|
|
6104
6071
|
if((this.ShowTextMode.Left==1&&this.Frame.ChartBorder.Left>=30||this.ShowTextMode.Left==2||this.ShowTextMode.Right==1&&this.Frame.ChartBorder.Right>=30||this.ShowTextMode.Right==2)&&this.StringFormatY.Operator()){//计算右侧文本输出顶部位置
|
|
6105
6072
|
var _Temp_CalculateRightTextBGTop=function _Temp_CalculateRightTextBGTop(rtBG,complexText,defaultTextHeight){if(complexText.ShowType==1){var yValue=defaultTextHeight/2;if(IFrameSplitOperator.IsNonEmptyArray(textSize.Text)&&textSize.Text[0]){var itemSize=textSize.Text[0];if(IFrameSplitOperator.IsNumber(itemSize.Height))yValue=itemSize.Height/2;}rtBG.Top=rtBG.YCenter-yValue;rtBG.Bottom=rtBG.Top+rtBG.Height;}else{rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;}};var text=this.StringFormatY.Text;this.Canvas.font=this.Font;var textWidth=this.Canvas.measureText(text).width;//前后各空2个像素
|
|
6106
6073
|
var textSize={Width:textWidth+4,Height:this.TextHeight,Text:[]};var buttonData={Y:y,YValue:yValue,FrameID:yValueExtend.FrameID};var margin=this.LeftConfig.Margin;var textOffset=this.LeftConfig.TextOffset;var rtBG=null;if(this.Frame.ChartBorder.Left>=30&&this.ShowTextMode.Left==1)//左边
|
|
6107
|
-
{var rtBG={Right:left,Width:textWidth+margin.Left+margin.Right,YCenter:y,Height:textHeight+margin.Top+margin.Bottom};rtBG.Left=rtBG.Right-rtBG.Width;rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;if(rtBG.Left<0){rtBG.Left=0;rtBG.Right=rtBG.Left+rtBG.Width;}}else if(this.ShowTextMode.Left==2)//在框架内显示
|
|
6108
|
-
{var rtBG={Left:left,Width:textWidth+margin.Left+margin.Right,YCenter:y,Height:textHeight+margin.Top+margin.Bottom};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;}if(rtBG){this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y);}var complexText={ShowType:0,//0=单行(默认) 1=多行
|
|
6074
|
+
{var rtBG={Right:left,Width:textWidth+margin.Left+margin.Right,YCenter:y,Height:textHeight+margin.Top+margin.Bottom};rtBG.Left=rtBG.Right-rtBG.Width;rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;if(rtBG.Left<0){rtBG.Left=0;rtBG.Right=rtBG.Left+rtBG.Width;}this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LEFT_TEXT_ID;}else if(this.ShowTextMode.Left==2)//在框架内显示
|
|
6075
|
+
{var rtBG={Left:left,Width:textWidth+margin.Left+margin.Right,YCenter:y,Height:textHeight+margin.Top+margin.Bottom};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LEFT_INTER_TEXT_ID;}if(rtBG){this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y);}var complexText={ShowType:0,//0=单行(默认) 1=多行
|
|
6109
6076
|
Font:this.Font,Color:this.TextColor,Text:[{Text:text,Margin:this.RightConfig.Margin,TextOffset:this.RightConfig.TextOffset}]};var yTop=y-this.TextHeight/2;if(this.StringFormatY.PercentageText){if(this.TextFormat.Right==0){text=this.StringFormatY.PercentageText+'%';complexText.Text[0].Text=text;}}if(this.StringFormatY.RText){text=this.StringFormatY.RText;complexText.Text[0].Text=text;}if(this.StringFormatY.RComplexText&&IFrameSplitOperator.IsNonEmptyArray(this.StringFormatY.RComplexText.Text)){complexText=this.StringFormatY.RComplexText;if(!complexText.Font)complexText.Font=this.Font;if(!complexText.Color)complexText.Color=this.TextColor;}this.CalculateComplexTextSize(complexText,textSize);if(this.Frame.ChartBorder.Right>=30&&this.ShowTextMode.Right==1){var isOverlayIndex=false;//是否有叠加子坐标
|
|
6110
6077
|
var overlayIndexInterval=null;//子坐标间距
|
|
6111
6078
|
if(yValueExtend.FrameID>=0){var frame=this.Frame.SubFrame[yValueExtend.FrameID];isOverlayIndex=frame.OverlayIndex.length>0;overlayIndexInterval=null;if(isOverlayIndex){for(var i=0;i<=frame.OverlayIndex.length;++i){var item=frame.OverlayIndex[i];if(!item||!item.Frame)continue;if(item.Frame.IsShow===false)continue;if(!item.Frame.GetXHorizontal)continue;var overlayLeft=item.Frame.GetXHorizontal();overlayIndexInterval=overlayLeft-right;break;}}}//叠加坐标
|
|
6112
6079
|
if(isOverlayIndex&&textSize.Width>overlayIndexInterval&&overlayIndexInterval>0)//大于子坐标宽度
|
|
6113
|
-
{var rtBG={Right:right+overlayIndexInterval,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Left=rtBG.Right-rtBG.Width;_Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);if(rtBG.Right>chartRight){rtBG.Right=chartRight;rtBG.Left=rtBG.Right-rtBG.Width;}var drawRight=right+overlayIndexInterval;if(drawRight>chartRight)drawRight=chartRight;this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);}else{var rtBG={Left:right+1,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Right=rtBG.Left+rtBG.Width;_Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);if(rtBG.Right>chartRight){rtBG.Right=chartRight;rtBG.Left=rtBG.Right-rtBG.Width;}this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);}}else if(this.ShowTextMode.Right==2)//框架内侧显示
|
|
6114
|
-
{var rtBG={Right:right,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Left=rtBG.Right-rtBG.Width;_Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);this.Canvas.fillStyle=this.TextBGColor;this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);}}//X轴 Bottom==8 自定义
|
|
6080
|
+
{var rtBG={Right:right+overlayIndexInterval,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Left=rtBG.Right-rtBG.Width;_Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);if(rtBG.Right>chartRight){rtBG.Right=chartRight;rtBG.Left=rtBG.Right-rtBG.Width;}var drawRight=right+overlayIndexInterval;if(drawRight>chartRight)drawRight=chartRight;this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);}else{var rtBG={Left:right+1,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Right=rtBG.Left+rtBG.Width;_Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);if(rtBG.Right>chartRight){rtBG.Right=chartRight;rtBG.Left=rtBG.Right-rtBG.Width;}this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.RIGHT_TEXT_ID;}}else if(this.ShowTextMode.Right==2)//框架内侧显示
|
|
6081
|
+
{var rtBG={Right:right,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Left=rtBG.Right-rtBG.Width;_Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);this.Canvas.fillStyle=this.TextBGColor;this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.RIGHT_INTER_TEXT_ID;}}//X轴 Bottom==8 自定义
|
|
6115
6082
|
if((this.ShowTextMode.Bottom==1||this.ShowTextMode.Bottom==2||this.ShowTextMode.Bottom==8)&&this.StringFormatX.Operator()){var text=this.StringFormatX.Text;this.Canvas.font=this.Font;this.Canvas.fillStyle=this.TextBGColor;var textWidth=this.Canvas.measureText(text).width;//前后各空2个像素
|
|
6116
6083
|
var margin=this.BottomConfig.Margin;var textOffset=this.BottomConfig.TextOffset;var textAlign=this.BottomConfig.Align;var rtBG={Top:bottom,Height:margin.Top+margin.Bottom+textHeight,XCenter:x,Width:textWidth+margin.Left+margin.Right};rtBG.Bottom=rtBG.Top+rtBG.Height;if(textAlign==1)rtBG.Left=rtBG.XCenter-rtBG.Width/2;else rtBG.Left=rtBG.XCenter;rtBG.Right=rtBG.Left+rtBG.Width;if(rtBG.Left<=0){rtBG.Left=0;rtBG.Right=rtBG.Left+rtBG.Width;}else if(rtBG.Right>=right){rtBG.Right=right;rtBG.Left=rtBG.Right-rtBG.Width;}var bShowText=true;if(this.ShowTextMode.Bottom==2){rtBG.Bottom=bottom;rtBG.Top=rtBG.Bottom-rtBG.Height;}else if(this.ShowTextMode.Bottom==8){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_CORSSCURSOR_POSITION);if(event&&event.Callback){var sendData={RectText:rtBG,IsShowText:bShowText,X:x,Y:y};event.Callback(event,sendData,this);bShowText=sendData.IsShowText;}}//JSConsole.Chart.Log('[ChartCorssCursor::Draw] ',yCenter);
|
|
6117
|
-
if(bShowText){this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y,textWidth);var buttonData={X:x,Y:y,XValue:xValue,FrameID:yValueExtend.FrameID};if(this.StringFormatX.KItem)buttonData.KItem=this.StringFormatX.KItem;this.BottomButton.Rect=rtBG;this.BottomButton.Data=buttonData;}}//子坐标Y轴
|
|
6084
|
+
if(bShowText){this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y,textWidth);var buttonData={X:x,Y:y,XValue:xValue,FrameID:yValueExtend.FrameID};if(this.StringFormatX.KItem)buttonData.KItem=this.StringFormatX.KItem;this.BottomButton.Rect=rtBG;this.BottomButton.Data=buttonData;this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.BOTTOM_TEXT_ID;}}//子坐标Y轴
|
|
6118
6085
|
if(yValueExtend.FrameID>=0){var frame=this.Frame.SubFrame[yValueExtend.FrameID];var overlayLeft=right;this.Canvas.font=this.Font;for(var i=0;i<frame.OverlayIndex.length;++i){var item=frame.OverlayIndex[i];if(item.Frame.IsShow===false)continue;if(!item.Frame.GetXHorizontal)continue;overlayLeft=item.Frame.GetXHorizontal();//if (overlayLeft+30>chartRight) break;
|
|
6119
6086
|
var yValue=item.Frame.GetYData(y);var text=IFrameSplitOperator.FormatValueString(yValue,2);var textWidth=this.Canvas.measureText(text).width;//前后各空2个像素
|
|
6120
6087
|
var margin=this.RightOverlayConfig.Margin;var textOffset=this.RightOverlayConfig.TextOffset;var rtBG={Left:overlayLeft+1,Width:textWidth+margin.Left+margin.Right,YCenter:y,Height:textHeight+margin.Top+margin.Bottom};rtBG.Right=rtBG.Left-rtBG.Width;rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);/*
|
|
@@ -6124,7 +6091,7 @@ var margin=this.RightOverlayConfig.Margin;var textOffset=this.RightOverlayConfig
|
|
|
6124
6091
|
var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
|
|
6125
6092
|
if (textWidth<frame.Interval) break;
|
|
6126
6093
|
}
|
|
6127
|
-
*/this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y);}}
|
|
6094
|
+
*/this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y);}}};this.DrawComplexRightText=function(rtBG,complexText,size){this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var showType=0;if(complexText.ShowType==1)showType=complexText.ShowType;if(showType==1)//多行
|
|
6128
6095
|
{var xLeft=rtBG.Left;var yTop=rtBG.Top;//顶
|
|
6129
6096
|
for(var i=0;i<complexText.Text.length;++i){var item=complexText.Text[i];var itemSize=size.Text[i];if(item.Font)this.Canvas.font=item.Font;else this.Canvas.font=complexText.Font;if(item.Color)this.Canvas.fillStyle=item.Color;else this.Canvas.fillStyle=complexText.Color;var y=yTop+itemSize.Height;var x=xLeft;if(item.TextOffset){var textOffset=item.TextOffset;if(IFrameSplitOperator.IsNumber(textOffset.X))x+=textOffset.X;if(IFrameSplitOperator.IsNumber(textOffset.Y))y+=textOffset.Y;}this.Canvas.fillText(item.Text,x,y,itemSize.Width);yTop+=itemSize.Height;}}else//水平 单行
|
|
6130
6097
|
{var xText=rtBG.Left;var yBottom=rtBG.Bottom;for(var i=0;i<complexText.Text.length;++i){var item=complexText.Text[i];var itemSize=size.Text[i];if(item.Font)this.Canvas.font=item.Font;else this.Canvas.font=complexText.Font;if(item.Color)this.Canvas.fillStyle=item.Color;else this.Canvas.fillStyle=complexText.Color;var x=xText;var y=yBottom;if(item.TextOffset){var textOffset=item.TextOffset;if(IFrameSplitOperator.IsNumber(textOffset.X))x+=textOffset.X;if(IFrameSplitOperator.IsNumber(textOffset.Y))y+=textOffset.Y;}this.Canvas.fillText(item.Text,x,y,itemSize.Width);xText+=itemSize.Width;}}};this.CalculateComplexTextSize=function(complexText,size){if(!complexText||!IFrameSplitOperator.IsNonEmptyArray(complexText.Text))return;var showType=0;if(complexText.ShowType==1)showType=complexText.ShowType;if(showType==1)//多行
|
|
@@ -6138,28 +6105,28 @@ textWidth+=itemWidth;if(textHeight<itemHeight)textHeight=itemHeight;}size.Width=
|
|
|
6138
6105
|
this.Canvas.strokeStyle=this.RightButton.PenColor;var x=rtButtom.Left+spaceWidth;var y=rtButtom.Top+spaceWidth;this.Canvas.save();this.Canvas.linewidth=1*pixelRatio;this.Canvas.beginPath();this.Canvas.moveTo(ToFixedPoint(x),ToFixedPoint(yCenter));this.Canvas.lineTo(ToFixedPoint(x+rtButton.Width-spaceWidth*2),ToFixedPoint(yCenter));this.Canvas.moveTo(ToFixedPoint(xCenter),ToFixedPoint(y));this.Canvas.lineTo(ToFixedPoint(xCenter),ToFixedPoint(y+rtButton.Height-spaceWidth*2));this.Canvas.stroke();this.Canvas.restore();}};this.DrawRightButton=function(drawTop,drawRight,drawWidth,drawHeight,data){this.Canvas.fillStyle=this.RightButton.BGColor;var rtButton={Left:drawRight-drawWidth,Top:drawTop,Width:drawWidth,Height:drawHeight};rtButton.Right=rtButton.Left+rtButton.Width;rtButton.Bottom=rtButton.Top+rtButton.Height;this.RightButton.Rect=rtButton;this.RightButton.Data=data;this.Canvas.fillRect(ToFixedPoint(rtButton.Left+1),ToFixedPoint(rtButton.Top),ToFixedRect(rtButton.Width),ToFixedRect(rtButton.Height));var pixelRatio=GetDevicePixelRatio();var spaceWidth=3;var yCenter=rtButton.Top+spaceWidth+(rtButton.Height-spaceWidth*2)/2;var xCenter=rtButton.Left+spaceWidth+(rtButton.Width-spaceWidth*2)/2;if(this.RightButton.Icon){var icon=this.RightButton.Icon;this.Canvas.font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText('\uE6A3',xCenter,yCenter);}else{//画加号
|
|
6139
6106
|
this.Canvas.strokeStyle=this.RightButton.PenColor;var x=rtButtom.Left+spaceWidth;var y=rtButtom.Top+spaceWidth;this.Canvas.save();this.Canvas.linewidth=1*pixelRatio;this.Canvas.beginPath();this.Canvas.moveTo(ToFixedPoint(x),ToFixedPoint(yCenter));this.Canvas.lineTo(ToFixedPoint(x+rtButton.Width-spaceWidth*2),ToFixedPoint(yCenter));this.Canvas.moveTo(ToFixedPoint(xCenter),ToFixedPoint(y));this.Canvas.lineTo(ToFixedPoint(xCenter),ToFixedPoint(y+rtButton.Height-spaceWidth*2));this.Canvas.stroke();this.Canvas.restore();}};this.PtInButton=function(x,y){var item=this.PtInRightButton(x,y);if(item)return item;item=this.PtInButtomButton(x,y);if(item)return item;return null;};this.PtInRightButton=function(x,y){if(!this.RightButton.Enable)return null;if(!this.RightButton.Rect)return null;var rect=this.RightButton.Rect;if(x>=rect.Left&&x<=rect.Right&&y>=rect.Top&&y<=rect.Bottom){return{Data:this.RightButton.Data,Rect:rect,Type:1};//Type:1=右侧 2=底部
|
|
6140
6107
|
}return null;};this.PtInButtomButton=function(x,y){if(!this.BottomButton.Enable)return null;if(!this.BottomButton.Rect)return null;var rect=this.BottomButton.Rect;if(x>=rect.Left&&x<=rect.Right&&y>=rect.Top&&y<=rect.Bottom){return{Data:this.BottomButton.Data,Rect:rect,Type:2};//Type:1=右侧 2=底部
|
|
6141
|
-
}return null;};this.DrawTextBGRect=function(x,y,height,width){this.Canvas.fillStyle=this.TextBGColor;this.Canvas.fillRect(ToFixedPoint(x),ToFixedPoint(y),ToFixedRect(height),ToFixedRect(width));if(this.BorderColor){this.Canvas.strokeStyle=this.BorderColor;this.Canvas.strokeRect(ToFixedPoint(x),ToFixedPoint(y),ToFixedRect(height),ToFixedRect(width));}};this.HScreenDraw=function(){var x=this.LastPoint.X;var y=this.LastPoint.Y;if(this.IsOnlyDrawKLine)//手机端 十字只能画在K线上
|
|
6108
|
+
}return null;};this.DrawTextBGRect=function(x,y,height,width){this.Canvas.fillStyle=this.TextBGColor;this.Canvas.fillRect(ToFixedPoint(x),ToFixedPoint(y),ToFixedRect(height),ToFixedRect(width));if(this.BorderColor){this.Canvas.strokeStyle=this.BorderColor;this.Canvas.strokeRect(ToFixedPoint(x),ToFixedPoint(y),ToFixedRect(height),ToFixedRect(width));}};this.HScreenDraw=function(){this.Status=JSCHART_CORSSCURSOR_STATUS_ID.NONE_ID;var x=this.LastPoint.X;var y=this.LastPoint.Y;if(this.IsOnlyDrawKLine)//手机端 十字只能画在K线上
|
|
6142
6109
|
{y=this.Frame.GetXFromIndex(this.CursorIndex);if(this.IsShowClose){var yPoint=this.GetCloseYPoint(this.CursorIndex);if(yPoint!=null)x=yPoint;}}else if(this.IsOnlyDrawMinute){var yPoint=this.GetMinuteCloseYPoint(this.CursorIndex);if(yPoint!=null)x=yPoint;}var border=this.Frame.ChartBorder.GetHScreenBorder();var left=border.Left;var right=border.Right;var top=border.Top;var bottom=border.Bottom;var bottomWidth=this.Frame.ChartBorder.Bottom;if(this.CallAcutionXOperator){this.CallAcutionXOperator.Value=y;this.CallAcutionXOperator.Point={X:x,Y:y};this.CallAcutionXOperator.ClientPos=this.ClientPos;if(this.CallAcutionXOperator.Operator()){y=this.CallAcutionXOperator.X;}}this.PointY=[[left,y],[right,y]];this.PointX=[[x,top],[x,bottom]];//十字线
|
|
6143
6110
|
if(this.IsShowCorss){var pixel=GetDevicePixelRatio();this.Canvas.save();this.Canvas.strokeStyle=this.HPenColor;if(this.HPenType==0)this.Canvas.setLineDash(this.LineDash);//虚线
|
|
6144
6111
|
//画竖线
|
|
6145
6112
|
this.Canvas.beginPath();this.Canvas.moveTo(ToFixedPoint(x),top);this.Canvas.lineTo(ToFixedPoint(x),bottom);this.Canvas.stroke();this.Canvas.restore();//画横线
|
|
6146
6113
|
this.Canvas.save();this.Canvas.strokeStyle=this.VPenColor;if(this.VPenType==0){this.Canvas.setLineDash(this.LineDash);//虚线
|
|
6147
6114
|
}else if(this.VPenType==2){var barWidth=this.Frame.SubFrame[0].Frame.DataWidth;//和K线一样宽度
|
|
6148
|
-
if(barWidth>2*pixel)this.Canvas.lineWidth=barWidth;}this.Canvas.beginPath();if(this.VLineType==1){this.Canvas.moveTo(left,ToFixedPoint(y));this.Canvas.lineTo(right,ToFixedPoint(y));}else{if(this.Frame.SubFrame.length>0){for(var i in this.Frame.SubFrame){var frame=this.Frame.SubFrame[i].Frame;var subBorder=frame.ChartBorder.GetHScreenBorder();this.Canvas.moveTo(subBorder.Left,ToFixedPoint(y));this.Canvas.lineTo(subBorder.RightEx,ToFixedPoint(y));}}else{this.Canvas.moveTo(left,ToFixedPoint(y));this.Canvas.lineTo(right,ToFixedPoint(y));}}this.Canvas.stroke();this.Canvas.restore();this.Canvas.save();this.DrawCorssPoint(x,y);this.Canvas.restore();}var xValue=this.Frame.GetXData(y);var yValueExtend={};var yValue=this.Frame.GetYData(x,yValueExtend);this.StringFormatX.Value=xValue;this.StringFormatX.Point={X:x,Y:y};this.StringFormatX.ClientPos=this.ClientPos;this.StringFormatY.Value=yValue;this.StringFormatY.FrameID=yValueExtend.FrameID;this.StringFormatY.RValue=yValueExtend.RightYValue;//右侧子坐标
|
|
6115
|
+
if(barWidth>2*pixel)this.Canvas.lineWidth=barWidth;}this.Canvas.beginPath();if(this.VLineType==1){this.Canvas.moveTo(left,ToFixedPoint(y));this.Canvas.lineTo(right,ToFixedPoint(y));}else{if(this.Frame.SubFrame.length>0){for(var i in this.Frame.SubFrame){var frame=this.Frame.SubFrame[i].Frame;var subBorder=frame.ChartBorder.GetHScreenBorder();this.Canvas.moveTo(subBorder.Left,ToFixedPoint(y));this.Canvas.lineTo(subBorder.RightEx,ToFixedPoint(y));}}else{this.Canvas.moveTo(left,ToFixedPoint(y));this.Canvas.lineTo(right,ToFixedPoint(y));}}this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LINE_ID;this.Canvas.stroke();this.Canvas.restore();this.Canvas.save();this.DrawCorssPoint(x,y);this.Canvas.restore();}var xValue=this.Frame.GetXData(y);var yValueExtend={};var yValue=this.Frame.GetYData(x,yValueExtend);this.StringFormatX.Value=xValue;this.StringFormatX.Point={X:x,Y:y};this.StringFormatX.ClientPos=this.ClientPos;this.StringFormatY.Value=yValue;this.StringFormatY.FrameID=yValueExtend.FrameID;this.StringFormatY.RValue=yValueExtend.RightYValue;//右侧子坐标
|
|
6149
6116
|
this.StringFormatY.Point={X:x,Y:y};this.StringFormatY.ClientPos=this.ClientPos;this.Canvas.font=this.Font;var textHeight=this.GetFontHeight();if(textHeight>this.TextHeight)this.TextHeight=textHeight;if((this.ShowTextMode.Left==1&&this.Frame.ChartBorder.Top>=30||this.ShowTextMode.Left==2||this.ShowTextMode.Right==1&&this.Frame.ChartBorder.Bottom>=30||this.ShowTextMode.Right==2)&&this.StringFormatY.Operator()){var text=this.StringFormatY.Text;this.Canvas.font=this.Font;var textWidth=this.Canvas.measureText(text).width+4;//前后各空2个像素
|
|
6150
6117
|
if(this.Frame.ChartBorder.Top>=30&&this.ShowTextMode.Left==1){var xText=x;var yText=top;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);//数据和框子旋转180度
|
|
6151
|
-
this.Canvas.fillStyle=this.TextBGColor;if(top>=textWidth){this.Canvas.fillRect(0,-(this.TextHeight/2),-textWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,-2,0,textWidth);}else{this.Canvas.fillRect(textWidth-top,-(this.TextHeight/2),-textWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,textWidth-top-2,0,textWidth);}this.Canvas.restore();}else if(this.ShowTextMode.Left==2){var xText=x;var yText=top;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);//数据和框子旋转180度
|
|
6152
|
-
this.Canvas.fillStyle=this.TextBGColor;this.Canvas.fillRect(0,-(this.TextHeight/2),textWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,2,0,textWidth);this.Canvas.restore();}if(this.StringFormatY.RText){text=this.StringFormatY.RText;var textWidth=this.Canvas.measureText(text).width+4;//前后各空2个像素
|
|
6118
|
+
this.Canvas.fillStyle=this.TextBGColor;if(top>=textWidth){this.Canvas.fillRect(0,-(this.TextHeight/2),-textWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,-2,0,textWidth);}else{this.Canvas.fillRect(textWidth-top,-(this.TextHeight/2),-textWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,textWidth-top-2,0,textWidth);}this.Canvas.restore();this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LEFT_TEXT_ID;}else if(this.ShowTextMode.Left==2){var xText=x;var yText=top;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);//数据和框子旋转180度
|
|
6119
|
+
this.Canvas.fillStyle=this.TextBGColor;this.Canvas.fillRect(0,-(this.TextHeight/2),textWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,2,0,textWidth);this.Canvas.restore();this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LEFT_INTER_TEXT_ID;}if(this.StringFormatY.RText){text=this.StringFormatY.RText;var textWidth=this.Canvas.measureText(text).width+4;//前后各空2个像素
|
|
6153
6120
|
}if(this.Frame.ChartBorder.Bottom>=30&&this.ShowTextMode.Right==1){var xText=x;var yText=bottom;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);//数据和框子旋转180度
|
|
6154
6121
|
this.Canvas.fillStyle=this.TextBGColor;if(bottomWidth>textWidth){this.Canvas.fillRect(0,-(this.TextHeight/2),textWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,2,0,textWidth);}else{this.Canvas.fillRect(bottomWidth-textWidth,-(this.TextHeight/2),textWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,bottomWidth-textWidth+2,0,textWidth);}if(this.StringFormatY.RExtendText&&this.StringFormatY.RExtendText.length>0){var yOffset=0;for(var i in this.StringFormatY.RExtendText){var item=this.StringFormatY.RExtendText[i];var rText='--.--';if(item.YText)rText=item.YText;else if(IFrameSplitOperator.IsNumber(item.Y))rText=item.Y.toFixed(0);var rTextWidth=this.Canvas.measureText(rText).width+4;//前后各空2个像素
|
|
6155
|
-
this.Canvas.fillStyle=item.TextBGColor;if(bottomWidth>rTextWidth){this.Canvas.fillRect(0,yOffset+this.TextHeight/2,rTextWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(rText,2,yOffset+this.TextHeight,rTextWidth);}else{var rTextLeft=bottomWidth-rTextWidth;this.Canvas.fillRect(rTextLeft,yOffset+this.TextHeight/2,rTextWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(rText,rTextLeft+2,yOffset+this.TextHeight,rTextWidth);}yOffset+=this.TextHeight;}}this.Canvas.restore();}else if(this.ShowTextMode.Right==2){var xText=x;var yText=bottom;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);//数据和框子旋转180度
|
|
6156
|
-
this.Canvas.fillStyle=this.TextBGColor;this.Canvas.fillRect(0,-(this.TextHeight/2),-textWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,-2,0,textWidth);this.Canvas.restore();}}//X轴 Bottom=8 自定义X轴文字位置
|
|
6122
|
+
this.Canvas.fillStyle=item.TextBGColor;if(bottomWidth>rTextWidth){this.Canvas.fillRect(0,yOffset+this.TextHeight/2,rTextWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(rText,2,yOffset+this.TextHeight,rTextWidth);}else{var rTextLeft=bottomWidth-rTextWidth;this.Canvas.fillRect(rTextLeft,yOffset+this.TextHeight/2,rTextWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(rText,rTextLeft+2,yOffset+this.TextHeight,rTextWidth);}yOffset+=this.TextHeight;}}this.Canvas.restore();this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.RIGHT_TEXT_ID;}else if(this.ShowTextMode.Right==2){var xText=x;var yText=bottom;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);//数据和框子旋转180度
|
|
6123
|
+
this.Canvas.fillStyle=this.TextBGColor;this.Canvas.fillRect(0,-(this.TextHeight/2),-textWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,-2,0,textWidth);this.Canvas.restore();this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.RIGHT_INTER_TEXT_ID;}}//X轴 Bottom=8 自定义X轴文字位置
|
|
6157
6124
|
if((this.ShowTextMode.Bottom===1||this.ShowTextMode.Bottom==8)&&this.StringFormatX.Operator()){var text=this.StringFormatX.Text;this.Canvas.font=this.Font;this.Canvas.fillStyle=this.TextBGColor;var textWidth=this.Canvas.measureText(text).width+4;//前后各空2个像素
|
|
6158
6125
|
var xText=left;var bShowText=true;if(this.ShowTextMode.Bottom==8){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_CORSSCURSOR_POSITION);if(event&&event.Callback){var sendData={XText:xText,Height:this.TextHeight,IsShowText:bShowText};event.Callback(event,sendData,this);xText=sendData.XText;bShowText=sendData.IsShowText;}}if(bShowText){if(y-textWidth/2<3)//左边位置不够了, 顶着左边画
|
|
6159
6126
|
{var yText=y;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);//数据和框子旋转180度
|
|
6160
6127
|
this.Canvas.fillRect(0,0,textWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,2,this.TextHeight/2,textWidth);this.Canvas.restore();}else if(y+textWidth/2>=bottom){var yText=y;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);//数据和框子旋转180度
|
|
6161
6128
|
this.Canvas.fillRect(-textWidth,0,textWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,-2,this.TextHeight/2,textWidth);this.Canvas.restore();}else{var yText=y;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);//数据和框子旋转180度
|
|
6162
|
-
this.Canvas.fillRect(-textWidth/2,0,textWidth,this.TextHeight);this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,0,this.TextHeight/2,textWidth);this.Canvas.restore();}
|
|
6129
|
+
this.Canvas.fillRect(-textWidth/2,0,textWidth,this.TextHeight);this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,0,this.TextHeight/2,textWidth);this.Canvas.restore();}this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.BOTTOM_TEXT_ID;}}};//data={ e:e, PreventDefault:false, KeyID, Draw:是否需要重绘 }
|
|
6163
6130
|
this.OnKeyDown=function(data){if(!this.EnableKeyboard)return;var keyID=data.KeyID;if(keyID==27)//ESC 隐藏十字线
|
|
6164
6131
|
{if(!this.IsShowCorss)return;this.IsShowCorss=false;data.Draw=true;if(this.OnChangeStatusCallback)this.OnChangeStatusCallback({Type:1,IsShowCorss:this.IsShowCorss},this);}else if(keyID==37||keyID==39)//left, right 显示十字线
|
|
6165
6132
|
{if(this.IsShowCorss)return;this.IsShowCorss=true;data.Draw=true;if(this.OnChangeStatusCallback)this.OnChangeStatusCallback({Type:1,IsShowCorss:this.IsShowCorss},this);}};this.OnDBClick=function(data){if(!this.EnableDBClick)return;if(!IFrameSplitOperator.IsNonEmptyArray(this.Frame.SubFrame))return;//在主图框架内
|
|
@@ -8517,7 +8484,7 @@ chart=new FrameSplitPaint();chart.Canvas=this.Canvas;chart.ChartBorder=this.Fram
|
|
|
8517
8484
|
if(this.ClickModel.IsShowCorssCursor==true&&this.TouchDrawCount>0)bShowCorssCursor=true;if(bShowCorssCursor){this.DelayAutoCloseCorssCursor();//自动延迟关闭十字光标
|
|
8518
8485
|
return;}this.ClickModel.IsShowCorssCursor=false;this.DrawDynamicInfo();return;}if(this.CorssCursorTouchEnd===true)//手势离开十字光标消失
|
|
8519
8486
|
{if(this.TouchDrawCount>0)this.DrawDynamicInfo();return;}for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.ClassName==='KLineTooltipPaint'){this.DrawDynamicInfo();}}};//锁|解锁指标 { Index:指标名字,IsLocked:是否要锁上,Callback:回调 }
|
|
8520
|
-
this.LockIndex=function(lockData){if(!lockData)return;if(!lockData.IndexName)return;for(var _i12 in this.WindowIndex){var _item4=this.WindowIndex[_i12];if(!_item4)conintue;if(_item4.Name==lockData.IndexName){_item4.SetLock(lockData);this.Update();break;}}};this.TryClickLock=function(x,y){for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i];if(!item.Frame.IsLocked)continue;if(!item.Frame.LockPaint)continue;var tooltip=new TooltipData();if(!item.Frame.LockPaint.GetTooltipData(x,y,tooltip))continue;tooltip.HQChart=this;if(tooltip.Data.Callback)tooltip.Data.Callback(tooltip);return true;}return false;};this.TryClickIndexTitle=function(x,y){for(var i in this.TitlePaint){var item=this.TitlePaint[i];if(!item.IsClickTitle)continue;if(!item.IsClickTitle(x,y))continue;var data={Point:{X:x,Y:y},Title:item.Title,FrameID:item.Frame.Identify};JSConsole.Chart.Log('[KLineChartContainer::TryClickIndexTitle] click title ',data);var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEXTITLE);if(event&&event.Callback)event.Callback(event,data,this);return true;}return false;};this.SetSizeChange=function(bChanged){this.Frame.SetSizeChage(bChanged);for(var i in this.ExtendChartPaint){var item=this.ExtendChartPaint[i];item.SizeChange=bChanged;}};this.SetSizeChage=this.SetSizeChange;//单词拼错了, 还没替换完
|
|
8487
|
+
this.LockIndex=function(lockData){if(!lockData)return;if(!lockData.IndexName)return;for(var _i12 in this.WindowIndex){var _item4=this.WindowIndex[_i12];if(!_item4)conintue;if(_item4.Name==lockData.IndexName){_item4.SetLock(lockData);this.Update();break;}}};this.TryClickLock=function(x,y){for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i];if(!item.Frame.IsLocked)continue;if(!item.Frame.LockPaint)continue;var tooltip=new TooltipData();if(!item.Frame.LockPaint.GetTooltipData(x,y,tooltip))continue;tooltip.HQChart=this;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEX_LOCK);if(event&&event.Callback){var sendData={FrameID:item.Frame.Identify,Data:tooltip};event.Callback(event,sendData,this);}if(tooltip.Data.Callback)tooltip.Data.Callback(tooltip);return true;}return false;};this.TryClickIndexTitle=function(x,y){for(var i in this.TitlePaint){var item=this.TitlePaint[i];if(!item.IsClickTitle)continue;if(!item.IsClickTitle(x,y))continue;var data={Point:{X:x,Y:y},Title:item.Title,FrameID:item.Frame.Identify};JSConsole.Chart.Log('[KLineChartContainer::TryClickIndexTitle] click title ',data);var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEXTITLE);if(event&&event.Callback)event.Callback(event,data,this);return true;}return false;};this.SetSizeChange=function(bChanged){this.Frame.SetSizeChage(bChanged);for(var i in this.ExtendChartPaint){var item=this.ExtendChartPaint[i];item.SizeChange=bChanged;}};this.SetSizeChage=this.SetSizeChange;//单词拼错了, 还没替换完
|
|
8521
8488
|
this.Update=function(option)//option: { UpdateCursorIndexType:更新十字光标方式 }
|
|
8522
8489
|
{if(!this.SourceData)return;if(this.BeforeBindMainData)this.BeforeBindMainData('Update');var bindData=new ChartData();bindData.Data=this.SourceData.Data;bindData.Period=this.Period;bindData.Right=this.Right;bindData.DataType=this.SourceData.DataType;bindData.Symbol=this.Symbol;if(bindData.Right>0&&ChartData.IsDayPeriod(bindData.Period,true))//复权(日线数据复权)
|
|
8523
8490
|
{var rightData=bindData.GetRightData(bindData.Right,{AlgorithmType:this.RightFormula});bindData.Data=rightData;}else if(bindData.Right>0&&ChartData.IsMinutePeriod(bindData.Period,true)&&this.RightFormula>=1)//复权(分钟数据复权, 复权因子模式)
|
|
@@ -9948,37 +9915,96 @@ function IsIndexSymbol(symbol){var upperSymbol=symbol.toUpperCase();if(upperSymb
|
|
|
9948
9915
|
//是否是基金代码
|
|
9949
9916
|
function IsFundSymbol(symbol){if(!symbol)return false;var upperSymbol=symbol.toUpperCase();if(upperSymbol.indexOf('.SH')>0){upperSymbol=upperSymbol.replace('.SH','');//51XXXX.sh
|
|
9950
9917
|
if(upperSymbol.charAt(0)=='5'&&upperSymbol.charAt(1)=='1')return true;}else if(upperSymbol.indexOf('.SZ')>0){upperSymbol=upperSymbol.replace('.SZ','');//15XXXX.sz, 16XXXX.sz, 17XXXX.sz, 18XXXX.sz
|
|
9951
|
-
if(upperSymbol.charAt(0)=='1'&&(upperSymbol.charAt(1)=='5'||upperSymbol.charAt(1)=='6'||upperSymbol.charAt(1)=='7'||upperSymbol.charAt(1)=='8'))return true;}return false;}
|
|
9952
|
-
function
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
this.
|
|
9956
|
-
this.
|
|
9957
|
-
|
|
9958
|
-
this.
|
|
9959
|
-
this.
|
|
9960
|
-
|
|
9961
|
-
this.
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
function
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
var
|
|
9974
|
-
var
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9918
|
+
if(upperSymbol.charAt(0)=='1'&&(upperSymbol.charAt(1)=='5'||upperSymbol.charAt(1)=='6'||upperSymbol.charAt(1)=='7'||upperSymbol.charAt(1)=='8'))return true;}return false;}/*
|
|
9919
|
+
function ChartPictureVolProfileSettingMenu(divElement)
|
|
9920
|
+
{
|
|
9921
|
+
this.newMethod=IDivDialog; //派生
|
|
9922
|
+
this.newMethod(divElement);
|
|
9923
|
+
delete this.newMethod;
|
|
9924
|
+
|
|
9925
|
+
this.ChartPicture;
|
|
9926
|
+
this.SettingDiv;
|
|
9927
|
+
this.Position;
|
|
9928
|
+
this.ID=Guid();
|
|
9929
|
+
|
|
9930
|
+
this.Close=function()
|
|
9931
|
+
{
|
|
9932
|
+
if (this.SettingDiv) this.DivElement.removeChild(this.SettingDiv); //直接删除
|
|
9933
|
+
}
|
|
9934
|
+
|
|
9935
|
+
this.DoModal=function()
|
|
9936
|
+
{
|
|
9937
|
+
var valueAreaVol=this.ChartPicture.VAVol; //Value area volume
|
|
9938
|
+
var barPosition=this.ChartPicture.BarPosition;
|
|
9939
|
+
|
|
9940
|
+
var self=this;
|
|
9941
|
+
var div=document.getElementById(this.ID);
|
|
9942
|
+
if (!div)
|
|
9943
|
+
{
|
|
9944
|
+
div=document.createElement("div");
|
|
9945
|
+
div.className='jchart-modifyindex-box';
|
|
9946
|
+
div.id=this.ID;
|
|
9947
|
+
this.DivElement.appendChild(div);
|
|
9948
|
+
this.SettingDiv=div;
|
|
9949
|
+
}
|
|
9950
|
+
else
|
|
9951
|
+
{
|
|
9952
|
+
this.SettingDiv=div;
|
|
9953
|
+
}
|
|
9954
|
+
|
|
9955
|
+
div.innerHTML=
|
|
9956
|
+
`<div class='parameter'>\
|
|
9957
|
+
<div class='parameter-header'>\
|
|
9958
|
+
<span>固定范围成交量分布设置</span>\
|
|
9959
|
+
<strong id='close' class='icon iconfont icon-close'></strong>\
|
|
9960
|
+
</div>\
|
|
9961
|
+
<div class='parameter-content'>
|
|
9962
|
+
<input class='row-line' value=${valueAreaVol} />VAVol <br>
|
|
9963
|
+
<input class='row-line' value=${barPosition} />BarPosition
|
|
9964
|
+
</div>\
|
|
9965
|
+
<div class='parameter-footer'>\
|
|
9966
|
+
<button class='submit' >确定</button>\
|
|
9967
|
+
<button class='cancel' >取消</button>\
|
|
9968
|
+
</div>\
|
|
9969
|
+
</div>`;
|
|
9970
|
+
|
|
9971
|
+
var pixelTatio = GetDevicePixelRatio();
|
|
9972
|
+
var frame=this.HQChart.Frame.SubFrame[0].Frame;
|
|
9973
|
+
var top=frame.ChartBorder.Top + 40;
|
|
9974
|
+
var right=frame.ChartBorder.Right;
|
|
9975
|
+
var left=frame.ChartBorder.GetLeft();
|
|
9976
|
+
|
|
9977
|
+
this.SettingDiv.style.right = right/pixelTatio + "px";
|
|
9978
|
+
this.SettingDiv.style.top = top/pixelTatio + "px";
|
|
9979
|
+
this.SettingDiv.style.position = "absolute";
|
|
9980
|
+
this.SettingDiv.style.display = "block";
|
|
9981
|
+
|
|
9982
|
+
var btnCancel=div.getElementsByClassName("cancel")[0];
|
|
9983
|
+
btnCancel.onclick=function()
|
|
9984
|
+
{
|
|
9985
|
+
self.Close();
|
|
9986
|
+
}
|
|
9987
|
+
|
|
9988
|
+
var btnClose=div.getElementsByClassName("icon iconfont icon-close")[0];
|
|
9989
|
+
btnClose.onclick=function()
|
|
9990
|
+
{
|
|
9991
|
+
self.Close();
|
|
9992
|
+
}
|
|
9993
|
+
|
|
9994
|
+
var btnSubmit=div.getElementsByClassName("submit")[0];
|
|
9995
|
+
btnSubmit.onclick=function()
|
|
9996
|
+
{
|
|
9997
|
+
var value=div.getElementsByClassName("row-line")[0].value;
|
|
9998
|
+
self.ChartPicture.VAVol=parseFloat(value);
|
|
9999
|
+
var value=parseInt(div.getElementsByClassName("row-line")[1].value);
|
|
10000
|
+
self.ChartPicture.BarPosition=value>0?1:0;
|
|
10001
|
+
|
|
10002
|
+
self.ChartPicture.RequestVolumeProfileData();
|
|
10003
|
+
self.Close();
|
|
10004
|
+
}
|
|
10005
|
+
}
|
|
10006
|
+
}
|
|
10007
|
+
*////////////////////////////////////////////////////////////////////////////////////////
|
|
9982
10008
|
//
|
|
9983
10009
|
// 各个品种分钟走势图坐标信息
|
|
9984
10010
|
//
|
|
@@ -15068,7 +15094,7 @@ data.Tooltip.style.display="inline";};this.OnLeaveButton=function(e,data){data.T
|
|
|
15068
15094
|
this.HQChart.Draw();};this.ModifyFontColor=function(){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.ClassName=="ChartDrawNote"){var color=this.GetRandomColor(this.ChartPicture.NoteTextColor,this.RandomFontColor);this.ChartPicture.NoteTextColor=color;}else{var color=this.GetRandomColor(this.ChartPicture.TextColor,this.RandomFontColor);this.ChartPicture.TextColor=color;}if(this.FontColorButton)this.FontColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
15069
15095
|
this.HQChart.Draw();};this.ModifyBGColor=function(){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.ClassName=="ChartDrawNote"){var color=this.GetRandomColor(this.ChartPicture.NoteBGColor,this.RandomBGColor);this.ChartPicture.NoteBGColor=color;}else{var color=this.GetRandomColor(this.ChartPicture.BGColor,this.RandomBGColor);this.ChartPicture.BGColor=color;}if(this.BGColorButton)this.BGColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
15070
15096
|
this.HQChart.Draw();};this.ModifyLockChart=function(){if(!this.ChartPicture||!this.HQChart)return;this.ChartPicture.EnableMove=!this.ChartPicture.EnableMove;if(this.LockButton)this.LockButton.Span.style['color']=this.ChartPicture.EnableMove?"rgb(220,220,220)":"rgb(0,0,0)";};this.ModifyBorderColor=function(){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.ClassName=="ChartDrawNote"){var color=this.GetRandomColor(this.ChartPicture.NoteBorderColor,this.RandomBorderColor);this.ChartPicture.NoteBorderColor=color;}else{var color=this.GetRandomColor(this.ChartPicture.BorderColor,this.RandomBorderColor);this.ChartPicture.BorderColor=color;}if(this.BorderColorButton)this.BorderColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
15071
|
-
this.HQChart.Draw();};this.ModifyFontZoom=function(step){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.FontOption.Size+step<=2)return;var chart=this.ChartPicture;chart.FontOption.Size+=step;if(chart.ClassName=="ChartDrawNote")chart.NoteFontOption.Size+=step;this.HQChart.Draw();};this.ModifyText=function(){if(!this.ChartPicture||!this.HQChart)return;var chart=this.ChartPicture;switch(chart.ClassName){case"ChartDrawPictureText":chart.Text=this.GetRandomText(chart.Text);break;case"ChartDrawAnchoredText":var text=null;if(IFrameSplitOperator.IsNonEmptyArray(chart.AryText))text=chart.AryText[0].Text;chart.AryText=[{Text:this.GetRandomText(text)},{Text:this.GetRandomText(null)}];break;case"ChartDrawNote":var text=null;if(IFrameSplitOperator.IsNonEmptyArray(chart.AryNoteText))text=chart.AryNoteText[0].Text;chart.AryNoteText=[{Text:this.GetRandomText(text)},{Text:this.GetRandomText(null)}];break;default:return;}this.HQChart.Draw();};this.GetRandomText=function(text){var ARY_TEXT=["下跌形态","反转十字星","低位档五阳线","倒V型反转","双顶","持续整理形态"];var index=this.GetRandomTestData(0,ARY_TEXT.length-1);for(var i=index;i<10;++i){var value=ARY_TEXT[i%ARY_TEXT.length];if(value!=text)return value;}};this.GetRandomTestData=function(min,max)//测试数据
|
|
15097
|
+
this.HQChart.Draw();};this.ModifyFontZoom=function(step){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.FontOption.Size+step<=2)return;var chart=this.ChartPicture;chart.FontOption.Size+=step;if(chart.ClassName=="ChartDrawNote")chart.NoteFontOption.Size+=step;this.HQChart.Draw();};this.ModifyText=function(){if(!this.ChartPicture||!this.HQChart)return;var chart=this.ChartPicture;switch(chart.ClassName){case"ChartDrawPictureText":chart.Text=this.GetRandomText(chart.Text);break;case"ChartDrawAnchoredText":var text=null;if(IFrameSplitOperator.IsNonEmptyArray(chart.AryText))text=chart.AryText[0].Text;chart.AryText=[{Text:this.GetRandomText(text)},{Text:this.GetRandomText(null)}];break;case"ChartDrawNote":var text=null;if(IFrameSplitOperator.IsNonEmptyArray(chart.AryNoteText))text=chart.AryNoteText[0].Text;chart.AryNoteText=[{Text:this.GetRandomText(text)},{Text:this.GetRandomText(null)}];break;default:return;}this.HQChart.Draw();};this.AdvancedSetting=function(){};this.GetRandomText=function(text){var ARY_TEXT=["下跌形态","反转十字星","低位档五阳线","倒V型反转","双顶","持续整理形态"];var index=this.GetRandomTestData(0,ARY_TEXT.length-1);for(var i=index;i<10;++i){var value=ARY_TEXT[i%ARY_TEXT.length];if(value!=text)return value;}};this.GetRandomTestData=function(min,max)//测试数据
|
|
15072
15098
|
{min=Math.ceil(min);max=Math.floor(max);return Math.floor(Math.random()*(max-min+1))+min;//含最大值,含最小值
|
|
15073
15099
|
};this.Show=function(x,y){if(!this.DivDialog)this.Create();this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.SetChartPicture=function(chart){this.ChartPicture=chart;var bShowLineColor=true,bShowBGColor=false,bShowFontColor=false,bShowBorderColor=false,bShowFontZoom=false,bModifyText=false,bAdvanced=false;;var bgColor=null,fontColor=null,borderColor=null;var ARRAY_TEXT_CHART=['ChartDrawPriceLabel',"ChartDrawAnchoredText","ChartDrawPriceNote"];if(ARRAY_TEXT_CHART.includes(chart.ClassName)){bShowBGColor=true;bShowFontColor=true;bShowBorderColor=true;bShowFontZoom=true;if(chart.ClassName=="ChartDrawAnchoredText")bModifyText=true;bgColor=chart.BGColor;fontColor=chart.TextColor;borderColor=chart.BorderColor;}else if(chart.ClassName=="ChartDrawPictureText"){bModifyText=true;bShowFontZoom=true;bShowLineColor=true;}else if(chart.ClassName=="ChartDrawNote"){bShowBGColor=true;bShowFontColor=true;bShowBorderColor=true;bModifyText=true;bShowFontZoom=true;bgColor=chart.NoteBGColor;fontColor=chart.NoteTextColor;borderColor=chart.NoteBorderColor;}else if(chart.ClassName=="ChartDrawVolProfile"){bShowLineColor=false;bAdvanced=true;}else if(chart.ClassName=="ChartDrawPictureIconFont"){bShowFontZoom=true;}if(this.ColorButton){var item=this.ColorButton;this.ShowButton(item.Div,bShowLineColor?"inline":"none");if(bShowLineColor){item.Span.style['color']=chart.LineColor;}}if(this.BGColorButton){var item=this.BGColorButton;this.ShowButton(item.Div,bShowBGColor?"inline":"none");if(bShowBGColor){item.Span.style['color']=bgColor;}}if(this.FontColorButton){var item=this.FontColorButton;this.ShowButton(item.Div,bShowFontColor?"inline":"none");if(bShowFontColor){item.Span.style['color']=fontColor;}}if(this.BorderColorButton){var item=this.BorderColorButton;this.ShowButton(item.Div,bShowBorderColor?"inline":"none");if(bShowBorderColor){item.Span.style['color']=borderColor;}}if(this.LockButton){var item=this.LockButton;item.Span.style['color']=this.ChartPicture.EnableMove?"rgb(220,220,220)":"rgb(0,0,0)";}if(this.FontZoomButton){var item=this.FontZoomButton;this.ShowButton(item.Div,bShowFontZoom?"inline":"none");}if(this.FontZoomOutButton){var item=this.FontZoomOutButton;this.ShowButton(item.Div,bShowFontZoom?"inline":"none");}if(this.ModifyTextButton){var item=this.ModifyTextButton;this.ShowButton(item.Div,bModifyText?"inline":"none");}if(this.AdvancedButton){var item=this.AdvancedButton;this.ShowButton(item.Div,bAdvanced?"inline":"none");}};this.OnMouseDownTitle=function(e){var _this94=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this94.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this94.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();if(e.stopPropagation)e.stopPropagation();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;document.onmousemove=null;document.onmouseup=null;};}/*
|
|
15074
15100
|
Copyright (c) 2018 jones
|
|
@@ -15506,7 +15532,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
|
|
|
15506
15532
|
this.ExecuteScript(item,data);}this.Status=0;}};this.OnExecuteFinish=function(data,indexInfo,jsExectute,jobInfo){var message={Data:data,IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.FINISH_EXECUTE_SCRIPT,JobInfo:jobInfo};postMessage(message);};this.OnExecuteError=function(error,indexInfo,jobData){var message={IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.ERROR_EXECUTE_SCRIPT,Error:error};postMessage(message);};}/********************************************************************************
|
|
15507
15533
|
* 版本信息输出
|
|
15508
15534
|
*
|
|
15509
|
-
*/var HQCHART_VERSION="1.1.
|
|
15535
|
+
*/var HQCHART_VERSION="1.1.15105";function PrintHQChartVersion(){var logo='\n\n*************************************************************************************************************************************************************************** \n* \n* :%@@- \n* :@@@@- \n* =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@. \n* :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@* \n* +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+ \n* %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@= \n* @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@- \n* @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%% \n* .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@ \n* :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@# \n* -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@. \n* +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#:: \n* #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+ \n* %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@- \n* @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@. \n* .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@. \n* -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@ \n* =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@ \n* +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@# \n* *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+ \n* %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@- \n* @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+ \n* .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+- \n* :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@- \n* =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@# \n* *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@* \n* =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:. \n* \n* \n* HQChart \n* Ver: '+HQCHART_VERSION+' \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n************************************************************************************************************************************************************************** \n ';console.log(logo);}PrintHQChartVersion();//把给外界调用的方法暴露出来
|
|
15510
15536
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
15511
15537
|
// BaseIndex:BaseIndex,
|
|
15512
15538
|
// ChartLine:ChartLine,
|
|
@@ -15533,5 +15559,6 @@ GetDevicePixelRatio:GetDevicePixelRatio},(0,_defineProperty3.default)(_jsChartIn
|
|
|
15533
15559
|
HQMinuteTimeStringFormat:HQMinuteTimeStringFormat,//分时图X轴 十字光标输出格式化
|
|
15534
15560
|
HQDateStringFormat:HQDateStringFormat,//K线图X轴 十字光标输出格式化
|
|
15535
15561
|
HQPriceStringFormat:HQPriceStringFormat//分时图,K线图Y轴 十字光标输出格式化
|
|
15536
|
-
}),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'JS_ID',{JSCHART_EVENT_ID:JSCHART_EVENT_ID,JSCHART_OPERATOR_ID:JSCHART_OPERATOR_ID,JSCHART_DRAG_ID:JSCHART_DRAG_ID,JSCHART_BUTTON_ID:JSCHART_BUTTON_ID,JSCHART_DATA_FIELD_ID:JSCHART_DATA_FIELD_ID,JSCHART_WORKER_MESSAGE_ID:JSCHART_WORKER_MESSAGE_ID,JSCHART_MENU_ID:JSCHART_MENU_ID,JSCHART_TRADE_STATUS_ID:JSCHART_TRADE_STATUS_ID
|
|
15562
|
+
}),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'JS_ID',{JSCHART_EVENT_ID:JSCHART_EVENT_ID,JSCHART_OPERATOR_ID:JSCHART_OPERATOR_ID,JSCHART_DRAG_ID:JSCHART_DRAG_ID,JSCHART_BUTTON_ID:JSCHART_BUTTON_ID,JSCHART_DATA_FIELD_ID:JSCHART_DATA_FIELD_ID,JSCHART_WORKER_MESSAGE_ID:JSCHART_WORKER_MESSAGE_ID,JSCHART_MENU_ID:JSCHART_MENU_ID,JSCHART_TRADE_STATUS_ID:JSCHART_TRADE_STATUS_ID,//交易状态
|
|
15563
|
+
JSCHART_CORSSCURSOR_STATUS_ID:JSCHART_CORSSCURSOR_STATUS_ID//十字光标状态
|
|
15537
15564
|
}),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'HQChartScriptWorker',HQChartScriptWorker),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'JSPopMenu',JSPopMenu),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'JSDialogDrawTool',JSDialogDrawTool),_jsChartInit$jsChartS);
|