hqchart 1.1.14340 → 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 +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 +344 -177
- package/src/jscommon/umychart.testdata.js +69 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +377 -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 +377 -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
|
-
|
|
40530
|
-
|
|
40531
|
-
var y=Math.min(item.Y,item.Y2);
|
|
40532
|
-
var barWidth=bar.Width;
|
|
40533
|
-
var barHeight=Math.abs(item.Y-item.Y2);
|
|
40534
|
-
this.Canvas.beginPath();
|
|
40535
|
-
if (this.IsHScreen)
|
|
40536
|
-
this.Canvas.rect(ToFixedPoint(y),ToFixedPoint(x),ToFixedRect(barHeight),ToFixedRect(barWidth));
|
|
40537
|
-
else
|
|
40538
|
-
this.Canvas.rect(ToFixedPoint(x),ToFixedPoint(y),ToFixedRect(barWidth),ToFixedRect(barHeight));
|
|
40565
|
+
aryBar=mapItem[1].AryBar;
|
|
40566
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryBar)) continue;
|
|
40539
40567
|
|
|
40540
|
-
|
|
40541
|
-
|
|
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
|
+
}
|
|
40542
40591
|
|
|
40543
|
-
|
|
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
|
+
}
|
|
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;
|
|
@@ -41328,18 +41443,16 @@ function ChartMultiText()
|
|
|
41328
41443
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
41329
41444
|
if (this.IsShowIndexTitleOnly()) return;
|
|
41330
41445
|
if (this.IsHideScriptIndex()) return;
|
|
41331
|
-
if (!this.Data || this.Data.
|
|
41332
|
-
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;
|
|
41333
41449
|
|
|
41334
41450
|
this.IsHScreen=(this.ChartFrame.IsHScreen===true);
|
|
41335
41451
|
|
|
41336
|
-
var mapText=this.GetShowTextData();
|
|
41337
|
-
if (mapText.size<=0) return;
|
|
41338
|
-
|
|
41339
41452
|
this.Canvas.save();
|
|
41340
41453
|
this.ClipClient(this.IsHScreen);
|
|
41341
41454
|
|
|
41342
|
-
this.DrawAllText(
|
|
41455
|
+
this.DrawAllText();
|
|
41343
41456
|
|
|
41344
41457
|
this.Canvas.restore();
|
|
41345
41458
|
}
|
|
@@ -41349,21 +41462,29 @@ function ChartMultiText()
|
|
|
41349
41462
|
var range={ Min:null, Max:null };
|
|
41350
41463
|
if (!this.Texts) return range;
|
|
41351
41464
|
|
|
41465
|
+
if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return range;
|
|
41466
|
+
if (!this.MapCache || this.MapCache.size<=0) return range;
|
|
41352
41467
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
41353
|
-
var start=this.Data.DataOffset;
|
|
41354
|
-
var end=start+xPointCount;
|
|
41355
41468
|
|
|
41356
|
-
for(var i
|
|
41469
|
+
for(var i=this.Data.DataOffset,j=0, k=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
|
|
41357
41470
|
{
|
|
41358
|
-
var
|
|
41359
|
-
|
|
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;
|
|
41360
41476
|
|
|
41361
|
-
|
|
41477
|
+
for(k=0;k<mapItem.Data.length;++k)
|
|
41362
41478
|
{
|
|
41363
|
-
|
|
41364
|
-
|
|
41365
|
-
if (
|
|
41366
|
-
|
|
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;
|
|
41367
41488
|
}
|
|
41368
41489
|
}
|
|
41369
41490
|
|
|
@@ -41880,7 +42001,7 @@ function ChartMultiHtmlDom()
|
|
|
41880
42001
|
}
|
|
41881
42002
|
}
|
|
41882
42003
|
|
|
41883
|
-
//绘制SVG图标
|
|
42004
|
+
//绘制SVG图标 2.0
|
|
41884
42005
|
function ChartDrawSVG()
|
|
41885
42006
|
{
|
|
41886
42007
|
this.newMethod=IChartPainting; //派生
|
|
@@ -57494,6 +57615,41 @@ function DynamicChartTitlePainting()
|
|
|
57494
57615
|
return aryText;
|
|
57495
57616
|
}
|
|
57496
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
|
+
|
|
57497
57653
|
this.FormatVPVRTitle=function(pt, dataInfo)
|
|
57498
57654
|
{
|
|
57499
57655
|
var chart=dataInfo.Chart;
|
|
@@ -57837,6 +57993,12 @@ function DynamicChartTitlePainting()
|
|
|
57837
57993
|
if (!aryText) return null;
|
|
57838
57994
|
return { Text:null, ArrayText:aryText };
|
|
57839
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
|
+
}
|
|
57840
58002
|
|
|
57841
58003
|
value=item.Data.Data[dataIndex];
|
|
57842
58004
|
|
|
@@ -58262,6 +58424,11 @@ function DynamicChartTitlePainting()
|
|
|
58262
58424
|
aryText=this.ForamtMultiPointTitle(dataIndex, item);
|
|
58263
58425
|
if (!aryText) continue;
|
|
58264
58426
|
}
|
|
58427
|
+
else if (item.DataType=="ChartMultiBar")
|
|
58428
|
+
{
|
|
58429
|
+
aryText=this.ForamtMultiBarTitle(dataIndex, item);
|
|
58430
|
+
if (!aryText) continue;
|
|
58431
|
+
}
|
|
58265
58432
|
else
|
|
58266
58433
|
{
|
|
58267
58434
|
valueText=this.FormatValue(value,item);
|