hqchart 1.1.13318 → 1.1.13327
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/umychart.vue.js +105 -86
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +119 -15
- package/src/jscommon/umychart.complier.js +82 -1
- package/src/jscommon/umychart.resource/font/drawtool/demo_index.html +72 -3
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.css +15 -3
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.js +1 -1
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.json +21 -0
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.ttf +0 -0
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.woff +0 -0
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.woff2 +0 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +83 -2
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +202 -17
|
@@ -100373,6 +100373,35 @@ function JSAlgorithm(errorHandler,symbolData)
|
|
|
100373
100373
|
return result;
|
|
100374
100374
|
}
|
|
100375
100375
|
|
|
100376
|
+
//反向过滤连续出现的信号.
|
|
100377
|
+
//用法:FILTERX(X,N):X满足条件后,将其前N周期内的数据置为0,N为常量.
|
|
100378
|
+
//例如:FILTERX(CLOSE>OPEN,5)查找阳线,前5天内出现过的阳线不被记录在内
|
|
100379
|
+
this.FILTERX=function(data, n, node)
|
|
100380
|
+
{
|
|
100381
|
+
var result=[];
|
|
100382
|
+
for(let i=0,j=0; i<data.length; ++i)
|
|
100383
|
+
{
|
|
100384
|
+
if (data[i])
|
|
100385
|
+
{
|
|
100386
|
+
result[i]=1;
|
|
100387
|
+
for(j=0;j<n && i-j-1>=0;++j)
|
|
100388
|
+
{
|
|
100389
|
+
result[i-j-1]=0;
|
|
100390
|
+
}
|
|
100391
|
+
i+=n;
|
|
100392
|
+
}
|
|
100393
|
+
else
|
|
100394
|
+
{
|
|
100395
|
+
result[i]=0;
|
|
100396
|
+
}
|
|
100397
|
+
}
|
|
100398
|
+
|
|
100399
|
+
return result;
|
|
100400
|
+
}
|
|
100401
|
+
|
|
100402
|
+
//上一次条件成立到当前的周期数.
|
|
100403
|
+
//用法:BARSLAST(X):上一次X不为0到现在的周期数
|
|
100404
|
+
//例如:BARSLAST(CLOSE/REF(CLOSE,1)>=1.1)表示上一个涨停板到当前的周期数
|
|
100376
100405
|
this.BARSLAST=function(data)
|
|
100377
100406
|
{
|
|
100378
100407
|
var result=[];
|
|
@@ -100392,6 +100421,52 @@ function JSAlgorithm(errorHandler,symbolData)
|
|
|
100392
100421
|
return result;
|
|
100393
100422
|
}
|
|
100394
100423
|
|
|
100424
|
+
//倒数第N次成立时距今的周期数.
|
|
100425
|
+
//用法:BARSLASTS(X,N):X倒数第N满足到现在的周期数,N支持变量
|
|
100426
|
+
this.BARSLASTS=function(data, n, node)
|
|
100427
|
+
{
|
|
100428
|
+
var result=[];
|
|
100429
|
+
if (!data) return result;
|
|
100430
|
+
if (n<=0) n=data.length;
|
|
100431
|
+
|
|
100432
|
+
var day=null;
|
|
100433
|
+
var SingleValue=0; //单词数
|
|
100434
|
+
var periodCount=0;
|
|
100435
|
+
for(let i=0;i<data.length;++i)
|
|
100436
|
+
{
|
|
100437
|
+
result[i]=null;
|
|
100438
|
+
var value=data[i];
|
|
100439
|
+
|
|
100440
|
+
if (value>0)
|
|
100441
|
+
{
|
|
100442
|
+
if (day==null)
|
|
100443
|
+
{
|
|
100444
|
+
day=0;
|
|
100445
|
+
++periodCount;
|
|
100446
|
+
}
|
|
100447
|
+
else
|
|
100448
|
+
{
|
|
100449
|
+
++periodCount;
|
|
100450
|
+
if (periodCount>n) day-=SingleValue;
|
|
100451
|
+
}
|
|
100452
|
+
|
|
100453
|
+
SingleValue=0;
|
|
100454
|
+
}
|
|
100455
|
+
else
|
|
100456
|
+
{
|
|
100457
|
+
if (day!=null)
|
|
100458
|
+
{
|
|
100459
|
+
++day;
|
|
100460
|
+
++SingleValue;
|
|
100461
|
+
}
|
|
100462
|
+
}
|
|
100463
|
+
|
|
100464
|
+
if (day!=null) result[i]=day;
|
|
100465
|
+
}
|
|
100466
|
+
|
|
100467
|
+
return result;
|
|
100468
|
+
}
|
|
100469
|
+
|
|
100395
100470
|
/*
|
|
100396
100471
|
N周期内第一个条件成立到当前的周期数.
|
|
100397
100472
|
用法:
|
|
@@ -104413,10 +104488,15 @@ function JSAlgorithm(errorHandler,symbolData)
|
|
|
104413
104488
|
return this.FILTER(args[0],args[1]);
|
|
104414
104489
|
case 'TFILTER':
|
|
104415
104490
|
return this.TFILTER(args[0],args[1],args[2]);
|
|
104491
|
+
case "FILTERX":
|
|
104492
|
+
return this.FILTERX(args[0],args[1],node);
|
|
104416
104493
|
case 'SLOPE':
|
|
104417
104494
|
return this.SLOPE(args[0],args[1]);
|
|
104418
104495
|
case 'BARSLAST':
|
|
104419
104496
|
return this.BARSLAST(args[0]);
|
|
104497
|
+
case "BARSLASTS":
|
|
104498
|
+
//this.ThrowUnexpectedNode(node,`函数'BARSLASTS'还在开发中`, name);
|
|
104499
|
+
return this.BARSLASTS(args[0],args[1],node);
|
|
104420
104500
|
case 'BARSCOUNT':
|
|
104421
104501
|
return this.BARSCOUNT(args[0]);
|
|
104422
104502
|
case 'BARSSINCEN':
|
|
@@ -113867,6 +113947,7 @@ function JSExplainer(ast,option)
|
|
|
113867
113947
|
this.JobList=[]; //执行的任务队列
|
|
113868
113948
|
this.VarTable=new Map(); //变量表
|
|
113869
113949
|
this.OutVarTable=[]; //输出变量
|
|
113950
|
+
this.MaxValueLength=150; //最长的字符
|
|
113870
113951
|
|
|
113871
113952
|
//脚本自动变量表, 只读
|
|
113872
113953
|
this.ConstVarTable=new Map(
|
|
@@ -114816,7 +114897,7 @@ function JSExplainer(ast,option)
|
|
|
114816
114897
|
|
|
114817
114898
|
this.ConvertToShortValue=function(value)
|
|
114818
114899
|
{
|
|
114819
|
-
var maxLength=
|
|
114900
|
+
var maxLength=this.MaxValueLength;
|
|
114820
114901
|
if (value && value.length>=maxLength)
|
|
114821
114902
|
{
|
|
114822
114903
|
var shortValue=value.slice(0, maxLength-10);
|
|
@@ -135635,6 +135716,9 @@ var JS_DRAWTOOL_MENU_ID=
|
|
|
135635
135716
|
CMD_ERASE_DRAW_CHART_ID:4,
|
|
135636
135717
|
CMD_ENABLE_MAGNET_ID:5, //画图工具磁体功能
|
|
135637
135718
|
CMD_DELETE_DRAW_CHART_ID:6,
|
|
135719
|
+
|
|
135720
|
+
CMD_CHANGE_FONT_COLOR_ID:7, //切换字体颜色
|
|
135721
|
+
CMD_CHANGE_BG_COLOR_ID:8 //切换背景色
|
|
135638
135722
|
};
|
|
135639
135723
|
|
|
135640
135724
|
function JSDialogDrawTool()
|
|
@@ -136162,16 +136246,23 @@ function JSDialogModifyDraw()
|
|
|
136162
136246
|
this.DivDialog=null;
|
|
136163
136247
|
this.HQChart;
|
|
136164
136248
|
this.ChartPicture;
|
|
136249
|
+
//按钮
|
|
136165
136250
|
this.ColorButton=null;
|
|
136251
|
+
this.BGColorButton=null;
|
|
136252
|
+
this.FontColorButton=null;
|
|
136253
|
+
|
|
136254
|
+
this.RandomLineColor=["rgb(255,69,0)", "rgb(173,255,47)", "rgb(238,154,73)", "rgb(255,105,180)"]; //线段颜色
|
|
136255
|
+
this.RandomBGColor=["rgba(210,251,209,0.8)", "rgb(217,217,253)", "rgb(255,208,204)", "rgb(252,249,206)"]; //背景颜色
|
|
136256
|
+
this.RandomFontColor=["rgb(0,0,0)", "rgb(255, 0, 0)", "rgb(20, 255, 0)", "rgb(255, 0, 255)"]; //文字颜色
|
|
136166
136257
|
|
|
136167
|
-
this.RandomLineColor=["rgb(255,69,0)", "rgb(173,255,47)", "rgb(238,154,73)", "rgb(255,105,180)"];
|
|
136168
136258
|
this.AryButton=
|
|
136169
136259
|
[
|
|
136170
|
-
{ Title:"
|
|
136260
|
+
{ Title:"点击线段颜色", ClassName: 'hqchart_drawtool icon-huabi', Type:2, Data:{ ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID }},
|
|
136261
|
+
{ Title:"点击字体颜色", ClassName: 'hqchart_drawtool icon-zitiyanse', Type:2, Data:{ ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID }},
|
|
136262
|
+
{ Title:"点击背景色", ClassName: 'hqchart_drawtool icon-zitibeijingse', Type:2, Data:{ ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID }},
|
|
136171
136263
|
{ Title:"删除", ClassName: 'hqchart_drawtool icon-recycle_bin', Type:2, Data:{ ID:JS_DRAWTOOL_MENU_ID.CMD_DELETE_DRAW_CHART_ID }}
|
|
136172
136264
|
];
|
|
136173
|
-
|
|
136174
|
-
|
|
136265
|
+
|
|
136175
136266
|
this.Inital=function(hqchart)
|
|
136176
136267
|
{
|
|
136177
136268
|
this.HQChart=hqchart;
|
|
@@ -136222,11 +136313,23 @@ function JSDialogModifyDraw()
|
|
|
136222
136313
|
spanDom.classList.add("UMyChart_DrawTool_Span");
|
|
136223
136314
|
divItem.appendChild(spanDom);
|
|
136224
136315
|
|
|
136225
|
-
var data={ Span:spanDom, Parent:parentDivDom, Item:item };
|
|
136316
|
+
var data={ Div:divItem, Span:spanDom, Parent:parentDivDom, Item:item };
|
|
136226
136317
|
divItem.onmousedown=(e)=> { this.OnClickButton(e, data); }; //点击
|
|
136227
136318
|
|
|
136228
|
-
|
|
136229
|
-
|
|
136319
|
+
switch(item.Data.ID)
|
|
136320
|
+
{
|
|
136321
|
+
case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID:
|
|
136322
|
+
this.ColorButton=data;
|
|
136323
|
+
break;
|
|
136324
|
+
case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID:
|
|
136325
|
+
this.BGColorButton=data;
|
|
136326
|
+
divItem.style.display="none";
|
|
136327
|
+
break;
|
|
136328
|
+
case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID:
|
|
136329
|
+
this.FontColorButton=data;
|
|
136330
|
+
divItem.style.display="none";
|
|
136331
|
+
break;
|
|
136332
|
+
}
|
|
136230
136333
|
|
|
136231
136334
|
parentDivDom.appendChild(divItem);
|
|
136232
136335
|
}
|
|
@@ -136245,6 +136348,12 @@ function JSDialogModifyDraw()
|
|
|
136245
136348
|
case JS_DRAWTOOL_MENU_ID.CMD_DELETE_DRAW_CHART_ID:
|
|
136246
136349
|
this.DeleteDrawPicture();
|
|
136247
136350
|
break;
|
|
136351
|
+
case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID:
|
|
136352
|
+
this.ModifyBGColor();
|
|
136353
|
+
break;
|
|
136354
|
+
case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID:
|
|
136355
|
+
this.ModifyFontColor();
|
|
136356
|
+
break;
|
|
136248
136357
|
}
|
|
136249
136358
|
}
|
|
136250
136359
|
|
|
@@ -136272,23 +136381,35 @@ function JSDialogModifyDraw()
|
|
|
136272
136381
|
this.Close();
|
|
136273
136382
|
}
|
|
136274
136383
|
|
|
136275
|
-
this.
|
|
136384
|
+
this.ShowButton=function(dom, diaplay)
|
|
136276
136385
|
{
|
|
136277
|
-
if (
|
|
136386
|
+
if (dom.style.display==diaplay) return;
|
|
136387
|
+
dom.style.display=diaplay;
|
|
136388
|
+
}
|
|
136278
136389
|
|
|
136279
|
-
|
|
136390
|
+
this.GetRandomColor=function(currentColor, randomLineColor)
|
|
136391
|
+
{
|
|
136280
136392
|
var colorIndex=0;
|
|
136281
|
-
for(var i=0;i<
|
|
136393
|
+
for(var i=0;i<randomLineColor.length;++i)
|
|
136282
136394
|
{
|
|
136283
|
-
if (
|
|
136395
|
+
if (currentColor==randomLineColor[i])
|
|
136284
136396
|
{
|
|
136285
136397
|
colorIndex=i+1;
|
|
136286
136398
|
break;
|
|
136287
136399
|
}
|
|
136288
136400
|
}
|
|
136289
136401
|
|
|
136290
|
-
colorIndex=colorIndex%
|
|
136291
|
-
color=
|
|
136402
|
+
colorIndex=colorIndex%randomLineColor.length;
|
|
136403
|
+
var color=randomLineColor[colorIndex];
|
|
136404
|
+
|
|
136405
|
+
return color;
|
|
136406
|
+
}
|
|
136407
|
+
|
|
136408
|
+
this.ModifyLineColor=function()
|
|
136409
|
+
{
|
|
136410
|
+
if (!this.ChartPicture || !this.HQChart) return;
|
|
136411
|
+
|
|
136412
|
+
var color=this.GetRandomColor(this.ChartPicture.LineColor, this.RandomLineColor);
|
|
136292
136413
|
|
|
136293
136414
|
this.ChartPicture.LineColor = color;
|
|
136294
136415
|
this.ChartPicture.PointColor = color;
|
|
@@ -136300,6 +136421,32 @@ function JSDialogModifyDraw()
|
|
|
136300
136421
|
this.HQChart.Draw();
|
|
136301
136422
|
}
|
|
136302
136423
|
|
|
136424
|
+
this.ModifyFontColor=function()
|
|
136425
|
+
{
|
|
136426
|
+
if (!this.ChartPicture || !this.HQChart) return;
|
|
136427
|
+
|
|
136428
|
+
var color=this.GetRandomColor(this.ChartPicture.TextColor, this.RandomFontColor);
|
|
136429
|
+
this.ChartPicture.TextColor=color;
|
|
136430
|
+
|
|
136431
|
+
if (this.FontColorButton) this.FontColorButton.Span.style['color']=color;
|
|
136432
|
+
|
|
136433
|
+
if (this.HQChart.ChartDrawStorage) this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture); //保存下
|
|
136434
|
+
|
|
136435
|
+
this.HQChart.Draw();
|
|
136436
|
+
}
|
|
136437
|
+
|
|
136438
|
+
this.ModifyBGColor=function()
|
|
136439
|
+
{
|
|
136440
|
+
if (!this.ChartPicture || !this.HQChart) return;
|
|
136441
|
+
var color=this.GetRandomColor(this.ChartPicture.BGColor, this.RandomBGColor);
|
|
136442
|
+
|
|
136443
|
+
this.ChartPicture.BGColor=color;
|
|
136444
|
+
if (this.BGColorButton) this.BGColorButton.Span.style['color']=color;
|
|
136445
|
+
if (this.HQChart.ChartDrawStorage) this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture); //保存下
|
|
136446
|
+
|
|
136447
|
+
this.HQChart.Draw();
|
|
136448
|
+
}
|
|
136449
|
+
|
|
136303
136450
|
this.Show=function(x, y)
|
|
136304
136451
|
{
|
|
136305
136452
|
if (!this.DivDialog) this.Create();
|
|
@@ -136312,10 +136459,48 @@ function JSDialogModifyDraw()
|
|
|
136312
136459
|
this.SetChartPicture=function(chart)
|
|
136313
136460
|
{
|
|
136314
136461
|
this.ChartPicture=chart;
|
|
136462
|
+
|
|
136463
|
+
var bShowLineColor=true, bShowBGColor=false, bShowFontColor=false;
|
|
136464
|
+
var bgColor=null, fontColor=null;
|
|
136465
|
+
var ARRAY_TEXT_CHART=['ChartDrawPriceLabel', "ChartDrawAnchoredText","ChartDrawPriceNote","ChartDrawNote"];
|
|
136466
|
+
if (ARRAY_TEXT_CHART.includes(chart.ClassName))
|
|
136467
|
+
{
|
|
136468
|
+
bShowBGColor=true;
|
|
136469
|
+
bShowFontColor=true;
|
|
136470
|
+
bgColor=chart.BGColor;
|
|
136471
|
+
fontColor=chart.TextColor;
|
|
136472
|
+
}
|
|
136473
|
+
|
|
136315
136474
|
if (this.ColorButton)
|
|
136316
136475
|
{
|
|
136317
|
-
this.ColorButton
|
|
136476
|
+
var item=this.ColorButton;
|
|
136477
|
+
this.ShowButton(item.Div, bShowLineColor?"block":"none");
|
|
136478
|
+
if (bShowLineColor)
|
|
136479
|
+
{
|
|
136480
|
+
item.Span.style['color']=chart.LineColor;
|
|
136481
|
+
}
|
|
136482
|
+
}
|
|
136483
|
+
|
|
136484
|
+
if (this.BGColorButton)
|
|
136485
|
+
{
|
|
136486
|
+
var item=this.BGColorButton;
|
|
136487
|
+
this.ShowButton(item.Div, bShowBGColor?"block":"none");
|
|
136488
|
+
if (bShowBGColor)
|
|
136489
|
+
{
|
|
136490
|
+
item.Span.style['color']=bgColor;
|
|
136491
|
+
}
|
|
136492
|
+
}
|
|
136493
|
+
|
|
136494
|
+
if (this.FontColorButton)
|
|
136495
|
+
{
|
|
136496
|
+
var item=this.FontColorButton;
|
|
136497
|
+
this.ShowButton(item.Div, bShowFontColor?"block":"none");
|
|
136498
|
+
if (bShowFontColor)
|
|
136499
|
+
{
|
|
136500
|
+
item.Span.style['color']=fontColor;
|
|
136501
|
+
}
|
|
136318
136502
|
}
|
|
136503
|
+
|
|
136319
136504
|
}
|
|
136320
136505
|
|
|
136321
136506
|
this.OnMouseDownTitle=function(e)
|
|
@@ -136483,7 +136668,7 @@ function HQChartScriptWorker()
|
|
|
136483
136668
|
|
|
136484
136669
|
|
|
136485
136670
|
|
|
136486
|
-
var HQCHART_VERSION="1.1.
|
|
136671
|
+
var HQCHART_VERSION="1.1.13326";
|
|
136487
136672
|
|
|
136488
136673
|
function PrintHQChartVersion()
|
|
136489
136674
|
{
|