hqchart 1.1.14336 → 1.1.14349
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 +61 -55
- package/package.json +1 -1
- package/src/jscommon/umychart.NetworkFilterTest.js +69 -0
- package/src/jscommon/umychart.complier.js +32 -36
- package/src/jscommon/umychart.js +346 -187
- package/src/jscommon/umychart.testdata.js +69 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +379 -224
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.NetworkFilterTest.vue.js +69 -0
- package/src/jscommon/umychart.vue/umychart.vue.js +379 -224
package/src/jscommon/umychart.js
CHANGED
|
@@ -24474,6 +24474,12 @@ function IChartPainting()
|
|
|
24474
24474
|
|
|
24475
24475
|
}
|
|
24476
24476
|
|
|
24477
|
+
this.BuildKey=function(item)
|
|
24478
|
+
{
|
|
24479
|
+
if (IFrameSplitOperator.IsNumber(item.Time)) return `${item.Date}-${item.Time}`;
|
|
24480
|
+
else return item.Date;
|
|
24481
|
+
}
|
|
24482
|
+
|
|
24477
24483
|
//数据导出 数据格式 [{ Title:数据名称, Data:[] }]
|
|
24478
24484
|
//this.ExportData=function(aryKData) { }
|
|
24479
24485
|
|
|
@@ -31307,15 +31313,7 @@ function ChartOverlayKLine()
|
|
|
31307
31313
|
|
|
31308
31314
|
if (!this.MainData || !this.Data) return range;
|
|
31309
31315
|
|
|
31310
|
-
var firstOpen=
|
|
31311
|
-
for(var i=this.Data.DataOffset,j=0;i<this.MainData.Data.length && j<xPointCount;++i,++j)
|
|
31312
|
-
{
|
|
31313
|
-
var data=this.MainData.Data[i];
|
|
31314
|
-
if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
31315
|
-
firstOpen=data.Close;
|
|
31316
|
-
break;
|
|
31317
|
-
}
|
|
31318
|
-
|
|
31316
|
+
var firstOpen=this.GetFirstOpen();
|
|
31319
31317
|
if (firstOpen==null) return range;
|
|
31320
31318
|
|
|
31321
31319
|
var firstOverlayOpen=null;
|
|
@@ -40419,159 +40417,285 @@ function ChartMultiBar()
|
|
|
40419
40417
|
delete this.newMethod;
|
|
40420
40418
|
|
|
40421
40419
|
this.ClassName="ChartMultiBar";
|
|
40422
|
-
this.Bars=[]; // [ {Point:[ {
|
|
40420
|
+
this.Bars=[]; // [ {Point:[ {Date, Time, Value, Value2 }, ], Color:, Width: , Type: 0 实心 1 空心 }, ]
|
|
40423
40421
|
this.IsHScreen=false;
|
|
40424
40422
|
|
|
40423
|
+
this.MapCache=null; //key=date/date-time value={ Data:[] }
|
|
40424
|
+
this.GetKValue=ChartData.GetKValue;
|
|
40425
|
+
|
|
40426
|
+
this.GetItem=function(kItem)
|
|
40427
|
+
{
|
|
40428
|
+
if (!this.MapCache || this.MapCache.size<=0) return null;
|
|
40429
|
+
|
|
40430
|
+
var key=this.BuildKey(kItem);
|
|
40431
|
+
if (!this.MapCache.has(key)) return null;
|
|
40432
|
+
|
|
40433
|
+
return this.MapCache.get(key);
|
|
40434
|
+
}
|
|
40435
|
+
|
|
40436
|
+
this.BuildCacheData=function()
|
|
40437
|
+
{
|
|
40438
|
+
var mapData=new Map();
|
|
40439
|
+
this.MapCache=mapData;
|
|
40440
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.Bars)) return;
|
|
40441
|
+
|
|
40442
|
+
for(var i=0; i<this.Bars.length; ++i)
|
|
40443
|
+
{
|
|
40444
|
+
var groupItem=this.Bars[i];
|
|
40445
|
+
if (!groupItem || !IFrameSplitOperator.IsNonEmptyArray(groupItem.Point)) continue;
|
|
40446
|
+
|
|
40447
|
+
var clrConfig= { Color:groupItem.Color, Width:5, Name:groupItem.Name, Type:0 };
|
|
40448
|
+
if (IFrameSplitOperator.IsNumber(groupItem.Width)) clrConfig.Width=groupItem.Width;
|
|
40449
|
+
if (IFrameSplitOperator.IsNumber(groupItem.Type)) clrConfig.Type=groupItem.Type;
|
|
40450
|
+
|
|
40451
|
+
for(var j=0; j<groupItem.Point.length; ++j)
|
|
40452
|
+
{
|
|
40453
|
+
var point=groupItem.Point[j];
|
|
40454
|
+
var key=this.BuildKey(point);
|
|
40455
|
+
|
|
40456
|
+
var item={ Data:point, ColorConfig:clrConfig }
|
|
40457
|
+
if (mapData.has(key))
|
|
40458
|
+
{
|
|
40459
|
+
var mapItem=mapData.get(key);
|
|
40460
|
+
mapItem.Data.push(item);
|
|
40461
|
+
}
|
|
40462
|
+
else
|
|
40463
|
+
{
|
|
40464
|
+
mapData.set(key,{ Data:[item] });
|
|
40465
|
+
}
|
|
40466
|
+
}
|
|
40467
|
+
}
|
|
40468
|
+
}
|
|
40469
|
+
|
|
40425
40470
|
this.Draw=function()
|
|
40426
40471
|
{
|
|
40427
40472
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
40428
40473
|
if (this.IsShowIndexTitleOnly()) return;
|
|
40429
40474
|
if (this.IsHideScriptIndex()) return;
|
|
40430
|
-
if (!this.Data || this.Data.
|
|
40475
|
+
if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return; //k线数据
|
|
40476
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.Bars)) return;
|
|
40477
|
+
if (!this.MapCache || this.MapCache.size<=0) return;
|
|
40431
40478
|
|
|
40432
40479
|
this.IsHScreen=(this.ChartFrame.IsHScreen===true);
|
|
40433
40480
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
40434
|
-
var offset=this.Data.DataOffset;
|
|
40435
40481
|
var dataWidth=this.ChartFrame.DataWidth;
|
|
40436
|
-
var
|
|
40482
|
+
var distanceWidth=this.ChartFrame.DistanceWidth;
|
|
40483
|
+
var isMinute=this.IsMinuteFrame();
|
|
40437
40484
|
|
|
40438
|
-
var
|
|
40439
|
-
|
|
40485
|
+
var border=this.GetBorder();
|
|
40486
|
+
if (this.IsHScreen)
|
|
40440
40487
|
{
|
|
40441
|
-
var
|
|
40442
|
-
var
|
|
40443
|
-
|
|
40444
|
-
if (item.Width>0)
|
|
40445
|
-
{
|
|
40446
|
-
drawPoints.Width=item.Width*pixelRatio;
|
|
40447
|
-
if (drawPoints.Width>dataWidth) drawPoints.Width=dataWidth;
|
|
40448
|
-
}
|
|
40449
|
-
else
|
|
40450
|
-
{
|
|
40451
|
-
if(drawPoints.Width<4) drawPoints.Width=1*pixelRatio;
|
|
40452
|
-
}
|
|
40453
|
-
|
|
40454
|
-
for(var j in item.Point)
|
|
40455
|
-
{
|
|
40456
|
-
var point=item.Point[j];
|
|
40457
|
-
if (!IFrameSplitOperator.IsNumber(point.Index)) continue;
|
|
40458
|
-
|
|
40459
|
-
var index=point.Index-offset;
|
|
40460
|
-
if (index>=0 && index<xPointCount)
|
|
40461
|
-
{
|
|
40462
|
-
var x=this.ChartFrame.GetXFromIndex(index);
|
|
40463
|
-
var y=this.ChartFrame.GetYFromData(point.Value);
|
|
40464
|
-
var y2=this.ChartFrame.GetYFromData(point.Value2);
|
|
40465
|
-
drawPoints.Point.push({X:x, Y:y, Y2:y2});
|
|
40466
|
-
}
|
|
40467
|
-
}
|
|
40468
|
-
|
|
40469
|
-
if (drawPoints.Point.length>0) drawBars.push(drawPoints)
|
|
40488
|
+
var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
40489
|
+
var chartright=border.BottomEx;
|
|
40490
|
+
var chartLeft=border.TopEx;
|
|
40470
40491
|
}
|
|
40471
|
-
|
|
40472
|
-
for(var i in drawBars)
|
|
40492
|
+
else
|
|
40473
40493
|
{
|
|
40474
|
-
var
|
|
40475
|
-
|
|
40476
|
-
|
|
40477
|
-
if (item.Type==1) this.DrawHollowBar(item);
|
|
40478
|
-
else this.DrawFillBar(item);
|
|
40479
|
-
}
|
|
40480
|
-
else
|
|
40481
|
-
{
|
|
40482
|
-
this.DrawLineBar(item);
|
|
40483
|
-
}
|
|
40494
|
+
var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
40495
|
+
var chartright=border.RightEx;
|
|
40496
|
+
var chartLeft=border.LeftEx;
|
|
40484
40497
|
}
|
|
40485
|
-
}
|
|
40486
40498
|
|
|
40487
|
-
|
|
40488
|
-
|
|
40489
|
-
this.
|
|
40490
|
-
var backupLineWidth=this.Canvas.lineWidth;
|
|
40491
|
-
this.Canvas.lineWidth=bar.Width;
|
|
40492
|
-
for(var i in bar.Point)
|
|
40499
|
+
//计算所有柱子位置
|
|
40500
|
+
var mapBar=new Map();
|
|
40501
|
+
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
40493
40502
|
{
|
|
40494
|
-
var
|
|
40503
|
+
var kItem=this.Data.Data[i];
|
|
40504
|
+
var key=this.BuildKey(kItem);
|
|
40505
|
+
if (!this.MapCache.has(key)) continue;
|
|
40506
|
+
var mapItem=this.MapCache.get(key);
|
|
40507
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
|
|
40495
40508
|
|
|
40496
|
-
|
|
40497
|
-
if (this.IsHScreen)
|
|
40509
|
+
if (isMinute)
|
|
40498
40510
|
{
|
|
40499
|
-
this.
|
|
40500
|
-
this.Canvas.lineTo(ToFixedPoint(item.Y2),ToFixedPoint(item.X));
|
|
40511
|
+
var x=this.ChartFrame.GetXFromIndex(j);
|
|
40501
40512
|
}
|
|
40502
40513
|
else
|
|
40503
40514
|
{
|
|
40504
|
-
|
|
40505
|
-
|
|
40515
|
+
var left=xOffset;
|
|
40516
|
+
var right=xOffset+dataWidth;
|
|
40517
|
+
if (right>chartright) break;
|
|
40518
|
+
var x=left+(right-left)/2;
|
|
40506
40519
|
}
|
|
40507
|
-
|
|
40508
|
-
this.
|
|
40520
|
+
|
|
40521
|
+
this.CalculateItem(mapItem, kItem, x, mapBar);
|
|
40509
40522
|
}
|
|
40510
40523
|
|
|
40511
|
-
|
|
40524
|
+
if (mapBar.size<=0) return;
|
|
40525
|
+
|
|
40526
|
+
this.Canvas.save();
|
|
40527
|
+
this.ClipClient(this.IsHScreen);
|
|
40528
|
+
|
|
40529
|
+
this.DrawAllBar(mapBar);
|
|
40530
|
+
|
|
40531
|
+
this.Canvas.restore();
|
|
40512
40532
|
}
|
|
40513
40533
|
|
|
40514
|
-
this.
|
|
40534
|
+
this.CalculateItem=function(groupItem, kItem, x, mapBar)
|
|
40515
40535
|
{
|
|
40516
|
-
|
|
40517
|
-
for(var i in bar.Point)
|
|
40536
|
+
for(var i=0; i<groupItem.Data.length; ++i)
|
|
40518
40537
|
{
|
|
40519
|
-
var item=
|
|
40520
|
-
var
|
|
40521
|
-
|
|
40522
|
-
|
|
40523
|
-
|
|
40524
|
-
|
|
40525
|
-
|
|
40526
|
-
|
|
40527
|
-
|
|
40538
|
+
var item=groupItem.Data[i];
|
|
40539
|
+
var value=item.Data.Value;
|
|
40540
|
+
if (IFrameSplitOperator.IsString(item.Data.Value)) value=this.GetKValue(kItem,item.Data.Value);
|
|
40541
|
+
if (!IFrameSplitOperator.IsNumber(value)) continue;
|
|
40542
|
+
|
|
40543
|
+
var value2=item.Data.Value2;
|
|
40544
|
+
if (IFrameSplitOperator.IsString(item.Data.Value2)) value2=this.GetKValue(kItem,item.Data.Value2);
|
|
40545
|
+
if (!IFrameSplitOperator.IsNumber(value2)) continue;
|
|
40546
|
+
|
|
40547
|
+
var y=this.ChartFrame.GetYFromData(value, false);
|
|
40548
|
+
var y2=this.ChartFrame.GetYFromData(value2, false);
|
|
40549
|
+
|
|
40550
|
+
var strConfig=JSON.stringify(item.ColorConfig);
|
|
40551
|
+
if (!mapBar.has(strConfig)) mapBar.set(strConfig, { AryBar:[]});
|
|
40552
|
+
var mapItem=mapBar.get(strConfig);
|
|
40553
|
+
|
|
40554
|
+
mapItem.AryBar.push({ X:x, Y:y, Y2:y2, Data:item });
|
|
40528
40555
|
}
|
|
40529
40556
|
}
|
|
40530
40557
|
|
|
40531
|
-
|
|
40558
|
+
|
|
40559
|
+
this.DrawAllBar=function(mapBar)
|
|
40532
40560
|
{
|
|
40533
|
-
|
|
40534
|
-
|
|
40535
|
-
for(var
|
|
40561
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
40562
|
+
|
|
40563
|
+
for(var mapItem of mapBar)
|
|
40536
40564
|
{
|
|
40537
|
-
|
|
40538
|
-
|
|
40539
|
-
var y=Math.min(item.Y,item.Y2);
|
|
40540
|
-
var barWidth=bar.Width;
|
|
40541
|
-
var barHeight=Math.abs(item.Y-item.Y2);
|
|
40542
|
-
this.Canvas.beginPath();
|
|
40543
|
-
if (this.IsHScreen)
|
|
40544
|
-
this.Canvas.rect(ToFixedPoint(y),ToFixedPoint(x),ToFixedRect(barHeight),ToFixedRect(barWidth));
|
|
40545
|
-
else
|
|
40546
|
-
this.Canvas.rect(ToFixedPoint(x),ToFixedPoint(y),ToFixedRect(barWidth),ToFixedRect(barHeight));
|
|
40565
|
+
aryBar=mapItem[1].AryBar;
|
|
40566
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryBar)) continue;
|
|
40547
40567
|
|
|
40548
|
-
|
|
40549
|
-
|
|
40568
|
+
var config=null;
|
|
40569
|
+
var path=new Path2D();
|
|
40570
|
+
var count=0;
|
|
40571
|
+
var drawType=-1; //1=直线 2=实心 3=空心
|
|
40572
|
+
var barWidth=1;
|
|
40573
|
+
for(var i=0;i<aryBar.length;++i)
|
|
40574
|
+
{
|
|
40575
|
+
var item=aryBar[i];
|
|
40576
|
+
if (!config)
|
|
40577
|
+
{
|
|
40578
|
+
config=item.Data.ColorConfig;
|
|
40579
|
+
barWidth=config.Width*pixelRatio;
|
|
40580
|
+
if (barWidth>4)
|
|
40581
|
+
{
|
|
40582
|
+
if (config.Type==0) drawType=2; //实心
|
|
40583
|
+
else if (config.Type==1) drawType=3; //空心
|
|
40584
|
+
else continue;
|
|
40585
|
+
}
|
|
40586
|
+
else //太细了, 直线
|
|
40587
|
+
{
|
|
40588
|
+
drawType=1;
|
|
40589
|
+
}
|
|
40590
|
+
}
|
|
40550
40591
|
|
|
40551
|
-
|
|
40592
|
+
if (drawType<=0) continue;
|
|
40593
|
+
|
|
40594
|
+
if (drawType==1)
|
|
40595
|
+
{
|
|
40596
|
+
this.Canvas.beginPath();
|
|
40597
|
+
if (this.IsHScreen)
|
|
40598
|
+
{
|
|
40599
|
+
this.Canvas.moveTo(ToFixedPoint(item.Y),ToFixedPoint(item.X));
|
|
40600
|
+
this.Canvas.lineTo(ToFixedPoint(item.Y2),ToFixedPoint(item.X));
|
|
40601
|
+
}
|
|
40602
|
+
else
|
|
40603
|
+
{
|
|
40604
|
+
this.Canvas.moveTo(ToFixedPoint(item.X),ToFixedPoint(item.Y));
|
|
40605
|
+
this.Canvas.lineTo(ToFixedPoint(item.X),ToFixedPoint(item.Y2));
|
|
40606
|
+
}
|
|
40607
|
+
++count;
|
|
40608
|
+
}
|
|
40609
|
+
else if (drawType==2) //实心
|
|
40610
|
+
{
|
|
40611
|
+
var x=item.X-(barWidth/2);
|
|
40612
|
+
var y=Math.min(item.Y,item.Y2);
|
|
40613
|
+
var barWidth=barWidth;
|
|
40614
|
+
var barHeight=Math.abs(item.Y-item.Y2);
|
|
40615
|
+
|
|
40616
|
+
var barPath = new Path2D();
|
|
40617
|
+
if (this.IsHScreen)
|
|
40618
|
+
barPath.rect(ToFixedRect(y),ToFixedRect(x),ToFixedRect(barHeight),ToFixedRect(barWidth))
|
|
40619
|
+
else
|
|
40620
|
+
barPath.rect(ToFixedRect(x),ToFixedRect(y),ToFixedRect(barWidth),ToFixedRect(barHeight))
|
|
40621
|
+
|
|
40622
|
+
path.addPath(barPath);
|
|
40623
|
+
++count;
|
|
40624
|
+
}
|
|
40625
|
+
else if (drawType==3) //空心
|
|
40626
|
+
{
|
|
40627
|
+
var x=item.X-(barWidth/2);
|
|
40628
|
+
var y=Math.min(item.Y,item.Y2);
|
|
40629
|
+
var barWidth=barWidth;
|
|
40630
|
+
var barHeight=Math.abs(item.Y-item.Y2);
|
|
40631
|
+
|
|
40632
|
+
var barPath = new Path2D();
|
|
40633
|
+
if (this.IsHScreen)
|
|
40634
|
+
barPath.rect(ToFixedPoint(y),ToFixedPoint(x),ToFixedPoint(barHeight),ToFixedPoint(barWidth))
|
|
40635
|
+
else
|
|
40636
|
+
barPath.rect(ToFixedPoint(x),ToFixedPoint(y),ToFixedPoint(barWidth),ToFixedPoint(barHeight))
|
|
40637
|
+
|
|
40638
|
+
path.addPath(barPath);
|
|
40639
|
+
++count;
|
|
40640
|
+
}
|
|
40641
|
+
}
|
|
40642
|
+
|
|
40643
|
+
|
|
40644
|
+
if (count>0 && drawType>0 && config)
|
|
40645
|
+
{
|
|
40646
|
+
if (drawType==1)
|
|
40647
|
+
{
|
|
40648
|
+
this.Canvas.lineWidth=1*pixelRatio;
|
|
40649
|
+
this.Canvas.strokeStyle=config.Color;
|
|
40650
|
+
this.Canvas.stroke();
|
|
40651
|
+
}
|
|
40652
|
+
else if (drawType==2)
|
|
40653
|
+
{
|
|
40654
|
+
this.Canvas.fillStyle=config.Color; //背景填充颜色
|
|
40655
|
+
this.Canvas.fill(path);
|
|
40656
|
+
}
|
|
40657
|
+
else if (drawType==3)
|
|
40658
|
+
{
|
|
40659
|
+
this.Canvas.lineWidth=1*pixelRatio;
|
|
40660
|
+
this.Canvas.strokeStyle=config.Color;
|
|
40661
|
+
this.Canvas.stroke(path);
|
|
40662
|
+
}
|
|
40663
|
+
}
|
|
40664
|
+
|
|
40665
|
+
}
|
|
40552
40666
|
}
|
|
40553
40667
|
|
|
40554
40668
|
this.GetMaxMin=function()
|
|
40555
40669
|
{
|
|
40556
40670
|
var range={ Min:null, Max:null };
|
|
40671
|
+
if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return range;
|
|
40672
|
+
if (!this.MapCache || this.MapCache.size<=0) return range;
|
|
40557
40673
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
40558
|
-
|
|
40559
|
-
var
|
|
40560
|
-
for(var i in this.Bars)
|
|
40674
|
+
|
|
40675
|
+
for(var i=this.Data.DataOffset,j=0, k=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
|
|
40561
40676
|
{
|
|
40562
|
-
var
|
|
40563
|
-
|
|
40677
|
+
var kItem=this.Data.Data[i];
|
|
40678
|
+
var key=this.BuildKey(kItem);
|
|
40679
|
+
if (!this.MapCache.has(key)) continue;
|
|
40680
|
+
var mapItem=this.MapCache.get(key);
|
|
40681
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
|
|
40682
|
+
|
|
40683
|
+
for(k=0;k<mapItem.Data.length;++k)
|
|
40564
40684
|
{
|
|
40565
|
-
var
|
|
40566
|
-
|
|
40567
|
-
|
|
40568
|
-
|
|
40569
|
-
|
|
40570
|
-
|
|
40571
|
-
|
|
40572
|
-
|
|
40573
|
-
|
|
40574
|
-
|
|
40685
|
+
var item=mapItem.Data[k];
|
|
40686
|
+
var value=item.Data.Value;
|
|
40687
|
+
if (IFrameSplitOperator.IsString(item.Data.Value)) value=this.GetKValue(kItem,item.Data.Value);
|
|
40688
|
+
if (!IFrameSplitOperator.IsNumber(value)) continue;
|
|
40689
|
+
var value2=item.Data.Value2;
|
|
40690
|
+
if (IFrameSplitOperator.IsString(item.Data.Value2)) value2=this.GetKValue(kItem,item.Data.Value2);
|
|
40691
|
+
if (!IFrameSplitOperator.IsNumber(value2)) continue;
|
|
40692
|
+
|
|
40693
|
+
var minValue=Math.min(value, value2);
|
|
40694
|
+
var maxValue=Math.max(value, value2);
|
|
40695
|
+
if (range.Max==null) range.Max=maxValue;
|
|
40696
|
+
else if (range.Max<maxValue) range.Max=maxValue;
|
|
40697
|
+
if (range.Min==null) range.Min=minValue;
|
|
40698
|
+
else if (range.Min>minValue) range.Min=minValue;
|
|
40575
40699
|
}
|
|
40576
40700
|
}
|
|
40577
40701
|
|
|
@@ -40913,7 +41037,7 @@ function ChartMultiLine()
|
|
|
40913
41037
|
}
|
|
40914
41038
|
}
|
|
40915
41039
|
|
|
40916
|
-
//
|
|
41040
|
+
// 多个点集合2.0 支持横屏
|
|
40917
41041
|
function ChartMultiPoint()
|
|
40918
41042
|
{
|
|
40919
41043
|
this.newMethod=IChartPainting; //派生
|
|
@@ -40931,12 +41055,6 @@ function ChartMultiPoint()
|
|
|
40931
41055
|
this.MapCache=null; //key=date/date-time value={ Data:[] }
|
|
40932
41056
|
this.GetKValue=ChartData.GetKValue;
|
|
40933
41057
|
|
|
40934
|
-
this.BuildKey=function(item)
|
|
40935
|
-
{
|
|
40936
|
-
if (IFrameSplitOperator.IsNumber(item.Time)) return `${item.Date}-${item.Time}`;
|
|
40937
|
-
else return item.Date;
|
|
40938
|
-
}
|
|
40939
|
-
|
|
40940
41058
|
this.GetItem=function(kItem)
|
|
40941
41059
|
{
|
|
40942
41060
|
if (!this.MapCache || this.MapCache.size<=0) return null;
|
|
@@ -40960,6 +41078,7 @@ function ChartMultiPoint()
|
|
|
40960
41078
|
|
|
40961
41079
|
var clrConfig= { Color:groupItem.Color, BGColor:groupItem.BGColor, LineWidth:this.LineWidth, Radius:this.PointRadius, Name:groupItem.Name };
|
|
40962
41080
|
if (IFrameSplitOperator.IsNumber(groupItem.PointRadius)) clrConfig.Radius=groupItem.PointRadius;
|
|
41081
|
+
if (IFrameSplitOperator.IsNumber(groupItem.LineWidth)) clrConfig.LineWidth=groupItem.LineWidth;
|
|
40963
41082
|
|
|
40964
41083
|
for(var j=0; j<groupItem.Point.length; ++j)
|
|
40965
41084
|
{
|
|
@@ -41084,7 +41203,7 @@ function ChartMultiPoint()
|
|
|
41084
41203
|
if (this.IsHScreen)
|
|
41085
41204
|
pointPath.arc(item.Y,item.X,config.Radius*pixelRatio,0,360,false);
|
|
41086
41205
|
else
|
|
41087
|
-
pointPath.arc(item.X,item.Y,config.Radius
|
|
41206
|
+
pointPath.arc(item.X,item.Y,config.Radius*pixelRatio,0,360,false);
|
|
41088
41207
|
|
|
41089
41208
|
path.addPath(pointPath);
|
|
41090
41209
|
++count;
|
|
@@ -41112,7 +41231,7 @@ function ChartMultiPoint()
|
|
|
41112
41231
|
{
|
|
41113
41232
|
var range={ Min:null, Max:null };
|
|
41114
41233
|
if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return range;
|
|
41115
|
-
if (!this.MapCache || this.MapCache.size<=0) return;
|
|
41234
|
+
if (!this.MapCache || this.MapCache.size<=0) return range;
|
|
41116
41235
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
41117
41236
|
|
|
41118
41237
|
for(var i=this.Data.DataOffset,j=0, k=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
|
|
@@ -41141,7 +41260,7 @@ function ChartMultiPoint()
|
|
|
41141
41260
|
}
|
|
41142
41261
|
}
|
|
41143
41262
|
|
|
41144
|
-
// 多文本集合 支持横屏
|
|
41263
|
+
// 多文本集合2.0 支持横屏
|
|
41145
41264
|
function ChartMultiText()
|
|
41146
41265
|
{
|
|
41147
41266
|
this.newMethod=IChartPainting; //派生
|
|
@@ -41149,58 +41268,38 @@ function ChartMultiText()
|
|
|
41149
41268
|
delete this.newMethod;
|
|
41150
41269
|
|
|
41151
41270
|
this.ClassName="ChartMultiText";
|
|
41152
|
-
this.Texts=[]; //[ {
|
|
41271
|
+
this.Texts=[]; //[ {Date:, Time, Value:, Text:, Color:, Font: , Baseline:, Line:{ Color:, Dash:[虚线点], KData:"H/L", Offset:[5,10], Width:线粗细 }} ]
|
|
41153
41272
|
this.Font=g_JSChartResource.DefaultTextFont;
|
|
41154
41273
|
this.Color=g_JSChartResource.DefaultTextColor;
|
|
41155
41274
|
this.IsHScreen=false; //是否横屏
|
|
41156
41275
|
|
|
41157
|
-
this.
|
|
41158
|
-
|
|
41159
|
-
if (IFrameSplitOperator.IsNumber(item.Time))
|
|
41160
|
-
{
|
|
41161
|
-
var key=`${item.Date}-${item.Time}`;
|
|
41162
|
-
}
|
|
41163
|
-
else
|
|
41164
|
-
{
|
|
41165
|
-
var key=`${item.Date}`;
|
|
41166
|
-
}
|
|
41167
|
-
|
|
41168
|
-
return key;
|
|
41169
|
-
}
|
|
41276
|
+
this.MapCache=null; //key=date/date-time value={ Data:[] }
|
|
41277
|
+
this.GetKValue=ChartData.GetKValue;
|
|
41170
41278
|
|
|
41171
|
-
this.
|
|
41279
|
+
this.BuildCacheData=function()
|
|
41172
41280
|
{
|
|
41173
|
-
var
|
|
41174
|
-
|
|
41281
|
+
var mapData=new Map();
|
|
41282
|
+
this.MapCache=mapData;
|
|
41283
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.Texts)) return;
|
|
41175
41284
|
|
|
41176
|
-
var
|
|
41177
|
-
for(var i=0; i<this.Texts.length; ++i)
|
|
41285
|
+
for(var i=0;i<this.Texts.length;++i)
|
|
41178
41286
|
{
|
|
41179
41287
|
var item=this.Texts[i];
|
|
41180
|
-
|
|
41181
|
-
if (
|
|
41182
|
-
|
|
41183
|
-
var index=item.Index-offset;
|
|
41184
|
-
if (index>=0 && index<xPointCount)
|
|
41288
|
+
var key=this.BuildKey(item);
|
|
41289
|
+
if (mapData.has(key))
|
|
41185
41290
|
{
|
|
41186
|
-
var
|
|
41187
|
-
|
|
41188
|
-
|
|
41189
|
-
|
|
41190
|
-
|
|
41191
|
-
}
|
|
41192
|
-
else
|
|
41193
|
-
{
|
|
41194
|
-
var textItem={ Data:[item] };
|
|
41195
|
-
mapText.set(key, textItem);
|
|
41196
|
-
}
|
|
41291
|
+
var mapItem=mapData.get(key);
|
|
41292
|
+
mapItem.Data.push(item);
|
|
41293
|
+
}
|
|
41294
|
+
else
|
|
41295
|
+
{
|
|
41296
|
+
mapData.set(key,{ Data:[item] });
|
|
41197
41297
|
}
|
|
41198
41298
|
}
|
|
41199
|
-
|
|
41200
|
-
return mapText;
|
|
41201
41299
|
}
|
|
41202
41300
|
|
|
41203
|
-
|
|
41301
|
+
|
|
41302
|
+
this.DrawAllText=function()
|
|
41204
41303
|
{
|
|
41205
41304
|
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
41206
41305
|
var isMinute=this.IsMinuteFrame();
|
|
@@ -41237,21 +41336,29 @@ function ChartMultiText()
|
|
|
41237
41336
|
if (!kItem) continue;
|
|
41238
41337
|
|
|
41239
41338
|
var key=this.BuildKey(kItem);
|
|
41240
|
-
if (!
|
|
41339
|
+
if (!this.MapCache.has(key)) continue;
|
|
41340
|
+
var mapItem=this.MapCache.get(key);
|
|
41341
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
|
|
41241
41342
|
|
|
41242
41343
|
var left=xOffset;
|
|
41243
41344
|
var right=xOffset+dataWidth;
|
|
41244
41345
|
if (right>chartright) break;
|
|
41245
41346
|
var x=left+(right-left)/2;
|
|
41246
41347
|
|
|
41247
|
-
var
|
|
41248
|
-
for(var k=0;k<textItem.Data.length;++k)
|
|
41348
|
+
for(var k=0;k<mapItem.Data.length;++k)
|
|
41249
41349
|
{
|
|
41250
|
-
var item=
|
|
41350
|
+
var item=mapItem.Data[k];
|
|
41251
41351
|
var y=top;
|
|
41252
41352
|
if (item.Value=="TOP") y=top;
|
|
41253
41353
|
else if (item.Value=="BOTTOM") y=bottom;
|
|
41254
|
-
else
|
|
41354
|
+
else
|
|
41355
|
+
{
|
|
41356
|
+
var price=item.Value;
|
|
41357
|
+
if (IFrameSplitOperator.IsString(item.Value)) price=this.GetKValue(kItem,item.Value);
|
|
41358
|
+
|
|
41359
|
+
y=this.ChartFrame.GetYFromData(price, false);
|
|
41360
|
+
}
|
|
41361
|
+
|
|
41255
41362
|
|
|
41256
41363
|
if (item.Color) this.Canvas.fillStyle = item.Color;
|
|
41257
41364
|
else this.Canvas.fillStyle = this.Color;
|
|
@@ -41336,18 +41443,16 @@ function ChartMultiText()
|
|
|
41336
41443
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
41337
41444
|
if (this.IsShowIndexTitleOnly()) return;
|
|
41338
41445
|
if (this.IsHideScriptIndex()) return;
|
|
41339
|
-
if (!this.Data || this.Data.
|
|
41340
|
-
if (!this.Texts) return;
|
|
41446
|
+
if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return; //k线数据
|
|
41447
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.Texts)) return;
|
|
41448
|
+
if (!this.MapCache || this.MapCache.size<=0) return;
|
|
41341
41449
|
|
|
41342
41450
|
this.IsHScreen=(this.ChartFrame.IsHScreen===true);
|
|
41343
41451
|
|
|
41344
|
-
var mapText=this.GetShowTextData();
|
|
41345
|
-
if (mapText.size<=0) return;
|
|
41346
|
-
|
|
41347
41452
|
this.Canvas.save();
|
|
41348
41453
|
this.ClipClient(this.IsHScreen);
|
|
41349
41454
|
|
|
41350
|
-
this.DrawAllText(
|
|
41455
|
+
this.DrawAllText();
|
|
41351
41456
|
|
|
41352
41457
|
this.Canvas.restore();
|
|
41353
41458
|
}
|
|
@@ -41357,21 +41462,29 @@ function ChartMultiText()
|
|
|
41357
41462
|
var range={ Min:null, Max:null };
|
|
41358
41463
|
if (!this.Texts) return range;
|
|
41359
41464
|
|
|
41465
|
+
if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return range;
|
|
41466
|
+
if (!this.MapCache || this.MapCache.size<=0) return range;
|
|
41360
41467
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
41361
|
-
var start=this.Data.DataOffset;
|
|
41362
|
-
var end=start+xPointCount;
|
|
41363
41468
|
|
|
41364
|
-
for(var i
|
|
41469
|
+
for(var i=this.Data.DataOffset,j=0, k=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
|
|
41365
41470
|
{
|
|
41366
|
-
var
|
|
41367
|
-
|
|
41471
|
+
var kItem=this.Data.Data[i];
|
|
41472
|
+
var key=this.BuildKey(kItem);
|
|
41473
|
+
if (!this.MapCache.has(key)) continue;
|
|
41474
|
+
var mapItem=this.MapCache.get(key);
|
|
41475
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
|
|
41368
41476
|
|
|
41369
|
-
|
|
41477
|
+
for(k=0;k<mapItem.Data.length;++k)
|
|
41370
41478
|
{
|
|
41371
|
-
|
|
41372
|
-
|
|
41373
|
-
if (
|
|
41374
|
-
|
|
41479
|
+
var item=mapItem.Data[k];
|
|
41480
|
+
var value=item.Value;
|
|
41481
|
+
if (IFrameSplitOperator.IsString(item.Value)) value=this.GetKValue(kItem,item.Value);
|
|
41482
|
+
if (!IFrameSplitOperator.IsNumber(value)) continue;
|
|
41483
|
+
|
|
41484
|
+
if (range.Max==null) range.Max=value;
|
|
41485
|
+
else if (range.Max<value) range.Max=value;
|
|
41486
|
+
if (range.Min==null) range.Min=value;
|
|
41487
|
+
else if (range.Min>value) range.Min=value;
|
|
41375
41488
|
}
|
|
41376
41489
|
}
|
|
41377
41490
|
|
|
@@ -41888,7 +42001,7 @@ function ChartMultiHtmlDom()
|
|
|
41888
42001
|
}
|
|
41889
42002
|
}
|
|
41890
42003
|
|
|
41891
|
-
//绘制SVG图标
|
|
42004
|
+
//绘制SVG图标 2.0
|
|
41892
42005
|
function ChartDrawSVG()
|
|
41893
42006
|
{
|
|
41894
42007
|
this.newMethod=IChartPainting; //派生
|
|
@@ -57502,6 +57615,41 @@ function DynamicChartTitlePainting()
|
|
|
57502
57615
|
return aryText;
|
|
57503
57616
|
}
|
|
57504
57617
|
|
|
57618
|
+
this.ForamtMultiBarTitle=function(dataIndex, dataInfo)
|
|
57619
|
+
{
|
|
57620
|
+
if (!dataInfo.GetItemCallback) return null;
|
|
57621
|
+
if (!dataInfo.Data || !IFrameSplitOperator.IsNonEmptyArray(dataInfo.Data.Data)) return null;
|
|
57622
|
+
var kItem=dataInfo.Data.Data[dataIndex];
|
|
57623
|
+
if (!kItem) return null;
|
|
57624
|
+
|
|
57625
|
+
var group=dataInfo.GetItemCallback(kItem);
|
|
57626
|
+
if (!group || !IFrameSplitOperator.IsNonEmptyArray(group.Data)) return null;
|
|
57627
|
+
|
|
57628
|
+
var aryText=[];
|
|
57629
|
+
for(var i=0;i<group.Data.length;++i)
|
|
57630
|
+
{
|
|
57631
|
+
var item=group.Data[i];
|
|
57632
|
+
var config=item.ColorConfig;
|
|
57633
|
+
|
|
57634
|
+
var color=null;
|
|
57635
|
+
if (config.BGColor) color=config.BGColor;
|
|
57636
|
+
else if (config.Color) color=config.Color;
|
|
57637
|
+
|
|
57638
|
+
if (config.Name) aryText.push({ Text:`${config.Name}:`, Color:color });
|
|
57639
|
+
|
|
57640
|
+
var value=item.Data.Value;
|
|
57641
|
+
if (IFrameSplitOperator.IsString(item.Data.Value)) value=ChartData.GetKValue(kItem, item.Data.Value);
|
|
57642
|
+
|
|
57643
|
+
var value2=item.Data.Value2;
|
|
57644
|
+
if (IFrameSplitOperator.IsString(item.Data.Value2)) value2=ChartData.GetKValue(kItem, item.Data.Value2);
|
|
57645
|
+
aryText.push({ Text:`[${this.FormatValue(value, dataInfo)}, ${this.FormatValue(value2, dataInfo)}] `, Color:color});
|
|
57646
|
+
}
|
|
57647
|
+
|
|
57648
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryText)) return null;
|
|
57649
|
+
|
|
57650
|
+
return aryText;
|
|
57651
|
+
}
|
|
57652
|
+
|
|
57505
57653
|
this.FormatVPVRTitle=function(pt, dataInfo)
|
|
57506
57654
|
{
|
|
57507
57655
|
var chart=dataInfo.Chart;
|
|
@@ -57845,6 +57993,12 @@ function DynamicChartTitlePainting()
|
|
|
57845
57993
|
if (!aryText) return null;
|
|
57846
57994
|
return { Text:null, ArrayText:aryText };
|
|
57847
57995
|
}
|
|
57996
|
+
else if (item.DataType=="ChartMultiBar")
|
|
57997
|
+
{
|
|
57998
|
+
aryText=this.ForamtMultiBarTitle(dataIndex, item);
|
|
57999
|
+
if (!aryText) return null;
|
|
58000
|
+
return { Text:null, ArrayText:aryText };
|
|
58001
|
+
}
|
|
57848
58002
|
|
|
57849
58003
|
value=item.Data.Data[dataIndex];
|
|
57850
58004
|
|
|
@@ -58270,6 +58424,11 @@ function DynamicChartTitlePainting()
|
|
|
58270
58424
|
aryText=this.ForamtMultiPointTitle(dataIndex, item);
|
|
58271
58425
|
if (!aryText) continue;
|
|
58272
58426
|
}
|
|
58427
|
+
else if (item.DataType=="ChartMultiBar")
|
|
58428
|
+
{
|
|
58429
|
+
aryText=this.ForamtMultiBarTitle(dataIndex, item);
|
|
58430
|
+
if (!aryText) continue;
|
|
58431
|
+
}
|
|
58273
58432
|
else
|
|
58274
58433
|
{
|
|
58275
58434
|
valueText=this.FormatValue(value,item);
|