hqchart 1.1.14742 → 1.1.14750
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 +31 -15
- package/package.json +1 -1
- package/src/jscommon/umychart.deal.js +255 -7
- package/src/jscommon/umychart.js +19 -3
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +275 -11
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +275 -11
package/lib/umychart.vue.js
CHANGED
|
@@ -2009,7 +2009,7 @@ for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint
|
|
|
2009
2009
|
info.LineColor=item.Color;info.TextColor=g_JSChartResource.FrameLatestPrice.OverlayTextColor;if(item.Title)info.Title=item.Title;frame.CustomHorizontalInfo.push(info);}};this.OffscreenToShowCanvas=function(){if(!this.ShowCanvas)return;this.ShowCanvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);this.ShowCanvas.drawImage(this.OffscreenCanvasElement,0,0);};this.GetDrawStatus=function(){var status={Point:{X:this.LastPoint.X,Y:this.LastPoint.Y},IsOnTouch:this.IsOnTouch,CorssCursorTouchEnd:this.CorssCursorTouchEnd,IsTitleShowLatestData:this.IsTitleShowLatestData,IsMinuteChart:this.ClassName=="MinuteChartContainer"||this.ClassName=="MinuteChartHScreenContainer"?true:false};status.FrameID=this.Frame.PtInFrame(this.LastPoint.X,this.LastPoint.Y);return status;};this.InvokeBeforeDrawSplashScreenCallback=function(){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_BEFORE_DRAW_SPLASH_SCREEN);if(!event||!event.Callback)return null;var data={PreventDefault:false};event.Callback(event,data,this);return data;};this.DrawSplashScreen=function(option){var data=this.InvokeBeforeDrawSplashScreenCallback();if(data&&data.PreventDefault===true)return;if(this.Frame.ScreenImageData==null&&!this.CacheCanvas)return;if(this.Frame.ScreenImageData){this.Canvas.putImageData(this.Frame.ScreenImageData,0,0);}else if(this.CacheCanvas){this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);this.Canvas.drawImage(this.CacheElement,0,0);}var bgColor=g_JSChartResource.SplashScreen.BGColor;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(0,0,this.UIElement.width,this.UIElement.height);if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){var title=g_JSChartResource.SplashScreen.Title;if(option&&option.Title)title=option.Title;this.ChartSplashPaint.SetTitle(title);this.ChartSplashPaint.Draw();}};//十字光标坐标
|
|
2010
2010
|
this.GetCorssCursorPosition=function(){var position={LastPoint:{X:this.LastPoint.X,Y:this.LastPoint.Y},CursorIndex:this.CursorIndex};return position;};this.IsLockCorssCursor=function(){if(!this.GlobalOption||!this.GlobalOption.LockCorssCursor)return false;return this.GlobalOption.LockCorssCursor.X.Enable;};//画动态信息
|
|
2011
2011
|
this.DrawDynamicInfo=function(option){this.LastMouseStatus.MouseOnToolbar=null;//鼠标在工具栏按钮上
|
|
2012
|
-
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_BEFORE_DRAW_DYNAMIC_INFO);if(event&&event.Callback){var sendData={};event.Callback(event,sendData,this);}if(this.Frame.ScreenImageData==null&&!this.CacheCanvas)return;var isErase=false;if(this.ChartCorssCursor){if(this.ChartCorssCursor.PointX!=null||this.ChartCorssCursor.PointY!=null)isErase=true;}isErase=true;//每次都擦除背景
|
|
2012
|
+
if(this.ChartCorssCursor)this.ChartCorssCursor.Status=0;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_BEFORE_DRAW_DYNAMIC_INFO);if(event&&event.Callback){var sendData={};event.Callback(event,sendData,this);}if(this.Frame.ScreenImageData==null&&!this.CacheCanvas)return;var isErase=false;if(this.ChartCorssCursor){if(this.ChartCorssCursor.PointX!=null||this.ChartCorssCursor.PointY!=null)isErase=true;}isErase=true;//每次都擦除背景
|
|
2013
2013
|
if(isErase==false){for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.IsCallbackDraw)continue;if(item.IsDynamic&&item.IsEraseBG){isErase=true;break;}}}if(isErase){if(this.Frame.ScreenImageData){this.Canvas.putImageData(this.Frame.ScreenImageData,0,0);}else if(this.CacheCanvas){this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);this.Canvas.drawImage(this.CacheElement,0,0);}}if(this.Frame.DrawToolbar)this.Frame.DrawToolbar(this.LastMouseStatus);this.DrawSelectedStatus();this.DrawSelectedBorder();if(this.DrawSelectedXBorder)this.DrawSelectedXBorder();var moveonPoint=null;if(this.LastMouseStatus&&this.LastMouseStatus.MoveOnPoint)moveonPoint=this.LastMouseStatus.MoveOnPoint;this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_20,{MoveonPoint:moveonPoint,LastMouseStatus:this.LastMouseStatus});/*
|
|
2014
2014
|
for(var i=0;i<this.ExtendChartPaint.length;++i) //动态扩展图形
|
|
2015
2015
|
{
|
|
@@ -2587,7 +2587,7 @@ this.FrameData={SubFrameItem:null};//窗口框架信息
|
|
|
2587
2587
|
//画图工具刻度
|
|
2588
2588
|
this.DrawPicture={BGColor:g_JSChartResource.DrawPicture.XYCoordinate.BGColor,TextBGColor:g_JSChartResource.DrawPicture.XYCoordinate.TextBGColor,TextColor:g_JSChartResource.DrawPicture.XYCoordinate.TextColor,Font:g_JSChartResource.DrawPicture.XYCoordinate.Font};this.IChartFramePainting_ReloadResource=this.ReloadResource;this.ReloadResource=function(resource){this.IChartFramePainting_ReloadResource(resource);if(!resource){this.ToolbarButtonStyle=g_JSChartResource.ToolbarButtonStyle;this.CloseWindowButton=CloneData(g_JSChartResource.Buttons.CloseWindow);this.OverlayIndexButton=CloneData(g_JSChartResource.Buttons.OverlayIndex);this.ChangeIndexButton=CloneData(g_JSChartResource.Buttons.ChangeIndex);this.ModifyIndexParamButton=CloneData(g_JSChartResource.Buttons.ModifyIndexParam);this.MaxMinWindowButton=CloneData(g_JSChartResource.Buttons.MaxMinWindow);this.TitleWindowButton=CloneData(g_JSChartResource.Buttons.TitleWindow);this.ButtonTooltip=CloneData(g_JSChartResource.Buttons.Tooltip);this.AddIndexWindowButton=CloneData(g_JSChartResource.Buttons.AddIndexWindow);}};this.DrawFrame=function(){if(this.XPointCount>0){var dInterval=this.ChartBorder.GetWidth()/(6*this.XPointCount);//分6份, 数据4 间距2
|
|
2589
2589
|
this.DistanceWidth=2*dInterval;this.DataWidth=4*dInterval;}this.DrawHorizontal();this.DrawVertical();};this.DrawTitleButton=function(aryButton,moveonPoint,mouseStatus){var border=this.GetBorder();if(this.IsHScreen){var y=border.Bottom-3;var x=border.RightTitle+this.ChartBorder.TitleHeight/2;this.Canvas.save();this.Canvas.translate(x,y);this.Canvas.rotate(90*Math.PI/180);//底部开始画
|
|
2590
|
-
var yButton=0,xButton=0,bottom=0;for(var i=0;i<aryButton.length;++i){var item=aryButton[i];var size=item.Style.Size;var xButton=bottom-size-item.Style.MerginLeft;var font=size+'px '+item.Style.Family;var color=item.Style.Color;this.Canvas.fillStyle=color;this.Canvas.font=font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(item.Style.Text,xButton,0);var rtButton={Left:x-size/2,Right:x+size/2,Bottom:y,Width:size,Height:size+item.Style.MerginLeft};rtButton.Top=rtButton.Bottom-size-item.Style.MerginLeft;this.Buttons.push({ID:item.ID,Rect:rtButton});bottom=xButton;y=rtButton.Top;}this.Canvas.restore();}else{var right=border.
|
|
2590
|
+
var yButton=0,xButton=0,bottom=0;for(var i=0;i<aryButton.length;++i){var item=aryButton[i];var size=item.Style.Size;var xButton=bottom-size-item.Style.MerginLeft;var font=size+'px '+item.Style.Family;var color=item.Style.Color;this.Canvas.fillStyle=color;this.Canvas.font=font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(item.Style.Text,xButton,0);var rtButton={Left:x-size/2,Right:x+size/2,Bottom:y,Width:size,Height:size+item.Style.MerginLeft};rtButton.Top=rtButton.Bottom-size-item.Style.MerginLeft;this.Buttons.push({ID:item.ID,Rect:rtButton});bottom=xButton;y=rtButton.Top;}this.Canvas.restore();}else{var right=border.RightEx-3;var left=border.Left;var yButton=border.Top+this.ChartBorder.TitleHeight/2;this.ToolbarCacheSize={RToolbar:{Right:right,Left:right}//右往左绘制
|
|
2591
2591
|
};for(var i=0;i<aryButton.length;++i){var item=aryButton[i];var size=item.Style.Size;var xBotton=right-size-item.Style.MerginLeft;var font=size+'px '+item.Style.Family;var rtButton={Left:xBotton,Top:yButton-size/2,Right:xBotton+size+item.Style.MerginLeft,Bottom:yButton+size/2,Width:size+item.Style.MerginLeft,Height:size};var color=item.Style.Color;if(moveonPoint&&moveonPoint.X>=rtButton.Left&&moveonPoint.X<rtButton.Right&&moveonPoint.Y>=rtButton.Top&&moveonPoint.Y<=rtButton.Bottom){color=item.Style.MoveOnColor;if(mouseStatus)mouseStatus.MouseOnToolbar={Rect:rtButton,Item:item,Frame:this,Point:{X:moveonPoint.X,Y:moveonPoint.Y}};}this.Canvas.fillStyle=color;this.Canvas.font=font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(item.Style.Text,xBotton,yButton);this.Buttons.push({ID:item.ID,Rect:rtButton});this.ToolbarCacheSize.RToolbar.Left=rtButton.Left;right=xBotton;}}};this.DrawToolbarTooltip=function(mouseOnToolbar){if(!mouseOnToolbar)return;var border=this.GetBorder();var text=null;if(mouseOnToolbar.Item.TooltipText){text=mouseOnToolbar.Item.TooltipText;}else{var key='Toolbar-'+mouseOnToolbar.Item.ID;text=g_JSChartLocalization.GetText(key,0);}if(!text)return;var pixelRatio=GetDevicePixelRatio();var canvas=this.Canvas;if(this.GetExtraCanvas){var finder=this.GetExtraCanvas(JSChart.TooltipCursorCanvasKey);if(finder)canvas=finder.Canvas;}var xCenter=mouseOnToolbar.Rect.Left+mouseOnToolbar.Rect.Width/2;canvas.font=this.ButtonTooltip.Font;canvas.textAlign="left";canvas.textBaseline="bottom";var mergin=this.ButtonTooltip.Mergin;var textWidth=canvas.measureText(text).width+mergin.Left+mergin.Right;var textHeight=this.GetFontHeight();var bgHeight=textHeight+mergin.Top+mergin.Bottom;if(mouseOnToolbar.ID=="TitleButton"){var x=mouseOnToolbar.Point.X;var y=mouseOnToolbar.Point.Y+20;}else if(JSCHART_BUTTON_ID.CLOSE_BEFOREOPEN_ID==mouseOnToolbar.Item.ID){var x=mouseOnToolbar.Rect.Right+5;var y=mouseOnToolbar.Rect.Top;}else if(JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE==mouseOnToolbar.Item.ID||JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING==mouseOnToolbar.Item.ID||mouseOnToolbar.Item.ID>=JSCHART_BUTTON_ID.DRAW_PICTURE_BUTTON_1&&mouseOnToolbar.Item.ID<=JSCHART_BUTTON_ID.DRAW_PICTURE_BUTTON_18){var x=mouseOnToolbar.Point.X;var y=mouseOnToolbar.Point.Y+20;if(x+textWidth>=border.ChartWidth)x=border.ChartWidth-textWidth-2;}else{var x=xCenter-textWidth/2;var y=border.Top-bgHeight;if(y<0)y=border.TopEx+1;if(x+textWidth>border.ChartWidth)x=border.ChartWidth-textWidth-2;}if(IFrameSplitOperator.IsNumber(this.ButtonTooltip.BorderRadius))//圆角
|
|
2592
2592
|
{var roundRadius=this.ButtonTooltip.BorderRadius;canvas.beginPath();canvas.roundRect(ToFixedPoint(x),ToFixedPoint(y),ToFixedRect(textWidth),ToFixedRect(bgHeight),[roundRadius]);canvas.closePath();canvas.fillStyle=this.ButtonTooltip.ColorBG;canvas.fill();canvas.strokeStyle=this.ButtonTooltip.ColorBorder;canvas.stroke();canvas.fillStyle=this.ButtonTooltip.Color;canvas.fillText(text,x+mergin.Left,y+bgHeight-mergin.Bottom);}else{canvas.fillStyle=this.ButtonTooltip.ColorBG;canvas.fillRect(x,y,textWidth,bgHeight);//画一个背景色, 不然是一个黑的背景
|
|
2593
2593
|
canvas.fillStyle=this.ButtonTooltip.Color;canvas.fillText(text,x+mergin.Left,y+bgHeight-mergin.Bottom);}};//isLimit 是否限制在当前坐标下
|
|
@@ -6227,7 +6227,8 @@ this.IsShowColorIndexTitle=true;this.IsShowUpDownArrow=true;//指标数据是否
|
|
|
6227
6227
|
this.TitleArrowType=0;//指标数据上涨下跌箭头类型 0=独立颜色 1=跟指标颜色一致
|
|
6228
6228
|
this.IsShowIndexName=true;//是否显示指标名字
|
|
6229
6229
|
this.IsShowIndexTitle=true;//是否显示指标标题信息
|
|
6230
|
-
this.IsShowNameArrow=false;this.NameArrowConfig=CloneData(g_JSChartResource.IndexTitle.NameArrow);this.
|
|
6230
|
+
this.IsShowNameArrow=false;this.NameArrowConfig=CloneData(g_JSChartResource.IndexTitle.NameArrow);this.CustomLocation;//自定义位置 { IsShow:, Top:, TitleHeight: }
|
|
6231
|
+
this.TradeIndex;//专家系统名字{Name:'名字', Param:'参数'}
|
|
6231
6232
|
this.IsShowTradeIndexTitle=true;this.OverlayIndex=new _map2.default();//叠加指标 key=Identify value={ Data:数据, Title:标题, Identify:标识}
|
|
6232
6233
|
this.IsShowOverlayIndexName=true;//是否显示叠加指标名字
|
|
6233
6234
|
this.OverlayIndexType={Position:0,LineSpace:5,BGColor:g_JSChartResource.OverlayIndexTitleBGColor};//Position 0=主图指标后面显示 1=叠加指标单行显示
|
|
@@ -6261,14 +6262,15 @@ if(item.YFClose>0&&MARKET_SUFFIX_NAME.IsChinaFutures(upperSymbol)){var value=(it
|
|
|
6261
6262
|
{var unit=MARKET_SUFFIX_NAME.GetVolUnit(upperSymbol);var vol=item.Vol/unit;var text=g_JSChartLocalization.GetText('KTitle-Vol',this.LanguageID)+IFrameSplitOperator.FromatIntegerString(vol,2,this.LanguageID);aryText.push({Text:text,Color:this.VolColor,LeftSpace:leftSpace});}if(IFrameSplitOperator.IsNumber(item.Amount))//成交金额
|
|
6262
6263
|
{var text=g_JSChartLocalization.GetText('KTitle-Amount',this.LanguageID)+IFrameSplitOperator.FormatValueString(item.Amount,2,this.LanguageID);aryText.push({Text:text,Color:this.AmountColor,LeftSpace:leftSpace});}return aryText;};this.FormatIndexTitle=function(kItem,dataInfo){var result=null;var aryText=[];if(dataInfo.Name){aryText.push({Text:dataInfo.Name,Color:dataInfo.Color});result={Text:null,ArrayText:aryText};}if(!kItem)return result;if(!dataInfo.Chart)return result;var titleItem=dataInfo.Chart.GetItem(kItem);if(!titleItem||!titleItem.Data)return result;if(!IFrameSplitOperator.IsNonEmptyArray(titleItem.Data.AryText))return result;if(!result)result={Text:null,ArrayText:aryText};for(var i=0;i<titleItem.Data.AryText.length;++i){var item=titleItem.Data.AryText[i];if(!item)continue;var textItem={Name:null,Text:null};if(item.Name)textItem.Name=item.Name;if(item.Text)textItem.Text=item.Text;if(item.Color)textItem.Color=item.Color;if(IFrameSplitOperator.IsNumber(item.LeftSpace))textItem.LeftSpace=item.LeftSpace;aryText.push(textItem);}return result;};this.GetColor=function(price,yClose){if(!IFrameSplitOperator.IsNumber(yClose))return this.UnchangeColor;if(price>yClose)return this.UpColor;else if(price<yClose)return this.DownColor;else return this.UnchangeColor;};this.ForamtMultiLineTitle=function(dataIndex,dataInfo){if(!IFrameSplitOperator.IsNonEmptyArray(dataInfo.Lines))return null;var aryText=[];for(var i=0;i<dataInfo.Lines.length;++i){var line=dataInfo.Lines[i];for(var j=0;j<line.Point.length;++j){var item=line.Point[j];if(item.Index==dataIndex){var item={Text:item.Value.toFixed(2)};if(aryText.length==0)item.Name=dataInfo.Name;item.Color=line.Color;aryText.push(item);break;}}}if(!IFrameSplitOperator.IsNonEmptyArray(aryText))return null;return aryText;};this.ForamtMultiPointTitle=function(dataIndex,dataInfo){if(!dataInfo.GetItemCallback)return null;if(!dataInfo.Data||!IFrameSplitOperator.IsNonEmptyArray(dataInfo.Data.Data))return null;var kItem=dataInfo.Data.Data[dataIndex];if(!kItem)return null;var group=dataInfo.GetItemCallback(kItem);if(!group||!IFrameSplitOperator.IsNonEmptyArray(group.Data))return null;var aryText=[];for(var i=0;i<group.Data.length;++i){var item=group.Data[i];var config=item.ColorConfig;var color=null;if(config.BGColor)color=config.BGColor;else if(config.Color)color=config.Color;if(config.Name)aryText.push({Text:config.Name+':',Color:color});var value=item.Data.Value;if(IFrameSplitOperator.IsString(item.Data.Value))value=ChartData.GetKValue(kItem,item.Data.Value);aryText.push({Text:this.FormatValue(value,dataInfo),Color:color});}if(!IFrameSplitOperator.IsNonEmptyArray(aryText))return null;return aryText;};this.ForamtMultiBarTitle=function(dataIndex,dataInfo){if(!dataInfo.GetItemCallback)return null;if(!dataInfo.Data||!IFrameSplitOperator.IsNonEmptyArray(dataInfo.Data.Data))return null;var kItem=dataInfo.Data.Data[dataIndex];if(!kItem)return null;var group=dataInfo.GetItemCallback(kItem);if(!group||!IFrameSplitOperator.IsNonEmptyArray(group.Data))return null;var aryText=[];for(var i=0;i<group.Data.length;++i){var item=group.Data[i];var config=item.ColorConfig;var color=null;if(config.BGColor)color=config.BGColor;else if(config.Color)color=config.Color;if(config.Name)aryText.push({Text:config.Name+':',Color:color});var value=item.Data.Value;if(IFrameSplitOperator.IsString(item.Data.Value))value=ChartData.GetKValue(kItem,item.Data.Value);var value2=item.Data.Value2;if(IFrameSplitOperator.IsString(item.Data.Value2))value2=ChartData.GetKValue(kItem,item.Data.Value2);aryText.push({Text:'['+this.FormatValue(value,dataInfo)+', '+this.FormatValue(value2,dataInfo)+'] ',Color:color});}if(!IFrameSplitOperator.IsNonEmptyArray(aryText))return null;return aryText;};this.FormatVPVRTitle=function(pt,dataInfo){var chart=dataInfo.Chart;var aryText=[];if(chart.VolType==0){var item={Text:" Up/Down ",Color:this.TitleColor};aryText.push(item);}else{var item={Text:" Total ",Color:this.TitleColor};aryText.push(item);}if(!IFrameSplitOperator.IsNumber(pt.Y))return aryText;var top=this.Frame.ChartBorder.GetTopEx();var bottom=this.Frame.ChartBorder.GetBottomEx();if(pt.Y<top||pt.Y>bottom)return aryText;var yPrice=this.Frame.GetYData(pt.Y);var find=null;for(var i=0;i<dataInfo.Data.Data.length;++i){var item=dataInfo.Data.Data[i];if(yPrice>=item.Price-dataInfo.Data.PriceOffset/2&&yPrice<item.Price+dataInfo.Data.PriceOffset/2){find=item;break;}}if(!find)return null;if(chart.VolType==0){var total=0;for(var i=0;i<find.Vol.length;++i){var volItem=find.Vol[i];if(!IFrameSplitOperator.IsNumber(volItem.Value))continue;var item={Text:IFrameSplitOperator.FormatVolString(volItem.Value,this.LanguageID)};total+=volItem.Value;if(IFrameSplitOperator.IsNumber(volItem.ColorID))item.Color=chart.BarColor[volItem.ColorID];else if(volItem.Color)item.Color=volItem.Color;aryText.push(item);}var item={Text:IFrameSplitOperator.FormatVolString(total,this.LanguageID),Color:this.TitleColor};aryText.push(item);}else{if(find.TotalVol&&IFrameSplitOperator.IsNumber(find.TotalVol.Value)){var item={Text:IFrameSplitOperator.FormatVolString(find.TotalVol.Value,this.LanguageID)};if(IFrameSplitOperator.IsNumber(find.TotalVol.ColorID))item.Color=chart.BarColor[find.TotalVol.ColorID];else if(find.TotalVol.Color)item.Color=find.TotalVol.Color;aryText.push(item);}}return aryText;};this.IsShowLastData=function(){if(this.HQChart&&this.HQChart.EnableClickModel&&this.HQChart.ClickModel){var clickModel=this.HQChart.ClickModel;if(clickModel.IsShowCorssCursor)return false;}var isShowLastData=false;if(this.DrawStatus&&this.DrawStatus.IsTitleShowLatestData){var status=this.DrawStatus;if(!IFrameSplitOperator.IsNumber(status.FrameID)||status.FrameID<0)isShowLastData=true;else if(status.CorssCursorTouchEnd&&status.IsOnTouch==false)isShowLastData=true;}else if(this.GlobalOption&&this.GlobalOption.IsDisplayLatest){isShowLastData=true;}//十字光标锁定状态 禁用显示最后一个数据
|
|
6263
6264
|
if(this.GlobalOption&&this.GlobalOption.LockCorssCursor&&this.GlobalOption.LockCorssCursor.X.Enable)isShowLastData=false;return isShowLastData;};this.OnDrawTitleEvent=function(){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_INDEXTITLE_DRAW);if(!event)return;var data={Index:null,Data:this.Data,Title:this.Title,Script:this.Script,FrameID:this.Frame.Identify,OverlayIndex:this.OverlayIndex,IsShowTitleOnly:false};if(this.ArgumentsText)data.ArgumentsText=this.ArgumentsText;if(this.Frame&&this.Frame.ChartBorder)data.IsShowTitleOnly=this.Frame.ChartBorder.IsShowTitleOnly;if(IFrameSplitOperator.IsNumber(this.CursorIndex)){var index=Math.abs(this.CursorIndex);index=parseInt(index.toFixed(0));data.Index=index;//当前屏数据索引
|
|
6264
|
-
}var pixelTatio=GetDevicePixelRatio();var border=this.Frame.GetBorder();data.Left=border.LeftEx/pixelTatio;data.Top=border.Top/pixelTatio;data.Right=border.RightEx/pixelTatio;event.Callback(event,data,this);};this.IsSelectedChart=function(id){if(!id)return false;if(!this.SelectedChart)return false;if(!this.SelectedChart.Selected)return false;return this.SelectedChart.Selected.Identify==id;};this.Draw=function(moveonPoint,mouseStatus){this.Buttons=[];this.NameButtonHeight=0;if(this.Frame.IsMinSize)return;this.IsKLineFrame=this.Frame.IsKLineFrame(false);this.IsMinuteFrame=this.Frame.IsMinuteFrame(false);this.IsDrawTitleBG=this.Frame.IsDrawTitleBG;this.IsShowNameArrow=this.Frame.IsShowNameArrow;this.IsShowUpDownArrow=this.Frame.IsShowTitleArrow;this.TitleArrowType=this.Frame.TitleArrowType;this.IsShowIndexName=this.Frame.IsShowIndexName;this.IsShowOverlayIndexName=this.Frame.IsShowOverlayIndexName;this.OverlayIndexType.Position=this.Frame.OverlayIndexType.Position;this.OverlayIndexType.LineSpace=this.Frame.OverlayIndexType.LineSpace;this.ParamSpace=this.Frame.IndexParamSpace;this.TitleSpace=this.Frame.IndexTitleSpace;this.TitleRect=null;this.GlobalOption=this.Frame.GlobalOption;this.OnDrawTitleEvent();if(this.Frame.IsShowIndexTitle==false)return;if(g_JSChartResource.IsDOMFrameTitle===true)return;if(!this.Data)return;if(this.Frame.ChartBorder.TitleHeight<5)return;if(this.CursorIndex==null&&!(this.GlobalOption&&this.GlobalOption.IsDisplayLatest))return;if(this.Frame.IsHScreen===true){this.Canvas.save();this.HScreenDraw();this.Canvas.restore();/* 测试用
|
|
6265
|
+
}var pixelTatio=GetDevicePixelRatio();var border=this.Frame.GetBorder();data.Left=border.LeftEx/pixelTatio;data.Top=border.Top/pixelTatio;data.Right=border.RightEx/pixelTatio;event.Callback(event,data,this);};this.IsSelectedChart=function(id){if(!id)return false;if(!this.SelectedChart)return false;if(!this.SelectedChart.Selected)return false;return this.SelectedChart.Selected.Identify==id;};this.Draw=function(moveonPoint,mouseStatus){this.Buttons=[];this.NameButtonHeight=0;if(this.Frame.IsMinSize)return;this.IsKLineFrame=this.Frame.IsKLineFrame(false);this.IsMinuteFrame=this.Frame.IsMinuteFrame(false);this.IsDrawTitleBG=this.Frame.IsDrawTitleBG;this.IsShowNameArrow=this.Frame.IsShowNameArrow;this.IsShowUpDownArrow=this.Frame.IsShowTitleArrow;this.TitleArrowType=this.Frame.TitleArrowType;this.IsShowIndexName=this.Frame.IsShowIndexName;this.IsShowOverlayIndexName=this.Frame.IsShowOverlayIndexName;this.OverlayIndexType.Position=this.Frame.OverlayIndexType.Position;this.OverlayIndexType.LineSpace=this.Frame.OverlayIndexType.LineSpace;this.ParamSpace=this.Frame.IndexParamSpace;this.TitleSpace=this.Frame.IndexTitleSpace;this.TitleRect=null;this.GlobalOption=this.Frame.GlobalOption;this.OnDrawTitleEvent();if(this.Frame.IsShowIndexTitle==false)return;if(g_JSChartResource.IsDOMFrameTitle===true)return;if(!this.Data)return;if(this.CustomLocation){if(!this.CustomLocation.IsShow)return;if(!IFrameSplitOperator.IsNumber(this.CustomLocation.Top)||!IFrameSplitOperator.IsNumber(this.CustomLocation.TitleHeight))return;}else{if(this.Frame.ChartBorder.TitleHeight<5)return;}if(this.CursorIndex==null&&!(this.GlobalOption&&this.GlobalOption.IsDisplayLatest))return;if(this.Frame.IsHScreen===true){this.Canvas.save();this.HScreenDraw();this.Canvas.restore();/* 测试用
|
|
6265
6266
|
if (this.TitleRect)
|
|
6266
6267
|
{
|
|
6267
6268
|
this.Canvas.strokeStyle='rgba(200,0,50,0.5)';
|
|
6268
6269
|
this.Canvas.strokeRect(ToFixedPoint(this.TitleRect.Left),ToFixedPoint(this.TitleRect.Top),ToFixedRect(this.TitleRect.Width),ToFixedRect(this.TitleRect.Height));
|
|
6269
6270
|
}
|
|
6270
6271
|
*/return;}var left=this.Frame.ChartBorder.GetLeft()+this.MerginLeft;var bottom=this.Frame.ChartBorder.GetTop()+this.Frame.ChartBorder.TitleHeight/2;//上下居中显示
|
|
6271
|
-
|
|
6272
|
+
if(this.CustomLocation)//自定义标题位置
|
|
6273
|
+
{bottom=this.Frame.ChartBorder.GetTop()+this.CustomLocation.Top+this.CustomLocation.TitleHeight/2;}var right=this.Frame.ChartBorder.GetRight();var toolbarInfo={Width:0,YCenter:bottom};this.DrawToolbar(toolbarInfo,moveonPoint,mouseStatus);left+=toolbarInfo.Width;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.font=this.Font;var pixelRatio=GetDevicePixelRatio();if(this.Title&&this.IsShowIndexName&&this.IsShowMainIndexTitle){if(this.IsDrawTitleBG){var rtButton={Left:left,YCenter:bottom,Width:0};this.DrawNameButton(rtButton,moveonPoint,mouseStatus);this.Buttons.push({ID:JSCHART_BUTTON_ID.INDEX_NAME_BUTTON,Rect:rtButton,FrameID:this.Frame.Identify,Type:2});//Type 0=主图按钮 1=附图按钮 2=主图指标名字按钮
|
|
6272
6274
|
this.NameButtonHeight=rtButton.Height;if(this.IsSelectedChart(this.Identify))this.DrawSelectedLine(left,bottom,textWidth);this.TitleRect=rtButton;left+=rtButton.Width+3*pixelRatio;left+=this.TitleSpace;}else{var textWidth=this.Canvas.measureText(this.Title).width+2;this.Canvas.fillStyle=this.TitleColor;this.Canvas.fillText(this.Title,left,bottom,textWidth);if(this.IsSelectedChart(this.Identify))this.DrawSelectedLine(left,bottom,textWidth);left+=textWidth;left+=this.TitleSpace;}}if(this.ArgumentsText&&this.IsShowIndexName&&this.IsShowMainIndexTitle){var textWidth=this.Canvas.measureText(this.ArgumentsText).width+2;this.Canvas.fillStyle=this.TitleColor;this.Canvas.fillText(this.ArgumentsText,left,bottom,textWidth);left+=textWidth;left+=this.TitleSpace;}var isShowLastData=this.IsShowLastData();var lockRect=this.Frame.GetLockRect();if(lockRect)//指标上锁区域不显示动态标题
|
|
6273
6275
|
{var index=Math.abs(this.CursorIndex);if(this.IsKLineFrame)index=this.CursorIndex;var x=this.Frame.GetXFromIndex(index.toFixed(0));if(x>=lockRect.Left)return;if(isShowLastData)return;}var rtText={Left:left,Right:left};if(this.IsMinuteFrame&&this.PointInfo&&(this.PointInfo.ClientPos==2||this.PointInfo.ClientPos==3||this.PointInfo.ClientPos>=200&&this.PointInfo.ClientPos<=299||this.PointInfo.ClientPos>=300&&this.PointInfo.ClientPos<=399)){var result={PreventDefault:false};var yRight=right;if(this.Frame.ToolbarCacheSize&&this.Frame.ToolbarCacheSize.RToolbar)yRight=this.Frame.ToolbarCacheSize.RToolbar.Left-2;//右侧按钮宽度要去掉
|
|
6274
6276
|
this.DrawMainCallAuction({Left:left,Right:yRight,Bottom:bottom},rtText,result);if(result.PreventDefault===false)this.DrawMainIndexTitle({Left:left,Right:yRight,Bottom:bottom},isShowLastData,rtText);if(IFrameSplitOperator.IsNumber(rtText.Bottom))bottom=rtText.Bottom;}else{var yRight=right;if(this.Frame.ToolbarCacheSize&&this.Frame.ToolbarCacheSize.RToolbar)yRight=this.Frame.ToolbarCacheSize.RToolbar.Left-2;//右侧按钮宽度要去掉
|
|
@@ -12923,7 +12925,11 @@ if(e.preventDefault)e.preventDefault();else e.returnValue=false;};this.UIOnMouse
|
|
|
12923
12925
|
{if(clickData.Redraw==true)this.Draw();}};this.UIOnDblClick=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart)chart.OnDblClick(x,y,e);};this.UIOnContextMenu=function(e){e.preventDefault();};this.GotoNextPage=function(){if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return false;var chart=this.ChartPaint[0];if(!chart)return false;var pageSize=chart.GetPageSize();if(pageSize>this.Data.Data.length)return false;var offset=this.Data.DataOffset+pageSize;if(offset+pageSize==this.Data.Data.length-1)return false;if(offset+pageSize>this.Data.Data.length)//最后一页不够一屏调整到满屏
|
|
12924
12926
|
{this.Data.DataOffset=this.Data.Data.length-pageSize;}else{this.Data.DataOffset=offset;}return true;};this.GotoPreviousPage=function(){if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return false;var chart=this.ChartPaint[0];if(!chart)return false;if(this.Data.DataOffset<=0)return false;var pageSize=chart.GetPageSize();var offset=this.Data.DataOffset;offset-=pageSize;if(offset<0)offset=0;this.Data.DataOffset=offset;return true;};this.GotoLastPage=function(){var chart=this.ChartPaint[0];if(!chart)return;//显示最后一屏
|
|
12925
12927
|
var pageSize=chart.GetPageSize(true);var offset=this.Data.Data.length-pageSize;if(offset<0)offset=0;this.Data.DataOffset=offset;};this.SetColumn=function(aryColunm,option){var chart=this.ChartPaint[0];if(chart){chart.SetColumn(aryColunm);chart.SizeChange=true;if(option&&option.Redraw)this.Draw();}};this.ReloadResource=function(option){this.Frame.ReloadResource(option);for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.ReloadResource)item.ReloadResource(option);}if(option&&option.Redraw){this.SetSizeChange(true);this.Draw();}};}JSDealChartContainer.JsonDataToDealData=function(data){var symbol=data.symbol;var result=[];if(!IFrameSplitOperator.IsNonEmptyArray(data.detail))return result;//0=时间 1=价格 2=成交量 3=成交金额 4=BS 5=字符串时间 6=ID
|
|
12926
|
-
for(var i=0;i<data.detail.length;++i){var item=data.detail[i];var dealItem={Time:item[0],Price:item[1],Vol:item[2],BS:item[4],Amount:item[3],Guid:Guid()};dealItem.Source=item;if(item[5])dealItem.StrTime=item[5];if(item[6])dealItem.ID=item[6];
|
|
12928
|
+
for(var i=0;i<data.detail.length;++i){var item=data.detail[i];var dealItem={Time:item[0],Price:item[1],Vol:item[2],BS:item[4],Amount:item[3],Guid:Guid()};dealItem.Source=item;if(item[5])dealItem.StrTime=item[5];if(item[6])dealItem.ID=item[6];if(item[11])dealItem.Symbol=item[11];//股票代码
|
|
12929
|
+
if(item[12])dealItem.Name=item[12];//股票名称
|
|
12930
|
+
//10个数值型 101-199
|
|
12931
|
+
if(IFrameSplitOperator.IsNumber(item[101]))dealItem.ReserveNumber1=item[101];if(IFrameSplitOperator.IsNumber(item[102]))dealItem.ReserveNumber2=item[102];if(IFrameSplitOperator.IsNumber(item[103]))dealItem.ReserveNumber3=item[103];if(IFrameSplitOperator.IsNumber(item[104]))dealItem.ReserveNumber4=item[104];if(IFrameSplitOperator.IsNumber(item[105]))dealItem.ReserveNumber5=item[105];if(IFrameSplitOperator.IsNumber(item[106]))dealItem.ReserveNumber6=item[106];if(IFrameSplitOperator.IsNumber(item[107]))dealItem.ReserveNumber7=item[107];if(IFrameSplitOperator.IsNumber(item[108]))dealItem.ReserveNumber8=item[108];if(IFrameSplitOperator.IsNumber(item[109]))dealItem.ReserveNumber9=item[109];if(IFrameSplitOperator.IsNumber(item[110]))dealItem.ReserveNumber10=item[110];//10个字符型 201-299
|
|
12932
|
+
if(IFrameSplitOperator.IsString(item[201])||IFrameSplitOperator.IsObject(item[201]))dealItem.ReserveString1=item[201];if(IFrameSplitOperator.IsString(item[202])||IFrameSplitOperator.IsObject(item[202]))dealItem.ReserveString2=item[202];if(IFrameSplitOperator.IsString(item[203])||IFrameSplitOperator.IsObject(item[203]))dealItem.ReserveString3=item[203];if(IFrameSplitOperator.IsString(item[204])||IFrameSplitOperator.IsObject(item[204]))dealItem.ReserveString4=item[204];if(IFrameSplitOperator.IsString(item[205])||IFrameSplitOperator.IsObject(item[205]))dealItem.ReserveString5=item[205];if(IFrameSplitOperator.IsString(item[206])||IFrameSplitOperator.IsObject(item[206]))dealItem.ReserveString6=item[206];if(IFrameSplitOperator.IsString(item[207])||IFrameSplitOperator.IsObject(item[207]))dealItem.ReserveString7=item[207];if(IFrameSplitOperator.IsString(item[208])||IFrameSplitOperator.IsObject(item[208]))dealItem.ReserveString8=item[208];if(IFrameSplitOperator.IsString(item[209])||IFrameSplitOperator.IsObject(item[209]))dealItem.ReserveString9=item[209];if(IFrameSplitOperator.IsString(item[210])||IFrameSplitOperator.IsObject(item[210]))dealItem.ReserveString10=item[210];result.push(dealItem);}return result;};function JSDealFrame(){this.ChartBorder;this.Canvas;//画布
|
|
12927
12933
|
this.BorderColor=g_JSChartResource.DealList.BorderColor;//边框线
|
|
12928
12934
|
this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;this.LogoTextFont=g_JSChartResource.FrameLogo.Font;this.ReloadResource=function(resource){this.BorderColor=g_JSChartResource.DealList.BorderColor;//边框线
|
|
12929
12935
|
this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;this.LogoTextFont=g_JSChartResource.FrameLogo.Font;};this.Draw=function(option){var left=ToFixedPoint(this.ChartBorder.GetLeft());var top=ToFixedPoint(this.ChartBorder.GetTop());var right=ToFixedPoint(this.ChartBorder.GetRight());var bottom=ToFixedPoint(this.ChartBorder.GetBottom());var width=right-left;var height=bottom-top;if(!IFrameSplitOperator.IsNumber(this.BorderLine)){this.Canvas.strokeStyle=this.BorderColor;this.Canvas.strokeRect(left,top,width,height);}else{this.Canvas.strokeStyle=this.BorderColor;this.Canvas.beginPath();if((this.BorderLine&1)>0)//上
|
|
@@ -12939,8 +12945,14 @@ STRING_TIME_ID:6,//字符串时间
|
|
|
12939
12945
|
INDEX_ID:7,//序号 从1开始
|
|
12940
12946
|
MULTI_BAR_ID:8,//多颜色柱子
|
|
12941
12947
|
CENTER_BAR_ID:9,//中心柱子
|
|
12942
|
-
CUSTOM_TEXT_ID:10
|
|
12943
|
-
|
|
12948
|
+
CUSTOM_TEXT_ID:10,//自定义文本
|
|
12949
|
+
SYMBOL_ID:11,//股票代码
|
|
12950
|
+
NAME_ID:12,//股票名称
|
|
12951
|
+
//预留数值类型 10个
|
|
12952
|
+
RESERVE_NUMBER1_ID:201,//ReserveNumber1:
|
|
12953
|
+
RESERVE_NUMBER2_ID:202,RESERVE_NUMBER3_ID:203,RESERVE_NUMBER4_ID:204,RESERVE_NUMBER5_ID:205,RESERVE_NUMBER6_ID:206,RESERVE_NUMBER7_ID:207,RESERVE_NUMBER8_ID:208,RESERVE_NUMBER9_ID:209,RESERVE_NUMBER10_ID:210,//预留字符串类型 10个 301-399
|
|
12954
|
+
RESERVE_STRING1_ID:301,//ReserveString1:
|
|
12955
|
+
RESERVE_STRING2_ID:302,RESERVE_STRING3_ID:303,RESERVE_STRING4_ID:304,RESERVE_STRING5_ID:305,RESERVE_STRING6_ID:306,RESERVE_STRING7_ID:307,RESERVE_STRING8_ID:308,RESERVE_STRING9_ID:309,RESERVE_STRING10_ID:310};var MAP_DEAL_COLUMN_FIELD=new _map2.default([[DEAL_COLUMN_ID.SYMBOL_ID,"Symbol"],[DEAL_COLUMN_ID.NAME_ID,"Name"],[DEAL_COLUMN_ID.PRICE_ID,"Price"],[DEAL_COLUMN_ID.RESERVE_NUMBER1_ID,"ReserveNumber1"],[DEAL_COLUMN_ID.RESERVE_NUMBER2_ID,"ReserveNumber2"],[DEAL_COLUMN_ID.RESERVE_NUMBER3_ID,"ReserveNumber3"],[DEAL_COLUMN_ID.RESERVE_NUMBER4_ID,"ReserveNumber4"],[DEAL_COLUMN_ID.RESERVE_NUMBER5_ID,"ReserveNumber5"],[DEAL_COLUMN_ID.RESERVE_NUMBER6_ID,"ReserveNumber6"],[DEAL_COLUMN_ID.RESERVE_NUMBER7_ID,"ReserveNumber7"],[DEAL_COLUMN_ID.RESERVE_NUMBER8_ID,"ReserveNumber8"],[DEAL_COLUMN_ID.RESERVE_NUMBER9_ID,"ReserveNumber9"],[DEAL_COLUMN_ID.RESERVE_NUMBER10_ID,"ReserveNumber10"],[DEAL_COLUMN_ID.RESERVE_STRING1_ID,"ReserveString1"],[DEAL_COLUMN_ID.RESERVE_STRING2_ID,"ReserveString2"],[DEAL_COLUMN_ID.RESERVE_STRING3_ID,"ReserveString3"],[DEAL_COLUMN_ID.RESERVE_STRING4_ID,"ReserveString4"],[DEAL_COLUMN_ID.RESERVE_STRING5_ID,"ReserveString5"],[DEAL_COLUMN_ID.RESERVE_STRING6_ID,"ReserveString6"],[DEAL_COLUMN_ID.RESERVE_STRING7_ID,"ReserveString7"],[DEAL_COLUMN_ID.RESERVE_STRING8_ID,"ReserveString8"],[DEAL_COLUMN_ID.RESERVE_STRING9_ID,"ReserveString9"],[DEAL_COLUMN_ID.RESERVE_STRING10_ID,"ReserveString10"]]);function ChartDealList(){this.Canvas;//画布
|
|
12944
12956
|
this.ChartBorder;//边框信息
|
|
12945
12957
|
this.ChartFrame;//框架画法
|
|
12946
12958
|
this.Name;//名称
|
|
@@ -12955,26 +12967,30 @@ this.IsShowHeader=true;//是否显示表头
|
|
|
12955
12967
|
this.ShowOrder=1;//0=顺序 1=倒序
|
|
12956
12968
|
this.SelectedData={Index:null,Guid:null,Enable:false};//{ Index:序号, Guid, Enable:是否启动 }
|
|
12957
12969
|
this.SizeChange=true;//涨跌颜色
|
|
12958
|
-
this.UpColor=g_JSChartResource.DealList.UpTextColor;this.DownColor=g_JSChartResource.DealList.DownTextColor;this.
|
|
12970
|
+
this.UpColor=g_JSChartResource.DealList.UpTextColor;this.DownColor=g_JSChartResource.DealList.DownTextColor;this.UnchangeColor=g_JSChartResource.DealList.UnchagneTextColor;this.BorderColor=g_JSChartResource.DealList.BorderColor;//边框线
|
|
12959
12971
|
this.SelectedConfig={BGColor:g_JSChartResource.DealList.Selected.BGColor};//表头配置
|
|
12960
12972
|
this.HeaderFontConfig={Size:g_JSChartResource.DealList.Header.Font.Size,Name:g_JSChartResource.DealList.Header.Font.Name};this.HeaderColor=g_JSChartResource.DealList.Header.Color;this.HeaderMergin={Left:g_JSChartResource.DealList.Header.Mergin.Left,Right:g_JSChartResource.DealList.Header.Mergin.Right,Top:g_JSChartResource.DealList.Header.Mergin.Top,Bottom:g_JSChartResource.DealList.Header.Mergin.Bottom};//表格内容配置
|
|
12961
12973
|
this.ItemFontConfig={Size:g_JSChartResource.DealList.Row.Font.Size,Name:g_JSChartResource.DealList.Row.Font.Name};this.RowMergin={Top:g_JSChartResource.DealList.Row.Mergin.Top,Bottom:g_JSChartResource.DealList.Row.Mergin.Bottom};this.BarMergin={Top:g_JSChartResource.DealList.Row.BarMergin.Top,Left:g_JSChartResource.DealList.Row.BarMergin.Left,Right:g_JSChartResource.DealList.Row.BarMergin.Right,Bottom:g_JSChartResource.DealList.Row.BarMergin.Bottom};//缓存
|
|
12962
12974
|
this.HeaderFont=12*GetDevicePixelRatio()+"px 微软雅黑";this.ItemFont=15*GetDevicePixelRatio()+"px 微软雅黑";this.RowCount=0;this.TableWidth=0;this.TableCount=0;this.HeaderHeight=0;this.Column=[{Type:DEAL_COLUMN_ID.TIME_ID,Title:"时间",TextAlign:"center",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.Time,MaxText:"88:88:88",Foramt:"HH:MM:SS"},{Type:DEAL_COLUMN_ID.PRICE_ID,Title:"价格",TextAlign:"center",Width:null,MaxText:"888888.88"},{Type:DEAL_COLUMN_ID.VOL_ID,Title:"成交",TextAlign:"right",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.Vol,MaxText:"888888"},{Type:DEAL_COLUMN_ID.BS_ID,Title:"",TextAlign:"right",Width:null,MaxText:"擎"}];this.RectClient={};this.AryCellRect=[];//{ Rect:, Type: 1=单行 }
|
|
12963
|
-
this.ReloadResource=function(resource){this.UpColor=g_JSChartResource.DealList.UpTextColor;this.DownColor=g_JSChartResource.DealList.DownTextColor;this.
|
|
12975
|
+
this.ReloadResource=function(resource){this.UpColor=g_JSChartResource.DealList.UpTextColor;this.DownColor=g_JSChartResource.DealList.DownTextColor;this.UnchangeColor=g_JSChartResource.DealList.UnchagneTextColor;this.BorderColor=g_JSChartResource.DealList.BorderColor;//边框线
|
|
12964
12976
|
//表头配置
|
|
12965
12977
|
this.HeaderFontConfig={Size:g_JSChartResource.DealList.Header.Font.Size,Name:g_JSChartResource.DealList.Header.Font.Name};this.HeaderColor=g_JSChartResource.DealList.Header.Color;this.HeaderMergin={Left:g_JSChartResource.DealList.Header.Mergin.Left,Right:g_JSChartResource.DealList.Header.Mergin.Right,Top:g_JSChartResource.DealList.Header.Mergin.Top,Bottom:g_JSChartResource.DealList.Header.Mergin.Bottom};//表格内容配置
|
|
12966
12978
|
this.ItemFontConfig={Size:g_JSChartResource.DealList.Row.Font.Size,Name:g_JSChartResource.DealList.Row.Font.Name};this.RowMergin={Top:g_JSChartResource.DealList.Row.Mergin.Top,Bottom:g_JSChartResource.DealList.Row.Mergin.Bottom};for(var i=0;i<this.Column.length;++i){var item=this.Column[i];if(item.Type==DEAL_COLUMN_ID.TIME_ID||item.Type==DEAL_COLUMN_ID.STRING_TIME_ID)item.TextColor=g_JSChartResource.DealList.FieldColor.Time;else if(item.Type==DEAL_COLUMN_ID.VOL_ID)item.TextColor=g_JSChartResource.DealList.FieldColor.Vol;else if(item.Type==DEAL_COLUMN_ID.DEAL_ID)item.TextColor=g_JSChartResource.DealList.FieldColor.Deal;else if(item.Type==DEAL_COLUMN_ID.INDEX_ID)item.TextColor=g_JSChartResource.DealList.FieldColor.Index;}};this.SetColumn=function(aryColumn){if(!IFrameSplitOperator.IsNonEmptyArray(aryColumn))return;this.Column=[];for(var i=0;i<aryColumn.length;++i){var item=aryColumn[i];var colItem=this.GetDefaultColunm(item.Type);if(!colItem)continue;if(item.Title)colItem.Title=item.Title;if(item.TextAlign)colItem.TextAlign=item.TextAlign;if(item.TextColor)colItem.TextColor=item.TextColor;if(item.MaxText)colItem.MaxText=item.MaxText;if(item.Type==DEAL_COLUMN_ID.MULTI_BAR_ID||item.Type==DEAL_COLUMN_ID.CENTER_BAR_ID){if(!IFrameSplitOperator.IsNumber(item.DataIndex))continue;colItem.DataIndex=item.DataIndex;//柱子数据所在原始数据索引列
|
|
12967
12979
|
}else if(item.Type==DEAL_COLUMN_ID.TIME_ID){if(IFrameSplitOperator.IsString(item.Foramt))colItem.Foramt=item.Foramt;//设置时间格式
|
|
12968
|
-
}
|
|
12980
|
+
}else if(this.IsReserveNumber(item.Type)){if(item.Format)colItem.Format=item.Format;//数据格式化设置{ Type:1=原始 2=千分位分割 3=万亿转换, ExFloatPrecision:万亿转换以后的小数位数 }
|
|
12981
|
+
if(IFrameSplitOperator.IsNumber(item.ColorType))colItem.ColorType=item.ColorType;//0=默认 1=(>0, =0, <0) 2=(>=0, <0)
|
|
12982
|
+
}this.Column.push(colItem);}};this.GetDefaultColunm=function(id){var DEFAULT_COLUMN=[{Type:DEAL_COLUMN_ID.TIME_ID,Title:"时间",TextAlign:"center",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.Time,MaxText:"88:88:88",Foramt:"HH:MM:SS"},{Type:DEAL_COLUMN_ID.PRICE_ID,Title:"价格",TextAlign:"center",Width:null,MaxText:"888888.88"},{Type:DEAL_COLUMN_ID.VOL_ID,Title:"成交",TextAlign:"right",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.Vol,MaxText:"888888"},{Type:DEAL_COLUMN_ID.BS_ID,Title:"",TextAlign:"right",Width:null,MaxText:"擎"},{Type:DEAL_COLUMN_ID.DEAL_ID,Title:"笔数",TextAlign:"right",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.Deal,MaxText:"8888"},{Type:DEAL_COLUMN_ID.UPDOWN_ID,Title:"涨跌",TextAlign:"right",Width:null,MaxText:"-8888.88"},{Type:DEAL_COLUMN_ID.STRING_TIME_ID,Title:"时间",TextAlign:"center",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.Time,MaxText:"88:88:88"},{Type:DEAL_COLUMN_ID.INDEX_ID,Title:"序号",TextAlign:"center",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.Index,MaxText:"88888"},{Type:DEAL_COLUMN_ID.MULTI_BAR_ID,Title:"柱子",TextAlign:"center",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.BarTitle,MaxText:"888888"},{Type:DEAL_COLUMN_ID.CENTER_BAR_ID,Title:"柱子2",TextAlign:"center",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.BarTitle,MaxText:"888888"},{Type:DEAL_COLUMN_ID.CUSTOM_TEXT_ID,Title:"自定义",TextAlign:"center",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.Text,MaxText:"擎擎擎擎擎"},{Type:DEAL_COLUMN_ID.NAME_ID,Title:"股票名称",TextAlign:"center",Width:null,TextColor:g_JSChartResource.DealList.FieldColor.Text,MaxText:"擎擎擎擎*"},{Type:DEAL_COLUMN_ID.RESERVE_NUMBER1_ID,Title:"数值1",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:DEAL_COLUMN_ID.RESERVE_NUMBER2_ID,Title:"数值2",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:DEAL_COLUMN_ID.RESERVE_NUMBER3_ID,Title:"数值3",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:DEAL_COLUMN_ID.RESERVE_NUMBER4_ID,Title:"数值4",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:DEAL_COLUMN_ID.RESERVE_NUMBER5_ID,Title:"数值5",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:DEAL_COLUMN_ID.RESERVE_NUMBER6_ID,Title:"数值6",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:DEAL_COLUMN_ID.RESERVE_NUMBER7_ID,Title:"数值7",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:DEAL_COLUMN_ID.RESERVE_NUMBER8_ID,Title:"数值8",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:DEAL_COLUMN_ID.RESERVE_NUMBER9_ID,Title:"数值9",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:DEAL_COLUMN_ID.RESERVE_NUMBER10_ID,Title:"数值10",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:DEAL_COLUMN_ID.RESERVE_STRING1_ID,Title:"文字1",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"擎擎擎擎擎擎"},{Type:DEAL_COLUMN_ID.RESERVE_STRING2_ID,Title:"文字2",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"擎擎擎擎擎擎"},{Type:DEAL_COLUMN_ID.RESERVE_STRING3_ID,Title:"文字3",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"擎擎擎擎擎擎"},{Type:DEAL_COLUMN_ID.RESERVE_STRING4_ID,Title:"文字4",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"擎擎擎擎擎擎"},{Type:DEAL_COLUMN_ID.RESERVE_STRING5_ID,Title:"文字5",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"擎擎擎擎擎擎"},{Type:DEAL_COLUMN_ID.RESERVE_STRING6_ID,Title:"文字6",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"擎擎擎擎擎擎"},{Type:DEAL_COLUMN_ID.RESERVE_STRING7_ID,Title:"文字7",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"擎擎擎擎擎擎"},{Type:DEAL_COLUMN_ID.RESERVE_STRING8_ID,Title:"文字8",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"擎擎擎擎擎擎"},{Type:DEAL_COLUMN_ID.RESERVE_STRING9_ID,Title:"文字9",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"擎擎擎擎擎擎"},{Type:DEAL_COLUMN_ID.RESERVE_STRING10_ID,Title:"文字10",TextAlign:"right",TextColor:g_JSChartResource.Report.FieldColor.Text,MaxText:"擎擎擎擎擎擎"}];for(var i=0;i<DEFAULT_COLUMN.length;++i){var item=DEFAULT_COLUMN[i];if(item.Type==id)return item;}return null;};this.Draw=function(){this.AryCellRect=[];if(this.SizeChange)this.CalculateSize();else this.UpdateCacheData();this.DrawBorder();this.DrawHeader();this.DrawBody();this.SizeChange=false;};//更新缓存变量
|
|
12969
12983
|
this.UpdateCacheData=function(){this.RectClient.Left=this.ChartBorder.GetLeft();this.RectClient.Right=this.ChartBorder.GetRight();this.RectClient.Top=this.ChartBorder.GetTop();this.RectClient.Bottom=this.ChartBorder.GetBottom();this.Decimal=GetfloatPrecision(this.Symbol);};this.GetPageSize=function(recalculate)//recalculate 是否重新计算
|
|
12970
12984
|
{if(recalculate)this.CalculateSize();var size=this.TableCount*this.RowCount;return size;};this.CalculateSize=function()//计算大小
|
|
12971
|
-
{this.UpdateCacheData();var pixelRatio=GetDevicePixelRatio();this.HeaderFont=this.HeaderFontConfig.Size*pixelRatio+'px '+this.HeaderFontConfig.Name;this.ItemFont=this.ItemFontConfig.Size*pixelRatio+'px '+this.ItemFontConfig.Name;this.Canvas.font=this.ItemFont;var sumWidth=0,itemWidth=0;for(var i=0;i<this.Column.length;++i){var item=this.Column[i];itemWidth=this.Canvas.measureText(item.MaxText).width;item.Width=itemWidth+4;sumWidth+=item.Width;}var clientWidth=this.RectClient.Right-this.RectClient.Left;this.TableCount=parseInt(clientWidth/sumWidth);if(this.IsSingleTable)this.TableCount=1;this.TableWidth=clientWidth/this.TableCount;this.HeaderHeight=this.GetFontHeight(this.HeaderFont,"擎")+this.HeaderMergin.Top+this.HeaderMergin.Bottom;if(!this.IsShowHeader)this.HeaderHeight=0;this.RowHeight=this.GetFontHeight(this.ItemFont,"擎")+this.HeaderMergin.Top+this.HeaderMergin.Bottom;this.RowCount=parseInt((this.RectClient.Bottom-this.RectClient.Top-this.HeaderHeight)/this.RowHeight);};this.DrawHeader=function(){if(!this.IsShowHeader)return;var left=this.RectClient.Left+this.HeaderMergin.Left;var top=this.RectClient.Top;var y=top+this.HeaderMergin.Top+(this.HeaderHeight-this.HeaderMergin.Top-this.HeaderMergin.Bottom)/2;this.Canvas.font=this.HeaderFont;this.Canvas.fillStyle=this.HeaderColor;for(var i=0,j=0;i<this.TableCount;++i){var tableLeft=left+this.TableWidth*i;var textLeft=tableLeft;for(j=0;j<this.Column.length;++j){var item=this.Column[j];var itemWidth=item.Width;if(j==this.Column.length-1)itemWidth=this.TableWidth-(textLeft-tableLeft)-this.HeaderMergin.Right-this.HeaderMergin.Left;var x=textLeft;if(item.TextAlign=='center'){x=textLeft+itemWidth/2;this.Canvas.textAlign="center";}else if(item.TextAlign=='right'){x=textLeft+itemWidth;this.Canvas.textAlign="right";}else{this.Canvas.textAlign="left";}this.Canvas.textBaseline="middle";this.Canvas.fillText(item.Title,x,y);textLeft+=item.Width;}}};this.DrawBorder=function(){var left=ToFixedPoint(this.RectClient.Left);var right=ToFixedPoint(this.RectClient.Right);var top=ToFixedPoint(this.RectClient.Top);var bottom=ToFixedPoint(this.RectClient.Bottom);this.Canvas.strokeStyle=this.BorderColor;this.Canvas.beginPath();if(this.IsShowHeader){this.Canvas.moveTo(left,top+this.HeaderHeight);this.Canvas.lineTo(right,top+this.HeaderHeight);}var tableLeft=ToFixedPoint(left+this.TableWidth);for(var i=1;i<this.TableCount;++i){this.Canvas.moveTo(tableLeft,top);this.Canvas.lineTo(tableLeft,bottom);tableLeft=ToFixedPoint(tableLeft+this.TableWidth);}this.Canvas.stroke();};this.DrawBody=function(){if(!this.Data)return;if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;this.Canvas.font=this.ItemFont;var top=this.RectClient.Top+this.HeaderHeight;var left=this.RectClient.Left+this.HeaderMergin.Left;var dataCount=this.Data.Data.length;var index=this.Data.DataOffset;if(this.ShowOrder==1){var index=this.Data.DataOffset+this.TableCount*this.RowCount;if(index>=dataCount)index=dataCount-1;for(var i=0,j=0;i<this.TableCount;++i){var tableLeft=left+this.TableWidth*i;var textLeft=tableLeft;var textTop=top;for(j=0;j<this.RowCount&&index>=0;++j,--index){var dataItem=this.Data.Data[index];this.DrawSelectedRow(dataItem,index,rtRow);this.DrawRow(dataItem,textLeft,textTop,index);textTop+=this.RowHeight;}}}else{for(var i=0,j=0;i<this.TableCount;++i){var tableLeft=left+this.TableWidth*i;var textLeft=tableLeft;var textTop=top;for(j=0;j<this.RowCount&&index<dataCount;++j,++index){var dataItem=this.Data.Data[index];var rtRow={Left:textLeft-this.HeaderMergin.Left,Top:textTop,Height:this.RowHeight,Width:this.TableWidth};rtRow.Right=rtRow.Left+rtRow.Width;rtRow.Bottom=rtRow.Top+rtRow.Height;this.DrawSelectedRow(dataItem,index,rtRow);this.DrawRow(dataItem,textLeft,textTop,index);this.AryCellRect.push({Rect:rtRow,Type:1,DataIndex:index});textTop+=this.RowHeight;}}}};this.DrawRow=function(data,left,top,dataIndex,colIndex){var tableLeft=left;var tableRight=left+this.TableWidth;for(var i=0;i<this.Column.length;++i){var item=this.Column[i];var textColor=item.TextColor;var text=null;var itemWidth=item.Width;var textAlign=item.TextAlign;if(left+itemWidth>tableRight)break;if(i==this.Column.length-1)itemWidth=this.TableWidth-(left-tableLeft)-this.HeaderMergin.Right-this.HeaderMergin.Left;if(item.Type==DEAL_COLUMN_ID.TIME_ID){text=IFrameSplitOperator.FormatTimeString(data.Time,item.Foramt);}else if(item.Type==DEAL_COLUMN_ID.STRING_TIME_ID){text=data.StrTime;}else if(item.Type==DEAL_COLUMN_ID.PRICE_ID){if(data.Price>this.YClose)textColor=this.UpColor;else if(data.Price<this.YClose)textColor=this.DownColor;else textColor=this.
|
|
12972
|
-
var rtItem={Left:left,Top:top,Width:itemWidth,Height:this.RowHeight};if(this.DrawCustomText(item,data,rtItem,dataIndex,i,out)){if(out.Text)text=out.Text;if(out.TextColor)textColor=out.TextColor;if(out.TextAlign)textAlign=out.TextAlign;}}this.
|
|
12985
|
+
{this.UpdateCacheData();var pixelRatio=GetDevicePixelRatio();this.HeaderFont=this.HeaderFontConfig.Size*pixelRatio+'px '+this.HeaderFontConfig.Name;this.ItemFont=this.ItemFontConfig.Size*pixelRatio+'px '+this.ItemFontConfig.Name;this.Canvas.font=this.ItemFont;var sumWidth=0,itemWidth=0;for(var i=0;i<this.Column.length;++i){var item=this.Column[i];itemWidth=this.Canvas.measureText(item.MaxText).width;item.Width=itemWidth+4;sumWidth+=item.Width;}var clientWidth=this.RectClient.Right-this.RectClient.Left;this.TableCount=parseInt(clientWidth/sumWidth);if(this.IsSingleTable)this.TableCount=1;this.TableWidth=clientWidth/this.TableCount;this.HeaderHeight=this.GetFontHeight(this.HeaderFont,"擎")+this.HeaderMergin.Top+this.HeaderMergin.Bottom;if(!this.IsShowHeader)this.HeaderHeight=0;this.RowHeight=this.GetFontHeight(this.ItemFont,"擎")+this.HeaderMergin.Top+this.HeaderMergin.Bottom;this.RowCount=parseInt((this.RectClient.Bottom-this.RectClient.Top-this.HeaderHeight)/this.RowHeight);};this.DrawHeader=function(){if(!this.IsShowHeader)return;var left=this.RectClient.Left+this.HeaderMergin.Left;var top=this.RectClient.Top;var y=top+this.HeaderMergin.Top+(this.HeaderHeight-this.HeaderMergin.Top-this.HeaderMergin.Bottom)/2;this.Canvas.font=this.HeaderFont;this.Canvas.fillStyle=this.HeaderColor;for(var i=0,j=0;i<this.TableCount;++i){var tableLeft=left+this.TableWidth*i;var textLeft=tableLeft;for(j=0;j<this.Column.length;++j){var item=this.Column[j];var itemWidth=item.Width;if(j==this.Column.length-1)itemWidth=this.TableWidth-(textLeft-tableLeft)-this.HeaderMergin.Right-this.HeaderMergin.Left;var x=textLeft;if(item.TextAlign=='center'){x=textLeft+itemWidth/2;this.Canvas.textAlign="center";}else if(item.TextAlign=='right'){x=textLeft+itemWidth;this.Canvas.textAlign="right";}else{this.Canvas.textAlign="left";}this.Canvas.textBaseline="middle";this.Canvas.fillText(item.Title,x,y);textLeft+=item.Width;}}};this.DrawBorder=function(){var left=ToFixedPoint(this.RectClient.Left);var right=ToFixedPoint(this.RectClient.Right);var top=ToFixedPoint(this.RectClient.Top);var bottom=ToFixedPoint(this.RectClient.Bottom);this.Canvas.strokeStyle=this.BorderColor;this.Canvas.beginPath();if(this.IsShowHeader){this.Canvas.moveTo(left,top+this.HeaderHeight);this.Canvas.lineTo(right,top+this.HeaderHeight);}var tableLeft=ToFixedPoint(left+this.TableWidth);for(var i=1;i<this.TableCount;++i){this.Canvas.moveTo(tableLeft,top);this.Canvas.lineTo(tableLeft,bottom);tableLeft=ToFixedPoint(tableLeft+this.TableWidth);}this.Canvas.stroke();};this.DrawBody=function(){if(!this.Data)return;if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;this.Canvas.font=this.ItemFont;var top=this.RectClient.Top+this.HeaderHeight;var left=this.RectClient.Left+this.HeaderMergin.Left;var dataCount=this.Data.Data.length;var index=this.Data.DataOffset;if(this.ShowOrder==1){var index=this.Data.DataOffset+this.TableCount*this.RowCount;if(index>=dataCount)index=dataCount-1;for(var i=0,j=0;i<this.TableCount;++i){var tableLeft=left+this.TableWidth*i;var textLeft=tableLeft;var textTop=top;for(j=0;j<this.RowCount&&index>=0;++j,--index){var dataItem=this.Data.Data[index];this.DrawSelectedRow(dataItem,index,rtRow);this.DrawRow(dataItem,textLeft,textTop,index);textTop+=this.RowHeight;}}}else{for(var i=0,j=0;i<this.TableCount;++i){var tableLeft=left+this.TableWidth*i;var textLeft=tableLeft;var textTop=top;for(j=0;j<this.RowCount&&index<dataCount;++j,++index){var dataItem=this.Data.Data[index];var rtRow={Left:textLeft-this.HeaderMergin.Left,Top:textTop,Height:this.RowHeight,Width:this.TableWidth};rtRow.Right=rtRow.Left+rtRow.Width;rtRow.Bottom=rtRow.Top+rtRow.Height;this.DrawSelectedRow(dataItem,index,rtRow);this.DrawRow(dataItem,textLeft,textTop,index);this.AryCellRect.push({Rect:rtRow,Type:1,DataIndex:index});textTop+=this.RowHeight;}}}};this.DrawRow=function(data,left,top,dataIndex,colIndex){var tableLeft=left;var tableRight=left+this.TableWidth;for(var i=0;i<this.Column.length;++i){var item=this.Column[i];var textColor=item.TextColor;var text=null;var itemWidth=item.Width;var textAlign=item.TextAlign;if(left+itemWidth>tableRight)break;if(i==this.Column.length-1)itemWidth=this.TableWidth-(left-tableLeft)-this.HeaderMergin.Right-this.HeaderMergin.Left;var drawInfo={Text:null,TextColor:item.TextColor,TextAlign:item.TextAlign,Tooltip:null,Index:dataIndex,ColumnIndex:i};var rtItem={Left:left,Top:top,Width:itemWidth,Height:this.RowHeight};rtItem.Right=rtItem.Left+rtItem.Width;rtItem.Bottom=rtItem.Top+rtItem.Height;drawInfo.Rect=rtItem;var bDrawV2=false;if(item.Type==DEAL_COLUMN_ID.TIME_ID){text=IFrameSplitOperator.FormatTimeString(data.Time,item.Foramt);}else if(item.Type==DEAL_COLUMN_ID.STRING_TIME_ID){text=data.StrTime;}else if(item.Type==DEAL_COLUMN_ID.PRICE_ID){if(data.Price>this.YClose)textColor=this.UpColor;else if(data.Price<this.YClose)textColor=this.DownColor;else textColor=this.UnchangeColor;text=data.Price.toFixed(this.Decimal);}else if(item.Type==DEAL_COLUMN_ID.VOL_ID){text=IFrameSplitOperator.FormatValueString(data.Vol,0);textColor=this.GetVolColor(item,data);}else if(item.Type==DEAL_COLUMN_ID.DEAL_ID){text=IFrameSplitOperator.FormatValueString(data.Deal,0);}else if(item.Type==DEAL_COLUMN_ID.BS_ID){if(data.BS==1){text="B";textColor=this.UpColor;}else if(data.BS==2){text="S";textColor=this.DownColor;}}else if(item.Type==DEAL_COLUMN_ID.UPDOWN_ID){if(IFrameSplitOperator.IsNumber(this.YClose)){var value=data.Price-this.YClose;text=value.toFixed(2);if(value>0)textColor=this.UpColor;else if(value<0)textColor=this.DownColor;else textColor=this.UnchangeColor;}}else if(item.Type==DEAL_COLUMN_ID.INDEX_ID){text=(dataIndex+1).toString();}else if(item.Type==DEAL_COLUMN_ID.MULTI_BAR_ID){var rtItem={Left:left,Top:top,Width:itemWidth,Height:this.RowHeight};this.DrawMultiBar(item,data,rtItem);}else if(item.Type==DEAL_COLUMN_ID.CENTER_BAR_ID){var rtItem={Left:left,Top:top,Width:itemWidth,Height:this.RowHeight};this.DrawCenterBar(item,data,rtItem);}else if(item.Type==DEAL_COLUMN_ID.CUSTOM_TEXT_ID){var out={Text:null,TextColor:null,TextAlign:null};//输出
|
|
12986
|
+
var rtItem={Left:left,Top:top,Width:itemWidth,Height:this.RowHeight};if(this.DrawCustomText(item,data,rtItem,dataIndex,i,out)){if(out.Text)text=out.Text;if(out.TextColor)textColor=out.TextColor;if(out.TextAlign)textAlign=out.TextAlign;}}else if(this.IsReserveString(item.Type)){this.FormatReserveString(item,data,drawInfo);bDrawV2=true;}else if(this.IsReserveNumber(item.Type)){this.FormatReserveNumber(item,data,drawInfo);bDrawV2=true;}if(bDrawV2){this.DrawItemText(drawInfo.Text,drawInfo.TextColor,drawInfo.TextAlign,rtItem.Left,rtItem.Top,rtItem.Width,drawInfo.BGColor);}else{this.DrawItemText(text,textColor,textAlign,left,top,itemWidth);}left+=item.Width;}};this.FormatReserveNumber=function(column,data,drawInfo){if(column.DefaultText)drawInfo.Text=column.DefaultText;var fieldName=MAP_DEAL_COLUMN_FIELD.get(column.Type);if(!data||!fieldName)return;var value=data[fieldName];if(!IFrameSplitOperator.IsNumber(value))return;if(IFrameSplitOperator.IsNumber(column.ColorType)){if(column.ColorType==1){drawInfo.TextColor=this.GetUpDownColor(value,0);}else if(column.ColorType==2){drawInfo.TextColor=this.GetUpDownColorV2(value,0);}}var text=value.toFixed(column.FloatPrecision);if(column.Format&&IFrameSplitOperator.IsNumber(column.Format.Type)){var format=column.Format;switch(format.Type){case 1://原始数据
|
|
12987
|
+
text=value.toFixed(column.FloatPrecision);break;case 2://千分位分割
|
|
12988
|
+
text=IFrameSplitOperator.FormatValueThousandsString(value,column.FloatPrecision);break;case 3:var exfloatPrecision=1;if(IFrameSplitOperator.IsNumber(format.ExFloatPrecision))exfloatPrecision=format.ExFloatPrecision;text=IFrameSplitOperator.FormatValueStringV2(value,column.FloatPrecision,exfloatPrecision);break;}}drawInfo.Text=text;};this.FormatReserveString=function(column,data,drawInfo){if(column.DefaultText)drawInfo.Text=column.DefaultText;var fieldName=MAP_DEAL_COLUMN_FIELD.get(column.Type);if(!data||!fieldName)return;var item=data[fieldName];if(IFrameSplitOperator.IsObject(item)){if(item.Text)drawInfo.Text=item.Text;if(item.TextColor)drawInfo.TextColor=item.TextColor;if(item.BGColor)drawInfo.BGColor=item.BGColor;}else if(IFrameSplitOperator.IsString(item)){drawInfo.Text=item;}};this.GetUpDownColor=function(price,price2){if(price>price2)return this.UpColor;else if(price<price2)return this.DownColor;else return this.UnchangeColor;};this.GetUpDownColorV2=function(price,price2){if(price>=price2)return this.UpColor;else return this.DownColor;};this.DrawSelectedRow=function(data,index,rtRow){if(!this.SelectedData)return;if(!this.SelectedData.Enable)return;if(!this.SelectedData.Guid||this.SelectedData.Guid!=data.Guid)return;this.Canvas.fillStyle=this.SelectedConfig.BGColor;this.Canvas.fillRect(rtRow.Left,rtRow.Top,rtRow.Width,rtRow.Height);};this.DrawItemText=function(text,textColor,textAlign,left,top,width){var x=left;if(textAlign=='center'){x=left+width/2;this.Canvas.textAlign="center";}else if(textAlign=='right'){x=left+width;this.Canvas.textAlign="right";}else{this.Canvas.textAlign="left";}this.Canvas.textBaseline="middle";this.Canvas.fillStyle=textColor;if(text)this.Canvas.fillText(text,x,top+this.RowHeight/2);};this.DrawMultiBar=function(colunmInfo,data,rtItem){if(!data.Source||!IFrameSplitOperator.IsNonEmptyArray(data.Source))return false;var barData=data.Source[colunmInfo.DataIndex];//{ Value:[0.4,0,2], Color:[0,1] };
|
|
12973
12989
|
if(!barData)return false;if(!IFrameSplitOperator.IsNonEmptyArray(barData.Value))return false;var width=rtItem.Width-this.BarMergin.Left-this.BarMergin.Right;var left=rtItem.Left+this.BarMergin.Left;var top=rtItem.Top+this.RowMergin.Top+this.BarMergin.Top;var height=rtItem.Height-this.RowMergin.Top-this.RowMergin.Bottom-this.BarMergin.Top-this.BarMergin.Bottom;var right=left+width;for(var i=0;i<barData.Value.length;++i){var value=barData.Value[i];if(value<=0)continue;if(left>=right)break;var barWidth=width*value;if(barWidth<1)barWidth=1;if(left+barWidth>right)barWidth=right-left;var colorIndex=i;if(IFrameSplitOperator.IsNonEmptyArray(barData.Color)&&i<barData.Color.length)colorIndex=barData.Color[i];this.Canvas.fillStyle=g_JSChartResource.DealList.FieldColor.Bar[colorIndex];this.Canvas.fillRect(left,top,barWidth,height);left+=barWidth;}return true;};this.DrawCenterBar=function(colunmInfo,data,rtItem){if(!data.Source||!IFrameSplitOperator.IsNonEmptyArray(data.Source))return false;var barData=data.Source[colunmInfo.DataIndex];//{ Value:[0.4,0,2], Color:[0,1] };
|
|
12974
12990
|
if(!barData)return false;if(!IFrameSplitOperator.IsNonEmptyArray(barData.Value))return false;var width=(rtItem.Width-this.BarMergin.Left-this.BarMergin.Right)/2;var left=rtItem.Left+this.BarMergin.Left;var center=left+width;var top=rtItem.Top+this.RowMergin.Top+this.BarMergin.Top;var height=rtItem.Height-this.RowMergin.Top-this.RowMergin.Bottom-this.BarMergin.Top-this.BarMergin.Bottom;var right=left+width;for(var i=0;i<barData.Value.length&&i<2;++i){var value=barData.Value[i];if(value<=0)continue;if(value>1)value=1;var barWidth=width*value;if(barWidth<1)barWidth=1;var colorIndex=i;if(IFrameSplitOperator.IsNonEmptyArray(barData.Color)&&i<barData.Color.length)colorIndex=barData.Color[i];this.Canvas.fillStyle=g_JSChartResource.DealList.FieldColor.Bar[colorIndex];if(i==0)//左边
|
|
12975
12991
|
{this.Canvas.fillRect(center,top,-barWidth,height);}else//右边
|
|
12976
12992
|
{this.Canvas.fillRect(center,top,barWidth,height);}}};this.DrawCustomText=function(columnInfo,data,rtItem,dataIndex,colid,out){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_DEAL_TEXT);if(!event||!event.Callback)return false;var sendData={Data:data,DataIndex:dataIndex,ColumnIndex:colid,ColumnInfo:columnInfo,Out:{Text:null,TextColor:null,TextAlign:null}};event.Callback(event,sendData,this);if(!sendData.Out.Text)return false;out.Text=sendData.Out.Text;if(sendData.Out.TextColor)out.TextColor=sendData.Out.TextColor;if(sendData.Out.TextAlign)out.TextAlign=sendData.Out.TextAlign;return true;};this.GetVolColor=function(colunmInfo,data){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_DEAL_VOL_COLOR);if(event&&event.Callback){var sendData={Data:data,TextColor:null};event.Callback(event,sendData,this);if(sendData.TextColor)return sendData.TextColor;}return colunmInfo.TextColor;};this.GetFontHeight=function(font,word){return GetFontHeight(this.Canvas,font,word);};this.OnMouseDown=function(x,y,e)//Type: 1=行
|
|
12977
|
-
{if(!this.Data)return null;var pixelTatio=GetDevicePixelRatio();var insidePoint={X:x/pixelTatio,Y:y/pixelTatio};var uiElement;if(this.UIElement)uiElement={Left:this.UIElement.getBoundingClientRect().left,Top:this.UIElement.getBoundingClientRect().top};else uiElement={Left:null,Top:null};var row=this.PtInBody(x,y);if(row){var bRedraw=true;var index=row.DataIndex;var id=row.Item.Guid;if(this.SelectedData.Index==index&&this.SelectedData.Guid==id)bRedraw=false;this.SelectedData.Index=index;this.SelectedData.Guid=id;var eventID=JSCHART_EVENT_ID.ON_CLICK_DEAL_ROW;if(e.button==2)eventID=JSCHART_EVENT_ID.ON_RCLICK_DEAL_ROW;this.SendClickEvent(eventID,{Data:row,X:x,Y:y,e:e,Inside:insidePoint,UIElement:uiElement});return{Type:row.Type,Redraw:bRedraw,Row:row};}return null;};this.OnDblClick=function(x,y,e){if(!this.Data)return false;var row=this.PtInBody(x,y);if(row){this.SendClickEvent(JSCHART_EVENT_ID.ON_DBCLICK_DEAL_ROW,{Data:row,X:x,Y:y});return true;}return false;};this.PtInBody=function(x,y){if(!this.Data)return null;if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return null;if(!IFrameSplitOperator.IsNonEmptyArray(this.AryCellRect))return null;for(var i=0;i<this.AryCellRect.length;++i){var item=this.AryCellRect[i];var rtRow=item.Rect;if(x>=rtRow.Left&&x<=rtRow.Right&&y>=rtRow.Top&&y<=rtRow.Bottom){var data={Rect:rtRow,DataIndex:item.DataIndex,Item:this.Data.Data[item.DataIndex],Type:item.Type};return data;}}return null;};this.SendClickEvent=function(id,data){var event=this.GetEventCallback(id);if(event&&event.Callback){event.Callback(event,data,this);}};}/*
|
|
12993
|
+
{if(!this.Data)return null;var pixelTatio=GetDevicePixelRatio();var insidePoint={X:x/pixelTatio,Y:y/pixelTatio};var uiElement;if(this.UIElement)uiElement={Left:this.UIElement.getBoundingClientRect().left,Top:this.UIElement.getBoundingClientRect().top};else uiElement={Left:null,Top:null};var row=this.PtInBody(x,y);if(row){var bRedraw=true;var index=row.DataIndex;var id=row.Item.Guid;if(this.SelectedData.Index==index&&this.SelectedData.Guid==id)bRedraw=false;this.SelectedData.Index=index;this.SelectedData.Guid=id;var eventID=JSCHART_EVENT_ID.ON_CLICK_DEAL_ROW;if(e.button==2)eventID=JSCHART_EVENT_ID.ON_RCLICK_DEAL_ROW;this.SendClickEvent(eventID,{Data:row,X:x,Y:y,e:e,Inside:insidePoint,UIElement:uiElement});return{Type:row.Type,Redraw:bRedraw,Row:row};}return null;};this.OnDblClick=function(x,y,e){if(!this.Data)return false;var row=this.PtInBody(x,y);if(row){this.SendClickEvent(JSCHART_EVENT_ID.ON_DBCLICK_DEAL_ROW,{Data:row,X:x,Y:y});return true;}return false;};this.PtInBody=function(x,y){if(!this.Data)return null;if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return null;if(!IFrameSplitOperator.IsNonEmptyArray(this.AryCellRect))return null;for(var i=0;i<this.AryCellRect.length;++i){var item=this.AryCellRect[i];var rtRow=item.Rect;if(x>=rtRow.Left&&x<=rtRow.Right&&y>=rtRow.Top&&y<=rtRow.Bottom){var data={Rect:rtRow,DataIndex:item.DataIndex,Item:this.Data.Data[item.DataIndex],Type:item.Type};return data;}}return null;};this.SendClickEvent=function(id,data){var event=this.GetEventCallback(id);if(event&&event.Callback){event.Callback(event,data,this);}};this.IsReserveString=function(value){var ARARY_TYPE=[DEAL_COLUMN_ID.RESERVE_STRING1_ID,DEAL_COLUMN_ID.RESERVE_STRING2_ID,DEAL_COLUMN_ID.RESERVE_STRING3_ID,DEAL_COLUMN_ID.RESERVE_STRING4_ID,DEAL_COLUMN_ID.RESERVE_STRING5_ID,DEAL_COLUMN_ID.RESERVE_STRING6_ID,DEAL_COLUMN_ID.RESERVE_STRING7_ID,DEAL_COLUMN_ID.RESERVE_STRING8_ID,DEAL_COLUMN_ID.RESERVE_STRING9_ID,DEAL_COLUMN_ID.RESERVE_STRING10_ID];return ARARY_TYPE.includes(value);};this.IsReserveNumber=function(value){var ARARY_TYPE=[DEAL_COLUMN_ID.RESERVE_NUMBER1_ID,DEAL_COLUMN_ID.RESERVE_NUMBER2_ID,DEAL_COLUMN_ID.RESERVE_NUMBER3_ID,DEAL_COLUMN_ID.RESERVE_NUMBER4_ID,DEAL_COLUMN_ID.RESERVE_NUMBER5_ID,DEAL_COLUMN_ID.RESERVE_NUMBER6_ID,DEAL_COLUMN_ID.RESERVE_NUMBER7_ID,DEAL_COLUMN_ID.RESERVE_NUMBER8_ID,DEAL_COLUMN_ID.RESERVE_NUMBER9_ID,DEAL_COLUMN_ID.RESERVE_NUMBER10_ID];return ARARY_TYPE.includes(value);};}/*
|
|
12978
12994
|
Copyright (c) 2018 jones
|
|
12979
12995
|
|
|
12980
12996
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -14913,7 +14929,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
|
|
|
14913
14929
|
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);};}/********************************************************************************
|
|
14914
14930
|
* 版本信息输出
|
|
14915
14931
|
*
|
|
14916
|
-
*/var HQCHART_VERSION="1.1.
|
|
14932
|
+
*/var HQCHART_VERSION="1.1.14749";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();//把给外界调用的方法暴露出来
|
|
14917
14933
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
14918
14934
|
// BaseIndex:BaseIndex,
|
|
14919
14935
|
// ChartLine:ChartLine,
|