hqchart 1.1.14340 → 1.1.14354
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 +60 -53
- 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 +343 -177
- package/src/jscommon/umychart.testdata.js +69 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +376 -214
- 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 +376 -214
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
|
|
|
@@ -40411,159 +40417,285 @@ function ChartMultiBar()
|
|
|
40411
40417
|
delete this.newMethod;
|
|
40412
40418
|
|
|
40413
40419
|
this.ClassName="ChartMultiBar";
|
|
40414
|
-
this.Bars=[]; // [ {Point:[ {
|
|
40420
|
+
this.Bars=[]; // [ {Point:[ {Date, Time, Value, Value2 }, ], Color:, Width: , Type: 0 实心 1 空心 }, ]
|
|
40415
40421
|
this.IsHScreen=false;
|
|
40416
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
|
+
|
|
40417
40470
|
this.Draw=function()
|
|
40418
40471
|
{
|
|
40419
40472
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
40420
40473
|
if (this.IsShowIndexTitleOnly()) return;
|
|
40421
40474
|
if (this.IsHideScriptIndex()) return;
|
|
40422
|
-
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;
|
|
40423
40478
|
|
|
40424
40479
|
this.IsHScreen=(this.ChartFrame.IsHScreen===true);
|
|
40425
40480
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
40426
|
-
var offset=this.Data.DataOffset;
|
|
40427
40481
|
var dataWidth=this.ChartFrame.DataWidth;
|
|
40428
|
-
var
|
|
40482
|
+
var distanceWidth=this.ChartFrame.DistanceWidth;
|
|
40483
|
+
var isMinute=this.IsMinuteFrame();
|
|
40429
40484
|
|
|
40430
|
-
var
|
|
40431
|
-
|
|
40485
|
+
var border=this.GetBorder();
|
|
40486
|
+
if (this.IsHScreen)
|
|
40432
40487
|
{
|
|
40433
|
-
var
|
|
40434
|
-
var
|
|
40435
|
-
|
|
40436
|
-
if (item.Width>0)
|
|
40437
|
-
{
|
|
40438
|
-
drawPoints.Width=item.Width*pixelRatio;
|
|
40439
|
-
if (drawPoints.Width>dataWidth) drawPoints.Width=dataWidth;
|
|
40440
|
-
}
|
|
40441
|
-
else
|
|
40442
|
-
{
|
|
40443
|
-
if(drawPoints.Width<4) drawPoints.Width=1*pixelRatio;
|
|
40444
|
-
}
|
|
40445
|
-
|
|
40446
|
-
for(var j in item.Point)
|
|
40447
|
-
{
|
|
40448
|
-
var point=item.Point[j];
|
|
40449
|
-
if (!IFrameSplitOperator.IsNumber(point.Index)) continue;
|
|
40450
|
-
|
|
40451
|
-
var index=point.Index-offset;
|
|
40452
|
-
if (index>=0 && index<xPointCount)
|
|
40453
|
-
{
|
|
40454
|
-
var x=this.ChartFrame.GetXFromIndex(index);
|
|
40455
|
-
var y=this.ChartFrame.GetYFromData(point.Value);
|
|
40456
|
-
var y2=this.ChartFrame.GetYFromData(point.Value2);
|
|
40457
|
-
drawPoints.Point.push({X:x, Y:y, Y2:y2});
|
|
40458
|
-
}
|
|
40459
|
-
}
|
|
40460
|
-
|
|
40461
|
-
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;
|
|
40462
40491
|
}
|
|
40463
|
-
|
|
40464
|
-
for(var i in drawBars)
|
|
40492
|
+
else
|
|
40465
40493
|
{
|
|
40466
|
-
var
|
|
40467
|
-
|
|
40468
|
-
|
|
40469
|
-
if (item.Type==1) this.DrawHollowBar(item);
|
|
40470
|
-
else this.DrawFillBar(item);
|
|
40471
|
-
}
|
|
40472
|
-
else
|
|
40473
|
-
{
|
|
40474
|
-
this.DrawLineBar(item);
|
|
40475
|
-
}
|
|
40494
|
+
var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
40495
|
+
var chartright=border.RightEx;
|
|
40496
|
+
var chartLeft=border.LeftEx;
|
|
40476
40497
|
}
|
|
40477
|
-
}
|
|
40478
40498
|
|
|
40479
|
-
|
|
40480
|
-
|
|
40481
|
-
this.
|
|
40482
|
-
var backupLineWidth=this.Canvas.lineWidth;
|
|
40483
|
-
this.Canvas.lineWidth=bar.Width;
|
|
40484
|
-
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))
|
|
40485
40502
|
{
|
|
40486
|
-
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;
|
|
40487
40508
|
|
|
40488
|
-
|
|
40489
|
-
if (this.IsHScreen)
|
|
40509
|
+
if (isMinute)
|
|
40490
40510
|
{
|
|
40491
|
-
this.
|
|
40492
|
-
this.Canvas.lineTo(ToFixedPoint(item.Y2),ToFixedPoint(item.X));
|
|
40511
|
+
var x=this.ChartFrame.GetXFromIndex(j);
|
|
40493
40512
|
}
|
|
40494
40513
|
else
|
|
40495
40514
|
{
|
|
40496
|
-
|
|
40497
|
-
|
|
40515
|
+
var left=xOffset;
|
|
40516
|
+
var right=xOffset+dataWidth;
|
|
40517
|
+
if (right>chartright) break;
|
|
40518
|
+
var x=left+(right-left)/2;
|
|
40498
40519
|
}
|
|
40499
|
-
|
|
40500
|
-
this.
|
|
40520
|
+
|
|
40521
|
+
this.CalculateItem(mapItem, kItem, x, mapBar);
|
|
40501
40522
|
}
|
|
40502
40523
|
|
|
40503
|
-
|
|
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();
|
|
40504
40532
|
}
|
|
40505
40533
|
|
|
40506
|
-
this.
|
|
40534
|
+
this.CalculateItem=function(groupItem, kItem, x, mapBar)
|
|
40507
40535
|
{
|
|
40508
|
-
|
|
40509
|
-
for(var i in bar.Point)
|
|
40536
|
+
for(var i=0; i<groupItem.Data.length; ++i)
|
|
40510
40537
|
{
|
|
40511
|
-
var item=
|
|
40512
|
-
var
|
|
40513
|
-
|
|
40514
|
-
|
|
40515
|
-
|
|
40516
|
-
|
|
40517
|
-
|
|
40518
|
-
|
|
40519
|
-
|
|
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 });
|
|
40520
40555
|
}
|
|
40521
40556
|
}
|
|
40522
40557
|
|
|
40523
|
-
|
|
40558
|
+
|
|
40559
|
+
this.DrawAllBar=function(mapBar)
|
|
40524
40560
|
{
|
|
40525
|
-
|
|
40526
|
-
|
|
40527
|
-
for(var
|
|
40561
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
40562
|
+
|
|
40563
|
+
for(var mapItem of mapBar)
|
|
40528
40564
|
{
|
|
40529
|
-
var
|
|
40530
|
-
|
|
40531
|
-
|
|
40532
|
-
var
|
|
40533
|
-
var
|
|
40565
|
+
var aryBar=mapItem[1].AryBar;
|
|
40566
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryBar)) continue;
|
|
40567
|
+
|
|
40568
|
+
var config=null;
|
|
40569
|
+
var path=new Path2D();
|
|
40570
|
+
var count=0;
|
|
40571
|
+
var drawType=-1; //1=直线 2=实心 3=空心
|
|
40572
|
+
var barWidth=1;
|
|
40534
40573
|
this.Canvas.beginPath();
|
|
40535
|
-
|
|
40536
|
-
|
|
40537
|
-
|
|
40538
|
-
|
|
40574
|
+
for(var i=0;i<aryBar.length;++i)
|
|
40575
|
+
{
|
|
40576
|
+
var item=aryBar[i];
|
|
40577
|
+
if (!config)
|
|
40578
|
+
{
|
|
40579
|
+
config=item.Data.ColorConfig;
|
|
40580
|
+
barWidth=config.Width*pixelRatio;
|
|
40581
|
+
if (barWidth>4)
|
|
40582
|
+
{
|
|
40583
|
+
if (config.Type==0) drawType=2; //实心
|
|
40584
|
+
else if (config.Type==1) drawType=3; //空心
|
|
40585
|
+
else continue;
|
|
40586
|
+
}
|
|
40587
|
+
else //太细了, 直线
|
|
40588
|
+
{
|
|
40589
|
+
drawType=1;
|
|
40590
|
+
}
|
|
40591
|
+
}
|
|
40539
40592
|
|
|
40540
|
-
|
|
40541
|
-
}
|
|
40593
|
+
if (drawType<=0) continue;
|
|
40542
40594
|
|
|
40543
|
-
|
|
40595
|
+
if (drawType==1)
|
|
40596
|
+
{
|
|
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
|
+
}
|
|
40544
40666
|
}
|
|
40545
40667
|
|
|
40546
40668
|
this.GetMaxMin=function()
|
|
40547
40669
|
{
|
|
40548
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;
|
|
40549
40673
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
40550
|
-
|
|
40551
|
-
var
|
|
40552
|
-
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)
|
|
40553
40676
|
{
|
|
40554
|
-
var
|
|
40555
|
-
|
|
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)
|
|
40556
40684
|
{
|
|
40557
|
-
var
|
|
40558
|
-
|
|
40559
|
-
|
|
40560
|
-
|
|
40561
|
-
|
|
40562
|
-
|
|
40563
|
-
|
|
40564
|
-
|
|
40565
|
-
|
|
40566
|
-
|
|
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;
|
|
40567
40699
|
}
|
|
40568
40700
|
}
|
|
40569
40701
|
|
|
@@ -40905,7 +41037,7 @@ function ChartMultiLine()
|
|
|
40905
41037
|
}
|
|
40906
41038
|
}
|
|
40907
41039
|
|
|
40908
|
-
// 多个点集合 支持横屏
|
|
41040
|
+
// 多个点集合2.0 支持横屏
|
|
40909
41041
|
function ChartMultiPoint()
|
|
40910
41042
|
{
|
|
40911
41043
|
this.newMethod=IChartPainting; //派生
|
|
@@ -40923,12 +41055,6 @@ function ChartMultiPoint()
|
|
|
40923
41055
|
this.MapCache=null; //key=date/date-time value={ Data:[] }
|
|
40924
41056
|
this.GetKValue=ChartData.GetKValue;
|
|
40925
41057
|
|
|
40926
|
-
this.BuildKey=function(item)
|
|
40927
|
-
{
|
|
40928
|
-
if (IFrameSplitOperator.IsNumber(item.Time)) return `${item.Date}-${item.Time}`;
|
|
40929
|
-
else return item.Date;
|
|
40930
|
-
}
|
|
40931
|
-
|
|
40932
41058
|
this.GetItem=function(kItem)
|
|
40933
41059
|
{
|
|
40934
41060
|
if (!this.MapCache || this.MapCache.size<=0) return null;
|
|
@@ -40952,6 +41078,7 @@ function ChartMultiPoint()
|
|
|
40952
41078
|
|
|
40953
41079
|
var clrConfig= { Color:groupItem.Color, BGColor:groupItem.BGColor, LineWidth:this.LineWidth, Radius:this.PointRadius, Name:groupItem.Name };
|
|
40954
41080
|
if (IFrameSplitOperator.IsNumber(groupItem.PointRadius)) clrConfig.Radius=groupItem.PointRadius;
|
|
41081
|
+
if (IFrameSplitOperator.IsNumber(groupItem.LineWidth)) clrConfig.LineWidth=groupItem.LineWidth;
|
|
40955
41082
|
|
|
40956
41083
|
for(var j=0; j<groupItem.Point.length; ++j)
|
|
40957
41084
|
{
|
|
@@ -41104,7 +41231,7 @@ function ChartMultiPoint()
|
|
|
41104
41231
|
{
|
|
41105
41232
|
var range={ Min:null, Max:null };
|
|
41106
41233
|
if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return range;
|
|
41107
|
-
if (!this.MapCache || this.MapCache.size<=0) return;
|
|
41234
|
+
if (!this.MapCache || this.MapCache.size<=0) return range;
|
|
41108
41235
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
41109
41236
|
|
|
41110
41237
|
for(var i=this.Data.DataOffset,j=0, k=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
|
|
@@ -41133,7 +41260,7 @@ function ChartMultiPoint()
|
|
|
41133
41260
|
}
|
|
41134
41261
|
}
|
|
41135
41262
|
|
|
41136
|
-
// 多文本集合 支持横屏
|
|
41263
|
+
// 多文本集合2.0 支持横屏
|
|
41137
41264
|
function ChartMultiText()
|
|
41138
41265
|
{
|
|
41139
41266
|
this.newMethod=IChartPainting; //派生
|
|
@@ -41141,58 +41268,38 @@ function ChartMultiText()
|
|
|
41141
41268
|
delete this.newMethod;
|
|
41142
41269
|
|
|
41143
41270
|
this.ClassName="ChartMultiText";
|
|
41144
|
-
this.Texts=[]; //[ {
|
|
41271
|
+
this.Texts=[]; //[ {Date:, Time, Value:, Text:, Color:, Font: , Baseline:, Line:{ Color:, Dash:[虚线点], KData:"H/L", Offset:[5,10], Width:线粗细 }} ]
|
|
41145
41272
|
this.Font=g_JSChartResource.DefaultTextFont;
|
|
41146
41273
|
this.Color=g_JSChartResource.DefaultTextColor;
|
|
41147
41274
|
this.IsHScreen=false; //是否横屏
|
|
41148
41275
|
|
|
41149
|
-
this.
|
|
41150
|
-
|
|
41151
|
-
if (IFrameSplitOperator.IsNumber(item.Time))
|
|
41152
|
-
{
|
|
41153
|
-
var key=`${item.Date}-${item.Time}`;
|
|
41154
|
-
}
|
|
41155
|
-
else
|
|
41156
|
-
{
|
|
41157
|
-
var key=`${item.Date}`;
|
|
41158
|
-
}
|
|
41159
|
-
|
|
41160
|
-
return key;
|
|
41161
|
-
}
|
|
41276
|
+
this.MapCache=null; //key=date/date-time value={ Data:[] }
|
|
41277
|
+
this.GetKValue=ChartData.GetKValue;
|
|
41162
41278
|
|
|
41163
|
-
this.
|
|
41279
|
+
this.BuildCacheData=function()
|
|
41164
41280
|
{
|
|
41165
|
-
var
|
|
41166
|
-
|
|
41281
|
+
var mapData=new Map();
|
|
41282
|
+
this.MapCache=mapData;
|
|
41283
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.Texts)) return;
|
|
41167
41284
|
|
|
41168
|
-
var
|
|
41169
|
-
for(var i=0; i<this.Texts.length; ++i)
|
|
41285
|
+
for(var i=0;i<this.Texts.length;++i)
|
|
41170
41286
|
{
|
|
41171
41287
|
var item=this.Texts[i];
|
|
41172
|
-
|
|
41173
|
-
if (
|
|
41174
|
-
|
|
41175
|
-
var index=item.Index-offset;
|
|
41176
|
-
if (index>=0 && index<xPointCount)
|
|
41288
|
+
var key=this.BuildKey(item);
|
|
41289
|
+
if (mapData.has(key))
|
|
41177
41290
|
{
|
|
41178
|
-
var
|
|
41179
|
-
|
|
41180
|
-
|
|
41181
|
-
|
|
41182
|
-
|
|
41183
|
-
}
|
|
41184
|
-
else
|
|
41185
|
-
{
|
|
41186
|
-
var textItem={ Data:[item] };
|
|
41187
|
-
mapText.set(key, textItem);
|
|
41188
|
-
}
|
|
41291
|
+
var mapItem=mapData.get(key);
|
|
41292
|
+
mapItem.Data.push(item);
|
|
41293
|
+
}
|
|
41294
|
+
else
|
|
41295
|
+
{
|
|
41296
|
+
mapData.set(key,{ Data:[item] });
|
|
41189
41297
|
}
|
|
41190
41298
|
}
|
|
41191
|
-
|
|
41192
|
-
return mapText;
|
|
41193
41299
|
}
|
|
41194
41300
|
|
|
41195
|
-
|
|
41301
|
+
|
|
41302
|
+
this.DrawAllText=function()
|
|
41196
41303
|
{
|
|
41197
41304
|
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
41198
41305
|
var isMinute=this.IsMinuteFrame();
|
|
@@ -41229,21 +41336,29 @@ function ChartMultiText()
|
|
|
41229
41336
|
if (!kItem) continue;
|
|
41230
41337
|
|
|
41231
41338
|
var key=this.BuildKey(kItem);
|
|
41232
|
-
if (!
|
|
41339
|
+
if (!this.MapCache.has(key)) continue;
|
|
41340
|
+
var mapItem=this.MapCache.get(key);
|
|
41341
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
|
|
41233
41342
|
|
|
41234
41343
|
var left=xOffset;
|
|
41235
41344
|
var right=xOffset+dataWidth;
|
|
41236
41345
|
if (right>chartright) break;
|
|
41237
41346
|
var x=left+(right-left)/2;
|
|
41238
41347
|
|
|
41239
|
-
var
|
|
41240
|
-
for(var k=0;k<textItem.Data.length;++k)
|
|
41348
|
+
for(var k=0;k<mapItem.Data.length;++k)
|
|
41241
41349
|
{
|
|
41242
|
-
var item=
|
|
41350
|
+
var item=mapItem.Data[k];
|
|
41243
41351
|
var y=top;
|
|
41244
41352
|
if (item.Value=="TOP") y=top;
|
|
41245
41353
|
else if (item.Value=="BOTTOM") y=bottom;
|
|
41246
|
-
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
|
+
|
|
41247
41362
|
|
|
41248
41363
|
if (item.Color) this.Canvas.fillStyle = item.Color;
|
|
41249
41364
|
else this.Canvas.fillStyle = this.Color;
|
|
@@ -41283,7 +41398,6 @@ function ChartMultiText()
|
|
|
41283
41398
|
|
|
41284
41399
|
if (item.Line)
|
|
41285
41400
|
{
|
|
41286
|
-
var kItem=this.Data.Data[item.Index];
|
|
41287
41401
|
var price=item.Line.KData=="H"? kItem.High:kItem.Low;
|
|
41288
41402
|
var yPrice=this.ChartFrame.GetYFromData(price, false);
|
|
41289
41403
|
var yText=y;
|
|
@@ -41328,18 +41442,16 @@ function ChartMultiText()
|
|
|
41328
41442
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
41329
41443
|
if (this.IsShowIndexTitleOnly()) return;
|
|
41330
41444
|
if (this.IsHideScriptIndex()) return;
|
|
41331
|
-
if (!this.Data || this.Data.
|
|
41332
|
-
if (!this.Texts) return;
|
|
41445
|
+
if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return; //k线数据
|
|
41446
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.Texts)) return;
|
|
41447
|
+
if (!this.MapCache || this.MapCache.size<=0) return;
|
|
41333
41448
|
|
|
41334
41449
|
this.IsHScreen=(this.ChartFrame.IsHScreen===true);
|
|
41335
41450
|
|
|
41336
|
-
var mapText=this.GetShowTextData();
|
|
41337
|
-
if (mapText.size<=0) return;
|
|
41338
|
-
|
|
41339
41451
|
this.Canvas.save();
|
|
41340
41452
|
this.ClipClient(this.IsHScreen);
|
|
41341
41453
|
|
|
41342
|
-
this.DrawAllText(
|
|
41454
|
+
this.DrawAllText();
|
|
41343
41455
|
|
|
41344
41456
|
this.Canvas.restore();
|
|
41345
41457
|
}
|
|
@@ -41349,21 +41461,29 @@ function ChartMultiText()
|
|
|
41349
41461
|
var range={ Min:null, Max:null };
|
|
41350
41462
|
if (!this.Texts) return range;
|
|
41351
41463
|
|
|
41464
|
+
if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return range;
|
|
41465
|
+
if (!this.MapCache || this.MapCache.size<=0) return range;
|
|
41352
41466
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
41353
|
-
var start=this.Data.DataOffset;
|
|
41354
|
-
var end=start+xPointCount;
|
|
41355
41467
|
|
|
41356
|
-
for(var i
|
|
41468
|
+
for(var i=this.Data.DataOffset,j=0, k=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
|
|
41357
41469
|
{
|
|
41358
|
-
var
|
|
41359
|
-
|
|
41470
|
+
var kItem=this.Data.Data[i];
|
|
41471
|
+
var key=this.BuildKey(kItem);
|
|
41472
|
+
if (!this.MapCache.has(key)) continue;
|
|
41473
|
+
var mapItem=this.MapCache.get(key);
|
|
41474
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
|
|
41360
41475
|
|
|
41361
|
-
|
|
41476
|
+
for(k=0;k<mapItem.Data.length;++k)
|
|
41362
41477
|
{
|
|
41363
|
-
|
|
41364
|
-
|
|
41365
|
-
if (
|
|
41366
|
-
|
|
41478
|
+
var item=mapItem.Data[k];
|
|
41479
|
+
var value=item.Value;
|
|
41480
|
+
if (IFrameSplitOperator.IsString(item.Value)) value=this.GetKValue(kItem,item.Value);
|
|
41481
|
+
if (!IFrameSplitOperator.IsNumber(value)) continue;
|
|
41482
|
+
|
|
41483
|
+
if (range.Max==null) range.Max=value;
|
|
41484
|
+
else if (range.Max<value) range.Max=value;
|
|
41485
|
+
if (range.Min==null) range.Min=value;
|
|
41486
|
+
else if (range.Min>value) range.Min=value;
|
|
41367
41487
|
}
|
|
41368
41488
|
}
|
|
41369
41489
|
|
|
@@ -41880,7 +42000,7 @@ function ChartMultiHtmlDom()
|
|
|
41880
42000
|
}
|
|
41881
42001
|
}
|
|
41882
42002
|
|
|
41883
|
-
//绘制SVG图标
|
|
42003
|
+
//绘制SVG图标 2.0
|
|
41884
42004
|
function ChartDrawSVG()
|
|
41885
42005
|
{
|
|
41886
42006
|
this.newMethod=IChartPainting; //派生
|
|
@@ -57494,6 +57614,41 @@ function DynamicChartTitlePainting()
|
|
|
57494
57614
|
return aryText;
|
|
57495
57615
|
}
|
|
57496
57616
|
|
|
57617
|
+
this.ForamtMultiBarTitle=function(dataIndex, dataInfo)
|
|
57618
|
+
{
|
|
57619
|
+
if (!dataInfo.GetItemCallback) return null;
|
|
57620
|
+
if (!dataInfo.Data || !IFrameSplitOperator.IsNonEmptyArray(dataInfo.Data.Data)) return null;
|
|
57621
|
+
var kItem=dataInfo.Data.Data[dataIndex];
|
|
57622
|
+
if (!kItem) return null;
|
|
57623
|
+
|
|
57624
|
+
var group=dataInfo.GetItemCallback(kItem);
|
|
57625
|
+
if (!group || !IFrameSplitOperator.IsNonEmptyArray(group.Data)) return null;
|
|
57626
|
+
|
|
57627
|
+
var aryText=[];
|
|
57628
|
+
for(var i=0;i<group.Data.length;++i)
|
|
57629
|
+
{
|
|
57630
|
+
var item=group.Data[i];
|
|
57631
|
+
var config=item.ColorConfig;
|
|
57632
|
+
|
|
57633
|
+
var color=null;
|
|
57634
|
+
if (config.BGColor) color=config.BGColor;
|
|
57635
|
+
else if (config.Color) color=config.Color;
|
|
57636
|
+
|
|
57637
|
+
if (config.Name) aryText.push({ Text:`${config.Name}:`, Color:color });
|
|
57638
|
+
|
|
57639
|
+
var value=item.Data.Value;
|
|
57640
|
+
if (IFrameSplitOperator.IsString(item.Data.Value)) value=ChartData.GetKValue(kItem, item.Data.Value);
|
|
57641
|
+
|
|
57642
|
+
var value2=item.Data.Value2;
|
|
57643
|
+
if (IFrameSplitOperator.IsString(item.Data.Value2)) value2=ChartData.GetKValue(kItem, item.Data.Value2);
|
|
57644
|
+
aryText.push({ Text:`[${this.FormatValue(value, dataInfo)}, ${this.FormatValue(value2, dataInfo)}] `, Color:color});
|
|
57645
|
+
}
|
|
57646
|
+
|
|
57647
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryText)) return null;
|
|
57648
|
+
|
|
57649
|
+
return aryText;
|
|
57650
|
+
}
|
|
57651
|
+
|
|
57497
57652
|
this.FormatVPVRTitle=function(pt, dataInfo)
|
|
57498
57653
|
{
|
|
57499
57654
|
var chart=dataInfo.Chart;
|
|
@@ -57837,6 +57992,12 @@ function DynamicChartTitlePainting()
|
|
|
57837
57992
|
if (!aryText) return null;
|
|
57838
57993
|
return { Text:null, ArrayText:aryText };
|
|
57839
57994
|
}
|
|
57995
|
+
else if (item.DataType=="ChartMultiBar")
|
|
57996
|
+
{
|
|
57997
|
+
aryText=this.ForamtMultiBarTitle(dataIndex, item);
|
|
57998
|
+
if (!aryText) return null;
|
|
57999
|
+
return { Text:null, ArrayText:aryText };
|
|
58000
|
+
}
|
|
57840
58001
|
|
|
57841
58002
|
value=item.Data.Data[dataIndex];
|
|
57842
58003
|
|
|
@@ -58262,6 +58423,11 @@ function DynamicChartTitlePainting()
|
|
|
58262
58423
|
aryText=this.ForamtMultiPointTitle(dataIndex, item);
|
|
58263
58424
|
if (!aryText) continue;
|
|
58264
58425
|
}
|
|
58426
|
+
else if (item.DataType=="ChartMultiBar")
|
|
58427
|
+
{
|
|
58428
|
+
aryText=this.ForamtMultiBarTitle(dataIndex, item);
|
|
58429
|
+
if (!aryText) continue;
|
|
58430
|
+
}
|
|
58265
58431
|
else
|
|
58266
58432
|
{
|
|
58267
58433
|
valueText=this.FormatValue(value,item);
|