Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
bluefrankey
hqchart
提交
ab10b44d
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,发现更多精彩内容 >>
提交
ab10b44d
编写于
7月 17, 2019
作者:
J
jones
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ver 6313
上级
45c7ee94
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
1018 addition
and
287 deletion
+1018
-287
vuehqchart/package.json
vuehqchart/package.json
+1
-1
vuehqchart/src/jscommon/umychart.complier.js
vuehqchart/src/jscommon/umychart.complier.js
+64
-19
vuehqchart/src/jscommon/umychart.index.data.js
vuehqchart/src/jscommon/umychart.index.data.js
+15
-1
vuehqchart/src/jscommon/umychart.js
vuehqchart/src/jscommon/umychart.js
+130
-48
vuehqchart/src/jscommon/umychart.vue.components/stockkline.demo.vue
.../src/jscommon/umychart.vue.components/stockkline.demo.vue
+45
-11
vuehqchart/src/jscommon/umychart.vue/umychart.vue.js
vuehqchart/src/jscommon/umychart.vue/umychart.vue.js
+345
-71
webhqchart.demo/jscommon/umychart.complier.js
webhqchart.demo/jscommon/umychart.complier.js
+64
-19
webhqchart.demo/jscommon/umychart.index.data.js
webhqchart.demo/jscommon/umychart.index.data.js
+15
-1
webhqchart.demo/jscommon/umychart.js
webhqchart.demo/jscommon/umychart.js
+130
-48
webhqchart/umychart.complier.js
webhqchart/umychart.complier.js
+64
-19
webhqchart/umychart.index.data.js
webhqchart/umychart.index.data.js
+15
-1
webhqchart/umychart.js
webhqchart/umychart.js
+130
-48
未找到文件。
vuehqchart/package.json
浏览文件 @
ab10b44d
...
...
@@ -2,7 +2,7 @@
"name"
:
"hqchart"
,
"description"
:
"stock chart"
,
"author"
:
"jones2000"
,
"version"
:
"1.0.3
3
"
,
"version"
:
"1.0.3
4
"
,
"private"
:
false
,
"license"
:
"MIT"
,
"scripts"
:
{
...
...
vuehqchart/src/jscommon/umychart.complier.js
浏览文件 @
ab10b44d
...
...
@@ -5647,7 +5647,7 @@ function JSSymbolData(ast,option,jsExecute)
if
(
this
.
LatestData
)
return
this
.
Execute
.
RunNextJob
();
var
self
=
this
;
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
RealtimeApiUrl
,
data
:
{
...
...
@@ -5789,7 +5789,7 @@ function JSSymbolData(ast,option,jsExecute)
var
self
=
this
;
if
(
this
.
Period
<=
3
)
//请求日线数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
KLineApiUrl
,
data
:
{
...
...
@@ -5814,7 +5814,7 @@ function JSSymbolData(ast,option,jsExecute)
}
else
//请求分钟数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
MinuteKLineApiUrl
,
data
:
{
...
...
@@ -6064,7 +6064,7 @@ function JSSymbolData(ast,option,jsExecute)
if
(
this
.
DataType
===
HQ_DATA_TYPE
.
MINUTE_ID
)
//当天分钟数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
RealtimeApiUrl
,
data
:
{
...
...
@@ -6086,7 +6086,7 @@ function JSSymbolData(ast,option,jsExecute)
if
(
this
.
Period
<=
3
)
//请求日线数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
KLineApiUrl
,
data
:
{
...
...
@@ -6111,7 +6111,7 @@ function JSSymbolData(ast,option,jsExecute)
}
else
//请求分钟数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
this
.
MinuteKLineApiUrl
,
data
:
{
...
...
@@ -6352,6 +6352,9 @@ function JSSymbolData(ast,option,jsExecute)
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
//过去4个季度现金分红总额
fieldList
.
push
(
'
execdividend.quarter4
'
);
break
;
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
fieldList
.
push
(
'
shareholder
'
);
//股东信息
break
;
}
//请求数据
...
...
@@ -6393,6 +6396,7 @@ function JSSymbolData(ast,option,jsExecute)
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_AL_RATIO_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_PROFIT_YOY_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
return
this
.
RecvStockDayData
(
recvData
,
jobID
);
}
}
...
...
@@ -6517,6 +6521,13 @@ function JSSymbolData(ast,option,jsExecute)
if
(
!
financeData
)
continue
;
if
(
!
this
.
IsNumber
(
financeData
.
quarter4
))
continue
;
indexData
.
Value
=
financeData
.
quarter4
;
//过去4个季度现金分红总额
bFinanceData
=
true
;
break
;
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
//股东人数
var
shareHolder
=
item
.
shareholder
;
if
(
!
shareHolder
||
!
this
.
IsNumber
(
shareHolder
.
count
))
continue
;
indexData
.
Value
=
shareHolder
.
count
;
bFinanceData
=
true
;
break
;
default
:
continue
;
...
...
@@ -7527,6 +7538,7 @@ var JS_EXECUTE_JOB_ID=
JOB_DOWNLOAD_PROFIT_YOY_DATA
:
111
,
//利润同比 (Profit year on year)
JOB_DOWNLOAD_AL_RATIO_DATA
:
112
,
//资产负债率 (asset-liability ratio)
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
113
,
//股息率
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
114
,
//股东人数
JOB_DOWNLOAD_CAPITAL_DATA
:
200
,
//流通股本(手)
...
...
@@ -7582,6 +7594,8 @@ var JS_EXECUTE_JOB_ID=
[
43
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_PROFIT_YOY_DATA
],
//FINANCE(43) 利润同比 (Profit year on year)
[
45
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
],
//FINANCE(45) 股息率
[
100
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
],
//FINANCE(100) 股东人数
[
200
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_CAPITAL_DATA
],
//流通股本(手)
[
201
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_EXCHANGE_DATA
]
//换手率 成交量/流通股本
...
...
@@ -7659,6 +7673,7 @@ function JSExecute(ast,option)
this
.
VarTable
=
new
Map
();
//变量表
this
.
OutVarTable
=
new
Array
();
//输出变量
this
.
Arguments
=
[];
this
.
ErrorCallback
;
//执行错误回调
//脚本自动变量表, 只读
this
.
ConstVarTable
=
new
Map
([
...
...
@@ -7738,6 +7753,7 @@ function JSExecute(ast,option)
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_AL_RATIO_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_PROFIT_YOY_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
return
this
.
SymbolData
.
GetFinanceData
(
jobItem
.
ID
);
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_RELEASE_DATE_DATA
:
...
...
@@ -8038,15 +8054,23 @@ function JSExecute(ast,option)
}
this
.
Run
=
function
()
{
let
data
=
this
.
RunAST
();
//执行脚本
console
.
log
(
'
[JSComplier.Run] execute finish
'
,
data
);
{
try
{
let
data
=
this
.
RunAST
();
//执行脚本
console
.
log
(
'
[JSComplier.Run] execute finish
'
,
data
);
if
(
this
.
UpdateUICallback
)
if
(
this
.
UpdateUICallback
)
{
console
.
log
(
'
[JSComplier.Run] invoke UpdateUICallback.
'
);
if
(
this
.
CallbackParam
&&
this
.
CallbackParam
.
Self
&&
this
.
CallbackParam
.
Self
.
ClassName
===
'
ScriptIndexConsole
'
)
this
.
CallbackParam
.
JSExecute
=
this
;
this
.
UpdateUICallback
(
data
,
this
.
CallbackParam
);
}
}
catch
(
error
)
{
console
.
log
(
'
[JSComplier.Run] invoke UpdateUICallback.
'
);
if
(
this
.
CallbackParam
&&
this
.
CallbackParam
.
Self
&&
this
.
CallbackParam
.
Self
.
ClassName
===
'
ScriptIndexConsole
'
)
this
.
CallbackParam
.
JSExecute
=
this
;
this
.
UpdateUICallback
(
data
,
this
.
CallbackParam
);
console
.
log
(
error
);
if
(
this
.
ErrorCallback
)
this
.
ErrorCallback
(
error
);
}
}
...
...
@@ -8425,6 +8449,7 @@ JSComplier.Execute=function(code,option,errorCallback)
console
.
log
(
'
[JSComplier.Execute] execute .....
'
);
let
execute
=
new
JSExecute
(
ast
,
option
);
execute
.
ErrorCallback
=
errorCallback
;
//执行错误回调
execute
.
JobList
=
parser
.
Node
.
GetDataJobList
();
execute
.
JobList
.
push
({
ID
:
JS_EXECUTE_JOB_ID
.
JOB_RUN_SCRIPT
});
...
...
@@ -9277,6 +9302,7 @@ function OverlayScriptIndex(name,script,args,option)
var
titleIndex
=
windowIndex
+
1
;
var
titlePaint
=
hqChart
.
TitlePaint
[
titleIndex
];
titlePaint
.
OverlayIndex
.
set
(
this
.
OverlayIndex
.
Identify
,
titleInfo
);
this
.
OverlayIndex
.
Frame
.
Frame
.
Title
=
titleInfo
.
Title
;
//给子框架设置标题
for
(
var
i
in
this
.
OutVar
)
{
...
...
@@ -9959,12 +9985,7 @@ function ScriptIndexConsole(obj)
var
self
=
param
.
Self
;
var
jsExec
=
param
.
JSExecute
;
var
date
=
[];
for
(
var
i
=
0
;
i
<
jsExec
.
SymbolData
.
Data
.
Data
.
length
;
++
i
)
{
var
item
=
jsExec
.
SymbolData
.
Data
.
Data
[
i
];
date
[
i
]
=
item
.
Date
;
}
var
date
=
jsExec
.
SymbolData
.
Data
.
GetDate
();
var
result
=
{
...
...
@@ -9972,11 +9993,35 @@ function ScriptIndexConsole(obj)
Date
:
date
,
//日期对应 上面的数据
Stock
:{
Name
:
jsExec
.
SymbolData
.
Name
,
Symbol
:
jsExec
.
SymbolData
.
Symbol
},
};
if
(
jsExec
.
SymbolData
.
Period
>=
4
)
result
.
Time
=
jsExec
.
SymbolData
.
Data
.
GetTime
();
//console.log('[ScriptIndexConsole::RecvResultData] outVar ', outVar);
if
(
self
.
FinishCallback
)
self
.
FinishCallback
(
result
,
param
.
JSExecute
);
}
}
ScriptIndexConsole
.
SetDomain
=
function
(
domain
,
cacheDomain
)
//修改API地址
{
JSComplier
.
SetDomain
(
domain
,
cacheDomain
);
}
function
JSNetwork
()
{
}
JSNetwork
.
HttpReqeust
=
function
(
obj
)
//对请求进行封装
{
$
.
ajax
(
{
url
:
obj
.
url
,
data
:
obj
.
data
,
type
:
obj
.
type
,
dataType
:
obj
.
dataType
,
async
:
obj
.
async
,
success
:
obj
.
success
,
error
:
obj
.
error
,
}
);
}
/* 测试例子
var code1='VARHIGH:IF(VAR1<=REF(HH,-1),REF(H,BARSLAST(VAR1>=REF(HH,1))),DRAWNULL),COLORYELLOW;';
...
...
vuehqchart/src/jscommon/umychart.index.data.js
浏览文件 @
ab10b44d
...
...
@@ -66,7 +66,7 @@ function JSIndexScript()
[
'
飞龙四式
'
,
this
.
Dragon4_Main
],[
'
飞龙四式-附图
'
,
this
.
Dragon4_Fig
],
[
'
资金分析
'
,
this
.
FundsAnalysis
],[
'
融资占比
'
,
this
.
MarginProportion
],[
'
负面新闻
'
,
this
.
NewsNegative
],
[
'
涨跌趋势
'
,
this
.
UpDownAnalyze
],[
'
北上资金
'
,
this
.
HK2SHSZ
],
[
'
涨跌趋势
'
,
this
.
UpDownAnalyze
],[
'
北上资金
'
,
this
.
HK2SHSZ
],
[
'
股东人数
'
,
this
.
ShareHolder
],
[
'
Zealink-资金吸筹
'
,
this
.
Zealink_Index1
],
[
'
Zealink-牛熊区间
'
,
this
.
Zealink_Index2
],[
'
Zealink-持仓信号
'
,
this
.
Zealink_Index3
],
[
'
Zealink-增减持
'
,
this
.
Zealink_Index4
],[
'
Zealink-大宗交易
'
,
this
.
Zealink_Index5
],
[
'
Zealink-信托持股
'
,
this
.
Zealink_Index6
],
...
...
@@ -2130,6 +2130,20 @@ JSIndexScript.prototype.HK2SHSZ=function()
return
data
;
}
JSIndexScript
.
prototype
.
ShareHolder
=
function
()
{
let
data
=
{
Name
:
'
股东人数
'
,
Description
:
'
股东人数
'
,
IsMainIndex
:
false
,
FloatPrecision
:
0
,
Condition
:
{
Period
:[
CONDITION_PERIOD
.
KLINE_DAY_ID
]
},
Args
:
[],
Script
:
//脚本
"
人数:FINANCE(100);
"
};
return
data
;
}
JSIndexScript
.
prototype
.
VOLRate
=
function
()
{
let
data
=
...
...
vuehqchart/src/jscommon/umychart.js
浏览文件 @
ab10b44d
...
...
@@ -257,7 +257,7 @@ function JSChart(divElement)
{
var item=option.OverlayIndex[i];
if (item.Windows>=chart.Frame.SubFrame.length) continue;
chart.CreateOverlayWindowsIndex(
item.Windows,item.Index
);
chart.CreateOverlayWindowsIndex(
{ WindowIndex:item.Windows,IndexName: item.Index, ShowRightText:item.ShowRightText }
);
}
this.AdjustTitleHeight(chart);
...
...
@@ -903,10 +903,10 @@ function JSChart(divElement)
this.JSChartContainer.SetMainDataConotrl(dataControl);
}
this.AddOverlayIndex=function(
windowIndex, indexName, identify)
this.AddOverlayIndex=function(
obj) //{WindowIndex:窗口ID, IndexName:指标ID, Identify:叠加指标ID(可选)}
{
if (this.JSChartContainer && typeof(this.JSChartContainer.AddOverlayIndex)=='function')
this.JSChartContainer.AddOverlayIndex(
windowIndex, indexName,identify
);
this.JSChartContainer.AddOverlayIndex(
obj
);
}
this.DeleteOverlayWindowsIndex=function(identify)
...
...
@@ -2552,6 +2552,7 @@ function JSChartContainer(uielement)
function GetDevicePixelRatio()
{
if (typeof(window) =='undefined') return 1;
return window.devicePixelRatio || 1;
}
...
...
@@ -3817,19 +3818,48 @@ function OverlayKLineFrame()
this.MainFrame=null; //主框架
this.RightOffset=50;
this.PenBorder=g_JSChartResource.OverlayFrameBolderPen; //'rgb(0,0,0)'
this.PenBorder=g_JSChartResource.OverlayFrame.BolderPen; //'rgb(0,0,0)'
this.IsShow=true; //坐标是否显示
this.Title=null;
this.TitleColor=g_JSChartResource.OverlayFrame.TitleColor;
this.TitleFont=g_JSChartResource.OverlayFrame.TitleFont;
this.Draw=function()
{
this.SplitXYCoordinate();
this.DrawVertical();
this.DrawHorizontal();
if (this.IsShow)
{
this.DrawVertical();
this.DrawHorizontal();
this.DrawTitle();
}
this.SizeChange=false;
this.XYSplit=false;
}
this.DrawTitle=function() //画标题
{
if (!this.Title) return;
var top = this.ChartBorder.GetTopTitle();
var bottom = this.ChartBorder.GetBottom();
var right=this.ChartBorder.GetRight();
right+=this.RightOffset;
this.Canvas.fillStyle=this.TitleColor;
this.Canvas.font=this.TitleFont;
this.Canvas.textAlign="center";
this.Canvas.textBaseline="top";
var xText=right-2,yText=top+(bottom-top)/2;
this.Canvas.save();
this.Canvas.translate(xText, yText);
this.Canvas.rotate(90 * Math.PI / 180);
this.Canvas.fillText(this.Title, 0, 0);
this.Canvas.restore();
}
//分割x,y轴坐标信息
this.SplitXYCoordinate=function()
{
...
...
@@ -3861,7 +3891,7 @@ function OverlayKLineFrame()
this.Canvas.strokeStyle=this.PenBorder;
this.Canvas.beginPath();
this.Canvas.moveTo(right-
5
,ToFixedPoint(y));
this.Canvas.moveTo(right-
2
,ToFixedPoint(y));
this.Canvas.lineTo(right,ToFixedPoint(y));
this.Canvas.stroke();
...
...
@@ -4178,7 +4208,7 @@ function SubFrameItem()
this.Frame;
this.Height;
this.OverlayIndex=[]; //叠加指标
this.Interval=
5
0; //子坐标间间距
this.Interval=
6
0; //子坐标间间距
}
function OverlayIndexItem()
...
...
@@ -4272,10 +4302,12 @@ function HQTradeFrame()
overlayItem.Frame.DataWidth=item.Frame.DataWidth;
overlayItem.Frame.DistanceWidth=item.Frame.DistanceWidth;
overlayItem.Frame.XPointCount=item.Frame.XPointCount;
if (overlayItem.ChartPaint.length>0)
if (overlayItem.ChartPaint.length>0 && overlayItem.Frame.IsShow)
{
overlayItem.Frame.RightOffset=rightOffset;
overlayItem.Frame.Draw();
rightOffset+=item.Interval;
}
}
}
...
...
@@ -4292,7 +4324,8 @@ function HQTradeFrame()
var overlayItem=item.OverlayIndex[j];
for(k in overlayItem.ChartPaint)
{
overlayItem.ChartPaint[k].Draw();
if (overlayItem.ChartPaint[k].IsShow)
overlayItem.ChartPaint[k].Draw();
}
}
}
...
...
@@ -4877,6 +4910,28 @@ function ChartData()
return result;
}
this.GetDate=function()
{
var result=new Array();
for(var i in this.Data)
{
result[i]=this.Data[i].Date;
}
return result;
}
this.GetTime=function()
{
var result=new Array();
for(var i in this.Data)
{
result[i]=this.Data[i].Time;
}
return result;
}
this.GetUp=function() //上涨家数
{
var result=[];
...
...
@@ -12449,6 +12504,8 @@ function ChartCorssCursor()
for(var i in frame.OverlayIndex)
{
var item=frame.OverlayIndex[i];
if (item.Frame.IsShow===false) continue;
overlayLeft+=frame.Interval;
if (overlayLeft+30>chartRight) break;
var yValue=item.Frame.GetYData(y);
...
...
@@ -12777,7 +12834,7 @@ function HQMinuteTimeStringFormat()
if (this.IsBeforeData) //增加盘前数据时间刻度
{
var allTimeData=[915,916,917,918,919,920,921,922,923,924,925,926,927,928,929]
for(i in timeData)
for(
var
i in timeData)
{
if (timeData[i]==925) continue;
allTimeData.push(timeData[i])
...
...
@@ -13552,7 +13609,7 @@ function DynamicChartTitlePainting()
left+=textWidth;
}
this.DrawOverlayIndex(left
);
this.DrawOverlayIndex(left
+10*GetDevicePixelRatio()); //间距都空点 和主指标区分开
}
this.DrawOverlayIndex=function(left) //叠加指标标题
...
...
@@ -16528,7 +16585,12 @@ function JSChartResource()
this.FrameSplitTextColor="rgb(117,125,129)"; //刻度文字颜色
this.FrameSplitTextFont=14*GetDevicePixelRatio() +"px 微软雅黑"; //坐标刻度文字字体
this.FrameTitleBGColor="rgb(246,251,253)"; //标题栏背景色
this.OverlayFrameBolderPen='rgb(190,190,190)'
this.OverlayFrame={
BolderPen:'rgb(190,190,190)',
TitleColor:'rgb(105,105,105)',
TitleFont:11*GetDevicePixelRatio() +'px arial',
};
this.CorssCursorBGColor="rgb(43,54,69)"; //十字光标背景
this.CorssCursorTextColor="rgb(255,255,255)";
...
...
@@ -17717,7 +17779,7 @@ function KLineChartContainer(uielement)
this.ChartDrawStorageCache=null; //首次需要创建的画图工具数据
this.CustomShow=null; //首先显示的K线的起始日期 { Date:日期 PageSize:}
this.OverlayIndexFrameWidth=
55
; //叠加指标框架宽度
this.OverlayIndexFrameWidth=
60
; //叠加指标框架宽度
//自动更新设置
this.IsAutoUpdate=false; //是否自动更新行情数据
...
...
@@ -18827,21 +18889,23 @@ function KLineChartContainer(uielement)
this.Draw();
}
this.AddOverlayIndex=function(
windowIndex, indexName,identify)
this.AddOverlayIndex=function(
obj)
{
var overlay=this.CreateOverlayWindowsIndex(
windowIndex, indexName
);
var overlay=this.CreateOverlayWindowsIndex(
obj
);
if (!overlay) return;
var bindData=this.ChartPaint[0].Data;
this.BindOverlayIndexData(overlay,
w
indowIndex,bindData);
this.BindOverlayIndexData(overlay,
obj.W
indowIndex,bindData);
this.UpdataDataoffset(); //更新数据偏移
this.UpdateFrameMaxMin(); //调整坐标最大 最小值
this.Draw();
}
//创建一个叠加指标
this.CreateOverlayWindowsIndex=function(
windowIndex, indexName,identify)
this.CreateOverlayWindowsIndex=function(
obj) // {WindowIndex:, IndexName:, Identify:, ShowRightText:}
{
let indexName=obj.IndexName;
let windowIndex=obj.WindowIndex;
let scriptData = new JSIndexScript();
let indexInfo = scriptData.Get(indexName); //系统指标
if (!indexInfo)
...
...
@@ -18857,17 +18921,20 @@ function KLineChartContainer(uielement)
var subFrame=this.Frame.SubFrame[windowIndex];
subFrame.Interval=this.OverlayIndexFrameWidth;
var overlayFrame=new OverlayIndexItem();
if (
identify) overlayFrame.Identify=i
dentify; //由外部指定id
if (
obj.Identify) overlayFrame.Identify=obj.I
dentify; //由外部指定id
frame=new OverlayKLineFrame();
frame.Canvas=this.Canvas;
frame.MainFrame=subFrame.Frame;
frame.ChartBorder=subFrame.Frame.ChartBorder;
if (obj.ShowRightText===true) frame.IsShow=true;
else if (obj.ShowRightText===false) frame.IsShow=false;
frame.YSplitOperator=new FrameSplitY();
frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');
frame.YSplitOperator.Frame=frame;
frame.YSplitOperator.ChartBorder=frame.ChartBorder;
frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;
overlayFrame.Frame=frame;
...
...
@@ -21415,8 +21482,6 @@ MinuteChartContainer.JsonDataToMinuteData=function(data,isBeforeData)
{
var jsData=data.stock[0].minute[i];
var item=new MinuteData();
if (jsData.price) preClose=jsData.price;
if (jsData.avprice) preAvPrice=jsData.avprice;
item.Close=jsData.price;
item.Open=jsData.open;
...
...
@@ -21445,6 +21510,7 @@ MinuteChartContainer.JsonDataToMinuteData=function(data,isBeforeData)
item.Close=preClose;
item.Open=item.High=item.Low=item.Close;
}
if (!item.AvPrice) item.AvPrice=preAvPrice;
//价格是0的 都用空
...
...
@@ -21459,6 +21525,17 @@ MinuteChartContainer.JsonDataToMinuteData=function(data,isBeforeData)
if (yClose && item.Close)
item.Increase=(item.Close-yClose)/yClose*100; //涨幅 (最新价格-昨收)/昨收*100;
//均价太大 可能是后台算错了
var checkValue=Math.abs(item.AvPrice-item.Close);
//console.log(`[MinuteChartContainer::JsonDataToMinuteData] checkValue=${checkValue}, ${item.Close*0.13} `)
if (checkValue>item.Close*0.13 )
item.AvPrice=preAvPrice;
//上次价格
if (jsData.price>0) preClose=jsData.price;
if (jsData.avprice>0 && item.AvPrice===jsData.avprice) preAvPrice=jsData.avprice;
aryMinuteData[i]=item;
}
...
...
@@ -25650,11 +25727,11 @@ function ChangeIndexDialog(divElement)
function changeIndeWindow()
{
$(".target-right ul").undelegate().delegate("li","click",function () {
var id
V
= $(this).attr("id");
var id
v
= $(this).attr("id");
if (isOverlay)
chart.AddOverlayIndex(
identify,idV
);
chart.AddOverlayIndex(
{WindowIndex:identify,IndexName:idv}
);
else
chart.ChangeIndex(identify,id
V
);
chart.ChangeIndex(identify,id
v
);
$(this).addClass("active-list").siblings().removeClass("active-list");
});
}
...
...
@@ -26520,7 +26597,10 @@ function KLineRightMenu(divElement)
var _self = this;
var id=this.DivElement.id;
var $body=$("#"+id);
var $body = $("#" + id);
$body.find("div[id^='topMenu_']").remove();
$body.find("div[id^='childMenu_']").remove();
var $topMenu = $("<div />");
$topMenu.attr("id", "topMenu_"+_self.ID).addClass("context-menu-wrapper topmenu").hide();
...
...
@@ -26553,22 +26633,24 @@ function KLineRightMenu(divElement)
this.Update=function()
{
var _self = this;
var id=this.DivElement.id;
var $body=$("#"+id);
//var id=this.DivElement.id;
//var $body=$("#"+id);
//
//var $topTable = $("#topTable_" + _self.ID);
//$topTable.empty();
//$topTable.append(_self.childrenList(_self.option.data));
//
//for (var i = 0; i < _self.option.data.length; i++) {
// var isHasChildren = typeof _self.option.data[i].children != "undefined";
//
// if (isHasChildren) {
// var $childTable = $("#childTable_" + _self.ID + i);
// $childTable.empty();
// $childTable.append(_self.childrenList(_self.option.data[i].children));
// }
//}
var $topTable = $("#topTable_" + _self.ID);
$topTable.empty();
$topTable.append(_self.childrenList(_self.option.data));
for (var i = 0; i < _self.option.data.length; i++) {
var isHasChildren = typeof _self.option.data[i].children != "undefined";
if (isHasChildren) {
var $childTable = $("#childTable_" + _self.ID + i);
$childTable.empty();
$childTable.append(_self.childrenList(_self.option.data[i].children));
}
}
_self.BindData();
_self.BindEvent();
}
...
...
@@ -27478,7 +27560,7 @@ function MinuteRightMenu(divElement)
var symbol=chart.Symbol;
if (MARKET_SUFFIX_NAME.IsSHSZStockA(symbol))
{
dataList.push({text:'集合竞价',children: this.GetShowBeforeData(chart)})
dataList.push({text:'集合竞价',children: this.GetShowBeforeData(chart)})
;
}
var identify=event.data.FrameID;
...
...
@@ -27586,9 +27668,10 @@ function MinuteRightMenu(divElement)
{
text: "隐藏",
click: function () { chart.ShowBeforeData(false); },
isBorder:true
}
]
];
return data;
}
else
{
...
...
@@ -27597,12 +27680,11 @@ function MinuteRightMenu(divElement)
{
text: "显示",
click: function () { chart.ShowBeforeData(true); },
isBorder:true
},
]
}
}
];
return data;
return data;
}
}
}
...
...
vuehqchart/src/jscommon/umychart.vue.components/stockkline.demo.vue
浏览文件 @
ab10b44d
...
...
@@ -12,9 +12,9 @@
<!-- 图形操作工具条 !-->
<div
class=
'chartbar'
ref=
'divchartbar'
id=
'chartbar'
>
<!-- 分时图设置导航条 -->
<div
id=
'barForMinute'
v-show=
"Minute.IsShow"
>
<div
id=
'barForMinute'
class=
'menuWrap'
v-show=
"Minute.IsShow"
>
<div
class=
"item"
v-for=
'(menuOne,index) in Minute.Toolbar.Data'
:key=
'menuOne.Text'
@
click=
"OnClickToolBar('minute',menuOne,index)"
>
<p
class=
"menuOne"
:class=
'
{light:Minute.Toolbar.Selected == index}'>
<p
class=
"menuOne"
:class=
'
{light:Minute.Toolbar.Selected == index}'
v-show='menuOne.IsShow'
>
<span>
{{
menuOne
.
Text
}}
</span>
<i
class=
"iconfont"
:class=
'Minute.Toolbar.Selected == index ? "icon-shang" : "icon-xia"'
></i>
</p>
...
...
@@ -26,7 +26,7 @@
</div>
<!-- k线设置导航条 -->
<div
id=
'barForKLine'
v-show=
"KLine.IsShow"
>
<div
id=
'barForKLine'
class=
'menuWrap'
v-show=
"KLine.IsShow"
>
<div
v-bind:class=
"[menuOne.IsShow==true? 'item':'hide_item']"
v-for=
'(menuOne,index) in KLine.Toolbar.Data'
:key=
'menuOne.Text'
v-show=
"KLineItemShow[index]"
@
click=
"OnClickToolBar('kline',menuOne,index)"
>
<p
class=
"menuOne"
:class=
'
{light:KLine.Toolbar.Selected == index}' v-show='menuOne.IsShow'>
<span>
{{
menuOne
.
Text
}}
</span>
...
...
@@ -223,6 +223,7 @@ DefaultData.GetPeriodMenu=function()
var
MINUTE_TOOLBAR_ID
=
{
INDEX_ID
:
0
,
// 指标
INDEX_ID_TWO
:
1
,
// 指标
}
DefaultData
.
GetMinuteToolbar
=
function
()
...
...
@@ -241,9 +242,12 @@ DefaultData.GetMinuteToolbar=function()
[
{
Name
:
"
MACD
"
},
{
Name
:
"
DMI
"
},
{
Name
:
"
DMA
"
},
{
Name
:
"
BRAR
"
},
{
Name
:
"
KDJ
"
},
{
Name
:
"
RSI
"
},
{
Name
:
"
WR
"
},
{
Name
:
"
CCI
"
},
{
Name
:
"
TRIX
"
},
{
Name
:
'
北上资金
'
},
{
Name
:
'
涨跌趋势
'
}
]
],
IsShow
:
true
}
data
.
Data
[
MINUTE_TOOLBAR_ID
.
INDEX_ID
]
=
indexMenu
;
return
data
;
...
...
@@ -454,7 +458,8 @@ export default
StartTime
:
null
,
Timer
:
null
//定时器
},
MoveInterval
:
null
MoveInterval
:
null
,
IsShowBeforeData
:
true
//显示
}
return
data
;
...
...
@@ -480,6 +485,19 @@ export default
}
}
if
(
!
this
.
IsSHSZIndex
()){
let
indexMenu2
=
{
Text
:
'
集合竞价
'
,
Selected
:
[],
Menu
:
[{
Name
:
'
显示
'
}],
IsShow
:
true
}
// this.Minute.Toolbar.Data.push(indexMenu2);
this
.
Minute
.
Toolbar
.
Data
[
MINUTE_TOOLBAR_ID
.
INDEX_ID_TWO
]
=
indexMenu2
;
console
.
log
(
'
分时图:
'
,
this
.
Minute
.
Toolbar
);
}
if
(
this
.
KLineOption
)
this
.
SetDefaultKLineOption
(
this
.
KLineOption
);
if
(
this
.
MinuteOption
)
this
.
SetDefaultMinuteOption
(
this
.
MinuteOption
);
if
(
this
.
TradeInfoTabWidth
>
0
)
this
.
TradeInfoTab
.
Width
=
this
.
TradeInfoTabWidth
;
...
...
@@ -652,7 +670,7 @@ export default
if
(
this
.
KLine
.
IsShow
){
var
totalWidth
=
width
-
20
;
var
dispalyAry
=
[];
if
(
this
.
IsSHSZIndex
){
//是指数
if
(
this
.
IsSHSZIndex
()
){
//是指数
var
startIndex
=
2
,
endIndex
=
7
;
dispalyAry
=
[
false
,
false
,
true
,
true
,
true
,
true
,
true
,
true
];
}
else
{
...
...
@@ -674,6 +692,10 @@ export default
console
.
log
(
`[StockKLine::OnSize] Chart:(
${
width
}
,
${
height
}
)`
);
},
IsSHSZIndex
(){
var
isIndex
=
JSCommon
.
MARKET_SUFFIX_NAME
.
IsSHSZIndex
(
this
.
Symbol
);
return
isIndex
;
},
//创建日线图
CreateMinuteChart
:
function
()
...
...
@@ -757,6 +779,8 @@ export default
var
isIndex
=
JSCommon
.
MARKET_SUFFIX_NAME
.
IsSHSZIndex
(
this
.
Symbol
);
this
.
KLine
.
Toolbar
.
Data
[
KLINE_TOOLBAR_ID
.
RIGHT_ID
].
IsShow
=!
isIndex
;
this
.
KLine
.
Toolbar
.
Data
[
KLINE_TOOLBAR_ID
.
KLINE_INFO_ID
].
IsShow
=!
isIndex
;
this
.
Minute
.
Toolbar
.
Data
[
MINUTE_TOOLBAR_ID
.
INDEX_ID_TWO
].
IsShow
=!
isIndex
;
},
SetDefaultKLineOption
:
function
(
option
)
...
...
@@ -1120,6 +1144,17 @@ export default
this
.
Minute
.
JSChart
.
ChangeIndex
(
1
,
secMenu
.
Name
);
this
.
UpdateIndexBarSelected
();
break
;
case
'
集合竞价
'
:
if
(
this
.
IsShowBeforeData
){
this
.
Minute
.
JSChart
.
JSChartContainer
.
ShowBeforeData
(
true
);
var
text
=
'
隐藏
'
;
}
else
{
this
.
Minute
.
JSChart
.
JSChartContainer
.
ShowBeforeData
(
false
);
var
text
=
'
显示
'
;
}
this
.
Minute
.
Toolbar
.
Data
[
MINUTE_TOOLBAR_ID
.
INDEX_ID_TWO
].
Menu
[
0
].
Name
=
text
;
this
.
IsShowBeforeData
=
!
this
.
IsShowBeforeData
;
break
;
}
this
.
Minute
.
Toolbar
.
Selected
=
-
1
;
//下标不相等,隐藏二级菜单
}
...
...
@@ -1505,23 +1540,22 @@ a
position
:
relative
;
z-index
:
999
;
/
/隐藏菜单
#barForMinute
,
#barForKLine
>
.hide_item
/
*隐藏菜单*/
.menuWrap
>
.hide_item
{
display
:
inline-block
;
cursor
:
pointer
;
/
/height: 32px;
/
* height: 32px; */
line-height
:
32px
;
padding-top
:
6px
;
position
:
relative
;
box-sizing
:
border-box
;
}
#barForMinute
,
#barForKLine
>
.item
.menuWrap
>
.item
{
display
:
inline-block
;
cursor
:
pointer
;
//height: 32px;
line-height
:
32px
;
width
:
104px
;
padding-top
:
6px
;
...
...
vuehqchart/src/jscommon/umychart.vue/umychart.vue.js
浏览文件 @
ab10b44d
此差异已折叠。
点击以展开。
webhqchart.demo/jscommon/umychart.complier.js
浏览文件 @
ab10b44d
...
...
@@ -5647,7 +5647,7 @@ function JSSymbolData(ast,option,jsExecute)
if
(
this
.
LatestData
)
return
this
.
Execute
.
RunNextJob
();
var
self
=
this
;
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
RealtimeApiUrl
,
data
:
{
...
...
@@ -5789,7 +5789,7 @@ function JSSymbolData(ast,option,jsExecute)
var
self
=
this
;
if
(
this
.
Period
<=
3
)
//请求日线数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
KLineApiUrl
,
data
:
{
...
...
@@ -5814,7 +5814,7 @@ function JSSymbolData(ast,option,jsExecute)
}
else
//请求分钟数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
MinuteKLineApiUrl
,
data
:
{
...
...
@@ -6064,7 +6064,7 @@ function JSSymbolData(ast,option,jsExecute)
if
(
this
.
DataType
===
HQ_DATA_TYPE
.
MINUTE_ID
)
//当天分钟数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
RealtimeApiUrl
,
data
:
{
...
...
@@ -6086,7 +6086,7 @@ function JSSymbolData(ast,option,jsExecute)
if
(
this
.
Period
<=
3
)
//请求日线数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
KLineApiUrl
,
data
:
{
...
...
@@ -6111,7 +6111,7 @@ function JSSymbolData(ast,option,jsExecute)
}
else
//请求分钟数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
this
.
MinuteKLineApiUrl
,
data
:
{
...
...
@@ -6352,6 +6352,9 @@ function JSSymbolData(ast,option,jsExecute)
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
//过去4个季度现金分红总额
fieldList
.
push
(
'
execdividend.quarter4
'
);
break
;
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
fieldList
.
push
(
'
shareholder
'
);
//股东信息
break
;
}
//请求数据
...
...
@@ -6393,6 +6396,7 @@ function JSSymbolData(ast,option,jsExecute)
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_AL_RATIO_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_PROFIT_YOY_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
return
this
.
RecvStockDayData
(
recvData
,
jobID
);
}
}
...
...
@@ -6517,6 +6521,13 @@ function JSSymbolData(ast,option,jsExecute)
if
(
!
financeData
)
continue
;
if
(
!
this
.
IsNumber
(
financeData
.
quarter4
))
continue
;
indexData
.
Value
=
financeData
.
quarter4
;
//过去4个季度现金分红总额
bFinanceData
=
true
;
break
;
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
//股东人数
var
shareHolder
=
item
.
shareholder
;
if
(
!
shareHolder
||
!
this
.
IsNumber
(
shareHolder
.
count
))
continue
;
indexData
.
Value
=
shareHolder
.
count
;
bFinanceData
=
true
;
break
;
default
:
continue
;
...
...
@@ -7527,6 +7538,7 @@ var JS_EXECUTE_JOB_ID=
JOB_DOWNLOAD_PROFIT_YOY_DATA
:
111
,
//利润同比 (Profit year on year)
JOB_DOWNLOAD_AL_RATIO_DATA
:
112
,
//资产负债率 (asset-liability ratio)
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
113
,
//股息率
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
114
,
//股东人数
JOB_DOWNLOAD_CAPITAL_DATA
:
200
,
//流通股本(手)
...
...
@@ -7582,6 +7594,8 @@ var JS_EXECUTE_JOB_ID=
[
43
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_PROFIT_YOY_DATA
],
//FINANCE(43) 利润同比 (Profit year on year)
[
45
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
],
//FINANCE(45) 股息率
[
100
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
],
//FINANCE(100) 股东人数
[
200
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_CAPITAL_DATA
],
//流通股本(手)
[
201
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_EXCHANGE_DATA
]
//换手率 成交量/流通股本
...
...
@@ -7659,6 +7673,7 @@ function JSExecute(ast,option)
this
.
VarTable
=
new
Map
();
//变量表
this
.
OutVarTable
=
new
Array
();
//输出变量
this
.
Arguments
=
[];
this
.
ErrorCallback
;
//执行错误回调
//脚本自动变量表, 只读
this
.
ConstVarTable
=
new
Map
([
...
...
@@ -7738,6 +7753,7 @@ function JSExecute(ast,option)
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_AL_RATIO_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_PROFIT_YOY_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
return
this
.
SymbolData
.
GetFinanceData
(
jobItem
.
ID
);
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_RELEASE_DATE_DATA
:
...
...
@@ -8038,15 +8054,23 @@ function JSExecute(ast,option)
}
this
.
Run
=
function
()
{
let
data
=
this
.
RunAST
();
//执行脚本
console
.
log
(
'
[JSComplier.Run] execute finish
'
,
data
);
{
try
{
let
data
=
this
.
RunAST
();
//执行脚本
console
.
log
(
'
[JSComplier.Run] execute finish
'
,
data
);
if
(
this
.
UpdateUICallback
)
if
(
this
.
UpdateUICallback
)
{
console
.
log
(
'
[JSComplier.Run] invoke UpdateUICallback.
'
);
if
(
this
.
CallbackParam
&&
this
.
CallbackParam
.
Self
&&
this
.
CallbackParam
.
Self
.
ClassName
===
'
ScriptIndexConsole
'
)
this
.
CallbackParam
.
JSExecute
=
this
;
this
.
UpdateUICallback
(
data
,
this
.
CallbackParam
);
}
}
catch
(
error
)
{
console
.
log
(
'
[JSComplier.Run] invoke UpdateUICallback.
'
);
if
(
this
.
CallbackParam
&&
this
.
CallbackParam
.
Self
&&
this
.
CallbackParam
.
Self
.
ClassName
===
'
ScriptIndexConsole
'
)
this
.
CallbackParam
.
JSExecute
=
this
;
this
.
UpdateUICallback
(
data
,
this
.
CallbackParam
);
console
.
log
(
error
);
if
(
this
.
ErrorCallback
)
this
.
ErrorCallback
(
error
);
}
}
...
...
@@ -8425,6 +8449,7 @@ JSComplier.Execute=function(code,option,errorCallback)
console
.
log
(
'
[JSComplier.Execute] execute .....
'
);
let
execute
=
new
JSExecute
(
ast
,
option
);
execute
.
ErrorCallback
=
errorCallback
;
//执行错误回调
execute
.
JobList
=
parser
.
Node
.
GetDataJobList
();
execute
.
JobList
.
push
({
ID
:
JS_EXECUTE_JOB_ID
.
JOB_RUN_SCRIPT
});
...
...
@@ -9277,6 +9302,7 @@ function OverlayScriptIndex(name,script,args,option)
var
titleIndex
=
windowIndex
+
1
;
var
titlePaint
=
hqChart
.
TitlePaint
[
titleIndex
];
titlePaint
.
OverlayIndex
.
set
(
this
.
OverlayIndex
.
Identify
,
titleInfo
);
this
.
OverlayIndex
.
Frame
.
Frame
.
Title
=
titleInfo
.
Title
;
//给子框架设置标题
for
(
var
i
in
this
.
OutVar
)
{
...
...
@@ -9959,12 +9985,7 @@ function ScriptIndexConsole(obj)
var
self
=
param
.
Self
;
var
jsExec
=
param
.
JSExecute
;
var
date
=
[];
for
(
var
i
=
0
;
i
<
jsExec
.
SymbolData
.
Data
.
Data
.
length
;
++
i
)
{
var
item
=
jsExec
.
SymbolData
.
Data
.
Data
[
i
];
date
[
i
]
=
item
.
Date
;
}
var
date
=
jsExec
.
SymbolData
.
Data
.
GetDate
();
var
result
=
{
...
...
@@ -9972,11 +9993,35 @@ function ScriptIndexConsole(obj)
Date
:
date
,
//日期对应 上面的数据
Stock
:{
Name
:
jsExec
.
SymbolData
.
Name
,
Symbol
:
jsExec
.
SymbolData
.
Symbol
},
};
if
(
jsExec
.
SymbolData
.
Period
>=
4
)
result
.
Time
=
jsExec
.
SymbolData
.
Data
.
GetTime
();
//console.log('[ScriptIndexConsole::RecvResultData] outVar ', outVar);
if
(
self
.
FinishCallback
)
self
.
FinishCallback
(
result
,
param
.
JSExecute
);
}
}
ScriptIndexConsole
.
SetDomain
=
function
(
domain
,
cacheDomain
)
//修改API地址
{
JSComplier
.
SetDomain
(
domain
,
cacheDomain
);
}
function
JSNetwork
()
{
}
JSNetwork
.
HttpReqeust
=
function
(
obj
)
//对请求进行封装
{
$
.
ajax
(
{
url
:
obj
.
url
,
data
:
obj
.
data
,
type
:
obj
.
type
,
dataType
:
obj
.
dataType
,
async
:
obj
.
async
,
success
:
obj
.
success
,
error
:
obj
.
error
,
}
);
}
/* 测试例子
var code1='VARHIGH:IF(VAR1<=REF(HH,-1),REF(H,BARSLAST(VAR1>=REF(HH,1))),DRAWNULL),COLORYELLOW;';
...
...
webhqchart.demo/jscommon/umychart.index.data.js
浏览文件 @
ab10b44d
...
...
@@ -66,7 +66,7 @@ function JSIndexScript()
[
'
飞龙四式
'
,
this
.
Dragon4_Main
],[
'
飞龙四式-附图
'
,
this
.
Dragon4_Fig
],
[
'
资金分析
'
,
this
.
FundsAnalysis
],[
'
融资占比
'
,
this
.
MarginProportion
],[
'
负面新闻
'
,
this
.
NewsNegative
],
[
'
涨跌趋势
'
,
this
.
UpDownAnalyze
],[
'
北上资金
'
,
this
.
HK2SHSZ
],
[
'
涨跌趋势
'
,
this
.
UpDownAnalyze
],[
'
北上资金
'
,
this
.
HK2SHSZ
],
[
'
股东人数
'
,
this
.
ShareHolder
],
[
'
Zealink-资金吸筹
'
,
this
.
Zealink_Index1
],
[
'
Zealink-牛熊区间
'
,
this
.
Zealink_Index2
],[
'
Zealink-持仓信号
'
,
this
.
Zealink_Index3
],
[
'
Zealink-增减持
'
,
this
.
Zealink_Index4
],[
'
Zealink-大宗交易
'
,
this
.
Zealink_Index5
],
[
'
Zealink-信托持股
'
,
this
.
Zealink_Index6
],
...
...
@@ -2130,6 +2130,20 @@ JSIndexScript.prototype.HK2SHSZ=function()
return
data
;
}
JSIndexScript
.
prototype
.
ShareHolder
=
function
()
{
let
data
=
{
Name
:
'
股东人数
'
,
Description
:
'
股东人数
'
,
IsMainIndex
:
false
,
FloatPrecision
:
0
,
Condition
:
{
Period
:[
CONDITION_PERIOD
.
KLINE_DAY_ID
]
},
Args
:
[],
Script
:
//脚本
"
人数:FINANCE(100);
"
};
return
data
;
}
JSIndexScript
.
prototype
.
VOLRate
=
function
()
{
let
data
=
...
...
webhqchart.demo/jscommon/umychart.js
浏览文件 @
ab10b44d
...
...
@@ -257,7 +257,7 @@ function JSChart(divElement)
{
var item=option.OverlayIndex[i];
if (item.Windows>=chart.Frame.SubFrame.length) continue;
chart.CreateOverlayWindowsIndex(
item.Windows,item.Index
);
chart.CreateOverlayWindowsIndex(
{ WindowIndex:item.Windows,IndexName: item.Index, ShowRightText:item.ShowRightText }
);
}
this.AdjustTitleHeight(chart);
...
...
@@ -903,10 +903,10 @@ function JSChart(divElement)
this.JSChartContainer.SetMainDataConotrl(dataControl);
}
this.AddOverlayIndex=function(
windowIndex, indexName, identify)
this.AddOverlayIndex=function(
obj) //{WindowIndex:窗口ID, IndexName:指标ID, Identify:叠加指标ID(可选)}
{
if (this.JSChartContainer && typeof(this.JSChartContainer.AddOverlayIndex)=='function')
this.JSChartContainer.AddOverlayIndex(
windowIndex, indexName,identify
);
this.JSChartContainer.AddOverlayIndex(
obj
);
}
this.DeleteOverlayWindowsIndex=function(identify)
...
...
@@ -2552,6 +2552,7 @@ function JSChartContainer(uielement)
function GetDevicePixelRatio()
{
if (typeof(window) =='undefined') return 1;
return window.devicePixelRatio || 1;
}
...
...
@@ -3817,19 +3818,48 @@ function OverlayKLineFrame()
this.MainFrame=null; //主框架
this.RightOffset=50;
this.PenBorder=g_JSChartResource.OverlayFrameBolderPen; //'rgb(0,0,0)'
this.PenBorder=g_JSChartResource.OverlayFrame.BolderPen; //'rgb(0,0,0)'
this.IsShow=true; //坐标是否显示
this.Title=null;
this.TitleColor=g_JSChartResource.OverlayFrame.TitleColor;
this.TitleFont=g_JSChartResource.OverlayFrame.TitleFont;
this.Draw=function()
{
this.SplitXYCoordinate();
this.DrawVertical();
this.DrawHorizontal();
if (this.IsShow)
{
this.DrawVertical();
this.DrawHorizontal();
this.DrawTitle();
}
this.SizeChange=false;
this.XYSplit=false;
}
this.DrawTitle=function() //画标题
{
if (!this.Title) return;
var top = this.ChartBorder.GetTopTitle();
var bottom = this.ChartBorder.GetBottom();
var right=this.ChartBorder.GetRight();
right+=this.RightOffset;
this.Canvas.fillStyle=this.TitleColor;
this.Canvas.font=this.TitleFont;
this.Canvas.textAlign="center";
this.Canvas.textBaseline="top";
var xText=right-2,yText=top+(bottom-top)/2;
this.Canvas.save();
this.Canvas.translate(xText, yText);
this.Canvas.rotate(90 * Math.PI / 180);
this.Canvas.fillText(this.Title, 0, 0);
this.Canvas.restore();
}
//分割x,y轴坐标信息
this.SplitXYCoordinate=function()
{
...
...
@@ -3861,7 +3891,7 @@ function OverlayKLineFrame()
this.Canvas.strokeStyle=this.PenBorder;
this.Canvas.beginPath();
this.Canvas.moveTo(right-
5
,ToFixedPoint(y));
this.Canvas.moveTo(right-
2
,ToFixedPoint(y));
this.Canvas.lineTo(right,ToFixedPoint(y));
this.Canvas.stroke();
...
...
@@ -4178,7 +4208,7 @@ function SubFrameItem()
this.Frame;
this.Height;
this.OverlayIndex=[]; //叠加指标
this.Interval=
5
0; //子坐标间间距
this.Interval=
6
0; //子坐标间间距
}
function OverlayIndexItem()
...
...
@@ -4272,10 +4302,12 @@ function HQTradeFrame()
overlayItem.Frame.DataWidth=item.Frame.DataWidth;
overlayItem.Frame.DistanceWidth=item.Frame.DistanceWidth;
overlayItem.Frame.XPointCount=item.Frame.XPointCount;
if (overlayItem.ChartPaint.length>0)
if (overlayItem.ChartPaint.length>0 && overlayItem.Frame.IsShow)
{
overlayItem.Frame.RightOffset=rightOffset;
overlayItem.Frame.Draw();
rightOffset+=item.Interval;
}
}
}
...
...
@@ -4292,7 +4324,8 @@ function HQTradeFrame()
var overlayItem=item.OverlayIndex[j];
for(k in overlayItem.ChartPaint)
{
overlayItem.ChartPaint[k].Draw();
if (overlayItem.ChartPaint[k].IsShow)
overlayItem.ChartPaint[k].Draw();
}
}
}
...
...
@@ -4877,6 +4910,28 @@ function ChartData()
return result;
}
this.GetDate=function()
{
var result=new Array();
for(var i in this.Data)
{
result[i]=this.Data[i].Date;
}
return result;
}
this.GetTime=function()
{
var result=new Array();
for(var i in this.Data)
{
result[i]=this.Data[i].Time;
}
return result;
}
this.GetUp=function() //上涨家数
{
var result=[];
...
...
@@ -12449,6 +12504,8 @@ function ChartCorssCursor()
for(var i in frame.OverlayIndex)
{
var item=frame.OverlayIndex[i];
if (item.Frame.IsShow===false) continue;
overlayLeft+=frame.Interval;
if (overlayLeft+30>chartRight) break;
var yValue=item.Frame.GetYData(y);
...
...
@@ -12777,7 +12834,7 @@ function HQMinuteTimeStringFormat()
if (this.IsBeforeData) //增加盘前数据时间刻度
{
var allTimeData=[915,916,917,918,919,920,921,922,923,924,925,926,927,928,929]
for(i in timeData)
for(
var
i in timeData)
{
if (timeData[i]==925) continue;
allTimeData.push(timeData[i])
...
...
@@ -13552,7 +13609,7 @@ function DynamicChartTitlePainting()
left+=textWidth;
}
this.DrawOverlayIndex(left
);
this.DrawOverlayIndex(left
+10*GetDevicePixelRatio()); //间距都空点 和主指标区分开
}
this.DrawOverlayIndex=function(left) //叠加指标标题
...
...
@@ -16528,7 +16585,12 @@ function JSChartResource()
this.FrameSplitTextColor="rgb(117,125,129)"; //刻度文字颜色
this.FrameSplitTextFont=14*GetDevicePixelRatio() +"px 微软雅黑"; //坐标刻度文字字体
this.FrameTitleBGColor="rgb(246,251,253)"; //标题栏背景色
this.OverlayFrameBolderPen='rgb(190,190,190)'
this.OverlayFrame={
BolderPen:'rgb(190,190,190)',
TitleColor:'rgb(105,105,105)',
TitleFont:11*GetDevicePixelRatio() +'px arial',
};
this.CorssCursorBGColor="rgb(43,54,69)"; //十字光标背景
this.CorssCursorTextColor="rgb(255,255,255)";
...
...
@@ -17717,7 +17779,7 @@ function KLineChartContainer(uielement)
this.ChartDrawStorageCache=null; //首次需要创建的画图工具数据
this.CustomShow=null; //首先显示的K线的起始日期 { Date:日期 PageSize:}
this.OverlayIndexFrameWidth=
55
; //叠加指标框架宽度
this.OverlayIndexFrameWidth=
60
; //叠加指标框架宽度
//自动更新设置
this.IsAutoUpdate=false; //是否自动更新行情数据
...
...
@@ -18827,21 +18889,23 @@ function KLineChartContainer(uielement)
this.Draw();
}
this.AddOverlayIndex=function(
windowIndex, indexName,identify)
this.AddOverlayIndex=function(
obj)
{
var overlay=this.CreateOverlayWindowsIndex(
windowIndex, indexName
);
var overlay=this.CreateOverlayWindowsIndex(
obj
);
if (!overlay) return;
var bindData=this.ChartPaint[0].Data;
this.BindOverlayIndexData(overlay,
w
indowIndex,bindData);
this.BindOverlayIndexData(overlay,
obj.W
indowIndex,bindData);
this.UpdataDataoffset(); //更新数据偏移
this.UpdateFrameMaxMin(); //调整坐标最大 最小值
this.Draw();
}
//创建一个叠加指标
this.CreateOverlayWindowsIndex=function(
windowIndex, indexName,identify)
this.CreateOverlayWindowsIndex=function(
obj) // {WindowIndex:, IndexName:, Identify:, ShowRightText:}
{
let indexName=obj.IndexName;
let windowIndex=obj.WindowIndex;
let scriptData = new JSIndexScript();
let indexInfo = scriptData.Get(indexName); //系统指标
if (!indexInfo)
...
...
@@ -18857,17 +18921,20 @@ function KLineChartContainer(uielement)
var subFrame=this.Frame.SubFrame[windowIndex];
subFrame.Interval=this.OverlayIndexFrameWidth;
var overlayFrame=new OverlayIndexItem();
if (
identify) overlayFrame.Identify=i
dentify; //由外部指定id
if (
obj.Identify) overlayFrame.Identify=obj.I
dentify; //由外部指定id
frame=new OverlayKLineFrame();
frame.Canvas=this.Canvas;
frame.MainFrame=subFrame.Frame;
frame.ChartBorder=subFrame.Frame.ChartBorder;
if (obj.ShowRightText===true) frame.IsShow=true;
else if (obj.ShowRightText===false) frame.IsShow=false;
frame.YSplitOperator=new FrameSplitY();
frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');
frame.YSplitOperator.Frame=frame;
frame.YSplitOperator.ChartBorder=frame.ChartBorder;
frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;
overlayFrame.Frame=frame;
...
...
@@ -21415,8 +21482,6 @@ MinuteChartContainer.JsonDataToMinuteData=function(data,isBeforeData)
{
var jsData=data.stock[0].minute[i];
var item=new MinuteData();
if (jsData.price) preClose=jsData.price;
if (jsData.avprice) preAvPrice=jsData.avprice;
item.Close=jsData.price;
item.Open=jsData.open;
...
...
@@ -21445,6 +21510,7 @@ MinuteChartContainer.JsonDataToMinuteData=function(data,isBeforeData)
item.Close=preClose;
item.Open=item.High=item.Low=item.Close;
}
if (!item.AvPrice) item.AvPrice=preAvPrice;
//价格是0的 都用空
...
...
@@ -21459,6 +21525,17 @@ MinuteChartContainer.JsonDataToMinuteData=function(data,isBeforeData)
if (yClose && item.Close)
item.Increase=(item.Close-yClose)/yClose*100; //涨幅 (最新价格-昨收)/昨收*100;
//均价太大 可能是后台算错了
var checkValue=Math.abs(item.AvPrice-item.Close);
//console.log(`[MinuteChartContainer::JsonDataToMinuteData] checkValue=${checkValue}, ${item.Close*0.13} `)
if (checkValue>item.Close*0.13 )
item.AvPrice=preAvPrice;
//上次价格
if (jsData.price>0) preClose=jsData.price;
if (jsData.avprice>0 && item.AvPrice===jsData.avprice) preAvPrice=jsData.avprice;
aryMinuteData[i]=item;
}
...
...
@@ -25650,11 +25727,11 @@ function ChangeIndexDialog(divElement)
function changeIndeWindow()
{
$(".target-right ul").undelegate().delegate("li","click",function () {
var id
V
= $(this).attr("id");
var id
v
= $(this).attr("id");
if (isOverlay)
chart.AddOverlayIndex(
identify,idV
);
chart.AddOverlayIndex(
{WindowIndex:identify,IndexName:idv}
);
else
chart.ChangeIndex(identify,id
V
);
chart.ChangeIndex(identify,id
v
);
$(this).addClass("active-list").siblings().removeClass("active-list");
});
}
...
...
@@ -26520,7 +26597,10 @@ function KLineRightMenu(divElement)
var _self = this;
var id=this.DivElement.id;
var $body=$("#"+id);
var $body = $("#" + id);
$body.find("div[id^='topMenu_']").remove();
$body.find("div[id^='childMenu_']").remove();
var $topMenu = $("<div />");
$topMenu.attr("id", "topMenu_"+_self.ID).addClass("context-menu-wrapper topmenu").hide();
...
...
@@ -26553,22 +26633,24 @@ function KLineRightMenu(divElement)
this.Update=function()
{
var _self = this;
var id=this.DivElement.id;
var $body=$("#"+id);
//var id=this.DivElement.id;
//var $body=$("#"+id);
//
//var $topTable = $("#topTable_" + _self.ID);
//$topTable.empty();
//$topTable.append(_self.childrenList(_self.option.data));
//
//for (var i = 0; i < _self.option.data.length; i++) {
// var isHasChildren = typeof _self.option.data[i].children != "undefined";
//
// if (isHasChildren) {
// var $childTable = $("#childTable_" + _self.ID + i);
// $childTable.empty();
// $childTable.append(_self.childrenList(_self.option.data[i].children));
// }
//}
var $topTable = $("#topTable_" + _self.ID);
$topTable.empty();
$topTable.append(_self.childrenList(_self.option.data));
for (var i = 0; i < _self.option.data.length; i++) {
var isHasChildren = typeof _self.option.data[i].children != "undefined";
if (isHasChildren) {
var $childTable = $("#childTable_" + _self.ID + i);
$childTable.empty();
$childTable.append(_self.childrenList(_self.option.data[i].children));
}
}
_self.BindData();
_self.BindEvent();
}
...
...
@@ -27478,7 +27560,7 @@ function MinuteRightMenu(divElement)
var symbol=chart.Symbol;
if (MARKET_SUFFIX_NAME.IsSHSZStockA(symbol))
{
dataList.push({text:'集合竞价',children: this.GetShowBeforeData(chart)})
dataList.push({text:'集合竞价',children: this.GetShowBeforeData(chart)})
;
}
var identify=event.data.FrameID;
...
...
@@ -27586,9 +27668,10 @@ function MinuteRightMenu(divElement)
{
text: "隐藏",
click: function () { chart.ShowBeforeData(false); },
isBorder:true
}
]
];
return data;
}
else
{
...
...
@@ -27597,12 +27680,11 @@ function MinuteRightMenu(divElement)
{
text: "显示",
click: function () { chart.ShowBeforeData(true); },
isBorder:true
},
]
}
}
];
return data;
return data;
}
}
}
...
...
webhqchart/umychart.complier.js
浏览文件 @
ab10b44d
...
...
@@ -5647,7 +5647,7 @@ function JSSymbolData(ast,option,jsExecute)
if
(
this
.
LatestData
)
return
this
.
Execute
.
RunNextJob
();
var
self
=
this
;
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
RealtimeApiUrl
,
data
:
{
...
...
@@ -5789,7 +5789,7 @@ function JSSymbolData(ast,option,jsExecute)
var
self
=
this
;
if
(
this
.
Period
<=
3
)
//请求日线数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
KLineApiUrl
,
data
:
{
...
...
@@ -5814,7 +5814,7 @@ function JSSymbolData(ast,option,jsExecute)
}
else
//请求分钟数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
MinuteKLineApiUrl
,
data
:
{
...
...
@@ -6064,7 +6064,7 @@ function JSSymbolData(ast,option,jsExecute)
if
(
this
.
DataType
===
HQ_DATA_TYPE
.
MINUTE_ID
)
//当天分钟数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
RealtimeApiUrl
,
data
:
{
...
...
@@ -6086,7 +6086,7 @@ function JSSymbolData(ast,option,jsExecute)
if
(
this
.
Period
<=
3
)
//请求日线数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
self
.
KLineApiUrl
,
data
:
{
...
...
@@ -6111,7 +6111,7 @@ function JSSymbolData(ast,option,jsExecute)
}
else
//请求分钟数据
{
$
.
ajax
({
JSNetwork
.
HttpReqeust
({
url
:
this
.
MinuteKLineApiUrl
,
data
:
{
...
...
@@ -6352,6 +6352,9 @@ function JSSymbolData(ast,option,jsExecute)
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
//过去4个季度现金分红总额
fieldList
.
push
(
'
execdividend.quarter4
'
);
break
;
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
fieldList
.
push
(
'
shareholder
'
);
//股东信息
break
;
}
//请求数据
...
...
@@ -6393,6 +6396,7 @@ function JSSymbolData(ast,option,jsExecute)
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_AL_RATIO_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_PROFIT_YOY_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
return
this
.
RecvStockDayData
(
recvData
,
jobID
);
}
}
...
...
@@ -6517,6 +6521,13 @@ function JSSymbolData(ast,option,jsExecute)
if
(
!
financeData
)
continue
;
if
(
!
this
.
IsNumber
(
financeData
.
quarter4
))
continue
;
indexData
.
Value
=
financeData
.
quarter4
;
//过去4个季度现金分红总额
bFinanceData
=
true
;
break
;
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
//股东人数
var
shareHolder
=
item
.
shareholder
;
if
(
!
shareHolder
||
!
this
.
IsNumber
(
shareHolder
.
count
))
continue
;
indexData
.
Value
=
shareHolder
.
count
;
bFinanceData
=
true
;
break
;
default
:
continue
;
...
...
@@ -7527,6 +7538,7 @@ var JS_EXECUTE_JOB_ID=
JOB_DOWNLOAD_PROFIT_YOY_DATA
:
111
,
//利润同比 (Profit year on year)
JOB_DOWNLOAD_AL_RATIO_DATA
:
112
,
//资产负债率 (asset-liability ratio)
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
113
,
//股息率
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
114
,
//股东人数
JOB_DOWNLOAD_CAPITAL_DATA
:
200
,
//流通股本(手)
...
...
@@ -7582,6 +7594,8 @@ var JS_EXECUTE_JOB_ID=
[
43
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_PROFIT_YOY_DATA
],
//FINANCE(43) 利润同比 (Profit year on year)
[
45
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
],
//FINANCE(45) 股息率
[
100
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
],
//FINANCE(100) 股东人数
[
200
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_CAPITAL_DATA
],
//流通股本(手)
[
201
,
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_EXCHANGE_DATA
]
//换手率 成交量/流通股本
...
...
@@ -7659,6 +7673,7 @@ function JSExecute(ast,option)
this
.
VarTable
=
new
Map
();
//变量表
this
.
OutVarTable
=
new
Array
();
//输出变量
this
.
Arguments
=
[];
this
.
ErrorCallback
;
//执行错误回调
//脚本自动变量表, 只读
this
.
ConstVarTable
=
new
Map
([
...
...
@@ -7738,6 +7753,7 @@ function JSExecute(ast,option)
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_AL_RATIO_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_PROFIT_YOY_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_DIVIDEND_YIELD_DATA
:
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_SHAREHOLDER_DATA
:
return
this
.
SymbolData
.
GetFinanceData
(
jobItem
.
ID
);
case
JS_EXECUTE_JOB_ID
.
JOB_DOWNLOAD_RELEASE_DATE_DATA
:
...
...
@@ -8038,15 +8054,23 @@ function JSExecute(ast,option)
}
this
.
Run
=
function
()
{
let
data
=
this
.
RunAST
();
//执行脚本
console
.
log
(
'
[JSComplier.Run] execute finish
'
,
data
);
{
try
{
let
data
=
this
.
RunAST
();
//执行脚本
console
.
log
(
'
[JSComplier.Run] execute finish
'
,
data
);
if
(
this
.
UpdateUICallback
)
if
(
this
.
UpdateUICallback
)
{
console
.
log
(
'
[JSComplier.Run] invoke UpdateUICallback.
'
);
if
(
this
.
CallbackParam
&&
this
.
CallbackParam
.
Self
&&
this
.
CallbackParam
.
Self
.
ClassName
===
'
ScriptIndexConsole
'
)
this
.
CallbackParam
.
JSExecute
=
this
;
this
.
UpdateUICallback
(
data
,
this
.
CallbackParam
);
}
}
catch
(
error
)
{
console
.
log
(
'
[JSComplier.Run] invoke UpdateUICallback.
'
);
if
(
this
.
CallbackParam
&&
this
.
CallbackParam
.
Self
&&
this
.
CallbackParam
.
Self
.
ClassName
===
'
ScriptIndexConsole
'
)
this
.
CallbackParam
.
JSExecute
=
this
;
this
.
UpdateUICallback
(
data
,
this
.
CallbackParam
);
console
.
log
(
error
);
if
(
this
.
ErrorCallback
)
this
.
ErrorCallback
(
error
);
}
}
...
...
@@ -8425,6 +8449,7 @@ JSComplier.Execute=function(code,option,errorCallback)
console
.
log
(
'
[JSComplier.Execute] execute .....
'
);
let
execute
=
new
JSExecute
(
ast
,
option
);
execute
.
ErrorCallback
=
errorCallback
;
//执行错误回调
execute
.
JobList
=
parser
.
Node
.
GetDataJobList
();
execute
.
JobList
.
push
({
ID
:
JS_EXECUTE_JOB_ID
.
JOB_RUN_SCRIPT
});
...
...
@@ -9277,6 +9302,7 @@ function OverlayScriptIndex(name,script,args,option)
var
titleIndex
=
windowIndex
+
1
;
var
titlePaint
=
hqChart
.
TitlePaint
[
titleIndex
];
titlePaint
.
OverlayIndex
.
set
(
this
.
OverlayIndex
.
Identify
,
titleInfo
);
this
.
OverlayIndex
.
Frame
.
Frame
.
Title
=
titleInfo
.
Title
;
//给子框架设置标题
for
(
var
i
in
this
.
OutVar
)
{
...
...
@@ -9959,12 +9985,7 @@ function ScriptIndexConsole(obj)
var
self
=
param
.
Self
;
var
jsExec
=
param
.
JSExecute
;
var
date
=
[];
for
(
var
i
=
0
;
i
<
jsExec
.
SymbolData
.
Data
.
Data
.
length
;
++
i
)
{
var
item
=
jsExec
.
SymbolData
.
Data
.
Data
[
i
];
date
[
i
]
=
item
.
Date
;
}
var
date
=
jsExec
.
SymbolData
.
Data
.
GetDate
();
var
result
=
{
...
...
@@ -9972,11 +9993,35 @@ function ScriptIndexConsole(obj)
Date
:
date
,
//日期对应 上面的数据
Stock
:{
Name
:
jsExec
.
SymbolData
.
Name
,
Symbol
:
jsExec
.
SymbolData
.
Symbol
},
};
if
(
jsExec
.
SymbolData
.
Period
>=
4
)
result
.
Time
=
jsExec
.
SymbolData
.
Data
.
GetTime
();
//console.log('[ScriptIndexConsole::RecvResultData] outVar ', outVar);
if
(
self
.
FinishCallback
)
self
.
FinishCallback
(
result
,
param
.
JSExecute
);
}
}
ScriptIndexConsole
.
SetDomain
=
function
(
domain
,
cacheDomain
)
//修改API地址
{
JSComplier
.
SetDomain
(
domain
,
cacheDomain
);
}
function
JSNetwork
()
{
}
JSNetwork
.
HttpReqeust
=
function
(
obj
)
//对请求进行封装
{
$
.
ajax
(
{
url
:
obj
.
url
,
data
:
obj
.
data
,
type
:
obj
.
type
,
dataType
:
obj
.
dataType
,
async
:
obj
.
async
,
success
:
obj
.
success
,
error
:
obj
.
error
,
}
);
}
/* 测试例子
var code1='VARHIGH:IF(VAR1<=REF(HH,-1),REF(H,BARSLAST(VAR1>=REF(HH,1))),DRAWNULL),COLORYELLOW;';
...
...
webhqchart/umychart.index.data.js
浏览文件 @
ab10b44d
...
...
@@ -66,7 +66,7 @@ function JSIndexScript()
[
'
飞龙四式
'
,
this
.
Dragon4_Main
],[
'
飞龙四式-附图
'
,
this
.
Dragon4_Fig
],
[
'
资金分析
'
,
this
.
FundsAnalysis
],[
'
融资占比
'
,
this
.
MarginProportion
],[
'
负面新闻
'
,
this
.
NewsNegative
],
[
'
涨跌趋势
'
,
this
.
UpDownAnalyze
],[
'
北上资金
'
,
this
.
HK2SHSZ
],
[
'
涨跌趋势
'
,
this
.
UpDownAnalyze
],[
'
北上资金
'
,
this
.
HK2SHSZ
],
[
'
股东人数
'
,
this
.
ShareHolder
],
[
'
Zealink-资金吸筹
'
,
this
.
Zealink_Index1
],
[
'
Zealink-牛熊区间
'
,
this
.
Zealink_Index2
],[
'
Zealink-持仓信号
'
,
this
.
Zealink_Index3
],
[
'
Zealink-增减持
'
,
this
.
Zealink_Index4
],[
'
Zealink-大宗交易
'
,
this
.
Zealink_Index5
],
[
'
Zealink-信托持股
'
,
this
.
Zealink_Index6
],
...
...
@@ -2130,6 +2130,20 @@ JSIndexScript.prototype.HK2SHSZ=function()
return
data
;
}
JSIndexScript
.
prototype
.
ShareHolder
=
function
()
{
let
data
=
{
Name
:
'
股东人数
'
,
Description
:
'
股东人数
'
,
IsMainIndex
:
false
,
FloatPrecision
:
0
,
Condition
:
{
Period
:[
CONDITION_PERIOD
.
KLINE_DAY_ID
]
},
Args
:
[],
Script
:
//脚本
"
人数:FINANCE(100);
"
};
return
data
;
}
JSIndexScript
.
prototype
.
VOLRate
=
function
()
{
let
data
=
...
...
webhqchart/umychart.js
浏览文件 @
ab10b44d
...
...
@@ -257,7 +257,7 @@ function JSChart(divElement)
{
var item=option.OverlayIndex[i];
if (item.Windows>=chart.Frame.SubFrame.length) continue;
chart.CreateOverlayWindowsIndex(
item.Windows,item.Index
);
chart.CreateOverlayWindowsIndex(
{ WindowIndex:item.Windows,IndexName: item.Index, ShowRightText:item.ShowRightText }
);
}
this.AdjustTitleHeight(chart);
...
...
@@ -903,10 +903,10 @@ function JSChart(divElement)
this.JSChartContainer.SetMainDataConotrl(dataControl);
}
this.AddOverlayIndex=function(
windowIndex, indexName, identify)
this.AddOverlayIndex=function(
obj) //{WindowIndex:窗口ID, IndexName:指标ID, Identify:叠加指标ID(可选)}
{
if (this.JSChartContainer && typeof(this.JSChartContainer.AddOverlayIndex)=='function')
this.JSChartContainer.AddOverlayIndex(
windowIndex, indexName,identify
);
this.JSChartContainer.AddOverlayIndex(
obj
);
}
this.DeleteOverlayWindowsIndex=function(identify)
...
...
@@ -2552,6 +2552,7 @@ function JSChartContainer(uielement)
function GetDevicePixelRatio()
{
if (typeof(window) =='undefined') return 1;
return window.devicePixelRatio || 1;
}
...
...
@@ -3817,19 +3818,48 @@ function OverlayKLineFrame()
this.MainFrame=null; //主框架
this.RightOffset=50;
this.PenBorder=g_JSChartResource.OverlayFrameBolderPen; //'rgb(0,0,0)'
this.PenBorder=g_JSChartResource.OverlayFrame.BolderPen; //'rgb(0,0,0)'
this.IsShow=true; //坐标是否显示
this.Title=null;
this.TitleColor=g_JSChartResource.OverlayFrame.TitleColor;
this.TitleFont=g_JSChartResource.OverlayFrame.TitleFont;
this.Draw=function()
{
this.SplitXYCoordinate();
this.DrawVertical();
this.DrawHorizontal();
if (this.IsShow)
{
this.DrawVertical();
this.DrawHorizontal();
this.DrawTitle();
}
this.SizeChange=false;
this.XYSplit=false;
}
this.DrawTitle=function() //画标题
{
if (!this.Title) return;
var top = this.ChartBorder.GetTopTitle();
var bottom = this.ChartBorder.GetBottom();
var right=this.ChartBorder.GetRight();
right+=this.RightOffset;
this.Canvas.fillStyle=this.TitleColor;
this.Canvas.font=this.TitleFont;
this.Canvas.textAlign="center";
this.Canvas.textBaseline="top";
var xText=right-2,yText=top+(bottom-top)/2;
this.Canvas.save();
this.Canvas.translate(xText, yText);
this.Canvas.rotate(90 * Math.PI / 180);
this.Canvas.fillText(this.Title, 0, 0);
this.Canvas.restore();
}
//分割x,y轴坐标信息
this.SplitXYCoordinate=function()
{
...
...
@@ -3861,7 +3891,7 @@ function OverlayKLineFrame()
this.Canvas.strokeStyle=this.PenBorder;
this.Canvas.beginPath();
this.Canvas.moveTo(right-
5
,ToFixedPoint(y));
this.Canvas.moveTo(right-
2
,ToFixedPoint(y));
this.Canvas.lineTo(right,ToFixedPoint(y));
this.Canvas.stroke();
...
...
@@ -4178,7 +4208,7 @@ function SubFrameItem()
this.Frame;
this.Height;
this.OverlayIndex=[]; //叠加指标
this.Interval=
5
0; //子坐标间间距
this.Interval=
6
0; //子坐标间间距
}
function OverlayIndexItem()
...
...
@@ -4272,10 +4302,12 @@ function HQTradeFrame()
overlayItem.Frame.DataWidth=item.Frame.DataWidth;
overlayItem.Frame.DistanceWidth=item.Frame.DistanceWidth;
overlayItem.Frame.XPointCount=item.Frame.XPointCount;
if (overlayItem.ChartPaint.length>0)
if (overlayItem.ChartPaint.length>0 && overlayItem.Frame.IsShow)
{
overlayItem.Frame.RightOffset=rightOffset;
overlayItem.Frame.Draw();
rightOffset+=item.Interval;
}
}
}
...
...
@@ -4292,7 +4324,8 @@ function HQTradeFrame()
var overlayItem=item.OverlayIndex[j];
for(k in overlayItem.ChartPaint)
{
overlayItem.ChartPaint[k].Draw();
if (overlayItem.ChartPaint[k].IsShow)
overlayItem.ChartPaint[k].Draw();
}
}
}
...
...
@@ -4877,6 +4910,28 @@ function ChartData()
return result;
}
this.GetDate=function()
{
var result=new Array();
for(var i in this.Data)
{
result[i]=this.Data[i].Date;
}
return result;
}
this.GetTime=function()
{
var result=new Array();
for(var i in this.Data)
{
result[i]=this.Data[i].Time;
}
return result;
}
this.GetUp=function() //上涨家数
{
var result=[];
...
...
@@ -12449,6 +12504,8 @@ function ChartCorssCursor()
for(var i in frame.OverlayIndex)
{
var item=frame.OverlayIndex[i];
if (item.Frame.IsShow===false) continue;
overlayLeft+=frame.Interval;
if (overlayLeft+30>chartRight) break;
var yValue=item.Frame.GetYData(y);
...
...
@@ -12777,7 +12834,7 @@ function HQMinuteTimeStringFormat()
if (this.IsBeforeData) //增加盘前数据时间刻度
{
var allTimeData=[915,916,917,918,919,920,921,922,923,924,925,926,927,928,929]
for(i in timeData)
for(
var
i in timeData)
{
if (timeData[i]==925) continue;
allTimeData.push(timeData[i])
...
...
@@ -13552,7 +13609,7 @@ function DynamicChartTitlePainting()
left+=textWidth;
}
this.DrawOverlayIndex(left
);
this.DrawOverlayIndex(left
+10*GetDevicePixelRatio()); //间距都空点 和主指标区分开
}
this.DrawOverlayIndex=function(left) //叠加指标标题
...
...
@@ -16528,7 +16585,12 @@ function JSChartResource()
this.FrameSplitTextColor="rgb(117,125,129)"; //刻度文字颜色
this.FrameSplitTextFont=14*GetDevicePixelRatio() +"px 微软雅黑"; //坐标刻度文字字体
this.FrameTitleBGColor="rgb(246,251,253)"; //标题栏背景色
this.OverlayFrameBolderPen='rgb(190,190,190)'
this.OverlayFrame={
BolderPen:'rgb(190,190,190)',
TitleColor:'rgb(105,105,105)',
TitleFont:11*GetDevicePixelRatio() +'px arial',
};
this.CorssCursorBGColor="rgb(43,54,69)"; //十字光标背景
this.CorssCursorTextColor="rgb(255,255,255)";
...
...
@@ -17717,7 +17779,7 @@ function KLineChartContainer(uielement)
this.ChartDrawStorageCache=null; //首次需要创建的画图工具数据
this.CustomShow=null; //首先显示的K线的起始日期 { Date:日期 PageSize:}
this.OverlayIndexFrameWidth=
55
; //叠加指标框架宽度
this.OverlayIndexFrameWidth=
60
; //叠加指标框架宽度
//自动更新设置
this.IsAutoUpdate=false; //是否自动更新行情数据
...
...
@@ -18827,21 +18889,23 @@ function KLineChartContainer(uielement)
this.Draw();
}
this.AddOverlayIndex=function(
windowIndex, indexName,identify)
this.AddOverlayIndex=function(
obj)
{
var overlay=this.CreateOverlayWindowsIndex(
windowIndex, indexName
);
var overlay=this.CreateOverlayWindowsIndex(
obj
);
if (!overlay) return;
var bindData=this.ChartPaint[0].Data;
this.BindOverlayIndexData(overlay,
w
indowIndex,bindData);
this.BindOverlayIndexData(overlay,
obj.W
indowIndex,bindData);
this.UpdataDataoffset(); //更新数据偏移
this.UpdateFrameMaxMin(); //调整坐标最大 最小值
this.Draw();
}
//创建一个叠加指标
this.CreateOverlayWindowsIndex=function(
windowIndex, indexName,identify)
this.CreateOverlayWindowsIndex=function(
obj) // {WindowIndex:, IndexName:, Identify:, ShowRightText:}
{
let indexName=obj.IndexName;
let windowIndex=obj.WindowIndex;
let scriptData = new JSIndexScript();
let indexInfo = scriptData.Get(indexName); //系统指标
if (!indexInfo)
...
...
@@ -18857,17 +18921,20 @@ function KLineChartContainer(uielement)
var subFrame=this.Frame.SubFrame[windowIndex];
subFrame.Interval=this.OverlayIndexFrameWidth;
var overlayFrame=new OverlayIndexItem();
if (
identify) overlayFrame.Identify=i
dentify; //由外部指定id
if (
obj.Identify) overlayFrame.Identify=obj.I
dentify; //由外部指定id
frame=new OverlayKLineFrame();
frame.Canvas=this.Canvas;
frame.MainFrame=subFrame.Frame;
frame.ChartBorder=subFrame.Frame.ChartBorder;
if (obj.ShowRightText===true) frame.IsShow=true;
else if (obj.ShowRightText===false) frame.IsShow=false;
frame.YSplitOperator=new FrameSplitY();
frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');
frame.YSplitOperator.Frame=frame;
frame.YSplitOperator.ChartBorder=frame.ChartBorder;
frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;
overlayFrame.Frame=frame;
...
...
@@ -21415,8 +21482,6 @@ MinuteChartContainer.JsonDataToMinuteData=function(data,isBeforeData)
{
var jsData=data.stock[0].minute[i];
var item=new MinuteData();
if (jsData.price) preClose=jsData.price;
if (jsData.avprice) preAvPrice=jsData.avprice;
item.Close=jsData.price;
item.Open=jsData.open;
...
...
@@ -21445,6 +21510,7 @@ MinuteChartContainer.JsonDataToMinuteData=function(data,isBeforeData)
item.Close=preClose;
item.Open=item.High=item.Low=item.Close;
}
if (!item.AvPrice) item.AvPrice=preAvPrice;
//价格是0的 都用空
...
...
@@ -21459,6 +21525,17 @@ MinuteChartContainer.JsonDataToMinuteData=function(data,isBeforeData)
if (yClose && item.Close)
item.Increase=(item.Close-yClose)/yClose*100; //涨幅 (最新价格-昨收)/昨收*100;
//均价太大 可能是后台算错了
var checkValue=Math.abs(item.AvPrice-item.Close);
//console.log(`[MinuteChartContainer::JsonDataToMinuteData] checkValue=${checkValue}, ${item.Close*0.13} `)
if (checkValue>item.Close*0.13 )
item.AvPrice=preAvPrice;
//上次价格
if (jsData.price>0) preClose=jsData.price;
if (jsData.avprice>0 && item.AvPrice===jsData.avprice) preAvPrice=jsData.avprice;
aryMinuteData[i]=item;
}
...
...
@@ -25650,11 +25727,11 @@ function ChangeIndexDialog(divElement)
function changeIndeWindow()
{
$(".target-right ul").undelegate().delegate("li","click",function () {
var id
V
= $(this).attr("id");
var id
v
= $(this).attr("id");
if (isOverlay)
chart.AddOverlayIndex(
identify,idV
);
chart.AddOverlayIndex(
{WindowIndex:identify,IndexName:idv}
);
else
chart.ChangeIndex(identify,id
V
);
chart.ChangeIndex(identify,id
v
);
$(this).addClass("active-list").siblings().removeClass("active-list");
});
}
...
...
@@ -26520,7 +26597,10 @@ function KLineRightMenu(divElement)
var _self = this;
var id=this.DivElement.id;
var $body=$("#"+id);
var $body = $("#" + id);
$body.find("div[id^='topMenu_']").remove();
$body.find("div[id^='childMenu_']").remove();
var $topMenu = $("<div />");
$topMenu.attr("id", "topMenu_"+_self.ID).addClass("context-menu-wrapper topmenu").hide();
...
...
@@ -26553,22 +26633,24 @@ function KLineRightMenu(divElement)
this.Update=function()
{
var _self = this;
var id=this.DivElement.id;
var $body=$("#"+id);
//var id=this.DivElement.id;
//var $body=$("#"+id);
//
//var $topTable = $("#topTable_" + _self.ID);
//$topTable.empty();
//$topTable.append(_self.childrenList(_self.option.data));
//
//for (var i = 0; i < _self.option.data.length; i++) {
// var isHasChildren = typeof _self.option.data[i].children != "undefined";
//
// if (isHasChildren) {
// var $childTable = $("#childTable_" + _self.ID + i);
// $childTable.empty();
// $childTable.append(_self.childrenList(_self.option.data[i].children));
// }
//}
var $topTable = $("#topTable_" + _self.ID);
$topTable.empty();
$topTable.append(_self.childrenList(_self.option.data));
for (var i = 0; i < _self.option.data.length; i++) {
var isHasChildren = typeof _self.option.data[i].children != "undefined";
if (isHasChildren) {
var $childTable = $("#childTable_" + _self.ID + i);
$childTable.empty();
$childTable.append(_self.childrenList(_self.option.data[i].children));
}
}
_self.BindData();
_self.BindEvent();
}
...
...
@@ -27478,7 +27560,7 @@ function MinuteRightMenu(divElement)
var symbol=chart.Symbol;
if (MARKET_SUFFIX_NAME.IsSHSZStockA(symbol))
{
dataList.push({text:'集合竞价',children: this.GetShowBeforeData(chart)})
dataList.push({text:'集合竞价',children: this.GetShowBeforeData(chart)})
;
}
var identify=event.data.FrameID;
...
...
@@ -27586,9 +27668,10 @@ function MinuteRightMenu(divElement)
{
text: "隐藏",
click: function () { chart.ShowBeforeData(false); },
isBorder:true
}
]
];
return data;
}
else
{
...
...
@@ -27597,12 +27680,11 @@ function MinuteRightMenu(divElement)
{
text: "显示",
click: function () { chart.ShowBeforeData(true); },
isBorder:true
},
]
}
}
];
return data;
return data;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录