hqchart
Version:
HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接
1,049 lines (882 loc) • 3.91 MB
JavaScript
/*
Copyright (c) 2018 jones
http://www.apache.org/licenses/LICENSE-2.0
开源项目 https://github.com/jones2000/HQChart
jones_2000@163.com
封装行情类图形控件 (H5版本)
*/
//日志输出类
if (!JSConsole)
{
var JSConsole=
{
Chart:{ Log:console.log, Warn:console.warn }, //图形日志
Complier:{ Log:console.log, Warn:console.warn } //编译器日志
};
}
function JSChart(divElement, bOffscreen, bCacheCanvas)
{
this.DivElement=divElement;
this.JSChartContainer; //画图控件
this.ResizeListener;
//h5 canvas
this.CanvasElement=document.createElement("canvas");
this.CanvasElement.className='jschart-drawing';
this.CanvasElement.id=Guid();
this.CanvasElement.setAttribute("tabindex",0);
if (this.CanvasElement.style)
{
this.CanvasElement.style.outline='none';
//this.CanvasElement.style.position="absolute"; //外部自己设置
}
if(divElement.hasChildNodes())
{
JSConsole.Chart.Log("[JSChart::JSChart] divElement hasChildNodes", divElement.childNodes);
}
divElement.appendChild(this.CanvasElement);
//离屏
this.OffscreenCanvasElement;
if (bOffscreen==true) this.OffscreenCanvasElement=document.createElement("canvas");
//图形缓存
this.CacheCanvasElement=null;
if (bCacheCanvas) this.CacheCanvasElement=document.createElement("canvas");
//额外的画布
this.MapExtraCanvasElement=new Map(); //key=画布名字, value={ Element:, Canvas:}
this.CreateExtraCanvasElement=function(name, option)
{
if (this.MapExtraCanvasElement.has(name)) return this.MapExtraCanvasElement.get(name);
var element=document.createElement("canvas");
element.className='jschart-drawing-extra';
element.id=Guid();
if (name==JSChart.CorssCursorCanvasKey)
element.setAttribute("tabindex",5);
else
element.setAttribute("tabindex",1);
if (element.style)
{
element.style.outline='none';
element.style.position="absolute";
element.style.left='0px';
element.style.top='0px';
element.style["pointer-events"]="none";
}
if (option)
{
if (IFrameSplitOperator.IsNumber(option.TabIndex)) element.setAttribute("tabindex",option.TabIndex);
if (IFrameSplitOperator.IsNumber(option.ZIndex)) element.style["z-index"]=option.ZIndex;
}
if (this.CanvasElement)
{
element.height=this.CanvasElement.height;
element.width=this.CanvasElement.width;
if (element.style)
{
element.style.width=this.CanvasElement.style.width;
element.style.height=this.CanvasElement.style.height
}
}
divElement.appendChild(element);
var item={ Element:element, Canvas:null };
this.MapExtraCanvasElement.set(name, item);
}
this.GetExtraCanvas=function(name)
{
if (!this.MapExtraCanvasElement.has(name)) return null;
var item=this.MapExtraCanvasElement.get(name);
if (!item.Element) return null;
if (!item.Canvas) item.Canvas=item.Element.getContext("2d");
return item;
}
/*
{ Type: 1=K线柱子宽度不变 2=K线全部显示
Redraw:是否重绘, XYSplit:是否重新计算分割线 }
*/
this.OnSize=function(option)
{
//画布大小通过div获取 如果有style里的大小 使用style里的
var height=this.DivElement.offsetHeight;
var width=this.DivElement.offsetWidth;
var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率s
if (this.DivElement.style.height && this.DivElement.style.width)
{
if (this.DivElement.style.height.includes("px"))
height=parseInt(this.DivElement.style.height.replace("px",""));
if (this.DivElement.style.width.includes("px"))
width=parseInt(this.DivElement.style.width.replace("px",""));
}
this.CanvasElement.style.width=`${width}px`;
this.CanvasElement.style.height=`${height}px`;
this.CanvasElement.height=parseInt(pixelTatio*height); //根据分辨率缩放
this.CanvasElement.width=parseInt(pixelTatio*width);
if (this.OffscreenCanvasElement)
{
this.OffscreenCanvasElement.height=this.CanvasElement.height;
this.OffscreenCanvasElement.width=this.CanvasElement.width;
}
if (this.CacheCanvasElement)
{
this.CacheCanvasElement.height=this.CanvasElement.height;
this.CacheCanvasElement.width=this.CanvasElement.width;
}
for(var mapItem of this.MapExtraCanvasElement)
{
var item=mapItem[1];
var element=item.Element;
if (!element) continue;
element.height=this.CanvasElement.height;
element.width=this.CanvasElement.width;
element.style.width=this.CanvasElement.style.width;
element.style.height=this.CanvasElement.style.height;
}
JSConsole.Chart.Log(`[JSChart::OnSize] devicePixelRatio=${window.devicePixelRatio}, height=${this.CanvasElement.height}, width=${this.CanvasElement.width}`);
if (option && option.Redraw==false) return;
if (this.JSChartContainer)
{
if (option && option.XYSplit===true) this.JSChartContainer.ResetFrameXYSplit();
if (this.JSChartContainer.OnSize && option && option.Type==1) //K线宽度不变
{
this.JSChartContainer.OnSize();
}
else if (this.JSChartContainer.ShowAllKLine && option && option.Type==2)
{
this.JSChartContainer.ShowAllKLine();
}
else
{
if (this.JSChartContainer.Frame) this.JSChartContainer.Frame.SetSizeChage(true);
this.JSChartContainer.Draw();
}
}
}
//手机屏需要调整 间距
this.AdjustChartBorder=function(chart)
{
var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
chart.Frame.ChartBorder.Left*=pixelTatio;
chart.Frame.ChartBorder.Right*=pixelTatio;
chart.Frame.ChartBorder.Top*=pixelTatio;
chart.Frame.ChartBorder.Bottom*=pixelTatio;
if (chart.Frame.AutoLeftBorder)
{
var item=chart.Frame.AutoLeftBorder;
if (IFrameSplitOperator.IsNumber(item.MinWidth)) item.MinWidth*=pixelTatio;
if (IFrameSplitOperator.IsNumber(item.Blank)) item.Blank*=pixelTatio;
}
if (chart.Frame.AutoRightBorder)
{
var item=chart.Frame.AutoRightBorder;
if (IFrameSplitOperator.IsNumber(item.MinWidth)) item.MinWidth*=pixelTatio;
if (IFrameSplitOperator.IsNumber(item.Blank)) item.Blank*=pixelTatio;
}
}
this.AdjustTitleHeight=function(chart)
{
var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
for(var i=0;i<chart.Frame.SubFrame.length;++i)
{
chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight*=pixelTatio;
}
chart.ChartCorssCursor.TextHeight*=pixelTatio; //十字光标文本信息高度
}
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);
}
}
/////////////////////////////////////////////////////////////////////////////////
//属性设置
//
this.SetPressKeyboardConfig=function(chart, option)
{
if (!chart || !option) return;
if (IFrameSplitOperator.IsBool(option.PauseUpdate)) chart.PressKeyboardConfig.PauseUpdate=option.PauseUpdate;
}
//缺口设置 KLine:{ PriceGap:{ Enable, Count } }
this.SetPriceGapConfig=function(chart, option)
{
if (!option || !option.PriceGap) return;
var klineChart=chart.ChartPaint[0];
if (!klineChart) return;
var item=option.PriceGap;
if (IFrameSplitOperator.IsBool(item.Enable)) klineChart.PriceGap.Enable=item.Enable;
if (IFrameSplitOperator.IsNumber(item.Count)) klineChart.PriceGap.Count=item.Count;
}
//历史K线图
this.CreateKLineChartContainer=function(option)
{
var chart=null;
if (option.Type==="历史K线图横屏") chart=new KLineChartHScreenContainer(this.CanvasElement);
else chart=new KLineChartContainer(this.CanvasElement,this.OffscreenCanvasElement,this.CacheCanvasElement);
chart.GetExtraCanvas=(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();
//右键菜单
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.IsNumber(option.ShiftMoveStep)) chart.ShiftMoveStep=option.ShiftMoveStep;
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 (item.LButton && IFrameSplitOperator.IsNumber(item.LButton.Type)) chart.EnableXDrag.LButton.Type=item.LButton.Type;
if (item.RButton && IFrameSplitOperator.IsNumber(item.RButton.Type)) chart.EnableXDrag.RButton.Type=item.RButton.Type;
}
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线图的属性设置
{
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; //兼容老版本
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"
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.CustomShow && IFrameSplitOperator.IsPlusNumber(option.CustomShow.Date))
{
var item=option.CustomShow;
chart.CustomShow={ Date:item.Date };
if (IFrameSplitOperator.IsNumber(item.Time)) chart.CustomShow.Time=item.Time;
if (IFrameSplitOperator.IsPlusNumber(item.PageSize)) chart.CustomShow.PageSize=item.PageSize;
}
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) //画图工具
{
if (option.DrawPicture.StorageKey && chart.ChartDrawStorage) chart.ChartDrawStorage.SetKey(option.DrawPicture.StorageKey);
}
if (option.DrawTool) //画图工具
{
var item=option.DrawTool;
if (chart.ChartDrawStorage)
{
if (item.StorageKey) chart.ChartDrawStorage.SetKey(item.StorageKey);
if (IFrameSplitOperator.IsBool(item.EnableCrossPeriod)) chart.ChartDrawStorage.EnableCrossPeriod=item.EnableCrossPeriod;
}
}
if (chart.ChartDrawStorage) chart.ChartDrawStorage.Load();
if (option.KeyboardMove)
{
var item=option.KeyboardMove;
if (IFrameSplitOperator.IsPlusNumber(item.Delay)) chart.KeyboardMove.Delay=item.Delay;
if (IFrameSplitOperator.IsPlusNumber(item.PressTime)) chart.KeyboardMove.PressTime=item.PressTime;
}
if (IFrameSplitOperator.IsNumber(option.StepPixel)) chart.StepPixel=option.StepPixel;
if (option.ZoomStepPixel>0) chart.ZoomStepPixel=option.ZoomStepPixel;
if (option.IsApiPeriod==true) chart.IsApiPeriod=option.IsApiPeriod;
//图形选中
if (option.SelectedChart)
{
var item=option.SelectedChart;
if (IFrameSplitOperator.IsBool(item.EnableSelected)) chart.SelectedChart.EnableSelected=item.EnableSelected;
if (IFrameSplitOperator.IsBool(item.EnableMoveOn)) chart.SelectedChart.EnableMoveOn=item.EnableMoveOn;
}
if (option.PressKeyboardConfig) this.SetPressKeyboardConfig(chart, option.PressKeyboardConfig);
if (!option.Windows || option.Windows.length<=0) return null;
//K线扩展计算方法配置
if (IFrameSplitOperator.IsNonEmptyArray(option.KLineCalcOption))
{
for(var i=0;i<option.KLineCalcOption.length;++i)
{
var item=option.KLineCalcOption[i];
if (!item.ClassName || !item.Option) continue;
chart.SetKLineCalcOption(item.ClassName, item.Option);
}
}
if (option.FastSlide)
{
var item=option.FastSlide;
if (IFrameSplitOperator.IsNumber(item.MinDistance)) chart.FastSlideConfig.MinDistance=item.MinDistance;
if (IFrameSplitOperator.IsNumber(item.MinSpeed)) chart.FastSlideConfig.MinSpeed=item.MinSpeed;
if (IFrameSplitOperator.IsNumber(item.MaxTime)) chart.FastSlideConfig.MaxTime=item.MaxTime;
if (IFrameSplitOperator.IsBool(item.Enable)) chart.FastSlideConfig.Enable=item.Enable;
}
if (chart.ClassName=="KLineChartContainer")
{
if (!option.DragSelectRect)
{
option.DragSelectRect={ Enable:true }; //默认开启区间选中画布
}
if (option.DragSelectRect)
{
var zindex=10;
var item=option.DragSelectRect;
if (IFrameSplitOperator.IsNumber(item.ZIndex)) zindex=item.ZIndex;
if (item.Enable) this.CreateExtraCanvasElement(JSChart.RectDragCanvasKey, { ZIndex:zindex }); //创建独立的区间选择画布
}
if (option.DragKLine)
{
var item=option.DragKLine;
if (IFrameSplitOperator.IsBool(item.EnableShfit)) chart.KLineDragConfig.EnableShfit=item.EnableShfit;
}
}
//创建子窗口
chart.Create(option.Windows.length, option);
this.SetChartBorder(chart, option);
this.AdjustChartBorder(chart);
if (option.KLine)
{
if (option.KLine.PageSize > 0) //一屏显示的数据个数
{
let pageSize = chart.GetMaxMinPageSize();
if (pageSize.Max>10 && pageSize.Max < option.KLine.PageSize) chart.PageSize = pageSize.Max;
else if (pageSize.Min>10 && pageSize.Min> option.KLine.PageSize) chart.PageSize=pageSize.Min;
else chart.PageSize = option.KLine.PageSize;
}
}
//取消显示十字光标刻度信息
if (option.IsCorssOnlyDrawKLine===true) chart.ChartCorssCursor.IsOnlyDrawKLine=option.IsCorssOnlyDrawKLine;
if (option.CorssCursorTouchEnd===true) chart.CorssCursorTouchEnd = option.CorssCursorTouchEnd;
if (option.IsClickShowCorssCursor==true) chart.IsClickShowCorssCursor=option.IsClickShowCorssCursor;
if (option.CorssCursorInfo)
{
var item=option.CorssCursorInfo;
if (!isNaN(option.CorssCursorInfo.Left)) chart.ChartCorssCursor.ShowTextMode.Left=option.CorssCursorInfo.Left;
if (!isNaN(option.CorssCursorInfo.Right)) chart.ChartCorssCursor.ShowTextMode.Right=option.CorssCursorInfo.Right;
if (!isNaN(option.CorssCursorInfo.Bottom)) chart.ChartCorssCursor.ShowTextMode.Bottom=option.CorssCursorInfo.Bottom;
if (option.CorssCursorInfo.IsShowCorss===false) chart.ChartCorssCursor.IsShowCorss=option.CorssCursorInfo.IsShowCorss;
if (IFrameSplitOperator.IsBool(item.IsShowClose)) chart.ChartCorssCursor.IsShowClose = item.IsShowClose; //Y轴显示收盘价
if (IFrameSplitOperator.IsBool(item.IsOnlyDrawKLine)) chart.ChartCorssCursor.IsOnlyDrawKLine = item.IsOnlyDrawKLine; //Y轴显示收盘价
if (option.CorssCursorInfo.PressTime) chart.PressTime=option.CorssCursorInfo.PressTime; //长按显示十字光标的时间
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.HPenType)) chart.ChartCorssCursor.HPenType=option.CorssCursorInfo.HPenType;
if (option.CorssCursorInfo.VPenType>0) chart.ChartCorssCursor.VPenType=option.CorssCursorInfo.VPenType;
if (IFrameSplitOperator.IsNumber(item.VLineType)) chart.ChartCorssCursor.VLineType=item.VLineType;
if (option.CorssCursorInfo.DateFormatType>0) chart.ChartCorssCursor.StringFormatX.DateFormatType=option.CorssCursorInfo.DateFormatType;
if (IFrameSplitOperator.IsBool(item.IsDrawXRangeBG)) chart.ChartCorssCursor.IsDrawXRangeBG=item.IsDrawXRangeBG;
if (IFrameSplitOperator.IsBool(option.CorssCursorInfo.IsFixXLastTime)) chart.ChartCorssCursor.IsFixXLastTime=option.CorssCursorInfo.IsFixXLastTime;
if (IFrameSplitOperator.IsNumber(item.TextHeight)) chart.ChartCorssCursor.TextHeight=item.TextHeight;
if (item.RightButton)
{
if (IFrameSplitOperator.IsBool(item.RightButton.Enable)) chart.ChartCorssCursor.RightButton.Enable=item.RightButton.Enable;
}
if (item.BottomButton)
{
var subItem=item.BottomButton;
if (IFrameSplitOperator.IsBool(subItem.Enable)) chart.ChartCorssCursor.BottomButton.Enable=subItem.Enable;
}
if (IFrameSplitOperator.IsNumber(item.PriceFormatType)) chart.ChartCorssCursor.StringFormatY.PriceFormatType=item.PriceFormatType;
if (IFrameSplitOperator.IsNumber(item.DataFormatType)) chart.ChartCorssCursor.StringFormatY.DataFormatType=item.DataFormatType;
if (IFrameSplitOperator.IsBool(item.EnableKeyboard)) chart.ChartCorssCursor.EnableKeyboard=item.EnableKeyboard;
if (IFrameSplitOperator.IsBool(item.EnableDBClick)) chart.ChartCorssCursor.EnableDBClick=item.EnableDBClick;
if (IFrameSplitOperator.IsBool(item.IsShowCorssPoint)) chart.ChartCorssCursor.CorssPointConfig.Enable=item.IsShowCorssPoint;
if (item.RangeIncrease)
{
var subItem=item.RangeIncrease;
if (IFrameSplitOperator.IsBool(subItem.IsShow)) chart.ChartCorssCursor.StringFormatX.RangeIncrease.IsShow=subItem.IsShow;
if (IFrameSplitOperator.IsNumber(subItem.Formula)) chart.ChartCorssCursor.StringFormatX.RangeIncrease.Formula=subItem.Formula;
}
}
//保存十字光标文字高度
option.CorssCursor={};
option.CorssCursor.TitleHeight=chart.ChartCorssCursor.TextHeight;
if (IFrameSplitOperator.IsNumber(option.SplashTitlePosition))
{
if (chart.ChartSplashPaint) chart.ChartSplashPaint.Position=option.SplashTitlePosition;
}
if (option.Frame)
{
for(var i=0;i<option.Frame.length;++i)
{
var item=option.Frame[i];
if (!chart.Frame.SubFrame[i]) continue;
chart.SetSubFrameAttribute(chart.Frame.SubFrame[i], null, item);
/* 窗口设置全部移动到 SetSubFrameAttribute
var subFrame=chart.Frame.SubFrame[i].Frame;
if (IFrameSplitOperator.IsNumber(item.SplitCount)) chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;
if (item.StringFormat) chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;
if (IFrameSplitOperator.IsNumber(item.FloatPrecision)) chart.Frame.SubFrame[i].Frame.YSplitOperator.FloatPrecision=item.FloatPrecision;
if (item.Custom) chart.Frame.SubFrame[i].Frame.YSplitOperator.Custom=item.Custom;
if (IFrameSplitOperator.IsNumber(item.SplitType))
{
chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitType=item.SplitType;
chart.Frame.SubFrame[i].Frame.YSplitOperator.DefaultSplitType=item.SplitType;
}
if (IFrameSplitOperator.IsNumber(item.FilterType)) subFrame.YSplitOperator.FilterType=item.FilterType;
if (!isNaN(item.Height)) chart.Frame.SubFrame[i].Height = item.Height;
if (item.IsShowLeftText===false || item.IsShowLeftText===true)
{
chart.Frame.SubFrame[i].Frame.IsShowYText[0]=item.IsShowLeftText;
chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowLeftText=item.IsShowLeftText; //显示左边刻度
}
if (item.IsShowRightText===false || item.IsShowRightText===true)
{
chart.Frame.SubFrame[i].Frame.IsShowYText[1]=item.IsShowRightText;
chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowRightText=item.IsShowRightText; //显示右边刻度
}
if (item.TopSpace>=0) chart.Frame.SubFrame[i].Frame.ChartBorder.TopSpace=item.TopSpace*pixelRatio;
if (item.BottomSpace>=0) chart.Frame.SubFrame[i].Frame.ChartBorder.BottomSpace=item.BottomSpace*pixelRatio;
if (item.RightTextPosition>0) chart.Frame.SubFrame[i].Frame.YTextPosition[1]=item.RightTextPosition;
if (item.LeftTextPosition>0) chart.Frame.SubFrame[i].Frame.YTextPosition[0]=item.LeftTextPosition;
if (item.IsShowXLine==false) chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;
if (item.IsShowYLine==false) chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;
if (IFrameSplitOperator.IsNumber(item.YTextBaseline)) chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;
if (item.YCoordinateType>0) chart.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType=item.YCoordinateType;
if (item.IsYReverse==true) chart.Frame.SubFrame[0].Frame.CoordinateType=1; //反转坐标
if (IFrameSplitOperator.IsNumber(item.PercentageTextFormat)) subFrame.YSplitOperator.PercentageTextFormat=item.PercentageTextFormat; //百分比坐标格式
if (item.DefaultYMaxMin) chart.Frame.SubFrame[i].Frame.YSplitOperator.DefaultYMaxMin=item.DefaultYMaxMin;
if (IFrameSplitOperator.IsBool(item.EnableRemoveZero)) chart.Frame.SubFrame[i].Frame.YSplitOperator.EnableRemoveZero=item.EnableRemoveZero;
if (IFrameSplitOperator.IsPlusNumber(item.MinYDistance)) chart.Frame.SubFrame[i].Frame.MinYDistance=item.MinYDistance;
if (IFrameSplitOperator.IsNumber(item.BorderLine)) chart.Frame.SubFrame[i].Frame.BorderLine=item.BorderLine;
if (IFrameSplitOperator.IsBool(item.IsShowIndexTitle)) chart.Frame.SubFrame[i].Frame.IsShowIndexTitle=item.IsShowIndexTitle;
if (IFrameSplitOperator.IsBool(item.IsDrawTitleBottomLine)) subFrame.IsDrawTitleBottomLine=item.IsDrawTitleBottomLine;
if (IFrameSplitOperator.IsBool(item.IsShowNameArrow)) chart.Frame.SubFrame[i].Frame.IsShowNameArrow=item.IsShowNameArrow;
if (item.ClientBGColor) subFrame.ClientBGColor=item.ClientBGColor;
*/
}
}
if (option.KLine)
{
var item=option.KLine;
var klineChart=chart.ChartPaint[0];
if (option.KLine.ShowKLine == false) klineChart.IsShow = false;
if (option.KLine.InfoPosition>0) klineChart.InfoPosition=option.KLine.InfoPosition;
if (IFrameSplitOperator.IsBool(item.IsShowMaxMinPrice)) klineChart.IsShowMaxMinPrice=item.IsShowMaxMinPrice;
if (IFrameSplitOperator.IsNumber(item.OneLimitBarType)) klineChart.OneLimitBarType=item.OneLimitBarType;
if (IFrameSplitOperator.IsNumber(item.UnchangeBarType)) klineChart.UnchangeBarType=item.UnchangeBarType;
if (IFrameSplitOperator.IsBool(item.EnablePrediction)) klineChart.PredictionConfig.Enable=item.EnablePrediction;
if (IFrameSplitOperator.IsBool(item.EnableDaySummary)) klineChart.DaySummary.Enable=item.EnableDaySummary;
this.SetPriceGapConfig(chart, option.KLine);
}
if(option.KLineTitle)
{
var item=option.KLineTitle;
var chartTitle=chart.TitlePaint[0];
if(option.KLineTitle.IsShowName==false) chart.TitlePaint[0].IsShowName=false;
if(option.KLineTitle.IsShowSettingInfo==false) chart.TitlePaint[0].IsShowSettingInfo=false;
if(option.KLineTitle.IsShow == false) chart.TitlePaint[0].IsShow = false;
if (IFrameSplitOperator.IsBool(item.IsShowDateTime)) chartTitle.IsShowDateTime=item.IsShowDateTime;
if (IFrameSplitOperator.IsBool(item.IsTitleShowLatestData)) chart.IsTitleShowLatestData=item.IsTitleShowLatestData;
if (item.ShowPosition || item.ShowPostion) //显示位置高级配置
{
var subItem=item.ShowPostion;
if (item.ShowPosition) subItem=item.ShowPosition;
if (!chartTitle.ShowPositionConfig) chartTitle.ShowPositionConfig={ Margin:{ } };
if (IFrameSplitOperator.IsNumber(subItem.Type)) chartTitle.ShowPositionConfig.Type=subItem.Type;
if (subItem.Margin)
{
if (IFrameSplitOperator.IsNumber(subItem.Margin.Left)) chartTitle.ShowPositionConfig.Margin.Left=subItem.Margin.Left;
if (IFrameSplitOperator.IsNumber(subItem.Margin.Right)) chartTitle.ShowPositionConfig.Margin.Right=subItem.Margin.Right;
if (IFrameSplitOperator.IsNumber(subItem.Margin.Bottom)) chartTitle.ShowPositionConfig.Margin.Bottom=subItem.Margin.Bottom;
}
}
}
//叠加股票
if (option.Overlay)
{
for(var i=0;i<option.Overlay.length;++i)
{
var item=option.Overlay[i];
chart.OverlaySymbol(item.Symbol,item);
}
}
if (option.ExtendChart)
{
for(var i=0;i<option.ExtendChart.length;++i)
{
var item=option.ExtendChart[i];
chart.CreateExtendChart(item.Name, item);
}
}
//创建子窗口的指标
var scriptData = new JSIndexScript();
if (option.ColorIndex) //五彩K线
{
var item=option.ColorIndex;
let indexInfo=scriptData.Get(item.Index);
if (indexInfo)
{
indexInfo.ID=item.Index;
chart.ColorIndex=new ScriptIndex(indexInfo.Name, indexInfo.Script, indexInfo.Args,indexInfo); //脚本执行
}
}
if (option.TradeIndex) //交易指标
{
var item=option.TradeIndex;
let indexInfo=scriptData.Get(item.Index);
if (indexInfo)
{
indexInfo.ID=item.Index;
chart.TradeIndex=new ScriptIndex(indexInfo.Name, indexInfo.Script, indexInfo.Args,indexInfo); //脚本执行
}
}
for(var i=0;i<option.Windows.length;++i)
{
var item=option.Windows[i];
if (item.Script)
{
chart.WindowIndex[i]=new ScriptIndex(item.Name,item.Script,item.Args,item); //脚本执行
}
else if (item.JsonData)
{
chart.WindowIndex[i]=new JsonDataIndex(item.Name,item.Script,item.Args,item); //脚本执行
}
else if (item.Local && item.Local.Data)
{
chart.WindowIndex[i]=new LocalJsonDataIndex(item.Local.Name,item.Local.Args,{JsonData:item.Local.Data});
}
else if (item.API) //使用API挂接指标数据 API:{ Name:指标名字, Script:指标脚本可以为空, Args:参数可以为空, Url:指标执行地址 }
{
var apiItem=item.API;
chart.WindowIndex[i]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,item);
}
else
{
let indexItem=JSIndexMap.Get(item.Index);
if (indexItem)
{
chart.WindowIndex[i]=indexItem.Create(item.Option);
if (chart.WindowIndex[i].SetArgs) chart.WindowIndex[i].SetArgs(item.Args);
chart.CreateWindowIndex(i);
}
else
{
var scriptData = new JSIndexScript();
let indexInfo = scriptData.Get(item.Index);
if (!indexInfo) continue;
JSIndexScript.ModifyAttribute(indexInfo, item);
indexInfo.ID=item.Index;
chart.WindowIndex[i] = new ScriptIndex(indexInfo.Name, indexInfo.Script, indexInfo.Args,indexInfo); //脚本执行
if (item.StringFormat>0) chart.WindowIndex[i].StringFormat=item.StringFormat;
if (item.FloatPrecision>=0) chart.WindowIndex[i].FloatPrecision=item.FloatPrecision;
}
}
chart.SetSubFrameAttribute(chart.Frame.SubFrame[i],item, null)
/* 窗口设置全部移动到 SetSubFrameAttribute
var frame=chart.Frame.SubFrame[i].Frame;
if (IFrameSplitOperator.IsBool(item.Modify)) frame.ModifyIndex=item.Modify;
if (IFrameSplitOperator.IsBool(item.Change)) frame.ChangeIndex=item.Change;
if (IFrameSplitOperator.IsBool(item.Close)) frame.CloseIndex=item.Close;
if (IFrameSplitOperator.IsBool(item.Overlay)) frame.OverlayIndex=item.Overlay;
if (IFrameSplitOperator.IsBool(item.Export)) frame.ExportData=item.Export;
if (IFrameSplitOperator.IsBool(item.MaxMin)) chart.Frame.SubFrame[i].Frame.MaxMinWindow=item.MaxMin;
if (IFrameSplitOperator.IsBool(item.TitleWindow)) chart.Frame.SubFrame[i].Frame.TitleWindow=item.TitleWindow;
if (IFrameSplitOperator.IsBool(item.AddIndexWindow)) frame.AddIndexWindow=item.AddIndexWindow;
if (IFrameSplitOperator.IsBool(item.IndexHelp)) frame.IndexHelp=item.IndexHelp;
if (item.IsDrawTitleBG==true) chart.Frame.SubFrame[i].Frame.IsDrawTitleBG=item.IsDrawTitleBG;
if (IFrameSplitOperator.IsBool(item.IsShowNameArrow)) chart.Frame.SubFrame[i].Frame.IsShowNameArrow=item.IsShowNameArrow;
if (IFrameSplitOperator.IsNumber(item.TitleHeight)) chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight=item.TitleHeight;
else item.TitleHeight=chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight;
if (IFrameSplitOperator.IsBool(item.IsShowTitleArrow)) frame.IsShowTitleArrow=item.IsShowTitleArrow;
if (IFrameSplitOperator.IsNumber(item.TitleArrowType)) frame.TitleArrowType=item.TitleArrowType;
if (item.IsShowIndexName==false) chart.Frame.SubFrame[i].Frame.IsShowIndexName=false;
if (item.IsShowOverlayIndexName==false) chart.Frame.SubFrame[i].Frame.IsShowOverlayIndexName=false;
if (IFrameSplitOperator.IsNumber(item.IndexParamSpace)) chart.Frame.SubFrame[i].Frame.IndexParamSpace=item.IndexParamSpace;
if (IFrameSplitOperator.IsNumber(item.IndexTitleSpace)) chart.Frame.SubFrame[i].Frame.IndexTitleSpace=item.IndexTitleSpace;
if (!IFrameSplitOperator.IsUndefined(item.HorizontalReserved)) frame.HorizontalReserved=item.HorizontalReserved;
if (item.OverlayIndexType)
{
if (IFrameSplitOperator.IsNumber(item.OverlayIndexType.Position)) chart.Frame.SubFrame[i].Frame.OverlayIndexType.Position=item.OverlayIndexType.Position;
if (IFrameSplitOperator.IsNumber(item.OverlayIndexType.LineSpace)) chart.Frame.SubFrame[i].Frame.OverlayIndexType.LineSpace=item.OverlayIndexType.LineSpace;
}
*/
}
//叠加指标宽度
if (option.OverlayIndexFrameWidth>40) chart.Frame.FixedRightWidth.Overlay=option.OverlayIndexFrameWidth;
//叠加指标
if (IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex))
{
for(var i=0;i<option.OverlayIndex.length;++i)
{
var item=option.OverlayIndex[i];
if (item.Windows>=chart.Frame.SubFrame.length) continue;
var itemString = JSON.stringify(item);
var obj = JSON.parse(itemString);
if (item.Index) obj.IndexName=item.Index;
if (item.Windows>=0) obj.WindowIndex=item.Windows;
chart.CreateOverlayWindowsIndex(obj);
}
}
this.AdjustTitleHeight(chart);
if (option.LatestPointFlash)
{
var item=option.LatestPointFlash;
if (item.Enable)
{
var zIndex=6;
if (IFrameSplitOperator.IsNumber(item.ZIndex)) zIndex=item.ZIndex;
this.CreateExtraCanvasElement(JSChart.LatestPointFlashKey, { ZIndex:zIndex });
chart.CreateExtendChart("LatestPointFlashPaint", item);
chart.StartLatestPointFlash();
}
}
if (option.KLineCountDown)
{
var item=option.KLineCountDown;
if (item.Enable)
{
var zIndex=4;
if (IFrameSplitOperator.IsNumber(item.ZIndex)) zIndex=item.ZIndex;
this.CreateExtraCanvasElement(JSChart.KLineCountDownKey, { ZIndex:zIndex });
chart.CreateExtendChart("KLineCountDownPaint", item);
chart.StartCountDown();
}
}
return chart;
}
//自定义指数历史K线图
this.CreateCustomKLineChartContainer=function(option)
{
var chart=new CustomKLineChartContainer(this.CanvasElement);
//右键菜单
if (IFrameSplitOperator.IsBool(option.IsShowRightMenu)) chart.IsShowRightMenu=option.IsShowRightMenu;
if (option.KLine) //k线图的属性设置
{
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.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.PageSize>0) chart.PageSize=option.KLine.PageSize;
if (option.KLine.IsShowTooltip==false) chart.IsShowTooltip=false;
}
if (option.CustomStock) chart.CustomStock=option.CustomStock;
if (option.QueryDate) chart.QueryDate=option.QueryDate;
if (!option.Windows || option.Windows.length<=0) return null;
//创建子窗口
chart.Create(option.Windows.length);
if (option.Border)
{
if (!isNaN(option.Border.Left)) chart.Frame.ChartBorder.Left=option.Border.Left;
if (!isNaN(option.Border.Right)) chart.Frame.ChartBorder.Right=option.Border.Right;
if (!isNaN(option.Border.Top)) chart.Frame.ChartBorder.Top=option.Border.Top;
}
if (option.IsShowCorssCursorInfo==false) //取消显示十字光标刻度信息
{
chart.ChartCorssCursor.IsShowText=option.IsShowCorssCursorInfo;
}
if (option.Frame)
{
for(var i=0;i<option.Frame.length;++i)
{
var item=option.Frame[i];
if (item.SplitCount) chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;
if (item.StringFormat) chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;
}
}
if(option.KLineTitle)
{
if(option.KLineTitle.IsShowName==false) chart.TitlePaint[0].IsShowName=false;
if(option.KLineTitle.IsShowSettingInfo==false) chart.TitlePaint[0].IsShowSettingInfo=false;
}
//创建子窗口的指标
let scriptData = new JSIndexScript();
for(var i=0;i<option.Windows.length;++i)
{
var item=option.Windows[i];
if (item.Script)
{
chart.WindowIndex[i]=new ScriptIndex(item.Name,item.Script,item.Args,item); //脚本执行
}
else
{
let indexItem=JSIndexMap.Get(item.Index);
if (indexItem)
{
chart.WindowIndex[i]=indexItem.Create();
chart.CreateWindowIndex(i);
}
else
{
let indexInfo = scriptData.Get(item.Index);
if (!indexInfo) continue;
if (item.Lock) indexInfo.Lock=item.Lock;
chart.WindowIndex[i] = new ScriptIndex(indexInfo.Name, indexInfo.Script, indexInfo.Args,indexInfo); //脚本执行
}
}
if (item.Modify!=null)
chart.Frame.SubFrame[i].Frame.ModifyIndex=item.Modify;
if (item.Change!=null)
chart.Frame.SubFrame[i].Frame.ChangeIndex=item.Change;
if (!isNaN(item.TitleHeight)) chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight=item.TitleHeight;
}
return chart;
}
//分钟走势图
this.CreateMinuteChartContainer=function(option)
{
var chart=null;
if (option.Type==="分钟走势图横屏") chart=new MinuteChartHScreenContainer(this.CanvasElement);
else chart=new MinuteChartContainer(this.CanvasElement, this.OffscreenCanvasElement, this.CacheCanvasElement);
chart.GetExtraCanvas=(name)=>{ return this.GetExtraCanvas(name); }
if (option.EventCallback) this.SetEventCallback(chart, option.EventCallback);
if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
var pixelRatio=GetDevicePixelRatio();
var windowsCount=2;
if (option.Windows && option.Windows.length>0) windowsCount+=option.Windows.length; //指标窗口从第3个窗口开始
if (option.EnableScrollUpDown==true) chart.EnableScrollUpDown=option.EnableScrollUpDown;
if (option.DisableMouse==true) chart.DisableMouse=option.DisableMouse;
if (option.ScriptError) chart.ScriptErrorCallback=option.ScriptError; //指标执行错误回调
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.IsBool(option.EnableNewIndex)) chart.EnableNewIndex=option.EnableNewIndex;
if (IFrameSplitOperator.IsBool(option.EnableIndexChartDrag)) chart.EnableIndexChartDrag=option.EnableIndexChartDrag;
if (IFrameSplitOperator.IsBool(option.EnableVerifyRecvData)) chart.EnableVerifyRecvData=option.EnableVerifyRecvData;
if (IFrameSplitOperator.IsBool(option.EnableNightDayBG)) chart.EnableNightDayBG=option.EnableNightDayBG;
if (IFrameSplitOperator.IsNumber(option.MaxDayCount)) chart.MaxDayCount=option.MaxDayCount;
//老版本开启左键区间选择
if (IFrameSplitOperator.IsBool(option.EnableSelectRect))
{
if (!option.DragSelectRect) option.DragSelectRect={ };
option.DragSelectRect.Enable=true;
option.DragSelectRect.EnableLButton=true;
}
if (option.GlobalOption)
{
var item=option.GlobalOption;
if (IFrameSplitOperator.IsBool(item.IsValueFullRange)) chart.GlobalOption.IsValueFullRange=item.IsValueFullRange;
if (IFrameSplitOperator.IsNumber(item.XDateFormat)) chart.GlobalOption.XDateFormat=item.XDateFormat;
}
if (option.DisplayLatest)
{
var item=option.DisplayLatest;
if (IFrameSplitOperator.IsBool(item.Enable)) chart.DisplayLatestOption.Enable=item.Enable;
if (IFrameSplitOperator.IsNumber(item.DelayTime)) chart.DisplayLatestOption.DelayTime=item.DelayTime;
}
if (option.DrawDynamicInfo)
{
var item=option.DrawDynamicInfo;
if (IFrameSplitOperator.IsBool(item.Enable)) chart.DrawDynamicInfoOption.Enable=item.Enable;
if (IFrameSplitOperator.IsNumber(item.DelayTime)) chart.DrawDynamicInfoOption.DelayTime=item.DelayTime;
}
if (option.Minute) //分钟走势图属性设置
{
if (option.Minute.IsShowTooltip==false) chart.IsShowTooltip=false;
if (option.Minute.DragMode>=0) chart.DragMode=option.Minute.DragMode;
}
if (option.Language)
{
var value=g_JSChartLocalization.GetLanguageID(option.Language);
if (IFrameSplitOperator.IsNumber(value)) chart.LanguageID=value;
}
if (option.Info && option.Info.length>0) chart.SetMinuteInfo(option.Info,false);
if (option.DrawTool) //画图工具
{
if (option.DrawTool.StorageKey && chart.ChartDrawStorage) chart.ChartDrawStorage.SetKey(option.DrawTool.StorageKey);
}
if (chart.ChartDrawStorage) chart.ChartDrawStorage.Load();
if (option.BeforeOpen) //集合竞价
{
var item=option.BeforeOpen;
if (IFrameSplitOperator.IsBool(item.IsShow)) chart.IsShowBeforeData=item.IsShow;
if (IFrameSplitOperator.IsNumber(item.Width)) chart.ExtendWidth.Left=item.Width;
if (IFrameSplitOperator.IsBool(item.IsShowMultiDay)) chart.IsShowMultiDayBeforeData=item.IsShowMultiDay;
if (IFrameSplitOperator.IsNumber(item.MulitiDayWidth)) chart.MultiDayExtendWidth.Left=item.MulitiDayWidth;
}
if (option.AfterClose) //收盘集合竞价
{
var item=option.AfterClose;
if (IFrameSplitOperator.IsBool(item.IsShow)) chart.IsShowAfterData=item.IsShow;
if (IFrameSplitOperator.IsNumber(item.ShareVol)) chart.ShareAfterVol=item.ShareVol;
if (IFrameSplitOperator.IsNumber(item.Width)) chart.ExtendWidth.Right=item.Width;
if (IFrameSplitOperator.IsBool(item.IsShowMultiDay)) chart.IsShowMultiDayAfterData=item.IsShowMultiDay;
if (IFrameSplitOperator.IsNumber(item.MulitiDayWidth)) chart.MultiDayExtendWidth.Right=item.MulitiDayWidth;
}
//图形选中
if (option.SelectedChart)
{
var item=option.SelectedChart;
if (IFrameSplitOperator.IsBool(item.Enab