hqchart 1.1.14962 → 1.1.14971
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 +38 -23
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +3 -0
- package/src/jscommon/umychart.NetworkFilterTest.js +76 -2
- package/src/jscommon/umychart.js +606 -13
- package/src/jscommon/umychart.resource/font/drawtool/demo_index.html +49 -3
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.css +11 -3
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.js +1 -1
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.json +14 -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.style.js +25 -0
- package/src/jscommon/umychart.testdata.js +76 -2
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +632 -14
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.NetworkFilterTest.vue.js +76 -2
- package/src/jscommon/umychart.vue/umychart.vue.js +635 -14
package/src/jscommon/umychart.js
CHANGED
|
@@ -429,6 +429,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
429
429
|
{
|
|
430
430
|
var item=option.KeyboardMove;
|
|
431
431
|
if (IFrameSplitOperator.IsPlusNumber(item.Delay)) chart.KeyboardMove.Delay=item.Delay;
|
|
432
|
+
if (IFrameSplitOperator.IsPlusNumber(item.PressTime)) chart.KeyboardMove.PressTime=item.PressTime;
|
|
432
433
|
}
|
|
433
434
|
|
|
434
435
|
if (IFrameSplitOperator.IsNumber(option.StepPixel)) chart.StepPixel=option.StepPixel;
|
|
@@ -2831,7 +2832,9 @@ var JSCHART_EVENT_ID=
|
|
|
2831
2832
|
ON_RELOAD_RESOURCE:173,
|
|
2832
2833
|
|
|
2833
2834
|
ON_REPORT_DATA_FILTER:174, //数据筛选
|
|
2834
|
-
ON_REPORT_SHOW_TOOLTIP:175, //报价列表
|
|
2835
|
+
ON_REPORT_SHOW_TOOLTIP:175, //报价列表 提示信息\
|
|
2836
|
+
|
|
2837
|
+
ON_FORMAT_TVLONGPOSITION_LABEL:176,
|
|
2835
2838
|
}
|
|
2836
2839
|
|
|
2837
2840
|
var JSCHART_OPERATOR_ID=
|
|
@@ -3322,7 +3325,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
3322
3325
|
this.AryHotKey=[]; //热键 { KeyID:87, SecondKeyID:1, CMD:JSCHART_MENU_ID.CMD_FULLSCREEN_SUMMARY_ID, Args:null, Description:"Alt+W 全屏区间统计" },
|
|
3323
3326
|
|
|
3324
3327
|
this.FastSlideConfig={ MinDistance:500, MinSpeed:3, MaxTime:250, Enable:false }; //快速滑动配置 MinDistance=最小的距离 MinSpeed=最小速度 MaxTime=最大间隔时间(ms)
|
|
3325
|
-
this.KeyboardMove={ Timer:null, Delay:100 , Enable:false, Event:null }; //键盘左右移动
|
|
3328
|
+
this.KeyboardMove={ Timer:null, Delay:100 , PressTime:500, Enable:false, Event:null }; //键盘左右移动 PressTime=长按时间
|
|
3326
3329
|
|
|
3327
3330
|
this.MapEventListenerCache=new Map(); //addEventListener 监听事件 key=type:"keydown|keyup ....", value:{ Callback:, Option: }
|
|
3328
3331
|
|
|
@@ -4994,9 +4997,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
4994
4997
|
{
|
|
4995
4998
|
drawPicture.PointStatus=drawPicture.Status;
|
|
4996
4999
|
if (this.FinishChartDrawPicturePoint())
|
|
5000
|
+
{
|
|
5001
|
+
if (drawPicture.IsDrawMain) this.Draw();
|
|
4997
5002
|
this.DrawDynamicInfo();
|
|
5003
|
+
}
|
|
4998
5004
|
else
|
|
5005
|
+
{
|
|
4999
5006
|
bClearDrawPicture=false;
|
|
5007
|
+
}
|
|
5000
5008
|
}
|
|
5001
5009
|
else if (drawPicture.Status==20)
|
|
5002
5010
|
{
|
|
@@ -6551,7 +6559,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
6551
6559
|
{
|
|
6552
6560
|
var item=this.ChartDrawPicture[i];
|
|
6553
6561
|
if (item.IsDrawFirst) continue;
|
|
6554
|
-
if (item.IsDrawMain && item.IsDrawMain())
|
|
6562
|
+
if (item.IsDrawMain && item.IsDrawMain())
|
|
6563
|
+
{
|
|
6564
|
+
if (item.MainPartDraw) item.MainPartDraw();
|
|
6565
|
+
continue;
|
|
6566
|
+
}
|
|
6567
|
+
|
|
6555
6568
|
if (this.SelectChartDrawPicture && this.SelectChartDrawPicture.Guid==item.Guid) continue; //当前选中在最后画
|
|
6556
6569
|
|
|
6557
6570
|
item.Draw();
|
|
@@ -7115,7 +7128,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
7115
7128
|
{
|
|
7116
7129
|
var item=this.ChartDrawPicture[i];
|
|
7117
7130
|
if (item.IsDrawFirst) continue;
|
|
7118
|
-
if (item.IsDrawMain && item.IsDrawMain())
|
|
7131
|
+
if (item.IsDrawMain && item.IsDrawMain())
|
|
7132
|
+
{
|
|
7133
|
+
if (item.MainPartDraw) item.MainPartDraw();
|
|
7134
|
+
continue;
|
|
7135
|
+
}
|
|
7119
7136
|
if (this.SelectChartDrawPicture &&item.Guid==this.SelectChartDrawPicture.Guid) continue; //选中画图最后画 确保显示在最外面
|
|
7120
7137
|
|
|
7121
7138
|
item.Draw(moveonPoint, this.LastMouseStatus);
|
|
@@ -7865,19 +7882,22 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
7865
7882
|
|
|
7866
7883
|
JSConsole.Chart.Log(`[JSChartContainer::StartKeyboardMoveTimer] Start` );
|
|
7867
7884
|
|
|
7868
|
-
this.AutoKeyboardMove();
|
|
7885
|
+
this.AutoKeyboardMove({ Delay:this.KeyboardMove.PressTime });
|
|
7869
7886
|
}
|
|
7870
7887
|
|
|
7871
|
-
this.AutoKeyboardMove=function()
|
|
7888
|
+
this.AutoKeyboardMove=function(option)
|
|
7872
7889
|
{
|
|
7873
7890
|
if (!this.KeyboardMove) return false;
|
|
7874
7891
|
if (!this.KeyboardMove.Enable) return false;
|
|
7875
7892
|
if (!this.KeyboardMove.Event) return false;
|
|
7876
7893
|
|
|
7894
|
+
var delay=this.KeyboardMove.Delay;
|
|
7895
|
+
if (option && IFrameSplitOperator.IsNumber(option.Delay)) delay=option.Delay;
|
|
7896
|
+
|
|
7877
7897
|
this.KeyboardMove.Timer=setTimeout(()=>
|
|
7878
7898
|
{
|
|
7879
7899
|
this.OnKeyboardMoveTimerProc();
|
|
7880
|
-
},
|
|
7900
|
+
},delay);
|
|
7881
7901
|
}
|
|
7882
7902
|
|
|
7883
7903
|
|
|
@@ -61766,13 +61786,24 @@ function DynamicChartTitlePainting()
|
|
|
61766
61786
|
|
|
61767
61787
|
|
|
61768
61788
|
//动态标题
|
|
61769
|
-
|
|
61789
|
+
//叠加指标动态标题
|
|
61770
61790
|
this.DynamicTitle={ OutName:null, OutValue:null };
|
|
61771
61791
|
this.OverlayDynamicTitle=new Map(); //key , value={ OutName, OutValue }
|
|
61772
61792
|
|
|
61773
61793
|
this.IsShowMainIndexTitle=true; //是否显示主图指标标题
|
|
61774
61794
|
this.MainTitlePaint=null; //主标题
|
|
61775
61795
|
|
|
61796
|
+
//option={ DynamicTitle:true/false }
|
|
61797
|
+
this.Clear=function(option)
|
|
61798
|
+
{
|
|
61799
|
+
this.Data=[];
|
|
61800
|
+
this.Title=null;
|
|
61801
|
+
if (option)
|
|
61802
|
+
{
|
|
61803
|
+
if (option.DynamicTitle===true) this.DynamicTitle={ OutName:null, OutValue:null }; //主图胴动态标题
|
|
61804
|
+
}
|
|
61805
|
+
}
|
|
61806
|
+
|
|
61776
61807
|
//十字线是否显示
|
|
61777
61808
|
this.IsShowCorssLine=function()
|
|
61778
61809
|
{
|
|
@@ -65120,6 +65151,17 @@ function IChartDrawPicture()
|
|
|
65120
65151
|
yText+=labelInfo.LineHeight;
|
|
65121
65152
|
}
|
|
65122
65153
|
}
|
|
65154
|
+
|
|
65155
|
+
this.IsActive=function()
|
|
65156
|
+
{
|
|
65157
|
+
if (!this.GetActiveDrawPicture) return false;
|
|
65158
|
+
|
|
65159
|
+
var active=this.GetActiveDrawPicture();
|
|
65160
|
+
if (active.Move.Guid!=this.Guid && active.Select.Guid!=this.Guid && active.MoveOn.Guid!=this.Guid)
|
|
65161
|
+
return false;
|
|
65162
|
+
|
|
65163
|
+
return true;
|
|
65164
|
+
}
|
|
65123
65165
|
}
|
|
65124
65166
|
|
|
65125
65167
|
IChartDrawPicture.ColorToRGBA=function(color,opacity)
|
|
@@ -65267,6 +65309,8 @@ IChartDrawPicture.ArrayDrawPricture=
|
|
|
65267
65309
|
{ Name:"TrendAngle", ClassName:"ChartTrendAngle", Create:function() { return new ChartTrendAngle(); }},
|
|
65268
65310
|
{ Name:"ArrowMarker", ClassName:"ChartArrowMarker", Create:function() { return new ChartArrowMarker(); } },
|
|
65269
65311
|
{ Name:"BarsPattern", ClassName:"ChartBarsPattern", Create:function() { return new ChartBarsPattern(); } },
|
|
65312
|
+
{ Name:"TVLongPosition", ClassName:"ChartDrawTVLongPosition", Create:function() { return new ChartDrawTVLongPosition(); } },
|
|
65313
|
+
{ Name:"TVShortPosition", ClassName:"ChartDrawTVShortPositionn", Create:function() { return new ChartDrawTVShortPosition(); } },
|
|
65270
65314
|
];
|
|
65271
65315
|
|
|
65272
65316
|
IChartDrawPicture.MapIonFont=new Map(
|
|
@@ -75237,6 +75281,483 @@ function ChartBarsPattern()
|
|
|
75237
75281
|
}
|
|
75238
75282
|
}
|
|
75239
75283
|
|
|
75284
|
+
function ChartDrawTVLongPosition()
|
|
75285
|
+
{
|
|
75286
|
+
this.newMethod=IChartDrawPicture; //派生
|
|
75287
|
+
this.newMethod();
|
|
75288
|
+
delete this.newMethod;
|
|
75289
|
+
|
|
75290
|
+
this.ClassName='ChartDrawTVLongPosition';
|
|
75291
|
+
this.PointCount=2; //起始2个点 画完4个点
|
|
75292
|
+
|
|
75293
|
+
this.TopAreaConfig=CloneData(g_JSChartResource.ChartDrawTVLongPosition.TopArea);
|
|
75294
|
+
this.BottomAreaConfig=CloneData(g_JSChartResource.ChartDrawTVLongPosition.BottomArea);
|
|
75295
|
+
this.LabelConfig=CloneData(g_JSChartResource.ChartDrawTVLongPosition.Label);
|
|
75296
|
+
|
|
75297
|
+
//内部变量
|
|
75298
|
+
this.AryRectArea=[];
|
|
75299
|
+
|
|
75300
|
+
this.GetXYCoordinate=this.GetXYCoordinate_default;
|
|
75301
|
+
this.SetOption_Backup=this.SetOption;
|
|
75302
|
+
this.PointToValue_Backup=this.PointToValue;
|
|
75303
|
+
|
|
75304
|
+
this.SetOption=function(option)
|
|
75305
|
+
{
|
|
75306
|
+
this.SetOption_Backup();
|
|
75307
|
+
|
|
75308
|
+
if (option)
|
|
75309
|
+
{
|
|
75310
|
+
|
|
75311
|
+
}
|
|
75312
|
+
}
|
|
75313
|
+
|
|
75314
|
+
this.PointToValue=function()
|
|
75315
|
+
{
|
|
75316
|
+
//拖拽完成 把点移动到线段头尾
|
|
75317
|
+
if (this.Frame.IsHScreen)
|
|
75318
|
+
{
|
|
75319
|
+
this.Point[1].X=this.Point[0].X;
|
|
75320
|
+
}
|
|
75321
|
+
else
|
|
75322
|
+
{
|
|
75323
|
+
this.Point[1].Y=this.Point[0].Y;
|
|
75324
|
+
}
|
|
75325
|
+
|
|
75326
|
+
this.PointToValue_Backup();
|
|
75327
|
+
}
|
|
75328
|
+
|
|
75329
|
+
//0-10 鼠标对应的点索引 100=鼠标在正个图形上 -1 鼠标不在图形上
|
|
75330
|
+
this.IsPointIn=function(x,y, option)
|
|
75331
|
+
{
|
|
75332
|
+
if (this.Status!=10) return -1;
|
|
75333
|
+
|
|
75334
|
+
var value=this.IsPointInXYValue(x,y,option);
|
|
75335
|
+
if (value>=0) return value;
|
|
75336
|
+
|
|
75337
|
+
for(var i=0;i<this.AryRectArea.length;++i)
|
|
75338
|
+
{
|
|
75339
|
+
var item=this.AryRectArea[i];
|
|
75340
|
+
if (!item) continue;
|
|
75341
|
+
|
|
75342
|
+
if (Path2DHelper.PtInRect(x, y, item.Rect))
|
|
75343
|
+
{
|
|
75344
|
+
return item.ID;
|
|
75345
|
+
}
|
|
75346
|
+
}
|
|
75347
|
+
|
|
75348
|
+
return -1;
|
|
75349
|
+
}
|
|
75350
|
+
|
|
75351
|
+
this.OnFinish=function()
|
|
75352
|
+
{
|
|
75353
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.Value)) return false;
|
|
75354
|
+
|
|
75355
|
+
if (!this.Frame) return false;
|
|
75356
|
+
var data=this.Frame.Data;
|
|
75357
|
+
if (!data) return false;
|
|
75358
|
+
|
|
75359
|
+
var firstPoint=this.Point[0];
|
|
75360
|
+
var firstValue=this.Value[0];
|
|
75361
|
+
var entryPrice=firstValue.YValue;
|
|
75362
|
+
|
|
75363
|
+
var topPrice=entryPrice*(1+0.05);
|
|
75364
|
+
var bottomPrice=entryPrice*(1-0.05);
|
|
75365
|
+
|
|
75366
|
+
this.Value[2]={ XValue:firstValue.XValue, YValue:topPrice };
|
|
75367
|
+
this.Value[3]={ XValue:firstValue.XValue, YValue:bottomPrice };
|
|
75368
|
+
if (firstValue.DateTime)
|
|
75369
|
+
{
|
|
75370
|
+
var item=firstValue.DateTime;
|
|
75371
|
+
this.Value[2].DateTime={ Date:item.Date, Time:item.Time };
|
|
75372
|
+
this.Value[3].DateTime={ Date:item.Date, Time:item.Time };
|
|
75373
|
+
}
|
|
75374
|
+
|
|
75375
|
+
this.Point[2]={ X:firstPoint.X, Y:this.Frame.GetYFromData(topPrice,false)};
|
|
75376
|
+
this.Point[3]={ X:firstPoint.X, Y:this.Frame.GetYFromData(bottomPrice,false)};
|
|
75377
|
+
|
|
75378
|
+
this.PointCount=4;
|
|
75379
|
+
}
|
|
75380
|
+
|
|
75381
|
+
this.IsDrawMain=function() //选中绘制在动态绘图上, 没有选中绘制在背景上
|
|
75382
|
+
{
|
|
75383
|
+
if (!this.GetActiveDrawPicture) return true;
|
|
75384
|
+
|
|
75385
|
+
var active=this.GetActiveDrawPicture();
|
|
75386
|
+
if (active.Select.Guid==this.Guid) return false;
|
|
75387
|
+
|
|
75388
|
+
return true;
|
|
75389
|
+
}
|
|
75390
|
+
|
|
75391
|
+
this.IsSelected=function()
|
|
75392
|
+
{
|
|
75393
|
+
if (!this.GetActiveDrawPicture) return false;
|
|
75394
|
+
|
|
75395
|
+
var active=this.GetActiveDrawPicture();
|
|
75396
|
+
if (active.Select.Guid==this.Guid) return true;
|
|
75397
|
+
|
|
75398
|
+
return false;
|
|
75399
|
+
}
|
|
75400
|
+
|
|
75401
|
+
this.MainDraw=function()
|
|
75402
|
+
{
|
|
75403
|
+
this.Draw();
|
|
75404
|
+
}
|
|
75405
|
+
|
|
75406
|
+
|
|
75407
|
+
this.MainPartDraw=function()
|
|
75408
|
+
{
|
|
75409
|
+
if (this.IsFrameMinSize()) return;
|
|
75410
|
+
|
|
75411
|
+
var drawPoint=this.CalculateDrawPoint( {IsCheckX:true, IsCheckY:true} );
|
|
75412
|
+
if (!drawPoint) return;
|
|
75413
|
+
if (drawPoint.length<2) return;
|
|
75414
|
+
this.IsHScreen=this.Frame.IsHScreen;
|
|
75415
|
+
if (this.IsHScreen) return;
|
|
75416
|
+
|
|
75417
|
+
this.ClipFrame();
|
|
75418
|
+
this.ChartBorder=this.Frame.ChartBorder;
|
|
75419
|
+
|
|
75420
|
+
if (this.Status==10 || this.Status==20)
|
|
75421
|
+
{
|
|
75422
|
+
this.DrawLabel(drawPoint);
|
|
75423
|
+
this.DrawPoint(drawPoint);
|
|
75424
|
+
}
|
|
75425
|
+
|
|
75426
|
+
this.Canvas.restore();
|
|
75427
|
+
}
|
|
75428
|
+
|
|
75429
|
+
this.Draw=function()
|
|
75430
|
+
{
|
|
75431
|
+
this.AryRectArea=[]
|
|
75432
|
+
if (this.IsFrameMinSize()) return;
|
|
75433
|
+
|
|
75434
|
+
var drawPoint=this.CalculateDrawPoint( {IsCheckX:true, IsCheckY:true} );
|
|
75435
|
+
if (!drawPoint) return;
|
|
75436
|
+
if (drawPoint.length<2) return;
|
|
75437
|
+
this.IsHScreen=this.Frame.IsHScreen;
|
|
75438
|
+
if (this.IsHScreen) return;
|
|
75439
|
+
|
|
75440
|
+
this.ClipFrame();
|
|
75441
|
+
this.ChartBorder=this.Frame.ChartBorder;
|
|
75442
|
+
|
|
75443
|
+
if (this.Status==10 || this.Status==20) //0=开始画 1=完成第1个点 2=完成第2个点 3=完成第3个点 10=完成 20=移动)
|
|
75444
|
+
{
|
|
75445
|
+
this.DrawArea(drawPoint);
|
|
75446
|
+
this.DrawLabel(drawPoint);
|
|
75447
|
+
this.DrawPoint(drawPoint);
|
|
75448
|
+
}
|
|
75449
|
+
else
|
|
75450
|
+
{
|
|
75451
|
+
var ptStart=drawPoint[0];
|
|
75452
|
+
var ptEnd=drawPoint[1];
|
|
75453
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
75454
|
+
this.DrawVerticalLine(ptStart,ptEnd);
|
|
75455
|
+
}
|
|
75456
|
+
|
|
75457
|
+
this.Canvas.restore();
|
|
75458
|
+
}
|
|
75459
|
+
|
|
75460
|
+
this.DrawVerticalLine=function(ptStart, ptEnd)
|
|
75461
|
+
{
|
|
75462
|
+
var data=this.Frame.Data;
|
|
75463
|
+
if (this.IsHScreen)
|
|
75464
|
+
{
|
|
75465
|
+
var left=this.ChartBorder.GetLeft();
|
|
75466
|
+
var right=this.ChartBorder.GetRight();
|
|
75467
|
+
var xValue=Math.round(this.Frame.GetXData(ptStart.Y,false))+data.DataOffset;
|
|
75468
|
+
if (xValue<0) xValue=0;
|
|
75469
|
+
else if (xValue>=data.Data.length) xValue=data.Data.length-1;
|
|
75470
|
+
var yStart=this.Frame.GetXFromIndex(xValue-data.DataOffset,false);
|
|
75471
|
+
|
|
75472
|
+
xValue=Math.round(this.Frame.GetXData(ptEnd.Y,false))+data.DataOffset;
|
|
75473
|
+
if (xValue<0) xValue=0;
|
|
75474
|
+
else if (xValue>=data.Data.length) xValue=data.Data.length-1;
|
|
75475
|
+
var yEnd=this.Frame.GetXFromIndex(xValue-data.DataOffset,false);
|
|
75476
|
+
|
|
75477
|
+
this.Canvas.beginPath();
|
|
75478
|
+
this.Canvas.moveTo(left,yStart);
|
|
75479
|
+
this.Canvas.lineTo(right,yStart);
|
|
75480
|
+
|
|
75481
|
+
this.Canvas.moveTo(left,yEnd);
|
|
75482
|
+
this.Canvas.lineTo(right,yEnd);
|
|
75483
|
+
this.Canvas.stroke();
|
|
75484
|
+
|
|
75485
|
+
this.Canvas.beginPath();
|
|
75486
|
+
this.Canvas.moveTo(ptStart.X,yStart);
|
|
75487
|
+
this.Canvas.lineTo(ptStart.X,yEnd);
|
|
75488
|
+
this.Canvas.stroke();
|
|
75489
|
+
}
|
|
75490
|
+
else
|
|
75491
|
+
{
|
|
75492
|
+
var top=this.ChartBorder.GetTopEx();
|
|
75493
|
+
var bottom=this.ChartBorder.GetBottomEx();
|
|
75494
|
+
|
|
75495
|
+
var xValue=Math.round(this.Frame.GetXData(ptStart.X,false))+data.DataOffset;
|
|
75496
|
+
if (xValue<0) xValue=0;
|
|
75497
|
+
else if (xValue>=data.Data.length) xValue=data.Data.length-1;
|
|
75498
|
+
var xStart=this.Frame.GetXFromIndex(xValue-data.DataOffset,false);
|
|
75499
|
+
|
|
75500
|
+
xValue=Math.round(this.Frame.GetXData(ptEnd.X,false))+data.DataOffset;
|
|
75501
|
+
if (xValue<0) xValue=0;
|
|
75502
|
+
else if (xValue>=data.Data.length) xValue=data.Data.length-1;
|
|
75503
|
+
var xEnd=this.Frame.GetXFromIndex(xValue-data.DataOffset,false);
|
|
75504
|
+
|
|
75505
|
+
this.Canvas.beginPath();
|
|
75506
|
+
this.Canvas.moveTo(xStart,top);
|
|
75507
|
+
this.Canvas.lineTo(xStart,bottom);
|
|
75508
|
+
|
|
75509
|
+
this.Canvas.moveTo(xEnd,top);
|
|
75510
|
+
this.Canvas.lineTo(xEnd,bottom);
|
|
75511
|
+
this.Canvas.stroke();
|
|
75512
|
+
|
|
75513
|
+
this.Canvas.beginPath();
|
|
75514
|
+
this.Canvas.moveTo(xStart,ptStart.Y);
|
|
75515
|
+
this.Canvas.lineTo(xEnd,ptStart.Y);
|
|
75516
|
+
this.Canvas.stroke();
|
|
75517
|
+
}
|
|
75518
|
+
}
|
|
75519
|
+
|
|
75520
|
+
this.GetCursorType=function(ptIndex)
|
|
75521
|
+
{
|
|
75522
|
+
if (ptIndex==100) return "pointer";
|
|
75523
|
+
else if (ptIndex==0) return "move";
|
|
75524
|
+
else if (ptIndex==1) return "ew-resize";
|
|
75525
|
+
else if (ptIndex==2 || ptIndex==3) return "ns-resize";
|
|
75526
|
+
|
|
75527
|
+
return null;
|
|
75528
|
+
}
|
|
75529
|
+
|
|
75530
|
+
this.DrawArea=function(drawPoint)
|
|
75531
|
+
{
|
|
75532
|
+
var ptCenter=drawPoint[0];
|
|
75533
|
+
var ptRight=drawPoint[1]
|
|
75534
|
+
var ptTop=drawPoint[2];
|
|
75535
|
+
var ptBottom=drawPoint[3];
|
|
75536
|
+
var bSelected=this.IsSelected();
|
|
75537
|
+
|
|
75538
|
+
var rtTopArea={ Left:ptCenter.X, Top: ptTop.Y, Right:ptRight.X, Bottom:ptCenter.Y};
|
|
75539
|
+
rtTopArea.Width=rtTopArea.Right-rtTopArea.Left;
|
|
75540
|
+
rtTopArea.Height=rtTopArea.Bottom-rtTopArea.Top;
|
|
75541
|
+
|
|
75542
|
+
this.Canvas.fillStyle=bSelected ? this.TopAreaConfig.SelectedAreaColor: this.TopAreaConfig.AreaColor;
|
|
75543
|
+
this.Canvas.beginPath();
|
|
75544
|
+
this.Canvas.fillRect(rtTopArea.Left,rtTopArea.Top,rtTopArea.Width,rtTopArea.Height);
|
|
75545
|
+
this.AryRectArea[0]={ ID:100, Rect:rtTopArea };
|
|
75546
|
+
|
|
75547
|
+
var rtBottomArea={Left:ptCenter.X, Top: ptCenter.Y, Right:ptRight.X, Bottom:ptBottom.Y};
|
|
75548
|
+
rtBottomArea.Width=rtBottomArea.Right-rtBottomArea.Left;
|
|
75549
|
+
rtBottomArea.Height=rtBottomArea.Bottom-rtBottomArea.Top;
|
|
75550
|
+
this.Canvas.fillStyle=bSelected? this.BottomAreaConfig.SelectedAreaColor:this.BottomAreaConfig.AreaColor;
|
|
75551
|
+
this.Canvas.beginPath();
|
|
75552
|
+
this.Canvas.fillRect(rtBottomArea.Left,rtBottomArea.Top,rtBottomArea.Width,rtBottomArea.Height);
|
|
75553
|
+
this.AryRectArea[1]={ ID:100, Rect:rtBottomArea };
|
|
75554
|
+
|
|
75555
|
+
//线段
|
|
75556
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
75557
|
+
this.Canvas.beginPath();
|
|
75558
|
+
this.Canvas.moveTo(ptCenter.X,ToFixedPoint(ptCenter.Y));
|
|
75559
|
+
this.Canvas.lineTo(ptRight.X,ToFixedPoint(ptRight.Y));
|
|
75560
|
+
this.Canvas.stroke();
|
|
75561
|
+
}
|
|
75562
|
+
|
|
75563
|
+
this.DrawLabel=function(drawPoint)
|
|
75564
|
+
{
|
|
75565
|
+
if (!this.IsActive()) return; //激活状态下才显示
|
|
75566
|
+
|
|
75567
|
+
var aryLabel=this.FormatLabelText(drawPoint);
|
|
75568
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryLabel)) return;
|
|
75569
|
+
|
|
75570
|
+
this.TextFontHeight=this.GetFontHeight(this.LabelConfig.Font,"擎");
|
|
75571
|
+
|
|
75572
|
+
for(var i=0;i<aryLabel.length;++i)
|
|
75573
|
+
{
|
|
75574
|
+
var item=aryLabel[i];
|
|
75575
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(item.AryText)) continue;
|
|
75576
|
+
|
|
75577
|
+
this.CalculateLabelSize(item);
|
|
75578
|
+
this.DrawLabelItem(item, drawPoint);
|
|
75579
|
+
}
|
|
75580
|
+
}
|
|
75581
|
+
|
|
75582
|
+
this.DrawLabelItem=function(lableItem, drawPoint)
|
|
75583
|
+
{
|
|
75584
|
+
var ptCenter=drawPoint[0];
|
|
75585
|
+
var ptRight=drawPoint[1];
|
|
75586
|
+
var ptTop=drawPoint[2];
|
|
75587
|
+
var ptBottom=drawPoint[3];
|
|
75588
|
+
var clientWidth=ptRight.X-ptCenter.X;
|
|
75589
|
+
var config=this.LabelConfig;
|
|
75590
|
+
var margin=config.Margin;
|
|
75591
|
+
|
|
75592
|
+
var rtText={ Width:lableItem.Width+margin.Left+margin.Right, Height:lableItem.Height+margin.Top+margin.Bottom };
|
|
75593
|
+
if (lableItem.Type==0) //中间
|
|
75594
|
+
{
|
|
75595
|
+
rtText.Left=ptCenter.X+clientWidth/2-rtText.Width/2;
|
|
75596
|
+
rtText.Right=rtText.Left+rtText.Width;
|
|
75597
|
+
rtText.Top=ptCenter.Y-rtText.Height/2;
|
|
75598
|
+
rtText.Bottom=rtText.Top+rtText.Height;
|
|
75599
|
+
}
|
|
75600
|
+
else if (lableItem.Type==1) //顶部
|
|
75601
|
+
{
|
|
75602
|
+
rtText.Left=ptCenter.X+clientWidth/2-rtText.Width/2;
|
|
75603
|
+
rtText.Right=rtText.Left+rtText.Width;
|
|
75604
|
+
rtText.Top=ptTop.Y-rtText.Height;
|
|
75605
|
+
rtText.Bottom=rtText.Top+rtText.Height;
|
|
75606
|
+
}
|
|
75607
|
+
else if (lableItem.Type==2)
|
|
75608
|
+
{
|
|
75609
|
+
rtText.Left=ptCenter.X+clientWidth/2-rtText.Width/2;
|
|
75610
|
+
rtText.Right=rtText.Left+rtText.Width;
|
|
75611
|
+
rtText.Top=ptBottom.Y;
|
|
75612
|
+
rtText.Bottom=rtText.Top+rtText.Height;
|
|
75613
|
+
}
|
|
75614
|
+
else
|
|
75615
|
+
{
|
|
75616
|
+
return;
|
|
75617
|
+
}
|
|
75618
|
+
|
|
75619
|
+
this.Canvas.fillStyle=lableItem.BGColor;
|
|
75620
|
+
this.Canvas.fillRect(rtText.Left, rtText.Top, rtText.Width, rtText.Height);
|
|
75621
|
+
|
|
75622
|
+
this.Canvas.textAlign = 'left';
|
|
75623
|
+
this.Canvas.textBaseline = 'bottom';
|
|
75624
|
+
this.Canvas.fillStyle=lableItem.TextColor;
|
|
75625
|
+
var x=rtText.Left+margin.Left;
|
|
75626
|
+
var y=rtText.Top+margin.Top+this.TextFontHeight;
|
|
75627
|
+
for(var i=0;i<lableItem.AryText.length;++i)
|
|
75628
|
+
{
|
|
75629
|
+
var item=lableItem.AryText[i];
|
|
75630
|
+
var xText=x;
|
|
75631
|
+
var yText=y;
|
|
75632
|
+
if (IFrameSplitOperator.IsNumber(item.YOffset)) yText+=item.YOffset;
|
|
75633
|
+
|
|
75634
|
+
this.Canvas.fillText(item.Text, xText, yText);
|
|
75635
|
+
|
|
75636
|
+
y+=this.TextFontHeight;
|
|
75637
|
+
}
|
|
75638
|
+
}
|
|
75639
|
+
|
|
75640
|
+
this.FormatLabelText=function(drawPoint)
|
|
75641
|
+
{
|
|
75642
|
+
if (this.HQChart)
|
|
75643
|
+
{
|
|
75644
|
+
var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_TVLONGPOSITION_LABEL);
|
|
75645
|
+
if (event && event.Callback)
|
|
75646
|
+
{
|
|
75647
|
+
var sendData={ Frame:this.Frame, AryLabel:null, AryPoint:drawPoint, PreventDefault:false };
|
|
75648
|
+
event.Callback(event, sendData, this);
|
|
75649
|
+
if (sendData.PreventDefault) return sendData.AryLabel;
|
|
75650
|
+
}
|
|
75651
|
+
}
|
|
75652
|
+
|
|
75653
|
+
var ptCenter=drawPoint[0];
|
|
75654
|
+
var ptTop=drawPoint[2];
|
|
75655
|
+
var ptBottom=drawPoint[3];
|
|
75656
|
+
var aryData=[];
|
|
75657
|
+
var yValue=this.Frame.GetYData(ptCenter.Y,false);
|
|
75658
|
+
aryData.push(
|
|
75659
|
+
{
|
|
75660
|
+
Type:0,
|
|
75661
|
+
AryText:
|
|
75662
|
+
[
|
|
75663
|
+
{ Text:`Open: ${yValue.toFixed(2)}`},
|
|
75664
|
+
//{ Text:"第2行:xxx"}
|
|
75665
|
+
],
|
|
75666
|
+
BGColor:"rgb(112,128,144)", TextColor:"rgb(255,255,255)"
|
|
75667
|
+
});
|
|
75668
|
+
|
|
75669
|
+
var yValue=this.Frame.GetYData(ptTop.Y,false);
|
|
75670
|
+
aryData.push({ Type:1, AryText:[{ Text:`Target: ${yValue.toFixed(2)}`, YOffset:-1 } ], BGColor:this.TopAreaConfig.TextBGColor, TextColor:this.TopAreaConfig.TextColor });
|
|
75671
|
+
|
|
75672
|
+
var yValue=this.Frame.GetYData(ptBottom.Y,false);
|
|
75673
|
+
aryData.push({ Type:2, AryText:[{ Text:`Stop: ${yValue.toFixed(2)}`, YOffset:-1 } ], BGColor:this.BottomAreaConfig.TextBGColor, TextColor:this.BottomAreaConfig.TextColor });
|
|
75674
|
+
|
|
75675
|
+
return aryData;
|
|
75676
|
+
}
|
|
75677
|
+
|
|
75678
|
+
this.CalculateLabelSize=function(lableItem)
|
|
75679
|
+
{
|
|
75680
|
+
lableItem.Width=0;
|
|
75681
|
+
lableItem.Height=0;
|
|
75682
|
+
for(var i=0;i<lableItem.AryText.length;++i)
|
|
75683
|
+
{
|
|
75684
|
+
var item=lableItem.AryText[i];
|
|
75685
|
+
var textWidth=this.Canvas.measureText(item.Text).width;
|
|
75686
|
+
|
|
75687
|
+
item.TextWidth=textWidth;
|
|
75688
|
+
if (lableItem.Width<textWidth) lableItem.Width=textWidth;
|
|
75689
|
+
lableItem.Height+=this.TextFontHeight;
|
|
75690
|
+
}
|
|
75691
|
+
}
|
|
75692
|
+
|
|
75693
|
+
this.Move=function(xStep,yStep)
|
|
75694
|
+
{
|
|
75695
|
+
if (this.Status!=20) return false;
|
|
75696
|
+
if (!this.Frame) return false;
|
|
75697
|
+
var data=this.Frame.Data;
|
|
75698
|
+
if (!data) return false;
|
|
75699
|
+
|
|
75700
|
+
if (this.MovePointIndex==100) //整体移动
|
|
75701
|
+
{
|
|
75702
|
+
for(var i=0; i<this.Point.length;++i)
|
|
75703
|
+
{
|
|
75704
|
+
var item= this.Point[i];
|
|
75705
|
+
item.X+=xStep;
|
|
75706
|
+
item.Y+=yStep;
|
|
75707
|
+
}
|
|
75708
|
+
}
|
|
75709
|
+
else if (this.MovePointIndex===0)
|
|
75710
|
+
{
|
|
75711
|
+
for(var i=0;i<this.Point.length;++i)
|
|
75712
|
+
{
|
|
75713
|
+
var item=this.Point[i];
|
|
75714
|
+
if (i==0)
|
|
75715
|
+
{
|
|
75716
|
+
item.X+=xStep;
|
|
75717
|
+
item.Y+=yStep;
|
|
75718
|
+
}
|
|
75719
|
+
else if (i==1)
|
|
75720
|
+
{
|
|
75721
|
+
item.Y+=yStep;
|
|
75722
|
+
}
|
|
75723
|
+
else if (i==2 || i==3)
|
|
75724
|
+
{
|
|
75725
|
+
item.X+=xStep;
|
|
75726
|
+
}
|
|
75727
|
+
}
|
|
75728
|
+
}
|
|
75729
|
+
else if (this.MovePointIndex==1)
|
|
75730
|
+
{
|
|
75731
|
+
this.Point[1].X+=xStep;
|
|
75732
|
+
}
|
|
75733
|
+
else if (this.MovePointIndex==2)
|
|
75734
|
+
{
|
|
75735
|
+
var ptCenter=this.Point[0];
|
|
75736
|
+
var item=this.Point[2];
|
|
75737
|
+
if (item.Y+yStep<ptCenter.Y) item.Y+=yStep;
|
|
75738
|
+
}
|
|
75739
|
+
else if (this.MovePointIndex==3)
|
|
75740
|
+
{
|
|
75741
|
+
var ptCenter=this.Point[0];
|
|
75742
|
+
var item=this.Point[3];
|
|
75743
|
+
if (item.Y+yStep>ptCenter.Y) item.Y+=yStep;
|
|
75744
|
+
}
|
|
75745
|
+
|
|
75746
|
+
}
|
|
75747
|
+
}
|
|
75748
|
+
|
|
75749
|
+
|
|
75750
|
+
function ChartDrawTVShortPosition()
|
|
75751
|
+
{
|
|
75752
|
+
this.newMethod=ChartDrawTVLongPosition; //派生
|
|
75753
|
+
this.newMethod();
|
|
75754
|
+
delete this.newMethod;
|
|
75755
|
+
|
|
75756
|
+
this.ClassName='ChartDrawTVShortPosition';
|
|
75757
|
+
this.TopAreaConfig=CloneData(g_JSChartResource.ChartDrawTVLongPosition.BottomArea);
|
|
75758
|
+
this.BottomAreaConfig=CloneData(g_JSChartResource.ChartDrawTVLongPosition.TopArea);
|
|
75759
|
+
}
|
|
75760
|
+
|
|
75240
75761
|
|
|
75241
75762
|
function ChartDrawStorage()
|
|
75242
75763
|
{
|
|
@@ -76306,6 +76827,31 @@ function JSChartResource()
|
|
|
76306
76827
|
DownColor:"rgb(25,158,0)"
|
|
76307
76828
|
}
|
|
76308
76829
|
|
|
76830
|
+
this.ChartDrawTVLongPosition=
|
|
76831
|
+
{
|
|
76832
|
+
TopArea:
|
|
76833
|
+
{
|
|
76834
|
+
AreaColor:"rgba(214, 234, 230,0.8)",
|
|
76835
|
+
SelectedAreaColor:"rgba(214, 234, 230,0.55)",
|
|
76836
|
+
TextBGColor:"rgb(80, 150, 130)",
|
|
76837
|
+
TextColor:"rgb(255,255,255)"
|
|
76838
|
+
},
|
|
76839
|
+
|
|
76840
|
+
BottomArea:
|
|
76841
|
+
{
|
|
76842
|
+
AreaColor:"rgb(243, 217, 218,0.8)",
|
|
76843
|
+
SelectedAreaColor:"rgba(243, 217, 218,0.55)",
|
|
76844
|
+
TextBGColor:"rgb(214, 75, 75)",
|
|
76845
|
+
TextColor:"rgb(255,255,255)"
|
|
76846
|
+
},
|
|
76847
|
+
|
|
76848
|
+
Label:
|
|
76849
|
+
{
|
|
76850
|
+
Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
|
|
76851
|
+
Margin:{ Left:2, Top:2, Bottom:2, Right:2 },
|
|
76852
|
+
}
|
|
76853
|
+
}
|
|
76854
|
+
|
|
76309
76855
|
//手机端tooltip
|
|
76310
76856
|
this.TooltipPaint = {
|
|
76311
76857
|
BGColor:'rgba(250,250,250,0.8)', //背景色
|
|
@@ -78133,6 +78679,42 @@ function JSChartResource()
|
|
|
78133
78679
|
|
|
78134
78680
|
if (style.IndexLock) this.SetIndexLock(style.IndexLock);
|
|
78135
78681
|
if (style.ChartScatterPlotV2) this.SetChartScatterPlotV2(style.ChartScatterPlotV2);
|
|
78682
|
+
|
|
78683
|
+
if (style.ChartDrawTVLongPosition) this.SetChartDrawTVLongPosition(style.ChartDrawTVLongPosition);
|
|
78684
|
+
}
|
|
78685
|
+
|
|
78686
|
+
|
|
78687
|
+
this.SetChartDrawTVLongPosition=function(style)
|
|
78688
|
+
{
|
|
78689
|
+
if (style.TopArea)
|
|
78690
|
+
{
|
|
78691
|
+
var item=style.TopArea;
|
|
78692
|
+
var dest=this.ChartDrawTVLongPosition.TopArea;
|
|
78693
|
+
|
|
78694
|
+
if (item.AreaColor) dest.AreaColor=item.AreaColor;
|
|
78695
|
+
if (item.SelectedAreaColor) dest.SelectedAreaColor=item.SelectedAreaColor;
|
|
78696
|
+
if (item.TextBGColor) dest.TextBGColor=item.TextBGColor;
|
|
78697
|
+
if (item.TextColor) dest.BorderColor=item.TextColor;
|
|
78698
|
+
}
|
|
78699
|
+
|
|
78700
|
+
if (style.BottomArea)
|
|
78701
|
+
{
|
|
78702
|
+
var item=style.BottomArea;
|
|
78703
|
+
var dest=this.ChartDrawTVLongPosition.BottomArea;
|
|
78704
|
+
|
|
78705
|
+
if (item.AreaColor) dest.AreaColor=item.AreaColor;
|
|
78706
|
+
if (item.SelectedAreaColor) dest.SelectedAreaColor=item.SelectedAreaColor;
|
|
78707
|
+
if (item.TextBGColor) dest.TextBGColor=item.TextBGColor;
|
|
78708
|
+
if (item.TextColor) dest.BorderColor=item.TextColor;
|
|
78709
|
+
}
|
|
78710
|
+
|
|
78711
|
+
if (style.Label)
|
|
78712
|
+
{
|
|
78713
|
+
var item=style.Label;
|
|
78714
|
+
var dest=this.ChartDrawTVLongPosition.Label;
|
|
78715
|
+
if (item.Font) dest.Font=item.Font;
|
|
78716
|
+
CopyMarginConfig(dest.Margin, item.Margin);
|
|
78717
|
+
}
|
|
78136
78718
|
}
|
|
78137
78719
|
|
|
78138
78720
|
|
|
@@ -83937,8 +84519,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
83937
84519
|
|
|
83938
84520
|
//清空东条标题
|
|
83939
84521
|
var titleIndex=windowIndex+1;
|
|
83940
|
-
this.TitlePaint[titleIndex]
|
|
83941
|
-
|
|
84522
|
+
var chartTitle=this.TitlePaint[titleIndex];
|
|
84523
|
+
if (chartTitle) chartTitle.Clear({ DynamicTitle:true });
|
|
83942
84524
|
}
|
|
83943
84525
|
|
|
83944
84526
|
//显示隐藏主图K线
|
|
@@ -84201,6 +84783,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
84201
84783
|
if (windowIndex == 0) windowIndex = 1; //幅图指标,不能再主图显示
|
|
84202
84784
|
}
|
|
84203
84785
|
|
|
84786
|
+
if (this.Frame.SubFrame.length<=windowIndex) return;
|
|
84787
|
+
|
|
84204
84788
|
JSIndexScript.ModifyAttribute(indexInfo, option);
|
|
84205
84789
|
return this.ChangeScriptIndex(windowIndex, indexInfo, option);
|
|
84206
84790
|
}
|
|
@@ -84233,8 +84817,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
84233
84817
|
|
|
84234
84818
|
//清空东条标题
|
|
84235
84819
|
var titleIndex=windowIndex+1;
|
|
84236
|
-
this.TitlePaint[titleIndex]
|
|
84237
|
-
|
|
84820
|
+
var chartTitle=this.TitlePaint[titleIndex];
|
|
84821
|
+
chartTitle.Clear({ DynamicTitle:true });
|
|
84238
84822
|
|
|
84239
84823
|
this.WindowIndex[windowIndex]=indexItem.Create(option);
|
|
84240
84824
|
this.CreateWindowIndex(windowIndex);
|
|
@@ -85887,7 +86471,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
85887
86471
|
if (item)
|
|
85888
86472
|
{
|
|
85889
86473
|
drawPicture=item.Create();
|
|
85890
|
-
|
|
86474
|
+
drawPicture.HQChart=this;
|
|
85891
86475
|
}
|
|
85892
86476
|
|
|
85893
86477
|
if (!drawPicture) //iconfont图标
|
|
@@ -103850,6 +104434,15 @@ Path2DHelper.FormatRadian=function(angle)
|
|
|
103850
104434
|
}
|
|
103851
104435
|
|
|
103852
104436
|
|
|
104437
|
+
Path2DHelper.PtInRect=function(x, y, rect)
|
|
104438
|
+
{
|
|
104439
|
+
if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom) return true;
|
|
104440
|
+
|
|
104441
|
+
return false;
|
|
104442
|
+
}
|
|
104443
|
+
|
|
104444
|
+
|
|
104445
|
+
|
|
103853
104446
|
|
|
103854
104447
|
|
|
103855
104448
|
|