hqchart 1.1.15039 → 1.1.15046
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 +26 -21
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +35 -1
- package/src/jscommon/umychart.js +178 -53
- package/src/jscommon/umychart.resource/font/drawtool/demo_index.html +26 -3
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.css +7 -3
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.js +1 -1
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.json +7 -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 +179 -54
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +214 -55
package/src/jscommon/umychart.js
CHANGED
|
@@ -422,7 +422,13 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
422
422
|
|
|
423
423
|
if (option.DrawTool) //画图工具
|
|
424
424
|
{
|
|
425
|
-
|
|
425
|
+
var item=option.DrawTool;
|
|
426
|
+
if (chart.ChartDrawStorage)
|
|
427
|
+
{
|
|
428
|
+
if (item.StorageKey) chart.ChartDrawStorage.Load(item.StorageKey);
|
|
429
|
+
if (IFrameSplitOperator.IsBool(item.EnableCrossPeriod)) chart.ChartDrawStorage.EnableCrossPeriod=item.EnableCrossPeriod;
|
|
430
|
+
}
|
|
431
|
+
|
|
426
432
|
}
|
|
427
433
|
|
|
428
434
|
if (option.KeyboardMove)
|
|
@@ -10026,6 +10032,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
10026
10032
|
|
|
10027
10033
|
drawPicture.PointMagnetKLine();
|
|
10028
10034
|
drawPicture.Status=10; //完成
|
|
10035
|
+
drawPicture.Period=this.Period;
|
|
10029
10036
|
drawPicture.PointToValue();
|
|
10030
10037
|
|
|
10031
10038
|
if (this.ChartDrawStorage) this.ChartDrawStorage.SaveDrawData(drawPicture);
|
|
@@ -64630,10 +64637,89 @@ function IChartDrawPicture()
|
|
|
64630
64637
|
}
|
|
64631
64638
|
}
|
|
64632
64639
|
|
|
64633
|
-
this.
|
|
64640
|
+
this.GetkData=function()
|
|
64634
64641
|
{
|
|
64635
|
-
if (!this.Frame) return
|
|
64642
|
+
if (!this.Frame) return null;
|
|
64636
64643
|
var data=this.Frame.Data;
|
|
64644
|
+
if (!data) return null;
|
|
64645
|
+
|
|
64646
|
+
return data;
|
|
64647
|
+
}
|
|
64648
|
+
|
|
64649
|
+
//周期变动 X重新定位
|
|
64650
|
+
this.ChangePeriod=function(period)
|
|
64651
|
+
{
|
|
64652
|
+
var kData=this.GetkData();
|
|
64653
|
+
if (!kData) return;
|
|
64654
|
+
|
|
64655
|
+
var aryDateTime=[];
|
|
64656
|
+
for(var i=0; i<this.Value.length; ++i)
|
|
64657
|
+
{
|
|
64658
|
+
var item=this.Value[i];
|
|
64659
|
+
if (!item.DateTime) break;
|
|
64660
|
+
var dateTime={ Date:item.DateTime.Date, Time:0, Match:null };
|
|
64661
|
+
if (IFrameSplitOperator.IsNumber(item.DateTime.Time)) dateTime.Time=item.DateTime.Time;
|
|
64662
|
+
aryDateTime[i]=dateTime;
|
|
64663
|
+
}
|
|
64664
|
+
|
|
64665
|
+
var findCount=0;
|
|
64666
|
+
var perData=null;
|
|
64667
|
+
var perIndex=-1;
|
|
64668
|
+
for(var i=0, j=0;i<kData.Data.length;++i)
|
|
64669
|
+
{
|
|
64670
|
+
var kItem=kData.Data[i];
|
|
64671
|
+
|
|
64672
|
+
for(j=0;j<aryDateTime.length;++j)
|
|
64673
|
+
{
|
|
64674
|
+
var item=aryDateTime[j];
|
|
64675
|
+
if (item.Match) continue;
|
|
64676
|
+
|
|
64677
|
+
if (ChartData.IsDayPeriod(period, true))
|
|
64678
|
+
{
|
|
64679
|
+
if (kItem.Date>item.Date)
|
|
64680
|
+
{
|
|
64681
|
+
item.Match={ KItem:perData, Index:perIndex };
|
|
64682
|
+
++findCount;
|
|
64683
|
+
}
|
|
64684
|
+
}
|
|
64685
|
+
else if (ChartData.IsMinutePeriod(period, true))
|
|
64686
|
+
{
|
|
64687
|
+
if (kItem.Date>item.Date || (kItem.Date==item.Date && kItem.Time>item.Time))
|
|
64688
|
+
{
|
|
64689
|
+
item.Match={ KItem:perData, Index:perIndex };
|
|
64690
|
+
++findCount;
|
|
64691
|
+
}
|
|
64692
|
+
}
|
|
64693
|
+
}
|
|
64694
|
+
|
|
64695
|
+
perData=kItem;
|
|
64696
|
+
perIndex=i;
|
|
64697
|
+
|
|
64698
|
+
if (findCount>=aryDateTime.length) break;
|
|
64699
|
+
}
|
|
64700
|
+
|
|
64701
|
+
for(var i=0;i<aryDateTime.length;++i)
|
|
64702
|
+
{
|
|
64703
|
+
var item=aryDateTime[i];
|
|
64704
|
+
var valueItem=this.Value[i];
|
|
64705
|
+
if (item.Match && item.Match.KItem)
|
|
64706
|
+
{
|
|
64707
|
+
valueItem.DateTime={ Date:item.Match.Date, Time:item.Match.Time };
|
|
64708
|
+
valueItem.XValue=item.Match.Index;
|
|
64709
|
+
}
|
|
64710
|
+
else
|
|
64711
|
+
{
|
|
64712
|
+
valueItem.DateTime=null;
|
|
64713
|
+
valueItem.XValue=null;
|
|
64714
|
+
}
|
|
64715
|
+
}
|
|
64716
|
+
|
|
64717
|
+
this.Period=period;
|
|
64718
|
+
}
|
|
64719
|
+
|
|
64720
|
+
this.UpdateXValue=function() //通过datetime更新x的索引
|
|
64721
|
+
{
|
|
64722
|
+
var data=this.GetkData();
|
|
64637
64723
|
if (!data) return false;
|
|
64638
64724
|
|
|
64639
64725
|
var aryDateTime=[];
|
|
@@ -76343,9 +76429,12 @@ function ChartDrawTVShortPosition()
|
|
|
76343
76429
|
|
|
76344
76430
|
function ChartDrawStorage()
|
|
76345
76431
|
{
|
|
76346
|
-
this.DrawData=new Map();
|
|
76432
|
+
//this.DrawData=new Map(); //画图工具数据 key=symbol-Period, value=Map() Key:Guid, Value:{ Guid, Symbol, Period, ClassName, Value }
|
|
76433
|
+
this.DrawDataV2=new Map(); //画图工具数据 key=symbol, value=Map() Key:Guid, Value:{ Guid, Symbol, Period, ClassName, Value }
|
|
76434
|
+
|
|
76347
76435
|
this.StorageKey;
|
|
76348
|
-
this.GetEventCallback;
|
|
76436
|
+
this.GetEventCallback; //事件回调
|
|
76437
|
+
this.EnableCrossPeriod=false; //跨周期
|
|
76349
76438
|
|
|
76350
76439
|
this.Load=function(key) //从本地读取画图工具
|
|
76351
76440
|
{
|
|
@@ -76358,18 +76447,39 @@ function ChartDrawStorage()
|
|
|
76358
76447
|
if (typeof(cacheValue) != "string") return;
|
|
76359
76448
|
|
|
76360
76449
|
var saveData=JSON.parse(cacheValue);
|
|
76361
|
-
|
|
76362
|
-
{
|
|
76363
|
-
var item=saveData[i];
|
|
76364
|
-
var drawMap=new Map();
|
|
76450
|
+
if (!saveData) return;
|
|
76365
76451
|
|
|
76366
|
-
|
|
76452
|
+
if (IFrameSplitOperator.IsNonEmptyArray(saveData)) //老版本 key=symbol-Period
|
|
76453
|
+
{
|
|
76454
|
+
for(var i=0;i<saveData.length;++i)
|
|
76367
76455
|
{
|
|
76368
|
-
var
|
|
76369
|
-
|
|
76456
|
+
var item=saveData[i];
|
|
76457
|
+
for(var j=0;j<item.Value.length;++j)
|
|
76458
|
+
{
|
|
76459
|
+
var drawItem=item.Value[j];
|
|
76460
|
+
var symbol=drawItem.Value.Symbol;
|
|
76461
|
+
if (!this.DrawDataV2.has(symbol))
|
|
76462
|
+
this.DrawDataV2.set(symbol, {Symbol:symbol, MapPicture: new Map() });
|
|
76463
|
+
|
|
76464
|
+
var stockItem=this.DrawDataV2.get(symbol);
|
|
76465
|
+
stockItem.MapPicture.set(drawItem.Value.Guid, drawItem.Value);
|
|
76466
|
+
}
|
|
76370
76467
|
}
|
|
76468
|
+
}
|
|
76469
|
+
else if (saveData.Ver==2.0 && IFrameSplitOperator.IsNonEmptyArray(saveData.Data))
|
|
76470
|
+
{
|
|
76471
|
+
for(var i=0;i<saveData.Data.length;++i)
|
|
76472
|
+
{
|
|
76473
|
+
var item=saveData.Data[i]; //{ Symbol:, AryPicture:[ { Guid, Symbol, Period, ClassName, Value }, ] }
|
|
76474
|
+
var stockItem={ Symbol:item.Symbol, MapPicture:new Map() };
|
|
76475
|
+
for(var j=0; j<item.AryPicture.length;++j)
|
|
76476
|
+
{
|
|
76477
|
+
var drawItem=item.AryPicture[j];
|
|
76478
|
+
stockItem.MapPicture.set(drawItem.Guid, drawItem);
|
|
76479
|
+
}
|
|
76371
76480
|
|
|
76372
|
-
|
|
76481
|
+
this.DrawDataV2.set(stockItem.Symbol,stockItem);
|
|
76482
|
+
}
|
|
76373
76483
|
}
|
|
76374
76484
|
}
|
|
76375
76485
|
|
|
@@ -76378,89 +76488,95 @@ function ChartDrawStorage()
|
|
|
76378
76488
|
if (!this.StorageKey) return;
|
|
76379
76489
|
|
|
76380
76490
|
var saveData=[];
|
|
76381
|
-
for(var
|
|
76491
|
+
for(var mapItem of this.DrawDataV2)
|
|
76382
76492
|
{
|
|
76383
|
-
var
|
|
76384
|
-
var
|
|
76385
|
-
var itemData={ Key:key, Value:[]};
|
|
76493
|
+
var symbol=mapItem[0];
|
|
76494
|
+
var stockItem=mapItem[1];
|
|
76386
76495
|
|
|
76387
|
-
|
|
76496
|
+
var itemData={ Symbol:symbol, AryPicture:[] };
|
|
76497
|
+
|
|
76498
|
+
for(var pictureItem of stockItem.MapPicture)
|
|
76388
76499
|
{
|
|
76389
|
-
|
|
76500
|
+
var drawItem=pictureItem[1];
|
|
76501
|
+
if (drawItem.EnableSave===false) continue;
|
|
76390
76502
|
|
|
76391
|
-
itemData.
|
|
76503
|
+
itemData.AryPicture.push(drawItem);
|
|
76392
76504
|
}
|
|
76393
76505
|
|
|
76394
|
-
if (IFrameSplitOperator.IsNonEmptyArray(itemData.
|
|
76506
|
+
if (IFrameSplitOperator.IsNonEmptyArray(itemData.AryPicture))
|
|
76395
76507
|
saveData.push(itemData);
|
|
76396
76508
|
}
|
|
76397
76509
|
|
|
76398
76510
|
JSConsole.Chart.Log(`[ChartDrawStorage::Save] save to localStorage, key=${this.StorageKey}`);
|
|
76399
|
-
var strData=JSON.stringify(saveData);
|
|
76511
|
+
var strData=JSON.stringify({Ver:2.0, Data:saveData});
|
|
76400
76512
|
localStorage[this.StorageKey]=strData;
|
|
76401
76513
|
}
|
|
76402
76514
|
|
|
76403
|
-
this.GetItemKey=function(obj) //生成每个画图工具的key
|
|
76404
|
-
{
|
|
76405
|
-
var strKey=`${obj.Symbol}-${obj.Period}`;
|
|
76406
|
-
return strKey;
|
|
76407
|
-
}
|
|
76408
|
-
|
|
76409
76515
|
this.SaveDrawData=function(drawPicture) //保存一个画图工具
|
|
76410
76516
|
{
|
|
76411
|
-
var
|
|
76517
|
+
var symbol=drawPicture.Symbol;
|
|
76412
76518
|
var data=drawPicture.ExportStorageData();
|
|
76413
76519
|
if (!data) return;
|
|
76414
76520
|
|
|
76415
|
-
if (this.
|
|
76521
|
+
if (this.DrawDataV2.has(symbol)) //更新
|
|
76416
76522
|
{
|
|
76417
|
-
JSConsole.Chart.Log('[ChartDrawStorage::SaveDrawData] Upate:
|
|
76418
|
-
this.
|
|
76523
|
+
JSConsole.Chart.Log('[ChartDrawStorage::SaveDrawData] Upate: symbol, drawPicture, data', symbol, drawPicture, data);
|
|
76524
|
+
var stockItem=this.DrawDataV2.get(symbol);
|
|
76525
|
+
stockItem.MapPicture.set(data.Guid, data);
|
|
76419
76526
|
}
|
|
76420
76527
|
else //新增
|
|
76421
76528
|
{
|
|
76422
|
-
JSConsole.Chart.Log('[ChartDrawStorage::SaveDrawData] Insert:
|
|
76423
|
-
var
|
|
76424
|
-
|
|
76425
|
-
this.
|
|
76529
|
+
JSConsole.Chart.Log('[ChartDrawStorage::SaveDrawData] Insert: symbol, drawPicture, data', symbol, drawPicture,data);
|
|
76530
|
+
var stockItem={ Symbol:symbol, MapPicture:new Map() } ;
|
|
76531
|
+
stockItem.set(data.Guid, data);
|
|
76532
|
+
this.DrawDataV2.set(symbol,newData);
|
|
76426
76533
|
}
|
|
76427
76534
|
|
|
76428
|
-
JSConsole.Chart.Log('[ChartDrawStorage::SaveDrawData] All draw data: ', this.
|
|
76535
|
+
JSConsole.Chart.Log('[ChartDrawStorage::SaveDrawData] All draw data: ', this.DrawDataV2);
|
|
76429
76536
|
|
|
76430
76537
|
this.Save();
|
|
76431
76538
|
}
|
|
76432
76539
|
|
|
76433
76540
|
this.DeleteDrawData=function(drawPicture) //删除一个画图工具
|
|
76434
76541
|
{
|
|
76435
|
-
var
|
|
76436
|
-
if (!this.
|
|
76542
|
+
var symbol=drawPicture.Symbol;
|
|
76543
|
+
if (!this.DrawDataV2.has(symbol)) return;
|
|
76437
76544
|
|
|
76438
|
-
var
|
|
76439
|
-
if (!
|
|
76545
|
+
var stockItem=this.DrawDataV2.get(symbol);
|
|
76546
|
+
if (!stockItem.MapPicture.has(drawPicture.Guid)) return;
|
|
76440
76547
|
|
|
76441
|
-
|
|
76548
|
+
stockItem.MapPicture.delete(drawPicture.Guid);
|
|
76442
76549
|
this.Save();
|
|
76443
76550
|
}
|
|
76444
76551
|
|
|
76445
76552
|
this.Clear=function()
|
|
76446
76553
|
{
|
|
76447
|
-
this.
|
|
76554
|
+
this.DrawDataV2=new Map();
|
|
76448
76555
|
this.Save();
|
|
76449
76556
|
}
|
|
76450
76557
|
|
|
76451
|
-
this.GetDrawData=function(obj) //获取已有的画图工具数据{Symbol: , Period:, }
|
|
76558
|
+
this.GetDrawData=function(obj) //获取已有的画图工具数据{ Symbol: , Period:, }
|
|
76452
76559
|
{
|
|
76453
|
-
var
|
|
76454
|
-
var
|
|
76455
|
-
if (!this.DrawData.has(strKey)) return data;
|
|
76560
|
+
var aryData=[];
|
|
76561
|
+
var symbol=obj.Symbol;
|
|
76456
76562
|
|
|
76457
|
-
|
|
76458
|
-
|
|
76563
|
+
if (!this.DrawDataV2.has(symbol)) return aryData;
|
|
76564
|
+
|
|
76565
|
+
var stockItem=this.DrawDataV2.get(symbol);
|
|
76566
|
+
for(var mapItem of stockItem.MapPicture)
|
|
76459
76567
|
{
|
|
76460
|
-
|
|
76568
|
+
var drawItem=mapItem[1];
|
|
76569
|
+
if (this.EnableCrossPeriod)
|
|
76570
|
+
{
|
|
76571
|
+
aryData.push(drawItem);
|
|
76572
|
+
}
|
|
76573
|
+
else
|
|
76574
|
+
{
|
|
76575
|
+
if (drawItem.Period==obj.Period) aryData.push(drawItem);
|
|
76576
|
+
}
|
|
76461
76577
|
}
|
|
76462
76578
|
|
|
76463
|
-
return
|
|
76579
|
+
return aryData;
|
|
76464
76580
|
}
|
|
76465
76581
|
}
|
|
76466
76582
|
|
|
@@ -87781,7 +87897,16 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
87781
87897
|
drawPicture.Option=this.ChartDrawOption;
|
|
87782
87898
|
|
|
87783
87899
|
if (drawPicture.ImportStorageData) drawPicture.ImportStorageData(item);
|
|
87784
|
-
drawPicture.
|
|
87900
|
+
if (drawPicture.Period!=this.Period)
|
|
87901
|
+
{
|
|
87902
|
+
drawPicture.ChangePeriod(this.Period);
|
|
87903
|
+
}
|
|
87904
|
+
else
|
|
87905
|
+
{
|
|
87906
|
+
drawPicture.UpdateXValue();
|
|
87907
|
+
}
|
|
87908
|
+
|
|
87909
|
+
|
|
87785
87910
|
drawPicture.ValueToPoint();
|
|
87786
87911
|
|
|
87787
87912
|
var self=this;
|
|
@@ -95579,7 +95704,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
95579
95704
|
{
|
|
95580
95705
|
if (!this.ChartDrawStorageCache || this.ChartDrawStorageCache.length<=0) return;
|
|
95581
95706
|
|
|
95582
|
-
var
|
|
95707
|
+
var kData=this.GetKData();
|
|
95583
95708
|
for(var i=0; i<this.ChartDrawStorageCache.length; ++i)
|
|
95584
95709
|
{
|
|
95585
95710
|
var item=this.ChartDrawStorageCache[i];
|
|
@@ -54,6 +54,12 @@
|
|
|
54
54
|
<div class="content unicode" style="display: block;">
|
|
55
55
|
<ul class="icon_lists dib-box">
|
|
56
56
|
|
|
57
|
+
<li class="dib">
|
|
58
|
+
<span class="icon hqchart_drawtool"></span>
|
|
59
|
+
<div class="name">跨周期</div>
|
|
60
|
+
<div class="code-name">&#xe647;</div>
|
|
61
|
+
</li>
|
|
62
|
+
|
|
57
63
|
<li class="dib">
|
|
58
64
|
<span class="icon hqchart_drawtool"></span>
|
|
59
65
|
<div class="name">chart-long-position</div>
|
|
@@ -516,9 +522,9 @@
|
|
|
516
522
|
<pre><code class="language-css"
|
|
517
523
|
>@font-face {
|
|
518
524
|
font-family: 'hqchart_drawtool';
|
|
519
|
-
src: url('iconfont.woff2?t=
|
|
520
|
-
url('iconfont.woff?t=
|
|
521
|
-
url('iconfont.ttf?t=
|
|
525
|
+
src: url('iconfont.woff2?t=1753977984776') format('woff2'),
|
|
526
|
+
url('iconfont.woff?t=1753977984776') format('woff'),
|
|
527
|
+
url('iconfont.ttf?t=1753977984776') format('truetype');
|
|
522
528
|
}
|
|
523
529
|
</code></pre>
|
|
524
530
|
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
|
|
@@ -544,6 +550,15 @@
|
|
|
544
550
|
<div class="content font-class">
|
|
545
551
|
<ul class="icon_lists dib-box">
|
|
546
552
|
|
|
553
|
+
<li class="dib">
|
|
554
|
+
<span class="icon hqchart_drawtool icon-kuazhouqi"></span>
|
|
555
|
+
<div class="name">
|
|
556
|
+
跨周期
|
|
557
|
+
</div>
|
|
558
|
+
<div class="code-name">.icon-kuazhouqi
|
|
559
|
+
</div>
|
|
560
|
+
</li>
|
|
561
|
+
|
|
547
562
|
<li class="dib">
|
|
548
563
|
<span class="icon hqchart_drawtool icon-chart-long-position"></span>
|
|
549
564
|
<div class="name">
|
|
@@ -1237,6 +1252,14 @@
|
|
|
1237
1252
|
<div class="content symbol">
|
|
1238
1253
|
<ul class="icon_lists dib-box">
|
|
1239
1254
|
|
|
1255
|
+
<li class="dib">
|
|
1256
|
+
<svg class="icon svg-icon" aria-hidden="true">
|
|
1257
|
+
<use xlink:href="#icon-kuazhouqi"></use>
|
|
1258
|
+
</svg>
|
|
1259
|
+
<div class="name">跨周期</div>
|
|
1260
|
+
<div class="code-name">#icon-kuazhouqi</div>
|
|
1261
|
+
</li>
|
|
1262
|
+
|
|
1240
1263
|
<li class="dib">
|
|
1241
1264
|
<svg class="icon svg-icon" aria-hidden="true">
|
|
1242
1265
|
<use xlink:href="#icon-chart-long-position"></use>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: "hqchart_drawtool"; /* Project id 4529603 */
|
|
3
|
-
src: url('iconfont.woff2?t=
|
|
4
|
-
url('iconfont.woff?t=
|
|
5
|
-
url('iconfont.ttf?t=
|
|
3
|
+
src: url('iconfont.woff2?t=1753977984776') format('woff2'),
|
|
4
|
+
url('iconfont.woff?t=1753977984776') format('woff'),
|
|
5
|
+
url('iconfont.ttf?t=1753977984776') format('truetype');
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.hqchart_drawtool {
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
-moz-osx-font-smoothing: grayscale;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
.icon-kuazhouqi:before {
|
|
17
|
+
content: "\e647";
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
.icon-chart-long-position:before {
|
|
17
21
|
content: "\e73a";
|
|
18
22
|
}
|