提交 76cef5a7 编写于 作者: HQChart's avatar HQChart

ver 6958

上级 82b15c6b
......@@ -5138,8 +5138,9 @@ function JSChartContainer(uielement)
{
this.ChartCorssCursor.LastPoint=this.LastPoint;
this.ChartCorssCursor.CursorIndex=this.CursorIndex;
//移动端 拖拽数据的时候 不显示十字光标
if (!(this.CorssCursorTouchEnd===true && this.MouseDrag)) this.ChartCorssCursor.Draw();
//移动端 拖拽数据的时候 不显示十字光标, 没有按屏的时候也不显示十字光标
if (!(this.CorssCursorTouchEnd===true && this.MouseDrag) && !(this.CorssCursorTouchEnd==true && this.IsOnTouch==false) )
this.ChartCorssCursor.Draw();
}
}
......@@ -1160,6 +1160,7 @@ var JSCHART_EVENT_ID=
CHART_STATUS:5, //每次Draw() 以后会调用
BARRAGE_PLAY_END:6, //单个弹幕播放完成
RECV_OVERLAY_INDEX_DATA:7,//接收叠加指标数据
DBCLICK_KLINE:8, //双击K线图
}
var JSCHART_OPERATOR_ID=
......@@ -1221,6 +1222,7 @@ function JSChartContainer(uielement)
//this.SelectRect.style.opacity=g_JSChartResource.SelectRectAlpha;
this.SelectRect.id=Guid();
uielement.parentNode.appendChild(this.SelectRect);
//区间选择右键菜单
this.SelectRectRightMenu;
......@@ -19501,7 +19503,7 @@ function KLineChartContainer(uielement)
this.ChartDrawStorageCache=null; //首次需要创建的画图工具数据
this.CustomShow=null; //首先显示的K线的起始日期 { Date:日期 PageSize:}
this.OverlayIndexFrameWidth=60; //叠加指标框架宽度
this.OverlayIndexFrameWidth=60; //叠加指标框架宽度
//自动更新设置
this.IsAutoUpdate=false; //是否自动更新行情数据
......@@ -20303,19 +20305,36 @@ function KLineChartContainer(uielement)
if (this.IsOnTouch==true) return; //正在操作中不更新数据
if (!data.stock || !data.stock[0] || this.Symbol!=data.stock[0].symbol) return;
var realtimeData=KLineChartContainer.JsonDataToRealtimeData(data);
if (this.SourceData.Data[this.SourceData.Data.length-1].Date!=realtimeData.Date) return;
var item=this.SourceData.Data[this.SourceData.Data.length-1]; //最新的一条数据
console.log('[KLineChartContainer::RecvRealtimeData] update kline by minute data',realtimeData);
if (item.Date==realtimeData.Date) //实时行情数据更新
{
console.log('[KLineChartContainer::RecvRealtimeData] update kline by minute data',realtimeData);
//实时行情数据更新
var item =this.SourceData.Data[this.SourceData.Data.length-1];
item.Close=realtimeData.Close;
item.High=realtimeData.High;
item.Low=realtimeData.Low;
item.Vol=realtimeData.Vol;
item.Amount=realtimeData.Amount;
item.Close=realtimeData.Close;
item.High=realtimeData.High;
item.Low=realtimeData.Low;
item.Vol=realtimeData.Vol;
item.Amount=realtimeData.Amount;
}
else if (item.Date<realtimeData.Date) //新增加数据
{
console.log('[KLineChartContainer::RecvRealtimeData] insert kline by minute data',realtimeData);
var newItem =new HistoryData();
newItem.Close=realtimeData.Close;
newItem.High=realtimeData.High;
newItem.Low=realtimeData.Low;
newItem.Vol=realtimeData.Vol;
newItem.Amount=realtimeData.Amount;
newItem.Date=realtimeData.Date;
this.SourceData.Data.push(newItem);
}
else
{
return;
}
var bindData=new ChartData();
bindData.Data=this.SourceData.Data;
bindData.Period=this.Period;
......@@ -22573,7 +22592,10 @@ function KLineChartContainer(uielement)
this.OnDoubleClick=function(x,y,e)
{
if (!this.MinuteDialog) return;
var event=null;
if (this.mapEvent.has(JSCHART_EVENT_ID.DBCLICK_KLINE)) event=this.mapEvent.get(JSCHART_EVENT_ID.DBCLICK_KLINE);
if (!this.MinuteDialog && !event) return;
var tooltip=new TooltipData();
for(var i in this.ChartPaint)
......@@ -22587,9 +22609,17 @@ function KLineChartContainer(uielement)
if (!tooltip.Data) return;
e.data={Chart:this,Tooltip:tooltip};
if (event)
{
var data={ Tooltip:tooltip, Stock:{Symbol:this.Symbol, Name:this.Name } }
event.Callback(event,data,this);
}
this.MinuteDialog.DoModal(e);
if (this.MinuteDialog)
{
e.data={Chart:this,Tooltip:tooltip};
this.MinuteDialog.DoModal(e);
}
}
//选中画图工具 出现单个图形设置菜单
......@@ -29023,13 +29053,13 @@ function MinuteDialog(divElement)
var div=document.createElement('div');
div.className='jchart-kline-minute-box';
div.id=this.ID;
div.innerHTML="<div><div class='minute-dialog-title'><span></span><strong class='close-munite icon iconfont icon-close'></strong></div></div>";
var hqchartID=Guid();
div.innerHTML=`<div><div class='minute-dialog-title'><span></span><strong class='close-munite icon iconfont icon-close'></strong></div><div class='minute-hqchart' id='${hqchartID}' ></div></div>`;
div.style.width=this.Height+'px';
div.style.height=this.Width+'px';
this.DivElement.appendChild(div);
this.JSChart=JSChart.Init(div);
this.JSChart=JSChart.Init(document.getElementById(hqchartID));
var option=
{
......@@ -5167,8 +5167,9 @@ function JSChartContainer(uielement)
{
this.ChartCorssCursor.LastPoint=this.LastPoint;
this.ChartCorssCursor.CursorIndex=this.CursorIndex;
//移动端 拖拽数据的时候 不显示十字光标
if (!(this.CorssCursorTouchEnd===true && this.MouseDrag)) this.ChartCorssCursor.Draw();
//移动端 拖拽数据的时候 不显示十字光标, 没有按屏的时候也不显示十字光标
if (!(this.CorssCursorTouchEnd===true && this.MouseDrag) && !(this.CorssCursorTouchEnd==true && this.IsOnTouch==false) )
this.ChartCorssCursor.Draw();
}
}
......@@ -1160,6 +1160,7 @@ var JSCHART_EVENT_ID=
CHART_STATUS:5, //每次Draw() 以后会调用
BARRAGE_PLAY_END:6, //单个弹幕播放完成
RECV_OVERLAY_INDEX_DATA:7,//接收叠加指标数据
DBCLICK_KLINE:8, //双击K线图
}
var JSCHART_OPERATOR_ID=
......@@ -1221,6 +1222,7 @@ function JSChartContainer(uielement)
//this.SelectRect.style.opacity=g_JSChartResource.SelectRectAlpha;
this.SelectRect.id=Guid();
uielement.parentNode.appendChild(this.SelectRect);
//区间选择右键菜单
this.SelectRectRightMenu;
......@@ -19501,7 +19503,7 @@ function KLineChartContainer(uielement)
this.ChartDrawStorageCache=null; //首次需要创建的画图工具数据
this.CustomShow=null; //首先显示的K线的起始日期 { Date:日期 PageSize:}
this.OverlayIndexFrameWidth=60; //叠加指标框架宽度
this.OverlayIndexFrameWidth=60; //叠加指标框架宽度
//自动更新设置
this.IsAutoUpdate=false; //是否自动更新行情数据
......@@ -20303,19 +20305,36 @@ function KLineChartContainer(uielement)
if (this.IsOnTouch==true) return; //正在操作中不更新数据
if (!data.stock || !data.stock[0] || this.Symbol!=data.stock[0].symbol) return;
var realtimeData=KLineChartContainer.JsonDataToRealtimeData(data);
if (this.SourceData.Data[this.SourceData.Data.length-1].Date!=realtimeData.Date) return;
var item=this.SourceData.Data[this.SourceData.Data.length-1]; //最新的一条数据
console.log('[KLineChartContainer::RecvRealtimeData] update kline by minute data',realtimeData);
if (item.Date==realtimeData.Date) //实时行情数据更新
{
console.log('[KLineChartContainer::RecvRealtimeData] update kline by minute data',realtimeData);
//实时行情数据更新
var item =this.SourceData.Data[this.SourceData.Data.length-1];
item.Close=realtimeData.Close;
item.High=realtimeData.High;
item.Low=realtimeData.Low;
item.Vol=realtimeData.Vol;
item.Amount=realtimeData.Amount;
item.Close=realtimeData.Close;
item.High=realtimeData.High;
item.Low=realtimeData.Low;
item.Vol=realtimeData.Vol;
item.Amount=realtimeData.Amount;
}
else if (item.Date<realtimeData.Date) //新增加数据
{
console.log('[KLineChartContainer::RecvRealtimeData] insert kline by minute data',realtimeData);
var newItem =new HistoryData();
newItem.Close=realtimeData.Close;
newItem.High=realtimeData.High;
newItem.Low=realtimeData.Low;
newItem.Vol=realtimeData.Vol;
newItem.Amount=realtimeData.Amount;
newItem.Date=realtimeData.Date;
this.SourceData.Data.push(newItem);
}
else
{
return;
}
var bindData=new ChartData();
bindData.Data=this.SourceData.Data;
bindData.Period=this.Period;
......@@ -22573,7 +22592,10 @@ function KLineChartContainer(uielement)
this.OnDoubleClick=function(x,y,e)
{
if (!this.MinuteDialog) return;
var event=null;
if (this.mapEvent.has(JSCHART_EVENT_ID.DBCLICK_KLINE)) event=this.mapEvent.get(JSCHART_EVENT_ID.DBCLICK_KLINE);
if (!this.MinuteDialog && !event) return;
var tooltip=new TooltipData();
for(var i in this.ChartPaint)
......@@ -22587,9 +22609,17 @@ function KLineChartContainer(uielement)
if (!tooltip.Data) return;
e.data={Chart:this,Tooltip:tooltip};
if (event)
{
var data={ Tooltip:tooltip, Stock:{Symbol:this.Symbol, Name:this.Name } }
event.Callback(event,data,this);
}
this.MinuteDialog.DoModal(e);
if (this.MinuteDialog)
{
e.data={Chart:this,Tooltip:tooltip};
this.MinuteDialog.DoModal(e);
}
}
//选中画图工具 出现单个图形设置菜单
......@@ -29023,13 +29053,13 @@ function MinuteDialog(divElement)
var div=document.createElement('div');
div.className='jchart-kline-minute-box';
div.id=this.ID;
div.innerHTML="<div><div class='minute-dialog-title'><span></span><strong class='close-munite icon iconfont icon-close'></strong></div></div>";
var hqchartID=Guid();
div.innerHTML=`<div><div class='minute-dialog-title'><span></span><strong class='close-munite icon iconfont icon-close'></strong></div><div class='minute-hqchart' id='${hqchartID}' ></div></div>`;
div.style.width=this.Height+'px';
div.style.height=this.Width+'px';
this.DivElement.appendChild(div);
this.JSChart=JSChart.Init(div);
this.JSChart=JSChart.Init(document.getElementById(hqchartID));
var option=
{
......@@ -1160,6 +1160,7 @@ var JSCHART_EVENT_ID=
CHART_STATUS:5, //每次Draw() 以后会调用
BARRAGE_PLAY_END:6, //单个弹幕播放完成
RECV_OVERLAY_INDEX_DATA:7,//接收叠加指标数据
DBCLICK_KLINE:8, //双击K线图
}
var JSCHART_OPERATOR_ID=
......@@ -1221,6 +1222,7 @@ function JSChartContainer(uielement)
//this.SelectRect.style.opacity=g_JSChartResource.SelectRectAlpha;
this.SelectRect.id=Guid();
uielement.parentNode.appendChild(this.SelectRect);
//区间选择右键菜单
this.SelectRectRightMenu;
......@@ -19501,7 +19503,7 @@ function KLineChartContainer(uielement)
this.ChartDrawStorageCache=null; //首次需要创建的画图工具数据
this.CustomShow=null; //首先显示的K线的起始日期 { Date:日期 PageSize:}
this.OverlayIndexFrameWidth=60; //叠加指标框架宽度
this.OverlayIndexFrameWidth=60; //叠加指标框架宽度
//自动更新设置
this.IsAutoUpdate=false; //是否自动更新行情数据
......@@ -20303,19 +20305,36 @@ function KLineChartContainer(uielement)
if (this.IsOnTouch==true) return; //正在操作中不更新数据
if (!data.stock || !data.stock[0] || this.Symbol!=data.stock[0].symbol) return;
var realtimeData=KLineChartContainer.JsonDataToRealtimeData(data);
if (this.SourceData.Data[this.SourceData.Data.length-1].Date!=realtimeData.Date) return;
var item=this.SourceData.Data[this.SourceData.Data.length-1]; //最新的一条数据
console.log('[KLineChartContainer::RecvRealtimeData] update kline by minute data',realtimeData);
if (item.Date==realtimeData.Date) //实时行情数据更新
{
console.log('[KLineChartContainer::RecvRealtimeData] update kline by minute data',realtimeData);
//实时行情数据更新
var item =this.SourceData.Data[this.SourceData.Data.length-1];
item.Close=realtimeData.Close;
item.High=realtimeData.High;
item.Low=realtimeData.Low;
item.Vol=realtimeData.Vol;
item.Amount=realtimeData.Amount;
item.Close=realtimeData.Close;
item.High=realtimeData.High;
item.Low=realtimeData.Low;
item.Vol=realtimeData.Vol;
item.Amount=realtimeData.Amount;
}
else if (item.Date<realtimeData.Date) //新增加数据
{
console.log('[KLineChartContainer::RecvRealtimeData] insert kline by minute data',realtimeData);
var newItem =new HistoryData();
newItem.Close=realtimeData.Close;
newItem.High=realtimeData.High;
newItem.Low=realtimeData.Low;
newItem.Vol=realtimeData.Vol;
newItem.Amount=realtimeData.Amount;
newItem.Date=realtimeData.Date;
this.SourceData.Data.push(newItem);
}
else
{
return;
}
var bindData=new ChartData();
bindData.Data=this.SourceData.Data;
bindData.Period=this.Period;
......@@ -22573,7 +22592,10 @@ function KLineChartContainer(uielement)
this.OnDoubleClick=function(x,y,e)
{
if (!this.MinuteDialog) return;
var event=null;
if (this.mapEvent.has(JSCHART_EVENT_ID.DBCLICK_KLINE)) event=this.mapEvent.get(JSCHART_EVENT_ID.DBCLICK_KLINE);
if (!this.MinuteDialog && !event) return;
var tooltip=new TooltipData();
for(var i in this.ChartPaint)
......@@ -22587,9 +22609,17 @@ function KLineChartContainer(uielement)
if (!tooltip.Data) return;
e.data={Chart:this,Tooltip:tooltip};
if (event)
{
var data={ Tooltip:tooltip, Stock:{Symbol:this.Symbol, Name:this.Name } }
event.Callback(event,data,this);
}
this.MinuteDialog.DoModal(e);
if (this.MinuteDialog)
{
e.data={Chart:this,Tooltip:tooltip};
this.MinuteDialog.DoModal(e);
}
}
//选中画图工具 出现单个图形设置菜单
......@@ -29023,13 +29053,13 @@ function MinuteDialog(divElement)
var div=document.createElement('div');
div.className='jchart-kline-minute-box';
div.id=this.ID;
div.innerHTML="<div><div class='minute-dialog-title'><span></span><strong class='close-munite icon iconfont icon-close'></strong></div></div>";
var hqchartID=Guid();
div.innerHTML=`<div><div class='minute-dialog-title'><span></span><strong class='close-munite icon iconfont icon-close'></strong></div><div class='minute-hqchart' id='${hqchartID}' ></div></div>`;
div.style.width=this.Height+'px';
div.style.height=this.Width+'px';
this.DivElement.appendChild(div);
this.JSChart=JSChart.Init(div);
this.JSChart=JSChart.Init(document.getElementById(hqchartID));
var option=
{
......@@ -52,15 +52,43 @@ var BLACK_STYLE = //黑色风格
CorssCursorTextFont: "12px 微软雅黑",
CorssCursorPenColor: "rgb(130,130,130)", //十字光标线段颜色
KLine:
{
{
MaxMin: { Font: '12px 微软雅黑', Color: 'rgb(111,111,111)' }, //K线最大最小值显示
Info: //信息地雷
{
{
Color: 'rgb(205,149,12)',
TextColor: '#afc0da',
TextBGColor: '#1a283e',
}
},
Investor:
{
ApiUrl: '/API/NewsInteract', //互动易
},
Announcement: //公告
{
ApiUrl: '/API/ReportList',
},
Pforecast: //业绩预告
{
ApiUrl: '/API/StockHistoryDay',
},
Research: //调研
{
ApiUrl: '/API/InvestorRelationsList',
},
BlockTrading: //大宗交易
{
ApiUrl: '/API/StockHistoryDay',
},
TradeDetail: //龙虎榜
{
ApiUrl: '/API/StockHistoryDay',
},
Policy: //策略
{
ApiUrl: '/API/StockHistoryDay',
}
}
},
Index: { //指标线段颜色
LineColor: [
......@@ -145,15 +173,43 @@ var WHITE_STYLE= //白色风格
CorssCursorPenColor: "rgb(130,130,130)", //十字光标线段颜色
KLine:
{
{
MaxMin: { Font: '12px 微软雅黑', Color: 'rgb(111,111,111)' }, //K线最大最小值显示
Info: //信息地雷
{
{
Color: 'rgb(205,149,12)',
TextColor: '#197de9',
TextBGColor: '#e1e4ef',
}
},
Investor:
{
ApiUrl: '/API/NewsInteract', //互动易
},
Announcement: //公告
{
ApiUrl: '/API/ReportList',
},
Pforecast: //业绩预告
{
ApiUrl: '/API/StockHistoryDay',
},
Research: //调研
{
ApiUrl: '/API/InvestorRelationsList',
},
BlockTrading: //大宗交易
{
ApiUrl: '/API/StockHistoryDay',
},
TradeDetail: //龙虎榜
{
ApiUrl: '/API/StockHistoryDay',
},
Policy: //策略
{
ApiUrl: '/API/StockHistoryDay',
}
}
},
Index: { //指标线段颜色
LineColor: [
......
......@@ -102,12 +102,11 @@ function JSChart(element)
}
}
this.OnSize = function () {
if (this.JSChartContainer && this.JSChartContainer.Frame)
this.JSChartContainer.Frame.SetSizeChage(true);
if (this.JSChartContainer) this.JSChartContainer.Draw();
}
this.OnSize = function ()
{
if (this.JSChartContainer && this.JSChartContainer.Frame) this.JSChartContainer.Frame.SetSizeChage(true);
if (this.JSChartContainer) this.JSChartContainer.Draw();
}
//历史K线图
this.CreateKLineChartContainer = function (option)
......@@ -953,6 +952,7 @@ function JSChartContainer(uielement)
this.TouchTimer = null; //触屏定时器
this.LastDrawStatus; //最后一次画的状态
this.LastDrawID=1; //最后一次画的ID
this.SnapshotType = 0;
this.CursorIndex = 0; //十字光标X轴索引
this.LastPoint = new Point(); //鼠标位置
......@@ -1004,45 +1004,43 @@ function JSChartContainer(uielement)
this.GetIndexEvent = function () { return this.GetEvent(JSCHART_EVENT_ID.RECV_INDEX_DATA); } //接收指标数据
this.GetBarrageEvent=function() { return this.GetEvent(JSCHART_EVENT_ID.BARRAGE_PLAY_END);} //获取弹幕事件
//判断是单个手指
this.IsPhoneDragging = function (e) {
// console.log(e);
var changed = e.changedTouches.length;
var touching = e.touches.length;
return changed == 1 && touching == 1;
}
//判断是单个手指
this.IsPhoneDragging = function (e)
{
// console.log(e);
var changed = e.changedTouches.length;
var touching = e.touches.length;
//是否是2个手指操所
this.IsPhonePinching = function (e) {
var changed = e.changedTouches.length;
var touching = e.touches.length;
return changed == 1 && touching == 1;
}
return (changed == 1 || changed == 2) && touching == 2;
}
//是否是2个手指操所
this.IsPhonePinching = function (e)
{
var changed = e.changedTouches.length;
var touching = e.touches.length;
this.GetToucheData = function (e, isForceLandscape) {
var touches = new Array();
for (var i = 0; i < e.touches.length; ++i) {
var item = e.touches[i];
if (isForceLandscape) {
touches.push(
{
clientX: item.y, clientY: item.x,
pageX: item.y, pageY: item.x
});
}
else {
touches.push(
{
clientX: item.x, clientY: item.y,
pageX: item.x, pageY: item.y
});
}
return (changed == 1 || changed == 2) && touching == 2;
}
return touches;
}
this.GetToucheData = function (e, isForceLandscape)
{
var touches = new Array();
for (var i = 0; i < e.touches.length; ++i)
{
var item = e.touches[i];
if (isForceLandscape)
{
touches.push( { clientX: item.y, clientY: item.x, pageX: item.y, pageY: item.x });
}
else
{
touches.push( {clientX: item.x, clientY: item.y, pageX: item.x, pageY: item.y });
}
}
return touches;
}
//手机拖拽
this.ontouchstart = function (e)
......@@ -1267,7 +1265,7 @@ function JSChartContainer(uielement)
this.Canvas.draw(false, function ()
{
//if (lastDrawID == self.LastDrawID)
self.Frame.Snapshot(); //只保存最后一次的截图
self.Frame.Snapshot(self.SnapshotType); //只保存最后一次的截图
console.log('[JSChartContainer:Draw] finish. DrawID('+ lastDrawID +','+ self.LastDrawID +')');
});
}
......@@ -1279,13 +1277,31 @@ function JSChartContainer(uielement)
//画动态信息
this.DrawDynamicInfo = function ()
{
if (this.Frame.ScreenImagePath == null) return;
var self = this;
var width = this.Frame.ChartBorder.GetChartWidth();
var height = this.Frame.ChartBorder.GetChartHeight();
self.Canvas.drawImage(this.Frame.ScreenImagePath, 0, 0, width, height);
if (self.SnapshotType==1)
{
if (this.Frame.ScreenImageData == null) return;
wx.canvasPutImageData({
canvasId: this.UIElement.ID,
x: 0,y: 0,width: width,height: height,
data: this.Frame.ScreenImageData,
success(res) { self.DrawDynamicChart(true); }
})
}
else
{
if (this.Frame.ScreenImagePath == null) return;
self.Canvas.drawImage(this.Frame.ScreenImagePath, 0, 0, width, height);
self.DrawDynamicChart(false);
}
}
this.DrawDynamicChart = function (bReserve)
{
var self = this;
if (self.ChartCorssCursor)
{
self.ChartCorssCursor.LastPoint = self.LastPoint;
......@@ -1317,10 +1333,10 @@ function JSChartContainer(uielement)
}
}
this.LastDrawStatus ='DrawDynamicInfo';
console.log('[JSChartContainer:DrawDynamicInfo][ID=' + this.UIElement.ID + '] draw .....');
self.Canvas.draw(false, function () {
console.log('[JSChartContainer:DrawDynamicInfo] finish.');
this.LastDrawStatus = 'DrawDynamicInfo';
console.log('[JSChartContainer:DrawDynamicChart][ID=' + this.UIElement.ID + '] draw .....');
self.Canvas.draw(bReserve, function () {
console.log('[JSChartContainer:DrawDynamicChart] finish.');
});
}
......@@ -2874,7 +2890,8 @@ function HQTradeFrame()
this.SizeChange = true; //大小是否改变
this.ChartBorder;
this.Canvas; //画布
this.ScreenImagePath; //截图路径
this.ScreenImagePath; //截图路径
this.ScreenImageData=null; //截图数据
this.Data; //主数据
this.Position; //画布的位置
this.SizeChange = true;
......@@ -2882,133 +2899,167 @@ function HQTradeFrame()
this.CurrentSnapshotID=0;
this.SnapshotStatus=0; //0空闲 1工作
this.CalculateChartBorder = function () //计算每个子框架的边框信息
{
if (this.SubFrame.length <= 0) return;
this.CalculateChartBorder = function () //计算每个子框架的边框信息
{
if (this.SubFrame.length <= 0) return;
var top = this.ChartBorder.GetTop();
var height = this.ChartBorder.GetHeight();
var totalHeight = 0;
var top = this.ChartBorder.GetTop();
var height = this.ChartBorder.GetHeight();
var totalHeight = 0;
for (var i in this.SubFrame) {
var item = this.SubFrame[i];
totalHeight += item.Height;
}
for (var i in this.SubFrame)
{
var item = this.SubFrame[i];
totalHeight += item.Height;
}
for (var i in this.SubFrame)
{
var item = this.SubFrame[i];
item.Frame.ChartBorder.Top = top;
item.Frame.ChartBorder.Left = this.ChartBorder.Left;
item.Frame.ChartBorder.Right = this.ChartBorder.Right;
var frameHeight = height * (item.Height / totalHeight) + top;
item.Frame.ChartBorder.Bottom = this.ChartBorder.GetChartHeight() - frameHeight;
top = frameHeight;
}
for (var i in this.SubFrame) {
var item = this.SubFrame[i];
item.Frame.ChartBorder.Top = top;
item.Frame.ChartBorder.Left = this.ChartBorder.Left;
item.Frame.ChartBorder.Right = this.ChartBorder.Right;
var frameHeight = height * (item.Height / totalHeight) + top;
item.Frame.ChartBorder.Bottom = this.ChartBorder.GetChartHeight() - frameHeight;
top = frameHeight;
}
}
this.Draw = function ()
{
if (this.SizeChange === true) this.CalculateChartBorder();
this.Draw = function () {
if (this.SizeChange === true) this.CalculateChartBorder();
for (var i in this.SubFrame)
{
var item = this.SubFrame[i];
item.Frame.Draw();
}
for (var i in this.SubFrame) {
var item = this.SubFrame[i];
item.Frame.Draw();
this.SizeChange = false;
}
this.SizeChange = false;
}
this.DrawLock = function () {
for (var i in this.SubFrame) {
var item = this.SubFrame[i];
item.Frame.DrawLock();
this.DrawLock = function () {
for (var i in this.SubFrame) {
var item = this.SubFrame[i];
item.Frame.DrawLock();
}
}
}
this.DrawInsideHorizontal = function () {
for (var i in this.SubFrame) {
var item = this.SubFrame[i];
item.Frame.DrawInsideHorizontal();
this.DrawInsideHorizontal = function () {
for (var i in this.SubFrame) {
var item = this.SubFrame[i];
item.Frame.DrawInsideHorizontal();
}
}
}
this.SetSizeChage = function (sizeChange) {
this.SizeChange = sizeChange;
this.SetSizeChage = function (sizeChange) {
this.SizeChange = sizeChange;
for (var i in this.SubFrame) {
var item = this.SubFrame[i];
item.Frame.SizeChange = sizeChange;
for (var i in this.SubFrame) {
var item = this.SubFrame[i];
item.Frame.SizeChange = sizeChange;
}
//画布的位置
this.Position = {
X: this.ChartBorder.UIElement.offsetLeft,
Y: this.ChartBorder.UIElement.offsetTop,
W: this.ChartBorder.UIElement.clientWidth,
H: this.ChartBorder.UIElement.clientHeight
};
}
//画布的位置
this.Position = {
X: this.ChartBorder.UIElement.offsetLeft,
Y: this.ChartBorder.UIElement.offsetTop,
W: this.ChartBorder.UIElement.clientWidth,
H: this.ChartBorder.UIElement.clientHeight
};
}
this.Snapshot=function(type)
{
if (type == 1) this.SnapshotImageData();
else this.SnapshotImagePath();
}
//图形快照
this.Snapshot = function ()
this.SnapshotImagePath = function ()
{
var self = this;
var width = this.ChartBorder.GetChartWidth();
var height = this.ChartBorder.GetChartHeight();
console.log('[HQTradeFrame::Snapshot][ID=' + this.ChartBorder.UIElement.ID + '] invoke canvasToTempFilePath' + '(width=' + width + ',height=' + height + ')' + ' SnapshotStatus='+ this.SnapshotStatus);
//console.log('[HQTradeFrame::SnapshotImageData][ID=' + this.ChartBorder.UIElement.ID + '] invoke canvasToTempFilePath' + '(width=' + width + ',height=' + height + ')' + ' SnapshotStatus='+ this.SnapshotStatus);
//if (this.SnapshotStatus==1) return;
++this.SnapshotID;
var id = this.SnapshotID;
this.SnapshotStatus=1;
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: width,
height: height,
canvasId: this.ChartBorder.UIElement.ID,
success: function (res) {
self.ScreenImagePath = res.tempFilePath;
self.SnapshotStatus = 0;
self.CurrentSnapshotID = id;
console.log('[HQTradeFrame::Snapshot] SnapshotID(' + self.SnapshotID + ',' + self.CurrentSnapshotID + ') Path ='+ res.tempFilePath);
}
x: 0,
y: 0,
width: width,
height: height,
canvasId: this.ChartBorder.UIElement.ID,
success: function (res)
{
self.ScreenImagePath = res.tempFilePath;
self.SnapshotStatus = 0;
self.CurrentSnapshotID = id;
//console.log('[HQTradeFrame::SnapshotImagePath] SnapshotID(' + self.SnapshotID + ',' + self.CurrentSnapshotID + ') Path ='+ res.tempFilePath);
}
})
}
this.GetXData = function (x) {
return this.SubFrame[0].Frame.GetXData(x);
}
this.GetYData = function (y, outObject) //outObject 可以保存返回的额外数据)
{
var frame;
for (var i in this.SubFrame) {
var item = this.SubFrame[i];
var left = item.Frame.ChartBorder.GetLeft();
var top = item.Frame.ChartBorder.GetTopEx();
var width = item.Frame.ChartBorder.GetWidth();
var height = item.Frame.ChartBorder.GetHeightEx();
this.SnapshotImageData=function()
{
var self = this;
var width = this.ChartBorder.GetChartWidth();
var height = this.ChartBorder.GetChartHeight();
var rtItem = new Rect(left, top, width, height);
if (rtItem.IsPointIn(left, y)) {
frame = item.Frame;
if (outObject) outObject.FrameID = i;
break;
}
console.log(`[HQTradeFrame::SnapshotImageData][ID=${this.ChartBorder.UIElement.ID} invoke canvasGetImageData(${width}, ${height}) SnapshotStatus=${this.SnapshotStatus}`);
++this.SnapshotID;
var id = this.SnapshotID;
this.SnapshotStatus = 1;
wx.canvasGetImageData({
canvasId: this.ChartBorder.UIElement.ID,
x: 0,
y: 0,
width: width,
height: height,
success(res)
{
self.ScreenImageData = res.data;
self.SnapshotStatus = 0;
self.CurrentSnapshotID = id;
console.log(`[HQTradeFrame::SnapshotImageData] SnapshotID=${self.SnapshotID}, CurrentSnapshotID=${self.CurrentSnapshotID}, size=${res.data.length}`);
}
})
}
if (frame != null) return frame.GetYData(y);
}
this.GetXData = function (x) { return this.SubFrame[0].Frame.GetXData(x); }
this.GetXFromIndex = function (index) {
return this.SubFrame[0].Frame.GetXFromIndex(index);
}
this.GetYData = function (y, outObject) //outObject 可以保存返回的额外数据)
{
var frame;
for (var i in this.SubFrame)
{
var item = this.SubFrame[i];
var left = item.Frame.ChartBorder.GetLeft();
var top = item.Frame.ChartBorder.GetTopEx();
var width = item.Frame.ChartBorder.GetWidth();
var height = item.Frame.ChartBorder.GetHeightEx();
this.GetYFromData = function (value) {
return this.SubFrame[0].Frame.GetYFromData(value);
}
var rtItem = new Rect(left, top, width, height);
if (rtItem.IsPointIn(left, y))
{
frame = item.Frame;
if (outObject) outObject.FrameID = i;
break;
}
}
if (frame != null) return frame.GetYData(y);
}
this.GetXFromIndex = function (index) { return this.SubFrame[0].Frame.GetXFromIndex(index); }
this.GetYFromData = function (value) { return this.SubFrame[0].Frame.GetYFromData(value); }
this.ZoomUp = function (cursorIndex) {
var result = this.SubFrame[0].Frame.ZoomUp(cursorIndex);
......@@ -3035,11 +3086,13 @@ function HQTradeFrame()
}
//设置重新计算刻度坐标
this.ResetXYSplit = function () {
for (let i in this.SubFrame) {
this.SubFrame[i].Frame.XYSplit = true;
this.ResetXYSplit = function ()
{
for (let i in this.SubFrame)
{
this.SubFrame[i].Frame.XYSplit = true;
}
}
}
}
//行情框架横屏
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册