hqchart 1.1.12788 → 1.1.12795
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 +12 -7
- package/package.json +1 -1
- package/src/jscommon/umychart.js +49 -2
- package/src/jscommon/umychart.scrollbar.js +7 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +57 -3
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +57 -3
package/lib/umychart.vue.js
CHANGED
|
@@ -1357,7 +1357,7 @@ for(var i=0;i<chart.Frame.SubFrame.length;++i){chart.Frame.SubFrame[i].Frame.Cha
|
|
|
1357
1357
|
};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线图
|
|
1358
1358
|
this.CreateKLineChartContainer=function(option){var _this2=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 _this2.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;//创建改参数div
|
|
1359
1359
|
chart.ModifyIndexDialog=this.ModifyIndexDialog;chart.ChangeIndexDialog=this.ChangeIndexDialog;chart.MinuteDialog=this.MinuteDialog;//右键菜单
|
|
1360
|
-
if(option.IsShowRightMenu==true)chart.RightMenu=new KLineRightMenu(this.DivElement);if(option.ScriptError)chart.ScriptErrorCallback=option.ScriptError;chart.SelectRectRightMenu=new KLineSelectRightMenu(this.DivElement);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(option.KLine)//k线图的属性设置
|
|
1360
|
+
if(option.IsShowRightMenu==true)chart.RightMenu=new KLineRightMenu(this.DivElement);if(option.ScriptError)chart.ScriptErrorCallback=option.ScriptError;chart.SelectRectRightMenu=new KLineSelectRightMenu(this.DivElement);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.KLine)//k线图的属性设置
|
|
1361
1361
|
{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;//兼容老版本
|
|
1362
1362
|
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(option.KLine.KLineDoubleClick==false)chart.MinuteDialog=this.MinuteDialog=null;if(option.KLine.IsShowTooltip==false)chart.IsShowTooltip=false;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};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;}if(option.EnableFlowCapital){var item=option.EnableFlowCapital;if(item.BIT==true)chart.EnableFlowCapital.BIT=item.BIT;}if(IFrameSplitOperator.IsBool(option.EnableBorderDrag)){chart.EnableBorderDrag=option.EnableBorderDrag;}if(option.Page){if(option.Page.Day&&option.Page.Day.Enable==true)chart.Page.Day.Enable=true;if(option.Page.Minute&&option.Page.Minute.Enable==true)chart.Page.Minute.Enable=true;}if(option.DragDownload){if(option.DragDownload.Day&&option.DragDownload.Day.Enable==true)chart.DragDownload.Day.Enable=true;if(option.DragDownload.Minute&&option.DragDownload.Minute.Enable==true)chart.DragDownload.Minute.Enable=true;}if(option.ZoomDownload){if(option.ZoomDownload.Day&&IFrameSplitOperator.IsBool(option.ZoomDownload.Day.Enable))chart.ZoomDownload.Day.Enable=option.ZoomDownload.Day.Enable;if(option.ZoomDownload.Minute&&IFrameSplitOperator.IsBool(option.ZoomDownload.Minute.Enable))chart.ZoomDownload.Minute.Enable=option.ZoomDownload.Minute.Enable;}if(option.Language){var value=g_JSChartLocalization.GetLanguageID(option.Language);if(IFrameSplitOperator.IsNumber(value))chart.LanguageID=value;}if(option.SourceDatatLimit)chart.SetSourceDatatLimit(option.SourceDatatLimit);if(option.DrawPicture)//画图工具
|
|
1363
1363
|
{if(option.DrawPicture.StorageKey&&chart.ChartDrawStorage)chart.ChartDrawStorage.Load(option.DrawPicture.StorageKey);}if(option.DrawTool)//画图工具
|
|
@@ -1512,7 +1512,8 @@ JSChart.SetTextResource=function(key,value){g_JSChartLocalization.SetTextResourc
|
|
|
1512
1512
|
JSChart.GetLocalization=function(){return g_JSChartLocalization;};//获取设备分辨率比
|
|
1513
1513
|
JSChart.GetDevicePixelRatio=function(){return GetDevicePixelRatio();};JSChart.CreateGuid=function(){return Guid();};JSChart.GetResource=function()//获取颜色配置 (设置配必须啊在JSChart.Init()之前)
|
|
1514
1514
|
{return g_JSChartResource;};JSChart.GetMinuteTimeStringData=function(){return g_MinuteTimeStringData;};JSChart.GetMinuteCoordinateData=function(){return g_MinuteCoordinateData;};JSChart.GetKLineZoom=function()//K线缩放配置
|
|
1515
|
-
{return ZOOM_SEED;};JSChart.
|
|
1515
|
+
{return ZOOM_SEED;};JSChart.SetKLineZoom=function(aryZoom)//设置K线缩放比例
|
|
1516
|
+
{ZOOM_SEED=aryZoom;};JSChart.GetDivTooltipDataFormat=function()//div tooltip数据格式化
|
|
1516
1517
|
{return g_DivTooltipDataForamt;};JSChart.GetKLineCustomCalulate=function()//K线额外计算
|
|
1517
1518
|
{return g_KLineCustomCalulate;};JSChart.SetUSATimeType=function(type)//设置 0=标准时间 1=夏令时间 3=美国时间
|
|
1518
1519
|
{g_NYMEXTimeData.TimeType=type;g_COMEXTimeData.TimeType=type;g_NYBOTTimeData.TimeType=type;g_CBOTTimeData.TimeType=type;};JSChart.GetChinaFuturesTimeData=function()//获取国内期货交易时间配置
|
|
@@ -1725,8 +1726,9 @@ this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;this.PressTime=500;this.
|
|
|
1725
1726
|
this.LastMouseStatus={MouseOnToolbar:null};// MouseOnToolbar={ Rect:{}, Title: }
|
|
1726
1727
|
this.ClickDownPoint;//鼠标点击坐标 {X, Y}, 鼠标放开以后清空为null
|
|
1727
1728
|
this.IsDestroy=false;//是否已经销毁了
|
|
1728
|
-
this.EnableYDrag={Left:false,Right:false
|
|
1729
|
-
|
|
1729
|
+
this.EnableYDrag={Left:false,Right:false,//是否可以拖拽缩放Y轴最大最小值
|
|
1730
|
+
Wheel:false,WheelYMove:5//是否可以滚轴缩放Y轴最大最小值
|
|
1731
|
+
};this.EnableZoomIndexWindow=false;//是否支持双击缩放附图窗口
|
|
1730
1732
|
this.EnableVerifyRecvData=false;//是否检测接收到的数据
|
|
1731
1733
|
this.PhoneDBClick=new PhoneDBClick();this.SelectedChart={EnableSelected:false,EnableMoveOn:false,Selected:{Identify:null},MoveOn:{Identify:null}};//选中图形
|
|
1732
1734
|
this.IndexChartDrag;//拖拽指标图形
|
|
@@ -6960,7 +6962,9 @@ this.ResetFrameXSplit();this.Frame.SetSizeChage(true);this.Draw();this.UpdatePoi
|
|
|
6960
6962
|
};this.OnWheel=function(e){var _this16=this;JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var isInClient=false;this.Canvas.beginPath();this.Canvas.rect(this.Frame.ChartBorder.GetLeft(),this.Frame.ChartBorder.GetTop(),this.Frame.ChartBorder.GetWidth(),this.Frame.ChartBorder.GetHeight());isInClient=this.Canvas.isPointInPath(x,y);var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;var enableZoomUpDown=true;//是否允许缩放
|
|
6961
6963
|
if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Wheel===false)enableZoomUpDown=false;if(this.SourceData&&this.SourceData.Data){if(isInClient&&wheelValue<0&&enableZoomUpDown)//缩小
|
|
6962
6964
|
{var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(this.Frame.ZoomDown(cursorIndex,{ZoomDownloadDataCallback:function ZoomDownloadDataCallback(requestData){_this16.ZoomDownloadData(requestData);}})){this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.ResetFrameXSplit();this.Draw();this.OnKLinePageChange("wheel");}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
|
|
6963
|
-
{var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(this.Frame.ZoomUp(cursorIndex)){JSConsole.Chart.Log("[KLineChartContainer::OnWheel] cursorIndex ",cursorIndex);this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.ResetFrameXSplit();this.Draw();this.OnKLinePageChange("wheel");}}}if(!isInClient)return;if(e.preventDefault)e.preventDefault();else e.returnValue=false;}
|
|
6965
|
+
{var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(this.Frame.ZoomUp(cursorIndex)){JSConsole.Chart.Log("[KLineChartContainer::OnWheel] cursorIndex ",cursorIndex);this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.ResetFrameXSplit();this.Draw();this.OnKLinePageChange("wheel");}}}if(!isInClient){if(!this.OnWheel_ZoomUpDownFrameY(e,x,y))return;}if(e.preventDefault)e.preventDefault();else e.returnValue=false;};//通过滚轴缩放Y轴
|
|
6966
|
+
this.OnWheel_ZoomUpDownFrameY=function(e,x,y){if(!this.EnableYDrag.Wheel)return false;var dragY=this.TryYDrag(x,y);if(!dragY)return false;if(dragY.Left&&!dragY.IsOverlay||dragY.Right){}else{return false;}var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;var yMove=this.EnableYDrag.WheelYMove;if(wheelValue>0)yMove*=-1;dragY.Position=0;//只能两边缩放
|
|
6967
|
+
if(!this.Frame.OnZoomUpDownFrameY(dragY,yMove))return false;this.Frame.SetSizeChage(true);this.Draw();return true;};//创建
|
|
6964
6968
|
//windowCount 窗口个数
|
|
6965
6969
|
this.Create=function(windowCount,option){var _this17=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
6966
6970
|
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this17.GetEventCallback(id);};this.ChartCorssCursor.StringFormatX.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this17.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ExtendChartPaint=this.ExtendChartPaint;//创建等待提示
|
|
@@ -12974,7 +12978,8 @@ this.ClassName='SliderChart';//类名
|
|
|
12974
12978
|
this.OffsetData;this.Color=g_JSChartResource.ScrollBar.Slider.BarAreaColor;this.BarColor=g_JSChartResource.ScrollBar.Slider.BarColor;this.BarWidth=10;this.BarPadding=10;//上下留白
|
|
12975
12979
|
this.DateFont=g_JSChartResource.ScrollBar.Slider.DateFont;this.DateColor=g_JSChartResource.ScrollBar.Slider.DateColor;this.AryRect=[];//[{ Rect:{Left, Top, Right:, Bottom:, Width, Height:}, Type:0中间 1=左 2=右 }]
|
|
12976
12980
|
this.XStart;this.XEnd;this.SizeChange=true;this.DragMode=false;this.ReloadResource=function(resource){this.Color=g_JSChartResource.ScrollBar.Slider.BarAreaColor;this.BarColor=g_JSChartResource.ScrollBar.Slider.BarColor;this.DateFont=g_JSChartResource.ScrollBar.Slider.DateFont;this.DateColor=g_JSChartResource.ScrollBar.Slider.DateColor;};this.Draw=function(){this.AryRect=[];if(!this.OffsetData||!IFrameSplitOperator.IsPlusNumber(this.OffsetData.Count))return;if(!IFrameSplitOperator.IsNumber(this.OffsetData.Start)||!IFrameSplitOperator.IsNumber(this.OffsetData.End))return;var top=this.ChartBorder.GetTop();var bottom=this.ChartBorder.GetBottom();var startData,endData;if(this.DragMode){var xStart=this.XStart;var xEnd=this.XEnd;var startIndex=this.ChartFrame.GetXData(xStart);var endIndx=this.ChartFrame.GetXData(xEnd);startIndex=parseInt(startIndex);endIndx=parseInt(endIndx);startData={Data:this.Data.Data[this.OffsetData.Start],X:xStart,Type:startIndex<endIndx?0:1};endData={Data:this.Data.Data[this.OffsetData.End],X:xEnd,Type:endIndx>startIndex?1:0};}else{var start=this.OffsetData.Start,end=this.OffsetData.End;var xStart=this.ChartFrame.GetXFromIndex(start);var xEnd=this.ChartFrame.GetXFromIndex(end);this.XStart=xStart;this.XEnd=xEnd;startData={Data:this.Data.Data[this.OffsetData.Start],X:xStart,Type:xStart<xEnd?0:1};endData={Data:this.Data.Data[this.OffsetData.End],X:xEnd,Type:xEnd>xStart?1:0};}this.Canvas.fillStyle=this.Color;var rtBar={Left:Math.min(xStart,xEnd),Top:top,Width:Math.abs(xEnd-xStart),Height:bottom-top};rtBar.Right=rtBar.Left+rtBar.Width;rtBar.Bottom=rtBar.Top+rtBar.Height;this.Canvas.fillRect(rtBar.Left,rtBar.Top,rtBar.Width,rtBar.Height);this.AryRect.push({Rect:rtBar,Type:0});//左右拖拽块
|
|
12977
|
-
var pixelRatio=GetDevicePixelRatio();var barWidth=this.BarWidth*pixelRatio;var barHeight=bottom-top-this.BarPadding*2*pixelRatio;var xBar=xStart-this.BarWidth/2;var yBar=top+this.BarPadding*pixelRatio;this.Canvas.fillStyle=this.BarColor;var rtBar={Left:xBar,Top:yBar,Width:barWidth,Height:barHeight};rtBar.Right=rtBar.Left+rtBar.Width;rtBar.Bottom=rtBar.Top+rtBar.Height;this.Canvas.fillRect(rtBar.Left,rtBar.Top,rtBar.Width,rtBar.Height);this.AryRect.push({Rect:rtBar,Type:1});var xBar=xEnd-this.BarWidth/2;var rtBar={Left:xBar,Top:yBar,Width:barWidth,Height:barHeight};rtBar.Right=rtBar.Left+rtBar.Width;rtBar.Bottom=rtBar.Top+rtBar.Height;this.Canvas.fillRect(rtBar.Left,rtBar.Top,rtBar.Width,rtBar.Height);this.AryRect.push({Rect:rtBar,Type:2})
|
|
12981
|
+
var pixelRatio=GetDevicePixelRatio();var barWidth=this.BarWidth*pixelRatio;var barHeight=bottom-top-this.BarPadding*2*pixelRatio;var xBar=xStart-this.BarWidth/2;var yBar=top+this.BarPadding*pixelRatio;this.Canvas.fillStyle=this.BarColor;var rtBar={Left:xBar,Top:yBar,Width:barWidth,Height:barHeight};rtBar.Right=rtBar.Left+rtBar.Width;rtBar.Bottom=rtBar.Top+rtBar.Height;this.Canvas.fillRect(rtBar.Left,rtBar.Top,rtBar.Width,rtBar.Height);this.AryRect.push({Rect:rtBar,Type:1});var xBar=xEnd-this.BarWidth/2;var rtBar={Left:xBar,Top:yBar,Width:barWidth,Height:barHeight};rtBar.Right=rtBar.Left+rtBar.Width;rtBar.Bottom=rtBar.Top+rtBar.Height;this.Canvas.fillRect(rtBar.Left,rtBar.Top,rtBar.Width,rtBar.Height);this.AryRect.push({Rect:rtBar,Type:2});//最右边可能是空白区 要处理下
|
|
12982
|
+
if(endData.Type==1){var dataIndex=this.OffsetData.End;if(dataIndex>=this.Data.Data.length)endData.Data=this.Data.Data[this.Data.Data.length-1];}this.DrawDateTime(startData);this.DrawDateTime(endData);};this.DrawDateTime=function(data){if(!data||!data.Data)return;var text=IFrameSplitOperator.FormatDateString(data.Data.Date);var top=this.ChartBorder.GetTop();var bottom=this.ChartBorder.GetBottom();var timeText=null;if(ChartData.IsMilliSecondPeriod(this.Data.Period)){var time=parseInt(data.Data.Time/1000);text=IFrameSplitOperator.FormatTimeString(time,"HH:MM:SS");}else if(ChartData.IsMinutePeriod(this.Data.Period,true)){timeText=IFrameSplitOperator.FormatTimeString(data.Data.Time,"HH:MM");}if(data.Type==0){this.Canvas.textAlign="right";var x=data.X-this.BarWidth/2;}else if(data.Type==1){this.Canvas.textAlign="left";var x=data.X+this.BarWidth/2;}this.Canvas.font=this.DateFont;var fontHeight=this.Canvas.measureText("擎").width;this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.DateColor;var yText=top+(bottom-top)/2;this.Canvas.fillText(text,x,yText);if(timeText){yText+=fontHeight;this.Canvas.fillText(timeText,x,yText);}};this.PtInChart=function(x,y){if(!IFrameSplitOperator.IsNonEmptyArray(this.AryRect))return null;for(var i=this.AryRect.length-1;i>=0;--i){var item=this.AryRect[i];var rt=item.Rect;if(x>=rt.Left&&x<=rt.Right&&y>=rt.Top&&y<=rt.Bottom){return{Data:item};}}return null;};}///////////////////////////////////////////////////////////////////////////////////////////////
|
|
12978
12983
|
// 滚动条K线背景色
|
|
12979
12984
|
//
|
|
12980
12985
|
//
|
|
@@ -13002,7 +13007,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
|
|
|
13002
13007
|
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);};}/********************************************************************************
|
|
13003
13008
|
* 版本信息输出
|
|
13004
13009
|
*
|
|
13005
|
-
*/var HQCHART_VERSION="1.1.
|
|
13010
|
+
*/var HQCHART_VERSION="1.1.12794";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
|
|
13006
13011
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
13007
13012
|
// BaseIndex:BaseIndex,
|
|
13008
13013
|
// ChartLine:ChartLine,
|
package/package.json
CHANGED
package/src/jscommon/umychart.js
CHANGED
|
@@ -307,6 +307,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
307
307
|
var item=option.EnableYDrag;
|
|
308
308
|
if (IFrameSplitOperator.IsBool(item.Left)) chart.EnableYDrag.Left=item.Left;
|
|
309
309
|
if (IFrameSplitOperator.IsBool(item.Right)) chart.EnableYDrag.Right=item.Right;
|
|
310
|
+
if (IFrameSplitOperator.IsBool(item.Wheel)) chart.EnableYDrag.Wheel=item.Wheel;
|
|
311
|
+
if (IFrameSplitOperator.IsNumber(item.WheelYMove)) chart.EnableYDrag.WheelYMove=item.WheelYMove;
|
|
310
312
|
}
|
|
311
313
|
|
|
312
314
|
if (option.KLine) //k线图的属性设置
|
|
@@ -2260,6 +2262,11 @@ JSChart.GetKLineZoom=function() //K线缩放配置
|
|
|
2260
2262
|
return ZOOM_SEED;
|
|
2261
2263
|
}
|
|
2262
2264
|
|
|
2265
|
+
JSChart.SetKLineZoom=function(aryZoom) //设置K线缩放比例
|
|
2266
|
+
{
|
|
2267
|
+
ZOOM_SEED=aryZoom;
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2263
2270
|
JSChart.GetDivTooltipDataFormat=function() //div tooltip数据格式化
|
|
2264
2271
|
{
|
|
2265
2272
|
return g_DivTooltipDataForamt;
|
|
@@ -2838,7 +2845,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
2838
2845
|
this.ClickDownPoint; //鼠标点击坐标 {X, Y}, 鼠标放开以后清空为null
|
|
2839
2846
|
this.IsDestroy=false; //是否已经销毁了
|
|
2840
2847
|
|
|
2841
|
-
this.EnableYDrag=
|
|
2848
|
+
this.EnableYDrag=
|
|
2849
|
+
{
|
|
2850
|
+
Left:false, Right:false, //是否可以拖拽缩放Y轴最大最小值
|
|
2851
|
+
Wheel:false, WheelYMove:5 //是否可以滚轴缩放Y轴最大最小值
|
|
2852
|
+
};
|
|
2853
|
+
|
|
2842
2854
|
this.EnableZoomIndexWindow=false; //是否支持双击缩放附图窗口
|
|
2843
2855
|
this.EnableVerifyRecvData=false; //是否检测接收到的数据
|
|
2844
2856
|
|
|
@@ -66229,12 +66241,47 @@ function KLineChartContainer(uielement,OffscreenElement)
|
|
|
66229
66241
|
}
|
|
66230
66242
|
}
|
|
66231
66243
|
|
|
66232
|
-
if (!isInClient)
|
|
66244
|
+
if (!isInClient)
|
|
66245
|
+
{
|
|
66246
|
+
if (!this.OnWheel_ZoomUpDownFrameY(e,x,y)) return;
|
|
66247
|
+
}
|
|
66233
66248
|
|
|
66234
66249
|
if(e.preventDefault) e.preventDefault();
|
|
66235
66250
|
else e.returnValue = false;
|
|
66236
66251
|
}
|
|
66237
66252
|
|
|
66253
|
+
//通过滚轴缩放Y轴
|
|
66254
|
+
this.OnWheel_ZoomUpDownFrameY=function(e, x, y)
|
|
66255
|
+
{
|
|
66256
|
+
if (!this.EnableYDrag.Wheel) return false;
|
|
66257
|
+
|
|
66258
|
+
var dragY=this.TryYDrag(x,y);
|
|
66259
|
+
if (!dragY) return false;
|
|
66260
|
+
|
|
66261
|
+
if ((dragY.Left && !dragY.IsOverlay) || dragY.Right)
|
|
66262
|
+
{
|
|
66263
|
+
|
|
66264
|
+
}
|
|
66265
|
+
else
|
|
66266
|
+
{
|
|
66267
|
+
return false;
|
|
66268
|
+
}
|
|
66269
|
+
|
|
66270
|
+
var wheelValue=e.wheelDelta;
|
|
66271
|
+
if (!IFrameSplitOperator.IsObjectExist(e.wheelDelta))
|
|
66272
|
+
wheelValue=e.deltaY* -0.01;
|
|
66273
|
+
|
|
66274
|
+
var yMove=this.EnableYDrag.WheelYMove;
|
|
66275
|
+
if (wheelValue>0) yMove*=-1;
|
|
66276
|
+
dragY.Position=0; //只能两边缩放
|
|
66277
|
+
if (!this.Frame.OnZoomUpDownFrameY(dragY, yMove)) return false;
|
|
66278
|
+
|
|
66279
|
+
this.Frame.SetSizeChage(true);
|
|
66280
|
+
this.Draw();
|
|
66281
|
+
|
|
66282
|
+
return true;
|
|
66283
|
+
}
|
|
66284
|
+
|
|
66238
66285
|
//创建
|
|
66239
66286
|
//windowCount 窗口个数
|
|
66240
66287
|
this.Create=function(windowCount, option)
|
|
@@ -1175,6 +1175,13 @@ function SliderChart()
|
|
|
1175
1175
|
this.Canvas.fillRect(rtBar.Left, rtBar.Top, rtBar.Width, rtBar.Height);
|
|
1176
1176
|
this.AryRect.push({ Rect:rtBar, Type:2});
|
|
1177
1177
|
|
|
1178
|
+
//最右边可能是空白区 要处理下
|
|
1179
|
+
if (endData.Type==1)
|
|
1180
|
+
{
|
|
1181
|
+
var dataIndex=this.OffsetData.End;
|
|
1182
|
+
if (dataIndex>=this.Data.Data.length) endData.Data=this.Data.Data[this.Data.Data.length-1];
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1178
1185
|
this.DrawDateTime(startData);
|
|
1179
1186
|
this.DrawDateTime(endData);
|
|
1180
1187
|
}
|
|
@@ -4451,6 +4451,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
4451
4451
|
var item=option.EnableYDrag;
|
|
4452
4452
|
if (IFrameSplitOperator.IsBool(item.Left)) chart.EnableYDrag.Left=item.Left;
|
|
4453
4453
|
if (IFrameSplitOperator.IsBool(item.Right)) chart.EnableYDrag.Right=item.Right;
|
|
4454
|
+
if (IFrameSplitOperator.IsBool(item.Wheel)) chart.EnableYDrag.Wheel=item.Wheel;
|
|
4455
|
+
if (IFrameSplitOperator.IsNumber(item.WheelYMove)) chart.EnableYDrag.WheelYMove=item.WheelYMove;
|
|
4454
4456
|
}
|
|
4455
4457
|
|
|
4456
4458
|
if (option.KLine) //k线图的属性设置
|
|
@@ -6404,6 +6406,11 @@ JSChart.GetKLineZoom=function() //K线缩放配置
|
|
|
6404
6406
|
return ZOOM_SEED;
|
|
6405
6407
|
}
|
|
6406
6408
|
|
|
6409
|
+
JSChart.SetKLineZoom=function(aryZoom) //设置K线缩放比例
|
|
6410
|
+
{
|
|
6411
|
+
ZOOM_SEED=aryZoom;
|
|
6412
|
+
}
|
|
6413
|
+
|
|
6407
6414
|
JSChart.GetDivTooltipDataFormat=function() //div tooltip数据格式化
|
|
6408
6415
|
{
|
|
6409
6416
|
return g_DivTooltipDataForamt;
|
|
@@ -6982,7 +6989,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
6982
6989
|
this.ClickDownPoint; //鼠标点击坐标 {X, Y}, 鼠标放开以后清空为null
|
|
6983
6990
|
this.IsDestroy=false; //是否已经销毁了
|
|
6984
6991
|
|
|
6985
|
-
this.EnableYDrag=
|
|
6992
|
+
this.EnableYDrag=
|
|
6993
|
+
{
|
|
6994
|
+
Left:false, Right:false, //是否可以拖拽缩放Y轴最大最小值
|
|
6995
|
+
Wheel:false, WheelYMove:5 //是否可以滚轴缩放Y轴最大最小值
|
|
6996
|
+
};
|
|
6997
|
+
|
|
6986
6998
|
this.EnableZoomIndexWindow=false; //是否支持双击缩放附图窗口
|
|
6987
6999
|
this.EnableVerifyRecvData=false; //是否检测接收到的数据
|
|
6988
7000
|
|
|
@@ -70373,12 +70385,47 @@ function KLineChartContainer(uielement,OffscreenElement)
|
|
|
70373
70385
|
}
|
|
70374
70386
|
}
|
|
70375
70387
|
|
|
70376
|
-
if (!isInClient)
|
|
70388
|
+
if (!isInClient)
|
|
70389
|
+
{
|
|
70390
|
+
if (!this.OnWheel_ZoomUpDownFrameY(e,x,y)) return;
|
|
70391
|
+
}
|
|
70377
70392
|
|
|
70378
70393
|
if(e.preventDefault) e.preventDefault();
|
|
70379
70394
|
else e.returnValue = false;
|
|
70380
70395
|
}
|
|
70381
70396
|
|
|
70397
|
+
//通过滚轴缩放Y轴
|
|
70398
|
+
this.OnWheel_ZoomUpDownFrameY=function(e, x, y)
|
|
70399
|
+
{
|
|
70400
|
+
if (!this.EnableYDrag.Wheel) return false;
|
|
70401
|
+
|
|
70402
|
+
var dragY=this.TryYDrag(x,y);
|
|
70403
|
+
if (!dragY) return false;
|
|
70404
|
+
|
|
70405
|
+
if ((dragY.Left && !dragY.IsOverlay) || dragY.Right)
|
|
70406
|
+
{
|
|
70407
|
+
|
|
70408
|
+
}
|
|
70409
|
+
else
|
|
70410
|
+
{
|
|
70411
|
+
return false;
|
|
70412
|
+
}
|
|
70413
|
+
|
|
70414
|
+
var wheelValue=e.wheelDelta;
|
|
70415
|
+
if (!IFrameSplitOperator.IsObjectExist(e.wheelDelta))
|
|
70416
|
+
wheelValue=e.deltaY* -0.01;
|
|
70417
|
+
|
|
70418
|
+
var yMove=this.EnableYDrag.WheelYMove;
|
|
70419
|
+
if (wheelValue>0) yMove*=-1;
|
|
70420
|
+
dragY.Position=0; //只能两边缩放
|
|
70421
|
+
if (!this.Frame.OnZoomUpDownFrameY(dragY, yMove)) return false;
|
|
70422
|
+
|
|
70423
|
+
this.Frame.SetSizeChage(true);
|
|
70424
|
+
this.Draw();
|
|
70425
|
+
|
|
70426
|
+
return true;
|
|
70427
|
+
}
|
|
70428
|
+
|
|
70382
70429
|
//创建
|
|
70383
70430
|
//windowCount 窗口个数
|
|
70384
70431
|
this.Create=function(windowCount, option)
|
|
@@ -131314,6 +131361,13 @@ function SliderChart()
|
|
|
131314
131361
|
this.Canvas.fillRect(rtBar.Left, rtBar.Top, rtBar.Width, rtBar.Height);
|
|
131315
131362
|
this.AryRect.push({ Rect:rtBar, Type:2});
|
|
131316
131363
|
|
|
131364
|
+
//最右边可能是空白区 要处理下
|
|
131365
|
+
if (endData.Type==1)
|
|
131366
|
+
{
|
|
131367
|
+
var dataIndex=this.OffsetData.End;
|
|
131368
|
+
if (dataIndex>=this.Data.Data.length) endData.Data=this.Data.Data[this.Data.Data.length-1];
|
|
131369
|
+
}
|
|
131370
|
+
|
|
131317
131371
|
this.DrawDateTime(startData);
|
|
131318
131372
|
this.DrawDateTime(endData);
|
|
131319
131373
|
}
|
|
@@ -131489,7 +131543,7 @@ function ScrollBarBGChart()
|
|
|
131489
131543
|
|
|
131490
131544
|
|
|
131491
131545
|
|
|
131492
|
-
var HQCHART_VERSION="1.1.
|
|
131546
|
+
var HQCHART_VERSION="1.1.12794";
|
|
131493
131547
|
|
|
131494
131548
|
function PrintHQChartVersion()
|
|
131495
131549
|
{
|
|
@@ -4495,6 +4495,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
4495
4495
|
var item=option.EnableYDrag;
|
|
4496
4496
|
if (IFrameSplitOperator.IsBool(item.Left)) chart.EnableYDrag.Left=item.Left;
|
|
4497
4497
|
if (IFrameSplitOperator.IsBool(item.Right)) chart.EnableYDrag.Right=item.Right;
|
|
4498
|
+
if (IFrameSplitOperator.IsBool(item.Wheel)) chart.EnableYDrag.Wheel=item.Wheel;
|
|
4499
|
+
if (IFrameSplitOperator.IsNumber(item.WheelYMove)) chart.EnableYDrag.WheelYMove=item.WheelYMove;
|
|
4498
4500
|
}
|
|
4499
4501
|
|
|
4500
4502
|
if (option.KLine) //k线图的属性设置
|
|
@@ -6448,6 +6450,11 @@ JSChart.GetKLineZoom=function() //K线缩放配置
|
|
|
6448
6450
|
return ZOOM_SEED;
|
|
6449
6451
|
}
|
|
6450
6452
|
|
|
6453
|
+
JSChart.SetKLineZoom=function(aryZoom) //设置K线缩放比例
|
|
6454
|
+
{
|
|
6455
|
+
ZOOM_SEED=aryZoom;
|
|
6456
|
+
}
|
|
6457
|
+
|
|
6451
6458
|
JSChart.GetDivTooltipDataFormat=function() //div tooltip数据格式化
|
|
6452
6459
|
{
|
|
6453
6460
|
return g_DivTooltipDataForamt;
|
|
@@ -7026,7 +7033,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
7026
7033
|
this.ClickDownPoint; //鼠标点击坐标 {X, Y}, 鼠标放开以后清空为null
|
|
7027
7034
|
this.IsDestroy=false; //是否已经销毁了
|
|
7028
7035
|
|
|
7029
|
-
this.EnableYDrag=
|
|
7036
|
+
this.EnableYDrag=
|
|
7037
|
+
{
|
|
7038
|
+
Left:false, Right:false, //是否可以拖拽缩放Y轴最大最小值
|
|
7039
|
+
Wheel:false, WheelYMove:5 //是否可以滚轴缩放Y轴最大最小值
|
|
7040
|
+
};
|
|
7041
|
+
|
|
7030
7042
|
this.EnableZoomIndexWindow=false; //是否支持双击缩放附图窗口
|
|
7031
7043
|
this.EnableVerifyRecvData=false; //是否检测接收到的数据
|
|
7032
7044
|
|
|
@@ -70417,12 +70429,47 @@ function KLineChartContainer(uielement,OffscreenElement)
|
|
|
70417
70429
|
}
|
|
70418
70430
|
}
|
|
70419
70431
|
|
|
70420
|
-
if (!isInClient)
|
|
70432
|
+
if (!isInClient)
|
|
70433
|
+
{
|
|
70434
|
+
if (!this.OnWheel_ZoomUpDownFrameY(e,x,y)) return;
|
|
70435
|
+
}
|
|
70421
70436
|
|
|
70422
70437
|
if(e.preventDefault) e.preventDefault();
|
|
70423
70438
|
else e.returnValue = false;
|
|
70424
70439
|
}
|
|
70425
70440
|
|
|
70441
|
+
//通过滚轴缩放Y轴
|
|
70442
|
+
this.OnWheel_ZoomUpDownFrameY=function(e, x, y)
|
|
70443
|
+
{
|
|
70444
|
+
if (!this.EnableYDrag.Wheel) return false;
|
|
70445
|
+
|
|
70446
|
+
var dragY=this.TryYDrag(x,y);
|
|
70447
|
+
if (!dragY) return false;
|
|
70448
|
+
|
|
70449
|
+
if ((dragY.Left && !dragY.IsOverlay) || dragY.Right)
|
|
70450
|
+
{
|
|
70451
|
+
|
|
70452
|
+
}
|
|
70453
|
+
else
|
|
70454
|
+
{
|
|
70455
|
+
return false;
|
|
70456
|
+
}
|
|
70457
|
+
|
|
70458
|
+
var wheelValue=e.wheelDelta;
|
|
70459
|
+
if (!IFrameSplitOperator.IsObjectExist(e.wheelDelta))
|
|
70460
|
+
wheelValue=e.deltaY* -0.01;
|
|
70461
|
+
|
|
70462
|
+
var yMove=this.EnableYDrag.WheelYMove;
|
|
70463
|
+
if (wheelValue>0) yMove*=-1;
|
|
70464
|
+
dragY.Position=0; //只能两边缩放
|
|
70465
|
+
if (!this.Frame.OnZoomUpDownFrameY(dragY, yMove)) return false;
|
|
70466
|
+
|
|
70467
|
+
this.Frame.SetSizeChage(true);
|
|
70468
|
+
this.Draw();
|
|
70469
|
+
|
|
70470
|
+
return true;
|
|
70471
|
+
}
|
|
70472
|
+
|
|
70426
70473
|
//创建
|
|
70427
70474
|
//windowCount 窗口个数
|
|
70428
70475
|
this.Create=function(windowCount, option)
|
|
@@ -131358,6 +131405,13 @@ function SliderChart()
|
|
|
131358
131405
|
this.Canvas.fillRect(rtBar.Left, rtBar.Top, rtBar.Width, rtBar.Height);
|
|
131359
131406
|
this.AryRect.push({ Rect:rtBar, Type:2});
|
|
131360
131407
|
|
|
131408
|
+
//最右边可能是空白区 要处理下
|
|
131409
|
+
if (endData.Type==1)
|
|
131410
|
+
{
|
|
131411
|
+
var dataIndex=this.OffsetData.End;
|
|
131412
|
+
if (dataIndex>=this.Data.Data.length) endData.Data=this.Data.Data[this.Data.Data.length-1];
|
|
131413
|
+
}
|
|
131414
|
+
|
|
131361
131415
|
this.DrawDateTime(startData);
|
|
131362
131416
|
this.DrawDateTime(endData);
|
|
131363
131417
|
}
|
|
@@ -131647,7 +131701,7 @@ function HQChartScriptWorker()
|
|
|
131647
131701
|
|
|
131648
131702
|
|
|
131649
131703
|
|
|
131650
|
-
var HQCHART_VERSION="1.1.
|
|
131704
|
+
var HQCHART_VERSION="1.1.12794";
|
|
131651
131705
|
|
|
131652
131706
|
function PrintHQChartVersion()
|
|
131653
131707
|
{
|