hqchart 1.1.14412 → 1.1.14425
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 +28 -23
- package/package.json +1 -1
- package/src/jscommon/umychart.js +97 -64
- package/src/jscommon/umychart.style.js +3 -3
- package/src/jscommon/umychart.testdata/DayMinute/im2503.cf.1day.minute.export.js +6 -0
- package/src/jscommon/umychart.testdata/DayMinute/im2503.cf.1day.minute.js +1348 -0
- package/src/jscommon/umychart.testdata/DayMinute/im2503.cf.1day.minute.json +1348 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +101 -68
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +101 -68
package/lib/umychart.vue.js
CHANGED
|
@@ -1154,7 +1154,7 @@ chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTat
|
|
|
1154
1154
|
for(var i=0;i<chart.Frame.SubFrame.length;++i){chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight*=pixelTatio;}chart.ChartCorssCursor.TextHeight*=pixelTatio;//十字光标文本信息高度
|
|
1155
1155
|
};this.SetChartBorder=function(chart,option){if(!option.Border)return;var item=option.Border;if(IFrameSplitOperator.IsNumber(option.Border.Left))chart.Frame.ChartBorder.Left=option.Border.Left;else option.Border.Left=chart.Frame.ChartBorder.Left;if(IFrameSplitOperator.IsNumber(option.Border.Right))chart.Frame.ChartBorder.Right=option.Border.Right;else option.Border.Right=chart.Frame.ChartBorder.Right;if(IFrameSplitOperator.IsNumber(option.Border.Top))chart.Frame.ChartBorder.Top=option.Border.Top;else option.Border.Top=chart.Frame.ChartBorder.Top;if(IFrameSplitOperator.IsNumber(option.Border.Bottom))chart.Frame.ChartBorder.Bottom=option.Border.Bottom;else option.Border.Bottom=chart.Frame.ChartBorder.Bottom;if(item.AutoLeft){chart.Frame.AutoLeftBorder={};if(IFrameSplitOperator.IsNumber(item.AutoLeft.Blank))chart.Frame.AutoLeftBorder.Blank=item.AutoLeft.Blank;if(IFrameSplitOperator.IsNumber(item.AutoLeft.MinWidth))chart.Frame.AutoLeftBorder.MinWidth=item.AutoLeft.MinWidth;}if(item.AutoRight){chart.Frame.AutoRightBorder={};if(IFrameSplitOperator.IsNumber(item.AutoRight.Blank))chart.Frame.AutoRightBorder.Blank=item.AutoRight.Blank;if(IFrameSplitOperator.IsNumber(item.AutoRight.MinWidth))chart.Frame.AutoRightBorder.MinWidth=item.AutoRight.MinWidth;}};this.SetEventCallback=function(chart,aryCallback){if(!chart)return;if(!IFrameSplitOperator.IsNonEmptyArray(aryCallback))return;for(var i=0;i<aryCallback.length;++i){var item=aryCallback[i];chart.AddEventCallback(item);}};//历史K线图
|
|
1156
1156
|
this.CreateKLineChartContainer=function(option){var _this=this;var chart=null;if(option.Type==="历史K线图横屏")chart=new KLineChartHScreenContainer(this.CanvasElement);else chart=new KLineChartContainer(this.CanvasElement,this.OffscreenCanvasElement,this.CacheCanvasElement);chart.GetExtraCanvas=function(name){return _this.GetExtraCanvas(name);};var extraElement=this.GetExtraCanvas(JSChart.CorssCursorCanvasKey);if(extraElement)chart.SetCorssCursorElement(extraElement);if(option.EventCallback)this.SetEventCallback(chart,option.EventCallback);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;var pixelRatio=GetDevicePixelRatio();//右键菜单
|
|
1157
|
-
if(IFrameSplitOperator.IsBool(option.IsShowRightMenu))chart.IsShowRightMenu=option.IsShowRightMenu;if(option.ScriptError)chart.ScriptErrorCallback=option.ScriptError;if(option.EnableScrollUpDown==true)chart.EnableScrollUpDown=option.EnableScrollUpDown;if(option.DisableMouse==true)chart.DisableMouse=option.DisableMouse;if(option.TouchMoveMinAngle)chart.TouchMoveMinAngle=option.TouchMoveMinAngle;if(option.EnableZoomUpDown)chart.EnableZoomUpDown=option.EnableZoomUpDown;if(IFrameSplitOperator.IsString(option.SplashTitle))chart.LoadDataSplashTitle=option.SplashTitle;if(IFrameSplitOperator.IsBool(option.EnableZoomIndexWindow))chart.EnableZoomIndexWindow=option.EnableZoomIndexWindow;if(IFrameSplitOperator.IsBool(option.IsDrawPictureXY))chart.IsDrawPictureXY=option.IsDrawPictureXY;if(IFrameSplitOperator.IsNumber(option.CtrlMoveStep))chart.CtrlMoveStep=option.CtrlMoveStep;if(IFrameSplitOperator.IsBool(option.EnableIndexChartDrag))chart.EnableIndexChartDrag=option.EnableIndexChartDrag;if(IFrameSplitOperator.IsBool(option.EnableVerifyRecvData))chart.EnableVerifyRecvData=option.EnableVerifyRecvData;if(option.GlobalOption){var item=option.GlobalOption;if(IFrameSplitOperator.IsBool(item.IsValueFullRange))chart.GlobalOption.IsValueFullRange=item.IsValueFullRange;if(item.SelectedBorder){var subItem=item.SelectedBorder;if(IFrameSplitOperator.IsNumber(subItem.Mode))chart.GlobalOption.SelectedBorder.Mode=subItem.Mode;}}if(option.EnableYDrag){var item=option.EnableYDrag;if(IFrameSplitOperator.IsBool(item.Left))chart.EnableYDrag.Left=item.Left;if(IFrameSplitOperator.IsBool(item.Right))chart.EnableYDrag.Right=item.Right;if(IFrameSplitOperator.IsBool(item.Wheel))chart.EnableYDrag.Wheel=item.Wheel;if(IFrameSplitOperator.IsNumber(item.WheelYMove))chart.EnableYDrag.WheelYMove=item.WheelYMove;}if(option.KLineTooltip){var item=option.KLineTooltip;if(IFrameSplitOperator.IsBool(item.Enable))chart.KLineTooltipConfig.Enable=item.Enable;if(IFrameSplitOperator.IsBool(item.EnableKeyDown))chart.KLineTooltipConfig.EnableKeyDown=item.EnableKeyDown;}if(option.KLine)//k线图的属性设置
|
|
1157
|
+
if(IFrameSplitOperator.IsBool(option.IsShowRightMenu))chart.IsShowRightMenu=option.IsShowRightMenu;if(option.ScriptError)chart.ScriptErrorCallback=option.ScriptError;if(option.EnableScrollUpDown==true)chart.EnableScrollUpDown=option.EnableScrollUpDown;if(option.DisableMouse==true)chart.DisableMouse=option.DisableMouse;if(option.TouchMoveMinAngle)chart.TouchMoveMinAngle=option.TouchMoveMinAngle;if(option.EnableZoomUpDown)chart.EnableZoomUpDown=option.EnableZoomUpDown;if(IFrameSplitOperator.IsString(option.SplashTitle))chart.LoadDataSplashTitle=option.SplashTitle;if(IFrameSplitOperator.IsBool(option.EnableZoomIndexWindow))chart.EnableZoomIndexWindow=option.EnableZoomIndexWindow;if(IFrameSplitOperator.IsBool(option.IsDrawPictureXY))chart.IsDrawPictureXY=option.IsDrawPictureXY;if(IFrameSplitOperator.IsNumber(option.CtrlMoveStep))chart.CtrlMoveStep=option.CtrlMoveStep;if(IFrameSplitOperator.IsBool(option.EnableIndexChartDrag))chart.EnableIndexChartDrag=option.EnableIndexChartDrag;if(IFrameSplitOperator.IsBool(option.EnableVerifyRecvData))chart.EnableVerifyRecvData=option.EnableVerifyRecvData;if(option.GlobalOption){var item=option.GlobalOption;if(IFrameSplitOperator.IsBool(item.IsValueFullRange))chart.GlobalOption.IsValueFullRange=item.IsValueFullRange;if(item.SelectedBorder){var subItem=item.SelectedBorder;if(IFrameSplitOperator.IsNumber(subItem.Mode))chart.GlobalOption.SelectedBorder.Mode=subItem.Mode;}}if(option.EnableYDrag){var item=option.EnableYDrag;if(IFrameSplitOperator.IsBool(item.Left))chart.EnableYDrag.Left=item.Left;if(IFrameSplitOperator.IsBool(item.Right))chart.EnableYDrag.Right=item.Right;if(IFrameSplitOperator.IsBool(item.Wheel))chart.EnableYDrag.Wheel=item.Wheel;if(IFrameSplitOperator.IsNumber(item.WheelYMove))chart.EnableYDrag.WheelYMove=item.WheelYMove;}if(option.EnableXDrag){var item=option.EnableXDrag;if(IFrameSplitOperator.IsBool(item.Bottom))chart.EnableXDrag.Bottom=item.Bottom;}if(option.KLineTooltip){var item=option.KLineTooltip;if(IFrameSplitOperator.IsBool(item.Enable))chart.KLineTooltipConfig.Enable=item.Enable;if(IFrameSplitOperator.IsBool(item.EnableKeyDown))chart.KLineTooltipConfig.EnableKeyDown=item.EnableKeyDown;}if(option.KLine)//k线图的属性设置
|
|
1158
1158
|
{var item=option.KLine;if(option.KLine.DragMode>=0)chart.DragMode=option.KLine.DragMode;if(option.KLine.Right>=0)chart.Right=option.KLine.Right;if(option.KLine.Period>=0)chart.Period=option.KLine.Period;if(option.KLine.MaxReqeustDataCount>0)chart.MaxRequestDataCount=option.KLine.MaxReqeustDataCount;//兼容老版本
|
|
1159
1159
|
if(option.KLine.MaxRequestDataCount>0)chart.MaxRequestDataCount=option.KLine.MaxRequestDataCount;if(option.KLine.Info&&option.KLine.Info.length>0)chart.SetKLineInfo(option.KLine.Info,false);if(IFrameSplitOperator.IsBool(item.IsShowTooltip))chart.IsShowTooltip=item.IsShowTooltip;if(option.KLine.MaxRequestMinuteDayCount>0)chart.MaxRequestMinuteDayCount=option.KLine.MaxRequestMinuteDayCount;if(option.KLine.DrawType)chart.KLineDrawType=option.KLine.DrawType;if(option.KLine.FirstShowDate>19910101)chart.CustomShow={Date:option.KLine.FirstShowDate,PageSize:option.KLine.PageSize};//!!已弃用 新的格式"CustomShow"
|
|
1160
1160
|
if(option.KLine.RightSpaceCount>0)chart.RightSpaceCount=option.KLine.RightSpaceCount;if(option.KLine.ZoomType>0)chart.ZoomType=option.KLine.ZoomType;if(option.KLine.DataWidth>=1)chart.KLineSize={DataWidth:option.KLine.DataWidth};if(IFrameSplitOperator.IsNumber(option.KLine.RightFormula))chart.RightFormula=option.KLine.RightFormula;}//自定义显示位置
|
|
@@ -1328,7 +1328,8 @@ this.CreateSettingDiv=function(option){};this.Focus=function(){if(this.CanvasEle
|
|
|
1328
1328
|
this.ChangeSymbol=function(symbol,option){if(this.JSChartContainer)this.JSChartContainer.ChangeSymbol(symbol,option);};//K线切换指标
|
|
1329
1329
|
this.ChangeIndex=function(windowIndex,indexName,option){if(this.JSChartContainer&&typeof this.JSChartContainer.ChangeIndex=='function')this.JSChartContainer.ChangeIndex(windowIndex,indexName,option);};//切换一个窗口指标,包含叠加指标,以及这个窗口的属性
|
|
1330
1330
|
this.ChangeIndexWindow=function(windowIndex,option){if(this.JSChartContainer&&typeof this.JSChartContainer.ChangeIndexWindow=='function')this.JSChartContainer.ChangeIndexWindow(windowIndex,option);};this.AddIndexWindow=function(indexName,option){if(this.JSChartContainer&&typeof this.JSChartContainer.AddIndexWindow=='function')this.JSChartContainer.AddIndexWindow(indexName,option);};this.AddScriptIndexWindow=function(indexInfo,option){if(this.JSChartContainer&&typeof this.JSChartContainer.AddScriptIndexWindow=='function')this.JSChartContainer.AddScriptIndexWindow(indexInfo,option);};this.AddAPIIndexWindow=function(indexData,option){if(this.JSChartContainer&&typeof this.JSChartContainer.AddAPIIndexWindow=='function')this.JSChartContainer.AddAPIIndexWindow(indexData,option);};this.RemoveIndexWindow=function(id){if(this.JSChartContainer&&typeof this.JSChartContainer.RemoveIndexWindow=='function')this.JSChartContainer.RemoveIndexWindow(id);};this.ChangeScriptIndex=function(windowIndex,indexData,option){if(this.JSChartContainer&&typeof this.JSChartContainer.ChangeScriptIndex=='function')this.JSChartContainer.ChangeScriptIndex(windowIndex,indexData,option);};this.ChangePyScriptIndex=function(windowIndex,indexData)//切换py指标
|
|
1331
|
-
{if(this.JSChartContainer&&typeof this.JSChartContainer.ChangePyScriptIndex=='function')this.JSChartContainer.ChangePyScriptIndex(windowIndex,indexData);};this.GetIndexInfo=function(){if(this.JSChartContainer&&typeof this.JSChartContainer.GetIndexInfo=='function')return this.JSChartContainer.GetIndexInfo();else return[];}
|
|
1331
|
+
{if(this.JSChartContainer&&typeof this.JSChartContainer.ChangePyScriptIndex=='function')this.JSChartContainer.ChangePyScriptIndex(windowIndex,indexData);};this.GetIndexInfo=function(){if(this.JSChartContainer&&typeof this.JSChartContainer.GetIndexInfo=='function')return this.JSChartContainer.GetIndexInfo();else return[];};//手动更新指标 aryIndex=[ {ID:主图指标ID, OverlayID:叠加指标ID }] ,option={ Draw:true/false }
|
|
1332
|
+
this.UpdateWindowIndexV2=function(aryIndex,option){if(this.JSChartContainer&&typeof this.JSChartContainer.UpdateWindowIndexV2=='function')return this.JSChartContainer.UpdateWindowIndexV2(aryIndex,option);};this.ChangeInstructionIndex=function(indexName,option){if(this.JSChartContainer&&typeof this.JSChartContainer.ChangeInstructionIndex=='function')this.JSChartContainer.ChangeInstructionIndex(indexName,option);};this.ChangeInstructionScriptIndex=function(indexData){if(this.JSChartContainer&&typeof this.JSChartContainer.ChangeInstructionIndex=='function')this.JSChartContainer.ChangeInstructionScriptIndex(indexData);};this.CancelInstructionIndex=function(){if(this.JSChartContainer&&typeof this.JSChartContainer.CancelInstructionIndex=='function')this.JSChartContainer.CancelInstructionIndex();};//K线周期切换
|
|
1332
1333
|
this.ChangePeriod=function(period,option){if(this.JSChartContainer&&typeof this.JSChartContainer.ChangePeriod=='function')this.JSChartContainer.ChangePeriod(period,option);};//K线复权切换
|
|
1333
1334
|
this.ChangeRight=function(right){if(this.JSChartContainer&&typeof this.JSChartContainer.ChangeRight=='function')this.JSChartContainer.ChangeRight(right);};//叠加股票
|
|
1334
1335
|
this.OverlaySymbol=function(symbol,option){if(this.JSChartContainer&&typeof this.JSChartContainer.OverlaySymbol=='function')this.JSChartContainer.OverlaySymbol(symbol,option);};//删除一个叠加股票
|
|
@@ -1666,7 +1667,8 @@ this.ClickDownPoint;//鼠标点击坐标 {X, Y}, 鼠标放开以后清空为null
|
|
|
1666
1667
|
this.IsDestroy=false;//是否已经销毁了
|
|
1667
1668
|
this.EnableYDrag={Left:false,Right:false,//是否可以拖拽缩放Y轴最大最小值
|
|
1668
1669
|
Wheel:false,WheelYMove:5//是否可以滚轴缩放Y轴最大最小值
|
|
1669
|
-
};this.
|
|
1670
|
+
};this.EnableXDrag={Bottom:true};//X轴拖动缩放
|
|
1671
|
+
this.EnableZoomIndexWindow=false;//是否支持双击缩放附图窗口
|
|
1670
1672
|
this.EnableVerifyRecvData=false;//是否检测接收到的数据
|
|
1671
1673
|
this.PhoneDBClick=new PhoneDBClick();this.SelectedChart={EnableSelected:false,EnableMoveOn:false,Selected:{Identify:null},MoveOn:{Identify:null}};//选中图形
|
|
1672
1674
|
this.IndexChartDrag;//拖拽指标图形
|
|
@@ -1732,9 +1734,9 @@ this.SetCursor({Cursor:"ew-resize"});this.RectSelectDrag={Index:item.PointIndex,
|
|
|
1732
1734
|
this.SetCursor({Cursor:"n-resize"});this.BorderDrag={Index:dragBorder.Index};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] DragBorder ",dragBorder);}}//拖拽Y轴缩放
|
|
1733
1735
|
if(!this.BorderDrag){var dragY=this.TryYDrag(x,y);if(dragY){//this.UIElement.style.cursor=dragY.Position==0 ? "n-resize":"row-resize";
|
|
1734
1736
|
var cursor=dragY.Position==0?"n-resize":"row-resize";this.SetCursor({Cursor:cursor});this.YDrag=dragY;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragY ",dragY);}else{var dragUpDown=this.TryUpDownDrag(x,y);if(dragUpDown){//this.UIElement.style.cursor="pointer";
|
|
1735
|
-
this.SetCursor({Cursor:"pointer"});this.UpDownDrag=dragUpDown;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragUpDown ",dragUpDown);}}}var sendData={X:x,Y:y,e:e};if(this.TryClick_CustomChartDrag(sendData)){}if(this.DragMode==0)return;var drag={
|
|
1736
|
-
CurrentMove:{}
|
|
1737
|
-
};drag.Click.X=e.clientX;drag.Click.Y=e.clientY;drag.Click.IsInFrameBottom=this.Frame.PtInFrameBottom(x,y);//是否点击在X轴上
|
|
1737
|
+
this.SetCursor({Cursor:"pointer"});this.UpDownDrag=dragUpDown;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragUpDown ",dragUpDown);}}}var sendData={X:x,Y:y,e:e};if(this.TryClick_CustomChartDrag(sendData)){}if(this.DragMode==0)return;var drag={Click:{},LastMove:{},//最后移动的位置
|
|
1738
|
+
CurrentMove:{},//当前的移动
|
|
1739
|
+
IsInFrameBottom:false};drag.Click.X=e.clientX;drag.Click.Y=e.clientY;if(this.EnableXDrag.Bottom)drag.Click.IsInFrameBottom=this.Frame.PtInFrameBottom(x,y);//是否点击在X轴上
|
|
1738
1740
|
drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;this.MouseDrag=drag;var drawPictureActive=this.GetActiveDrawPicture();//上一次选中的
|
|
1739
1741
|
var selectedChart={Chart:this.SelectedChart.Selected.Chart,Identify:this.SelectedChart.Selected.Identify};//上一次选中的图形
|
|
1740
1742
|
this.SelectChartDrawPicture=null;if(this.BorderDrag){}else if(this.YDrag||this.RectSelectDrag||this.CustomChartDrag){}else if(this.CurrentChartDrawPicture)//画图工具模式
|
|
@@ -1892,7 +1894,8 @@ event.Callback(event,data,this);if(data.PreventDefault)return;}if(button.ID==JSC
|
|
|
1892
1894
|
}else if(button.ID==JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING){}};this.PtInTitleButtons=function(x,y){for(var i=0;i<this.TitlePaint.length;++i){var item=this.TitlePaint[i];if(!item.PtInButtons)continue;var button=item.PtInButtons(x,y);if(button){button.Chart=item;return button;}}return null;};this.OnMouseMove=function(x,y,e,isPhone){var _this9=this;this.StopDrawDynamicInfo();this.LastPoint.X=x;this.LastPoint.Y=y;var mouseStatus=null;//鼠标状态
|
|
1893
1895
|
var button=null;//当前鼠标所在按钮
|
|
1894
1896
|
var frameID=this.Frame.PtInFrame(x,y);if(IFrameSplitOperator.IsNumber(frameID)&&frameID>=0)//在K线内部移动,调整K线索引
|
|
1895
|
-
this.CursorIndex=this.Frame.GetXData(x);if(this.EnableBorderDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){mouseStatus={Cursor:"n-resize",Name:"DragBorder"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag border ",dragBorder);}}if(this.EnableYDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragY=this.TryYDrag(x,y);if(dragY){mouseStatus={Cursor:dragY.Position==0?"n-resize":"row-resize",Name:"DragY"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag y ",dragY);}}if(!this.CurrentChartDrawPicture){button=this.PtInButton(x,y);if(button){mouseStatus={Cursor:"pointer",Name:button.Name};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ",button);}}if(this.ChartCorssCursor){var crossButton=this.ChartCorssCursor.PtInButton(x,y);if(crossButton){mouseStatus={Cursor:"pointer",Name:"CorssCursorButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] cross cursor button ",crossButton);}}
|
|
1897
|
+
this.CursorIndex=this.Frame.GetXData(x);if(this.EnableBorderDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){mouseStatus={Cursor:"n-resize",Name:"DragBorder"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag border ",dragBorder);}}if(this.EnableYDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragY=this.TryYDrag(x,y);if(dragY){mouseStatus={Cursor:dragY.Position==0?"n-resize":"row-resize",Name:"DragY"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag y ",dragY);}}if(!this.CurrentChartDrawPicture){button=this.PtInButton(x,y);if(button){mouseStatus={Cursor:"pointer",Name:button.Name};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ",button);}}if(this.ChartCorssCursor){var crossButton=this.ChartCorssCursor.PtInButton(x,y);if(crossButton){mouseStatus={Cursor:"pointer",Name:"CorssCursorButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] cross cursor button ",crossButton);}}//X轴拖动缩放
|
|
1898
|
+
if(this.ClassName=="KLineChartContainer"&&this.EnableXDrag.Bottom&&this.Frame.PtInFrameBottom(x,y)){mouseStatus={Cursor:"ew-resize",Name:"FrameButtom"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");}if(this.Frame.PtInHorizontalLabel&&this.Frame.PtInHorizontalLabel(x,y)){mouseStatus={Cursor:"pointer",Name:"HorizontalLabel"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame Horizontal Label ");}if(this.SelectedChart.EnableMoveOn&&this.PtInChart&&!this.CurrentChartDrawPicture){var chartInfo=this.PtInChart(x,y);if(chartInfo&&chartInfo.Identify){mouseStatus={Cursor:"pointer",Name:"PtInChart"};this.SelectedChart.MoveOn.Identify=chartInfo.Identify;this.SelectedChart.MoveOn.Identify=null;JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] Point in chart ",chartInfo);}else{this.SelectedChart.MoveOn.Identify=null;}}else{this.SelectedChart.MoveOn.Identify=null;}//区间选择
|
|
1896
1899
|
var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){if(item.Type==4)mouseStatus={Cursor:"pointer",Name:"DragRectSelect"};//子区域选中
|
|
1897
1900
|
else mouseStatus={Cursor:"ew-resize",Name:"DragRectSelect"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag rect select ",item);}}var sendData={MouseStatus:null,X:x,Y:y,FrameID:frameID,e:e};if(this.TryMouseMove_CustomChartDrag(sendData)){if(sendData.MouseStatus)mouseStatus=sendData.MouseStatus;}var bDrawPicture=false;//是否正在画图
|
|
1898
1901
|
if(this.CurrentChartDrawPicture){var index=this.Frame.PtInChartFrame(x,y);if(this.CurrentChartDrawPicture.Status!=20){var bDrawValid=false;//是否在有效绘图区域里面
|
|
@@ -2173,13 +2176,16 @@ this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
|
2173
2176
|
this.Draw();};this.ClickHorizontalLabel=function(lable,e){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_HORIZONTAL_LABEL);if(event&&event.Callback){var data={Info:lable,PreventDefault:false};//PreventDefault 是否阻止内置的点击处理
|
|
2174
2177
|
event.Callback(event,data,this);if(data.PreventDefault)return;}};this.ResetOverlaySymbolStatus=function(){for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];item.Status=OVERLAY_STATUS_ID.STATUS_NONE_ID;}};//十字光标状态变动
|
|
2175
2178
|
this.OnChangeCorssCursorStatus=function(data,obj){if(data.Type==1){if(!data.IsShowCorss)//十字光标隐藏
|
|
2176
|
-
{this.HideTooltip();this.CloseTooltipDialog();}}}
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
{var
|
|
2180
|
-
|
|
2179
|
+
{this.HideTooltip();this.CloseTooltipDialog();}}};//手动更新指标 [ {ID:主图指标ID, OverlayID:叠加指标ID }]
|
|
2180
|
+
this.UpdateWindowIndexV2=function(aryIndex,option){if(!this.Frame||!this.Frame.SubFrame)return false;var kData=this.GetKData();if(!kData||!IFrameSplitOperator.IsNonEmptyArray(kData.Data))return false;if(!IFrameSplitOperator.IsNonEmptyArray(aryIndex))return false;var setMainIndex=new _set2.default();//主图指标
|
|
2181
|
+
var setOverlayIndex=new _set2.default();//附图指标
|
|
2182
|
+
for(var i=0;aryIndex.length;++i){var item=aryIndex[i];if(!item)continue;if(item.ID)setMainIndex.set(item.ID);if(item.OverlayID)setOverlayIndex.set(item.OverlayID);}if(setMainIndex.size<=0&&setOverlayIndex.size<0)return false;//K线数据
|
|
2183
|
+
var bindData=new ChartData();if(kData)bindData.Data=kData.Data;if(this.IsKLineContainer())//K线
|
|
2184
|
+
{bindData.Period=this.Period;bindData.Right=this.Right;}//主图指标
|
|
2185
|
+
if(setMainIndex.size>0){for(var i=0;i<this.WindowIndex.length;++i){var item=this.WindowIndex[i];if(!item)continue;if(setMainIndex.has(item.ID)){this.BindIndexData(i,bindData);}}}//叠加指标
|
|
2186
|
+
if(setOverlayIndex.size>0){for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i];for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];if(setOverlayIndex.has(overlayItem.Identify)){this.BindOverlayIndexData(overlayItem,i,hisData);}}}}var bDraw=true;if(option&&option.Draw===false)bDraw=false;if(bDraw){this.UpdataDataoffset();//更新数据偏移
|
|
2181
2187
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
2182
|
-
this.Draw();};this.GetKData=function(){return null;};}function GetDevicePixelRatio(){if(typeof window=='undefined')return 1;return window.devicePixelRatio||1;}function GetFontHeight(context,font,word){if(!context)return null;if(font)context.font=font;var text='擎';if(IFrameSplitOperator.IsString(word))text=word;var fontInfo=context.measureText(text);var textHeight=fontInfo.fontBoundingBoxAscent+fontInfo.fontBoundingBoxDescent;if(!IFrameSplitOperator.IsNumber(textHeight))textHeight=fontInfo.width+2*GetDevicePixelRatio();return textHeight;}function IsPhoneWeb(){var userAgentInfo=navigator.userAgent;var Agents=new Array("Android","iPhone","SymbianOS","Windows Phone","iPad","iPod");for(var v=0;v<Agents.length;v++){if(userAgentInfo.indexOf(Agents[v])>0)return true;}return false;}function OnKeyDown(e)//键盘事件
|
|
2188
|
+
this.Draw();}return true;};this.GetKData=function(){return null;};}function GetDevicePixelRatio(){if(typeof window=='undefined')return 1;return window.devicePixelRatio||1;}function GetFontHeight(context,font,word){if(!context)return null;if(font)context.font=font;var text='擎';if(IFrameSplitOperator.IsString(word))text=word;var fontInfo=context.measureText(text);var textHeight=fontInfo.fontBoundingBoxAscent+fontInfo.fontBoundingBoxDescent;if(!IFrameSplitOperator.IsNumber(textHeight))textHeight=fontInfo.width+2*GetDevicePixelRatio();return textHeight;}function IsPhoneWeb(){var userAgentInfo=navigator.userAgent;var Agents=new Array("Android","iPhone","SymbianOS","Windows Phone","iPad","iPod");for(var v=0;v<Agents.length;v++){if(userAgentInfo.indexOf(Agents[v])>0)return true;}return false;}function OnKeyDown(e)//键盘事件
|
|
2183
2189
|
{if(this.JSChartContainer&&this.JSChartContainer.OnKeyDown)this.JSChartContainer.OnKeyDown(e);}function OnWheel(e)//上下滚动事件
|
|
2184
2190
|
{if(this.JSChartContainer&&this.JSChartContainer.OnWheel)this.JSChartContainer.OnWheel(e);}function ToFixed(number,precision){var b=1;if(isNaN(number))return number;if(number<0)b=-1;var multiplier=Math.pow(10,precision);var value=Math.round(Math.abs(number)*multiplier)/multiplier*b;if(/^(\d+(?:\.\d+)?)(e)([\-]?\d+)$/.test(value))var s=value.toFixed2(precision);else var s=value.toString();var rs=s.indexOf('.');if(rs<0&&precision>0){rs=s.length;s+='.';}while(s.length<=rs+precision){s+='0';}return s;}Number.prototype.toFixed2=Number.prototype.toFixed;//备份下老的
|
|
2185
2191
|
Number.prototype.toFixed=function(precision){return ToFixed(this,precision);};function Guid(){function S4(){return((1+Math.random())*0x10000|0).toString(16).substring(1);}return"guid"+(S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());}function GetScrollPosition(){var scrollPos={};var scrollTop=0;var scrollLeft=0;if(document.documentElement&&(document.documentElement.scrollTop||document.documentElement.scrollLeft)){scrollTop=document.documentElement.scrollTop;scrollLeft=document.documentElement.scrollLeft;}else if(document.body){scrollTop=document.body.scrollTop;scrollLeft=document.body.scrollLeft;}scrollPos.Top=scrollTop;scrollPos.Left=scrollLeft;return scrollPos;}//修正线段有毛刺
|
|
@@ -2352,7 +2358,7 @@ this.YTextPosition=[0,0],//是坐标否强制画在内部 [0=左侧] [1=右侧]
|
|
|
2352
2358
|
this.YTextPadding=[g_JSChartResource.Frame.YTextPadding[0],g_JSChartResource.Frame.YTextPadding[1]],//Y轴文字和边框间距 [0=左侧] [1=右侧]
|
|
2353
2359
|
this.IsShowXLine=true;//是否显示X轴刻度线
|
|
2354
2360
|
this.IsShowYLine=true;this.YInsideOffset=0;this.YTextBaseline=0;//0=居中 1=上部 (目前就支持内部刻度)
|
|
2355
|
-
this.MultiTextFormat=0;//多行刻度信息显示模式 0=显示第1行 1=单行多个文本 2=显示2行
|
|
2361
|
+
this.MultiTextFormat=0;//多行刻度信息显示模式 0=显示第1行 1=单行多个文本 2=显示2行 3=多行输出(json格式)
|
|
2356
2362
|
this.RightTextMaxWidth=0;this.ShortYLineLength=5;this.ShortXLineLength=5;this.BeforeDrawXYCallback;//坐标绘制前回调,绘制深度图
|
|
2357
2363
|
this.GetEventCallback;//事件回调
|
|
2358
2364
|
//工具栏的按钮样式
|
|
@@ -5345,7 +5351,7 @@ this.DefaultSplitType=0;this.DefaultYMaxMin;//{ Max:null, Min:null }; //指
|
|
|
5345
5351
|
this.FixedYMaxMin;//{ Max, Min} 固定Y轴最大最小值
|
|
5346
5352
|
this.EnableZoomUpDown=false;//上下左右拖拽
|
|
5347
5353
|
this.LastMaxMin;//当前显示的最高最低范围
|
|
5348
|
-
this.PercentageTextFormat=0;//0=显示第1行 1=显示2行 2
|
|
5354
|
+
this.PercentageTextFormat=0;//0=显示第1行 1=单行格式: 价格/百分比, 2=显示2行 3=2行显示(json格式)
|
|
5349
5355
|
this.IsEnableDragY=function(){return this.CoordinateType==0||this.CoordinateType==1;};this.Operator=function(){var splitData={};splitData.Max=this.Frame.HorizontalMax;splitData.Min=this.Frame.HorizontalMin;splitData.Count=this.SplitCount;if(this.Frame.YMaxMin)//原始的数据范围
|
|
5350
5356
|
{var item=this.Frame.YMaxMin;if(IFrameSplitOperator.IsNumber(item.Max)&&IFrameSplitOperator.IsNumber(item.Min)){splitData.Max=item.Max;splitData.Min=item.Min;}}if(splitData.Max==splitData.Min)//如果一样上下扩大下
|
|
5351
5357
|
{splitData.Max+=splitData.Max*0.01;splitData.Min-=splitData.Min*0.01;}var isFixedMaxMin=this.FixedYMaxMin&&IFrameSplitOperator.IsNumber(this.FixedYMaxMin.Max)&&IFrameSplitOperator.IsNumber(this.FixedYMaxMin.Min);if(isFixedMaxMin){splitData.Max=this.FixedYMaxMin.Max;splitData.Min=this.FixedYMaxMin.Min;//JSConsole.Chart.Log(`[FrameSplitKLinePriceY::Operator] FixedYMaxMin.Max=${this.FixedYMaxMin.Max} FixedYMaxMin.Min=${this.FixedYMaxMin.Min} `);
|
|
@@ -5367,12 +5373,11 @@ if(this.SplitLogarithmic(splitData,defaultfloatPrecision)){bFilter=false;}else{t
|
|
|
5367
5373
|
*/this.ReservedHeight(splitData);//预留高度
|
|
5368
5374
|
JSConsole.Chart.Log('[FrameSplitKLinePriceY::Operator] fixed . Max='+splitData.Max+' Min='+splitData.Min+' Count='+splitData.Count);if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_YCOORDINATE);if(event&&event.Callback){var data={ID:this.Frame.Identify,Frame:this.Frame};event.Callback(event,data,this);}}};this.SplitTickData=function(splitData,floatPrecision){switch(this.CoordinateType){case 1://百分比
|
|
5369
5375
|
if(!this.SplitPercentage(splitData,floatPrecision,splitData.IsFixedMaxMin)){this.SplitDefault(splitData,floatPrecision,splitData.IsFixedMaxMin);}else{this.Frame.MultiTextFormat=this.PercentageTextFormat;splitData.IsFilter=false;}break;default:if(this.SplitType==3){this.SplitTickPrice(splitData,floatPrecision);}else{this.SplitDefault(splitData,floatPrecision,splitData.IsFixedMaxMin);}}};this.SplitTickPrice=function(splitData,floatPrecision){var aryPrice=this.KLineChart.GetAllPrice();this.Frame.HorizontalInfo=[];for(var i in aryPrice){var value=aryPrice[i];this.Frame.HorizontalInfo[i]=new CoordinateInfo();this.Frame.HorizontalInfo[i].Value=value;if(this.IsShowLeftText)this.Frame.HorizontalInfo[i].Message[0]=value.toFixed(floatPrecision);if(this.IsShowRightText)this.Frame.HorizontalInfo[i].Message[1]=value.toFixed(floatPrecision);}};this.SplitPercentage=function(splitData,floatPrecision,isFixedMaxMin)//百分比坐标
|
|
5370
|
-
{var firstOpenPrice=this.GetFirstOpenPrice();if(!IFrameSplitOperator.IsNumber(firstOpenPrice))return false;splitData.Max=(splitData.Max-firstOpenPrice)/firstOpenPrice;splitData.Min=(splitData.Min-firstOpenPrice)/firstOpenPrice;splitData.Interval=(splitData.Max-splitData.Min)/(splitData.Count-1);if(!isFixedMaxMin)this.IntegerCoordinateSplit2(splitData);var minValue=(1+splitData.Min)*firstOpenPrice;var maxValue=(1+splitData.Max)*firstOpenPrice;var textColor;if(g_JSChartResource.Frame&&g_JSChartResource.Frame.PercentageText){var item=g_JSChartResource.Frame.PercentageText;textColor={PriceColor:item.PriceColor,PercentageColor:item.PercentageColor,SplitColor:item.SplitColor,Font:item.Font};}var aryHorizontal=[];for(var value=0;value<=splitData.Max;value+=splitData.Interval){var price=(value+1)*firstOpenPrice;var item=new CoordinateInfo();item.Value=price;
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
splitData.Max=maxValue;return true;};//等比坐标 当前屏最后第2根K线的收盘加为基准, 上下涨幅10%分割
|
|
5376
|
+
{var firstOpenPrice=this.GetFirstOpenPrice();if(!IFrameSplitOperator.IsNumber(firstOpenPrice))return false;splitData.Max=(splitData.Max-firstOpenPrice)/firstOpenPrice;splitData.Min=(splitData.Min-firstOpenPrice)/firstOpenPrice;splitData.Interval=(splitData.Max-splitData.Min)/(splitData.Count-1);if(!isFixedMaxMin)this.IntegerCoordinateSplit2(splitData);var minValue=(1+splitData.Min)*firstOpenPrice;var maxValue=(1+splitData.Max)*firstOpenPrice;var textColor;if(g_JSChartResource.Frame&&g_JSChartResource.Frame.PercentageText){var item=g_JSChartResource.Frame.PercentageText;textColor={PriceColor:item.PriceColor,PercentageColor:item.PercentageColor,SplitColor:item.SplitColor,Font:item.Font};}var aryHorizontal=[];for(var value=0;value<=splitData.Max;value+=splitData.Interval){var price=(value+1)*firstOpenPrice;var item=new CoordinateInfo();item.Value=price;this.FormatPercentageItem(item,value,floatPrecision,textColor);aryHorizontal.push(item);}for(var value=-splitData.Interval;value>=splitData.Min;value-=splitData.Interval){var price=(value+1)*firstOpenPrice;if(price<minValue||price>maxValue)continue;var item=new CoordinateInfo();item.Value=price;this.FormatPercentageItem(item,value,floatPrecision,textColor);aryHorizontal.push(item);}aryHorizontal.sort(function(left,right){return left.Value-right.Value;});this.Frame.HorizontalInfo=aryHorizontal;splitData.Min=minValue;//最大最小值调整
|
|
5377
|
+
splitData.Max=maxValue;return true;};this.FormatPercentageItem=function(item,percentage,floatPrecision,textColor){var price=item.Value;var strPrice=price.toFixed(floatPrecision);if(this.IsShowLeftText)item.Message[0]=strPrice;//左边价格坐标
|
|
5378
|
+
if(this.IsShowRightText)//右侧 价格/百分比
|
|
5379
|
+
{var strPrcentage=IFrameSplitOperator.RemoveZero(percentage.toFixed(2))+'%';//右边百分比
|
|
5380
|
+
if(this.PercentageTextFormat==1)item.Message[1]=[{Text:strPrice,Color:textColor.PriceColor},{Text:"/",Color:textColor.PercentageColor},{Text:strPrcentage,Color:textColor.SplitColor}];else if(this.PercentageTextFormat==3)item.Message[1]=[{Text:strPrice,Color:textColor.PriceColor},{Text:strPrcentage,Color:textColor.PercentageColor}];else if(this.PercentageTextFormat==2)item.Message[1]=[strPrcentage,strPrice];else item.Message[1]=strPrcentage;}};//等比坐标 当前屏最后第2根K线的收盘加为基准, 上下涨幅10%分割
|
|
5376
5381
|
this.SplitIncrease=function(splitData,floatPrecision){var basePrice=this.GetLast2ndClose();if(!IFrameSplitOperator.IsNumber(basePrice))return false;this.IntegerCoordinateSplit(splitData);this.Frame.HorizontalInfo=[];var increase=g_JSChartResource.FrameSplitIncrease.Increase;var aryHorizontal=[];for(var price=basePrice;price<splitData.Max;price=price*(1+increase)){var item=new CoordinateInfo();item.Value=price;var text=price.toFixed(floatPrecision);if(this.IsShowLeftText)item.Message[0]=text;if(this.IsShowRightText)item.Message[1]=text;aryHorizontal.push(item);}for(var price=basePrice*0.9;price>splitData.Min;price=price*(1-increase)){var item=new CoordinateInfo();item.Value=price;var text=price.toFixed(floatPrecision);if(this.IsShowLeftText)item.Message[0]=text;if(this.IsShowRightText)item.Message[1]=text;aryHorizontal.push(item);}this.Frame.HorizontalInfo=aryHorizontal;return true;};//等分坐标:以画面显示的最高价、最低价为基准,对这个区域N等分,显示分割的数值线
|
|
5377
5382
|
this.SplitAverage=function(splitData,floatPrecision){var max=splitData.Max;var min=splitData.Min;//this.IntegerCoordinateSplit(splitData);
|
|
5378
5383
|
this.Frame.HorizontalInfo=[];var count=g_JSChartResource.FrameSplitAverage.Count;var interval=(max-min)/count;for(var i=0;i<=count;++i){var item=new CoordinateInfo();item.Value=min+interval*i;var text=item.Value.toFixed(floatPrecision);if(this.IsShowLeftText)item.Message[0]=text;if(this.IsShowRightText)item.Message[1]=text;this.Frame.HorizontalInfo[i]=item;}};this.SplitGoldenSection=function(splitData,floatPrecision){var max=splitData.Max;var min=splitData.Min;//this.IntegerCoordinateSplit(splitData);
|
|
@@ -12168,7 +12173,7 @@ FrameTitleBGColor:"rgb(0,0,0)",//标题栏背景色
|
|
|
12168
12173
|
OverlayIndexTitleBGColor:'rgba(0,0,0,0.7)',//叠加指标背景色
|
|
12169
12174
|
Frame:{XBottomOffset:2*GetDevicePixelRatio(),//X轴文字向下偏移
|
|
12170
12175
|
PercentageText://百分比坐标文字颜色
|
|
12171
|
-
{PriceColor:'rgb(
|
|
12176
|
+
{PriceColor:'rgb(220,220,220)',PercentageColor:"rgb(220,220,220)",SplitColor:"rgb(220,220,220)",Font:14*GetDevicePixelRatio()+"px 微软雅黑"}},//叠加指标框架
|
|
12172
12177
|
OverlayFrame:{BolderPen:'rgb(130,130,130)',//指标边框线
|
|
12173
12178
|
TitleColor:'rgb(181,181,181)',//指标名字颜色
|
|
12174
12179
|
TitleFont:11*GetDevicePixelRatio()+'px arial'//指标名字字体
|
|
@@ -14328,7 +14333,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
|
|
|
14328
14333
|
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);};}/********************************************************************************
|
|
14329
14334
|
* 版本信息输出
|
|
14330
14335
|
*
|
|
14331
|
-
*/var HQCHART_VERSION="1.1.
|
|
14336
|
+
*/var HQCHART_VERSION="1.1.14424";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();//把给外界调用的方法暴露出来
|
|
14332
14337
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
14333
14338
|
// BaseIndex:BaseIndex,
|
|
14334
14339
|
// ChartLine:ChartLine,
|
package/package.json
CHANGED
package/src/jscommon/umychart.js
CHANGED
|
@@ -321,6 +321,12 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
321
321
|
if (IFrameSplitOperator.IsNumber(item.WheelYMove)) chart.EnableYDrag.WheelYMove=item.WheelYMove;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
+
if (option.EnableXDrag)
|
|
325
|
+
{
|
|
326
|
+
var item=option.EnableXDrag;
|
|
327
|
+
if (IFrameSplitOperator.IsBool(item.Bottom)) chart.EnableXDrag.Bottom=item.Bottom;
|
|
328
|
+
}
|
|
329
|
+
|
|
324
330
|
if (option.KLineTooltip)
|
|
325
331
|
{
|
|
326
332
|
var item=option.KLineTooltip;
|
|
@@ -1885,6 +1891,13 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
1885
1891
|
return [];
|
|
1886
1892
|
}
|
|
1887
1893
|
|
|
1894
|
+
//手动更新指标 aryIndex=[ {ID:主图指标ID, OverlayID:叠加指标ID }] ,option={ Draw:true/false }
|
|
1895
|
+
this.UpdateWindowIndexV2=function(aryIndex, option)
|
|
1896
|
+
{
|
|
1897
|
+
if (this.JSChartContainer && typeof(this.JSChartContainer.UpdateWindowIndexV2)=='function')
|
|
1898
|
+
return this.JSChartContainer.UpdateWindowIndexV2(aryIndex, option);
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1888
1901
|
this.ChangeInstructionIndex=function(indexName, option)
|
|
1889
1902
|
{
|
|
1890
1903
|
if (this.JSChartContainer && typeof(this.JSChartContainer.ChangeInstructionIndex)=='function')
|
|
@@ -3056,7 +3069,9 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
3056
3069
|
{
|
|
3057
3070
|
Left:false, Right:false, //是否可以拖拽缩放Y轴最大最小值
|
|
3058
3071
|
Wheel:false, WheelYMove:5 //是否可以滚轴缩放Y轴最大最小值
|
|
3059
|
-
};
|
|
3072
|
+
};
|
|
3073
|
+
|
|
3074
|
+
this.EnableXDrag={ Bottom:true }; //X轴拖动缩放
|
|
3060
3075
|
|
|
3061
3076
|
this.EnableZoomIndexWindow=false; //是否支持双击缩放附图窗口
|
|
3062
3077
|
this.EnableVerifyRecvData=false; //是否检测接收到的数据
|
|
@@ -3892,14 +3907,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
3892
3907
|
|
|
3893
3908
|
var drag=
|
|
3894
3909
|
{
|
|
3895
|
-
|
|
3896
|
-
|
|
3910
|
+
Click:{},
|
|
3911
|
+
LastMove:{}, //最后移动的位置
|
|
3897
3912
|
CurrentMove:{}, //当前的移动
|
|
3913
|
+
IsInFrameBottom:false,
|
|
3898
3914
|
};
|
|
3899
3915
|
|
|
3916
|
+
|
|
3917
|
+
|
|
3900
3918
|
drag.Click.X=e.clientX;
|
|
3901
3919
|
drag.Click.Y=e.clientY;
|
|
3902
|
-
drag.Click.IsInFrameBottom=this.Frame.PtInFrameBottom(x,y); //是否点击在X轴上
|
|
3920
|
+
if (this.EnableXDrag.Bottom) drag.Click.IsInFrameBottom=this.Frame.PtInFrameBottom(x,y); //是否点击在X轴上
|
|
3903
3921
|
drag.LastMove.X=e.clientX;
|
|
3904
3922
|
drag.LastMove.Y=e.clientY;
|
|
3905
3923
|
|
|
@@ -6601,7 +6619,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
6601
6619
|
}
|
|
6602
6620
|
}
|
|
6603
6621
|
|
|
6604
|
-
|
|
6622
|
+
//X轴拖动缩放
|
|
6623
|
+
if (this.ClassName=="KLineChartContainer" && this.EnableXDrag.Bottom && this.Frame.PtInFrameBottom(x,y))
|
|
6605
6624
|
{
|
|
6606
6625
|
mouseStatus={ Cursor:"ew-resize", Name:"FrameButtom"};
|
|
6607
6626
|
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");
|
|
@@ -10573,69 +10592,82 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
10573
10592
|
}
|
|
10574
10593
|
}
|
|
10575
10594
|
|
|
10576
|
-
|
|
10595
|
+
//手动更新指标 [ {ID:主图指标ID, OverlayID:叠加指标ID }]
|
|
10596
|
+
this.UpdateWindowIndexV2=function(aryIndex, option)
|
|
10577
10597
|
{
|
|
10598
|
+
if (!this.Frame || !this.Frame.SubFrame) return false;
|
|
10599
|
+
|
|
10600
|
+
var kData=this.GetKData();
|
|
10601
|
+
if (!kData || !IFrameSplitOperator.IsNonEmptyArray(kData.Data)) return false;
|
|
10602
|
+
|
|
10578
10603
|
if (!IFrameSplitOperator.IsNonEmptyArray(aryIndex)) return false;
|
|
10579
10604
|
|
|
10580
|
-
var
|
|
10581
|
-
|
|
10605
|
+
var setMainIndex=new Set(); //主图指标
|
|
10606
|
+
var setOverlayIndex=new Set(); //附图指标
|
|
10607
|
+
|
|
10608
|
+
for(var i=0;aryIndex.length;++i)
|
|
10582
10609
|
{
|
|
10583
|
-
var item=
|
|
10610
|
+
var item=aryIndex[i];
|
|
10584
10611
|
if (!item) continue;
|
|
10585
|
-
if (!item.ID) continue;
|
|
10586
10612
|
|
|
10587
|
-
if (
|
|
10588
|
-
|
|
10589
|
-
aryID.push(i);
|
|
10590
|
-
}
|
|
10613
|
+
if (item.ID) setMainIndex.set(item.ID);
|
|
10614
|
+
if (item.OverlayID) setOverlayIndex.set(item.OverlayID);
|
|
10591
10615
|
}
|
|
10592
10616
|
|
|
10593
|
-
if (
|
|
10617
|
+
if (setMainIndex.size<=0 && setOverlayIndex.size<0) return false;
|
|
10594
10618
|
|
|
10619
|
+
//K线数据
|
|
10620
|
+
var bindData=new ChartData();
|
|
10621
|
+
if (kData) bindData.Data=kData.Data;
|
|
10595
10622
|
if (this.IsKLineContainer()) //K线
|
|
10596
10623
|
{
|
|
10597
|
-
var bindData=new ChartData();
|
|
10598
|
-
bindData.Data=this.SourceData.Data;
|
|
10599
10624
|
bindData.Period=this.Period;
|
|
10600
10625
|
bindData.Right=this.Right;
|
|
10626
|
+
}
|
|
10601
10627
|
|
|
10602
|
-
|
|
10628
|
+
//主图指标
|
|
10629
|
+
if (setMainIndex.size>0)
|
|
10630
|
+
{
|
|
10631
|
+
for(var i=0;i<this.WindowIndex.length;++i)
|
|
10603
10632
|
{
|
|
10633
|
+
var item=this.WindowIndex[i];
|
|
10634
|
+
if (!item) continue;
|
|
10604
10635
|
|
|
10636
|
+
if (setMainIndex.has(item.ID))
|
|
10637
|
+
{
|
|
10638
|
+
this.BindIndexData(i,bindData);
|
|
10639
|
+
}
|
|
10605
10640
|
}
|
|
10606
|
-
|
|
10641
|
+
}
|
|
10642
|
+
|
|
10643
|
+
//叠加指标
|
|
10644
|
+
if (setOverlayIndex.size>0)
|
|
10645
|
+
{
|
|
10646
|
+
for(var i=0;i<this.Frame.SubFrame.length;++i)
|
|
10607
10647
|
{
|
|
10608
|
-
|
|
10648
|
+
var item=this.Frame.SubFrame[i];
|
|
10649
|
+
for(var j=0; j<item.OverlayIndex.length; ++j)
|
|
10609
10650
|
{
|
|
10610
|
-
var
|
|
10611
|
-
bindData.Data=rightData;
|
|
10612
|
-
}
|
|
10651
|
+
var overlayItem=item.OverlayIndex[j];
|
|
10613
10652
|
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10653
|
+
if (setOverlayIndex.has(overlayItem.Identify))
|
|
10654
|
+
{
|
|
10655
|
+
this.BindOverlayIndexData(overlayItem,i,hisData)
|
|
10656
|
+
}
|
|
10618
10657
|
}
|
|
10619
10658
|
}
|
|
10620
10659
|
}
|
|
10621
|
-
else if (this.IsMinuteContainer()) //分时图
|
|
10622
|
-
{
|
|
10623
|
-
var bindData=this.SourceData;
|
|
10624
|
-
}
|
|
10625
|
-
else
|
|
10626
|
-
{
|
|
10627
|
-
return;
|
|
10628
|
-
}
|
|
10629
10660
|
|
|
10630
|
-
|
|
10631
|
-
|
|
10661
|
+
var bDraw=true;
|
|
10662
|
+
if (option && option.Draw===false) bDraw=false;
|
|
10663
|
+
if (bDraw)
|
|
10632
10664
|
{
|
|
10633
|
-
this.
|
|
10665
|
+
this.UpdataDataoffset(); //更新数据偏移
|
|
10666
|
+
this.UpdateFrameMaxMin(); //调整坐标最大 最小值
|
|
10667
|
+
this.Draw();
|
|
10634
10668
|
}
|
|
10635
10669
|
|
|
10636
|
-
|
|
10637
|
-
this.UpdateFrameMaxMin(); //调整坐标最大 最小值
|
|
10638
|
-
this.Draw();
|
|
10670
|
+
return true;
|
|
10639
10671
|
}
|
|
10640
10672
|
|
|
10641
10673
|
this.GetKData=function()
|
|
@@ -11712,7 +11744,7 @@ function AverageWidthFrame()
|
|
|
11712
11744
|
this.IsShowYLine=true;
|
|
11713
11745
|
this.YInsideOffset=0;
|
|
11714
11746
|
this.YTextBaseline=0; //0=居中 1=上部 (目前就支持内部刻度)
|
|
11715
|
-
this.MultiTextFormat=0; //多行刻度信息显示模式 0=显示第1行 1=单行多个文本 2=显示2行
|
|
11747
|
+
this.MultiTextFormat=0; //多行刻度信息显示模式 0=显示第1行 1=单行多个文本 2=显示2行 3=多行输出(json格式)
|
|
11716
11748
|
this.RightTextMaxWidth=0;
|
|
11717
11749
|
|
|
11718
11750
|
this.ShortYLineLength=5;
|
|
@@ -50844,7 +50876,7 @@ function FrameSplitKLinePriceY()
|
|
|
50844
50876
|
this.EnableZoomUpDown=false; //上下左右拖拽
|
|
50845
50877
|
this.LastMaxMin; //当前显示的最高最低范围
|
|
50846
50878
|
|
|
50847
|
-
this.PercentageTextFormat=0; //0=显示第1行 1=显示2行 2
|
|
50879
|
+
this.PercentageTextFormat=0; //0=显示第1行 1=单行格式: 价格/百分比, 2=显示2行 3=2行显示(json格式)
|
|
50848
50880
|
|
|
50849
50881
|
this.IsEnableDragY=function()
|
|
50850
50882
|
{
|
|
@@ -51076,17 +51108,7 @@ function FrameSplitKLinePriceY()
|
|
|
51076
51108
|
var price=(value+1)*firstOpenPrice;
|
|
51077
51109
|
var item=new CoordinateInfo();
|
|
51078
51110
|
item.Value=price;
|
|
51079
|
-
|
|
51080
|
-
|
|
51081
|
-
if (this.IsShowRightText)
|
|
51082
|
-
{
|
|
51083
|
-
var strPrice=price.toFixed(floatPrecision);
|
|
51084
|
-
var text=(value*100).toFixed(2); //右边百分比
|
|
51085
|
-
text=IFrameSplitOperator.RemoveZero(text);
|
|
51086
|
-
text+='%';
|
|
51087
|
-
item.Message[1]=[text,strPrice];
|
|
51088
|
-
item.ExtendData=textColor;
|
|
51089
|
-
}
|
|
51111
|
+
this.FormatPercentageItem(item, value, floatPrecision,textColor);
|
|
51090
51112
|
aryHorizontal.push(item);
|
|
51091
51113
|
}
|
|
51092
51114
|
|
|
@@ -51097,16 +51119,7 @@ function FrameSplitKLinePriceY()
|
|
|
51097
51119
|
|
|
51098
51120
|
var item=new CoordinateInfo();
|
|
51099
51121
|
item.Value=price;
|
|
51100
|
-
|
|
51101
|
-
if (this.IsShowRightText)
|
|
51102
|
-
{
|
|
51103
|
-
var strPrice=price.toFixed(floatPrecision);
|
|
51104
|
-
var text=(value*100).toFixed(2); //右边百分比
|
|
51105
|
-
text=IFrameSplitOperator.RemoveZero(text);
|
|
51106
|
-
text+='%';
|
|
51107
|
-
item.Message[1]=[text,strPrice];
|
|
51108
|
-
item.ExtendData=textColor;
|
|
51109
|
-
}
|
|
51122
|
+
this.FormatPercentageItem(item, value, floatPrecision,textColor);
|
|
51110
51123
|
aryHorizontal.push(item);
|
|
51111
51124
|
}
|
|
51112
51125
|
|
|
@@ -51122,6 +51135,26 @@ function FrameSplitKLinePriceY()
|
|
|
51122
51135
|
return true;
|
|
51123
51136
|
}
|
|
51124
51137
|
|
|
51138
|
+
this.FormatPercentageItem=function(item, percentage, floatPrecision, textColor)
|
|
51139
|
+
{
|
|
51140
|
+
var price=item.Value;
|
|
51141
|
+
var strPrice=price.toFixed(floatPrecision);
|
|
51142
|
+
if (this.IsShowLeftText) item.Message[0]=strPrice; //左边价格坐标
|
|
51143
|
+
|
|
51144
|
+
if (this.IsShowRightText) //右侧 价格/百分比
|
|
51145
|
+
{
|
|
51146
|
+
var strPrcentage=`${IFrameSplitOperator.RemoveZero(percentage.toFixed(2))}%`; //右边百分比
|
|
51147
|
+
if (this.PercentageTextFormat==1)
|
|
51148
|
+
item.Message[1]=[{ Text:strPrice, Color:textColor.PriceColor }, {Text:"/", Color:textColor.PercentageColor}, {Text:strPrcentage, Color:textColor.SplitColor}];
|
|
51149
|
+
else if (this.PercentageTextFormat==3)
|
|
51150
|
+
item.Message[1]=[{ Text:strPrice, Color:textColor.PriceColor }, {Text:strPrcentage, Color:textColor.PercentageColor}];
|
|
51151
|
+
else if (this.PercentageTextFormat==2)
|
|
51152
|
+
item.Message[1]=[strPrcentage, strPrice];
|
|
51153
|
+
else
|
|
51154
|
+
item.Message[1]=strPrcentage;
|
|
51155
|
+
}
|
|
51156
|
+
}
|
|
51157
|
+
|
|
51125
51158
|
//等比坐标 当前屏最后第2根K线的收盘加为基准, 上下涨幅10%分割
|
|
51126
51159
|
this.SplitIncrease=function(splitData,floatPrecision)
|
|
51127
51160
|
{
|
|
@@ -151,9 +151,9 @@ function GetBlackStyle()
|
|
|
151
151
|
|
|
152
152
|
PercentageText: //百分比坐标文字颜色
|
|
153
153
|
{
|
|
154
|
-
PriceColor:'rgb(
|
|
155
|
-
PercentageColor:"rgb(
|
|
156
|
-
SplitColor:"rgb(
|
|
154
|
+
PriceColor:'rgb(220,220,220)',
|
|
155
|
+
PercentageColor:"rgb(220,220,220)",
|
|
156
|
+
SplitColor:"rgb(220,220,220)",
|
|
157
157
|
Font:14*GetDevicePixelRatio() +"px 微软雅黑"
|
|
158
158
|
}
|
|
159
159
|
},
|