Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
bluefrankey
hqchart
提交
76cef5a7
hqchart
项目概览
bluefrankey
/
hqchart
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
hqchart
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
76cef5a7
编写于
9月 23, 2019
作者:
HQChart
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ver 6958
上级
82b15c6b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
408 addition
and
207 deletion
+408
-207
umychart_uniapp_h5/umychart.uniapp.h5.js
umychart_uniapp_h5/umychart.uniapp.h5.js
+3
-2
vuehqchart/src/jscommon/umychart.js
vuehqchart/src/jscommon/umychart.js
+47
-17
vuehqchart/src/jscommon/umychart.vue/umychart.vue.js
vuehqchart/src/jscommon/umychart.vue/umychart.vue.js
+3
-2
webhqchart.demo/jscommon/umychart.js
webhqchart.demo/jscommon/umychart.js
+47
-17
webhqchart/umychart.js
webhqchart/umychart.js
+47
-17
wechathqchart/umychart.style.wechat.js
wechathqchart/umychart.style.wechat.js
+64
-8
wechathqchart/umychart.wechat.3.0.js
wechathqchart/umychart.wechat.3.0.js
+197
-144
未找到文件。
umychart_uniapp_h5/umychart.uniapp.h5.js
浏览文件 @
76cef5a7
...
...
@@ -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();
}
}
vuehqchart/src/jscommon/umychart.js
浏览文件 @
76cef5a7
...
...
@@ -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=
{
vuehqchart/src/jscommon/umychart.vue/umychart.vue.js
浏览文件 @
76cef5a7
...
...
@@ -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();
}
}
webhqchart.demo/jscommon/umychart.js
浏览文件 @
76cef5a7
...
...
@@ -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=
{
webhqchart/umychart.js
浏览文件 @
76cef5a7
...
...
@@ -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=
{
wechathqchart/umychart.style.wechat.js
浏览文件 @
76cef5a7
...
...
@@ -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
:
[
...
...
wechathqchart/umychart.wechat.3.0.js
浏览文件 @
76cef5a7
...
...
@@ -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:DrawDynamic
Info
][ID=
'
+
this
.
UIElement
.
ID
+
'
] draw .....
'
);
self
.
Canvas
.
draw
(
fals
e
,
function
()
{
console
.
log
(
'
[JSChartContainer:DrawDynamic
Info
] finish.
'
);
this
.
LastDrawStatus
=
'
DrawDynamicInfo
'
;
console
.
log
(
'
[JSChartContainer:DrawDynamic
Chart
][ID=
'
+
this
.
UIElement
.
ID
+
'
] draw .....
'
);
self
.
Canvas
.
draw
(
bReserv
e
,
function
()
{
console
.
log
(
'
[JSChartContainer:DrawDynamic
Chart
] 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
.
Snapshot
ImagePath
=
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录