victory-group 37.1.2 → 37.3.0
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/CHANGELOG.md +8 -0
- package/dist/victory-group.js +278 -155
- package/dist/victory-group.min.js +1 -1
- package/es/helper-methods.js +3 -2
- package/lib/helper-methods.js +3 -2
- package/package.json +3 -3
- package/src/helper-methods.tsx +2 -2
package/dist/victory-group.js
CHANGED
|
@@ -227,14 +227,15 @@ function getChildren(initialProps, childComponents, calculatedProps) {
|
|
|
227
227
|
} = newCalculatedProps;
|
|
228
228
|
const {
|
|
229
229
|
labelComponent,
|
|
230
|
-
polar
|
|
230
|
+
polar,
|
|
231
|
+
theme
|
|
231
232
|
} = props;
|
|
232
233
|
const childProps = getChildProps(props, newCalculatedProps);
|
|
233
234
|
const parentName = props.name || "group";
|
|
234
235
|
return children.map((child, index) => {
|
|
235
236
|
const role = child.type && child.type.role;
|
|
236
237
|
const xOffset = polar ? getPolarX0(props, newCalculatedProps, index, role) : getX0(props, newCalculatedProps, index, role);
|
|
237
|
-
const style = role === "voronoi" || role === "tooltip" || role === "label" ? child.props.style : victory_core__WEBPACK_IMPORTED_MODULE_3__.getChildStyle(child, index, newCalculatedProps);
|
|
238
|
+
const style = role === "voronoi" || role === "tooltip" || role === "label" ? child.props.style : victory_core__WEBPACK_IMPORTED_MODULE_3__.getChildStyle(child, index, newCalculatedProps, theme);
|
|
238
239
|
const labels = props.labels ? getLabels(props, datasets, index) : child.props.labels;
|
|
239
240
|
const name = child.props.name || `${parentName}-${role}-${index}`;
|
|
240
241
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(child, Object.assign({
|
|
@@ -5310,20 +5311,16 @@ const orange = {
|
|
|
5310
5311
|
"100": "#FEE2D5",
|
|
5311
5312
|
"300": "#FFA981",
|
|
5312
5313
|
"500": "#FF6F2C",
|
|
5314
|
+
"700": "#FF4E1B",
|
|
5313
5315
|
"900": "#D74D26"
|
|
5314
5316
|
};
|
|
5315
5317
|
const red = {
|
|
5316
5318
|
"100": "#FFDCE5",
|
|
5317
5319
|
"300": "#FF9EB7",
|
|
5318
5320
|
"500": "#F82B60",
|
|
5321
|
+
"700": "#D31A3D",
|
|
5319
5322
|
"900": "#BA1E45"
|
|
5320
5323
|
};
|
|
5321
|
-
const pink = {
|
|
5322
|
-
"100": "#FFDAF6",
|
|
5323
|
-
"300": "#F99DE2",
|
|
5324
|
-
"500": "#FF08C2",
|
|
5325
|
-
"900": "#B2158B"
|
|
5326
|
-
};
|
|
5327
5324
|
const purple = {
|
|
5328
5325
|
"100": "#EDE3FE",
|
|
5329
5326
|
"300": "#CDB0FF",
|
|
@@ -5334,6 +5331,7 @@ const blue = {
|
|
|
5334
5331
|
"100": "#CFDFFF",
|
|
5335
5332
|
"300": "#9CC7FF",
|
|
5336
5333
|
"500": "#2D7FF9",
|
|
5334
|
+
"700": "#0056B3",
|
|
5337
5335
|
"900": "#2750AE"
|
|
5338
5336
|
};
|
|
5339
5337
|
const cyan = {
|
|
@@ -5352,9 +5350,29 @@ const green = {
|
|
|
5352
5350
|
"100": "#D1F7C4",
|
|
5353
5351
|
"300": "#93E088",
|
|
5354
5352
|
"500": "#20C933",
|
|
5353
|
+
"700": "#1B9B2A",
|
|
5355
5354
|
"900": "#338A17"
|
|
5356
5355
|
};
|
|
5357
|
-
const colors =
|
|
5356
|
+
const colors = {
|
|
5357
|
+
blue: blue["500"],
|
|
5358
|
+
cyan: cyan["500"],
|
|
5359
|
+
green: green["500"],
|
|
5360
|
+
yellow: yellow["500"],
|
|
5361
|
+
orange: orange["500"],
|
|
5362
|
+
red: red["500"],
|
|
5363
|
+
purple: purple["500"],
|
|
5364
|
+
teal: teal["500"]
|
|
5365
|
+
};
|
|
5366
|
+
const colorScale = Object.values(colors);
|
|
5367
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
5368
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
5369
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
5370
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
5371
|
+
const redPalette = Object.values(red);
|
|
5372
|
+
const greenPalette = Object.values(green);
|
|
5373
|
+
const bluePalette = Object.values(blue);
|
|
5374
|
+
const defaultColor = blue["500"];
|
|
5375
|
+
|
|
5358
5376
|
// *
|
|
5359
5377
|
// * Typography
|
|
5360
5378
|
// *
|
|
@@ -5368,8 +5386,8 @@ const padding = 8;
|
|
|
5368
5386
|
const baseProps = {
|
|
5369
5387
|
width: 450,
|
|
5370
5388
|
height: 300,
|
|
5371
|
-
padding:
|
|
5372
|
-
colorScale
|
|
5389
|
+
padding: 60,
|
|
5390
|
+
colorScale
|
|
5373
5391
|
};
|
|
5374
5392
|
// *
|
|
5375
5393
|
// * Labels
|
|
@@ -5398,10 +5416,23 @@ const borderRadius = 1;
|
|
|
5398
5416
|
// * Theme
|
|
5399
5417
|
// *
|
|
5400
5418
|
const clean = {
|
|
5419
|
+
palette: {
|
|
5420
|
+
colors,
|
|
5421
|
+
grayscale,
|
|
5422
|
+
qualitative: colorScale,
|
|
5423
|
+
heatmap,
|
|
5424
|
+
warm,
|
|
5425
|
+
cool,
|
|
5426
|
+
red: redPalette,
|
|
5427
|
+
green: greenPalette,
|
|
5428
|
+
blue: bluePalette
|
|
5429
|
+
},
|
|
5401
5430
|
area: Object.assign({
|
|
5402
5431
|
style: {
|
|
5403
5432
|
data: {
|
|
5404
|
-
fill:
|
|
5433
|
+
fill: defaultColor,
|
|
5434
|
+
strokeWidth: 2,
|
|
5435
|
+
fillOpacity: 0.5
|
|
5405
5436
|
},
|
|
5406
5437
|
labels: baseLabelStyles
|
|
5407
5438
|
}
|
|
@@ -5410,13 +5441,13 @@ const clean = {
|
|
|
5410
5441
|
style: {
|
|
5411
5442
|
axis: {
|
|
5412
5443
|
fill: "transparent",
|
|
5413
|
-
stroke: gray["
|
|
5444
|
+
stroke: gray["500"],
|
|
5414
5445
|
strokeWidth: 1,
|
|
5415
5446
|
strokeLinecap,
|
|
5416
5447
|
strokeLinejoin
|
|
5417
5448
|
},
|
|
5418
5449
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
5419
|
-
padding,
|
|
5450
|
+
padding: 35,
|
|
5420
5451
|
stroke: "transparent"
|
|
5421
5452
|
}),
|
|
5422
5453
|
grid: {
|
|
@@ -5435,10 +5466,10 @@ const clean = {
|
|
|
5435
5466
|
polarAxis: Object.assign({
|
|
5436
5467
|
style: {
|
|
5437
5468
|
axis: {
|
|
5438
|
-
stroke: gray["
|
|
5469
|
+
stroke: gray["500"]
|
|
5439
5470
|
},
|
|
5440
5471
|
grid: {
|
|
5441
|
-
stroke: gray["
|
|
5472
|
+
stroke: gray["400"],
|
|
5442
5473
|
strokeDasharray,
|
|
5443
5474
|
strokeLinecap,
|
|
5444
5475
|
strokeLinejoin,
|
|
@@ -5447,7 +5478,7 @@ const clean = {
|
|
|
5447
5478
|
ticks: {
|
|
5448
5479
|
fill: "transparent",
|
|
5449
5480
|
size: 5,
|
|
5450
|
-
stroke: gray["
|
|
5481
|
+
stroke: gray["400"],
|
|
5451
5482
|
strokeWidth: 1,
|
|
5452
5483
|
strokeLinecap,
|
|
5453
5484
|
strokeLinejoin
|
|
@@ -5458,10 +5489,10 @@ const clean = {
|
|
|
5458
5489
|
polarDependentAxis: Object.assign({
|
|
5459
5490
|
style: {
|
|
5460
5491
|
axis: {
|
|
5461
|
-
stroke: gray["
|
|
5492
|
+
stroke: gray["500"]
|
|
5462
5493
|
},
|
|
5463
5494
|
grid: {
|
|
5464
|
-
stroke: gray["
|
|
5495
|
+
stroke: gray["400"],
|
|
5465
5496
|
strokeDasharray,
|
|
5466
5497
|
strokeLinecap,
|
|
5467
5498
|
strokeLinejoin,
|
|
@@ -5470,7 +5501,7 @@ const clean = {
|
|
|
5470
5501
|
ticks: {
|
|
5471
5502
|
fill: "transparent",
|
|
5472
5503
|
size: 5,
|
|
5473
|
-
stroke: gray["
|
|
5504
|
+
stroke: gray["300"],
|
|
5474
5505
|
strokeWidth: 1,
|
|
5475
5506
|
strokeLinecap,
|
|
5476
5507
|
strokeLinejoin
|
|
@@ -5481,9 +5512,10 @@ const clean = {
|
|
|
5481
5512
|
bar: Object.assign({
|
|
5482
5513
|
style: {
|
|
5483
5514
|
data: {
|
|
5484
|
-
fill:
|
|
5515
|
+
fill: defaultColor,
|
|
5485
5516
|
padding,
|
|
5486
|
-
strokeWidth:
|
|
5517
|
+
strokeWidth: 1,
|
|
5518
|
+
fillOpacity: 0.5
|
|
5487
5519
|
},
|
|
5488
5520
|
labels: baseLabelStyles
|
|
5489
5521
|
},
|
|
@@ -5519,15 +5551,16 @@ const clean = {
|
|
|
5519
5551
|
}),
|
|
5520
5552
|
q1: {
|
|
5521
5553
|
padding,
|
|
5522
|
-
fill:
|
|
5523
|
-
rx: borderRadius
|
|
5554
|
+
fill: colorScale[0],
|
|
5555
|
+
rx: borderRadius,
|
|
5556
|
+
strokeWidth: 2
|
|
5524
5557
|
},
|
|
5525
5558
|
q1Labels: Object.assign({}, baseLabelStyles, {
|
|
5526
5559
|
padding: 3
|
|
5527
5560
|
}),
|
|
5528
5561
|
q3: {
|
|
5529
5562
|
padding,
|
|
5530
|
-
fill:
|
|
5563
|
+
fill: colorScale[1],
|
|
5531
5564
|
rx: borderRadius
|
|
5532
5565
|
},
|
|
5533
5566
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -5548,8 +5581,8 @@ const clean = {
|
|
|
5548
5581
|
})
|
|
5549
5582
|
},
|
|
5550
5583
|
candleColors: {
|
|
5551
|
-
positive:
|
|
5552
|
-
negative:
|
|
5584
|
+
positive: green["500"],
|
|
5585
|
+
negative: red["500"]
|
|
5553
5586
|
},
|
|
5554
5587
|
wickStrokeWidth: 2
|
|
5555
5588
|
}, baseProps),
|
|
@@ -5568,14 +5601,13 @@ const clean = {
|
|
|
5568
5601
|
}
|
|
5569
5602
|
}, baseProps),
|
|
5570
5603
|
group: Object.assign({
|
|
5571
|
-
colorScale
|
|
5604
|
+
colorScale
|
|
5572
5605
|
}, baseProps),
|
|
5573
5606
|
histogram: Object.assign({
|
|
5574
5607
|
style: {
|
|
5575
5608
|
data: {
|
|
5576
5609
|
fill: cyan["500"],
|
|
5577
|
-
|
|
5578
|
-
strokeWidth: 0
|
|
5610
|
+
fillOpacity: 0.5
|
|
5579
5611
|
},
|
|
5580
5612
|
labels: baseLabelStyles
|
|
5581
5613
|
},
|
|
@@ -5586,21 +5618,23 @@ const clean = {
|
|
|
5586
5618
|
}, baseProps),
|
|
5587
5619
|
label: baseLabelStyles,
|
|
5588
5620
|
legend: {
|
|
5589
|
-
colorScale
|
|
5590
|
-
gutter:
|
|
5591
|
-
|
|
5621
|
+
colorScale,
|
|
5622
|
+
gutter: 24,
|
|
5623
|
+
borderPadding: 10,
|
|
5624
|
+
orientation: "horizontal",
|
|
5592
5625
|
titleOrientation: "top",
|
|
5626
|
+
centerTitle: true,
|
|
5593
5627
|
style: {
|
|
5594
5628
|
data: {
|
|
5595
5629
|
type: "circle"
|
|
5596
5630
|
},
|
|
5597
5631
|
labels: {
|
|
5598
5632
|
...baseLabelStyles,
|
|
5599
|
-
fontSize:
|
|
5633
|
+
fontSize: 12
|
|
5600
5634
|
},
|
|
5601
5635
|
title: Object.assign({}, baseLabelStyles, {
|
|
5602
5636
|
padding,
|
|
5603
|
-
fontSize:
|
|
5637
|
+
fontSize: 16
|
|
5604
5638
|
}),
|
|
5605
5639
|
border: {
|
|
5606
5640
|
stroke: gray["200"],
|
|
@@ -5614,7 +5648,7 @@ const clean = {
|
|
|
5614
5648
|
data: {
|
|
5615
5649
|
fill: "transparent",
|
|
5616
5650
|
opacity: 1,
|
|
5617
|
-
stroke:
|
|
5651
|
+
stroke: defaultColor,
|
|
5618
5652
|
strokeWidth: 2,
|
|
5619
5653
|
strokeLinecap,
|
|
5620
5654
|
strokeLinejoin
|
|
@@ -5624,31 +5658,40 @@ const clean = {
|
|
|
5624
5658
|
}, baseProps),
|
|
5625
5659
|
pie: Object.assign({
|
|
5626
5660
|
style: {
|
|
5661
|
+
parent: {
|
|
5662
|
+
backgroundColor: gray.white
|
|
5663
|
+
},
|
|
5627
5664
|
data: {
|
|
5628
5665
|
padding,
|
|
5629
5666
|
stroke: gray.white,
|
|
5630
5667
|
strokeWidth: 1
|
|
5631
5668
|
},
|
|
5632
|
-
labels:
|
|
5633
|
-
|
|
5634
|
-
|
|
5669
|
+
labels: {
|
|
5670
|
+
...baseLabelStyles,
|
|
5671
|
+
padding: 20,
|
|
5672
|
+
fill: gray["600"],
|
|
5673
|
+
fontSize: 10
|
|
5674
|
+
}
|
|
5635
5675
|
},
|
|
5636
|
-
colorScale
|
|
5676
|
+
colorScale,
|
|
5637
5677
|
cornerRadius: borderRadius
|
|
5638
5678
|
}, baseProps),
|
|
5639
5679
|
scatter: Object.assign({
|
|
5640
5680
|
style: {
|
|
5641
5681
|
data: {
|
|
5642
|
-
fill:
|
|
5682
|
+
fill: defaultColor,
|
|
5643
5683
|
opacity: 1,
|
|
5644
5684
|
stroke: "transparent",
|
|
5645
5685
|
strokeWidth: 0
|
|
5646
5686
|
},
|
|
5647
|
-
labels:
|
|
5687
|
+
labels: {
|
|
5688
|
+
...baseLabelStyles,
|
|
5689
|
+
padding: 20
|
|
5690
|
+
}
|
|
5648
5691
|
}
|
|
5649
5692
|
}, baseProps),
|
|
5650
5693
|
stack: Object.assign({
|
|
5651
|
-
colorScale
|
|
5694
|
+
colorScale
|
|
5652
5695
|
}, baseProps),
|
|
5653
5696
|
tooltip: {
|
|
5654
5697
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -5656,7 +5699,7 @@ const clean = {
|
|
|
5656
5699
|
pointerEvents: "none"
|
|
5657
5700
|
}),
|
|
5658
5701
|
flyoutStyle: {
|
|
5659
|
-
stroke: gray["
|
|
5702
|
+
stroke: gray["300"],
|
|
5660
5703
|
strokeWidth: 2,
|
|
5661
5704
|
fill: gray.white,
|
|
5662
5705
|
pointerEvents: "none"
|
|
@@ -5673,8 +5716,8 @@ const clean = {
|
|
|
5673
5716
|
voronoi: Object.assign({
|
|
5674
5717
|
style: {
|
|
5675
5718
|
data: {
|
|
5676
|
-
fill:
|
|
5677
|
-
stroke:
|
|
5719
|
+
fill: blue["100"],
|
|
5720
|
+
stroke: defaultColor,
|
|
5678
5721
|
strokeWidth: 2
|
|
5679
5722
|
},
|
|
5680
5723
|
labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -5711,9 +5754,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5711
5754
|
// *
|
|
5712
5755
|
// * Colors
|
|
5713
5756
|
// *
|
|
5714
|
-
const colors =
|
|
5757
|
+
const colors = {
|
|
5758
|
+
blue: "#4F7DA1",
|
|
5759
|
+
pink: "#E2A37F",
|
|
5760
|
+
teal: "#00796B",
|
|
5761
|
+
purple: "#DF948A",
|
|
5762
|
+
green: "#8BC34A",
|
|
5763
|
+
orange: "#F4511E",
|
|
5764
|
+
cyan: "#006064",
|
|
5765
|
+
red: "#DF5A49",
|
|
5766
|
+
yellow: "#FFF59D"
|
|
5767
|
+
};
|
|
5768
|
+
const colorScale = ["#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0"];
|
|
5715
5769
|
const charcoal = "#252525";
|
|
5716
5770
|
const grey = "#969696";
|
|
5771
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
5772
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
5773
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
5774
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
5775
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
5776
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
5777
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
5778
|
+
|
|
5717
5779
|
// *
|
|
5718
5780
|
// * Typography
|
|
5719
5781
|
// *
|
|
@@ -5727,7 +5789,7 @@ const baseProps = {
|
|
|
5727
5789
|
width: 450,
|
|
5728
5790
|
height: 300,
|
|
5729
5791
|
padding: 50,
|
|
5730
|
-
colorScale
|
|
5792
|
+
colorScale
|
|
5731
5793
|
};
|
|
5732
5794
|
// *
|
|
5733
5795
|
// * Labels
|
|
@@ -5749,6 +5811,17 @@ const centeredLabelStyles = Object.assign({
|
|
|
5749
5811
|
const strokeLinecap = "round";
|
|
5750
5812
|
const strokeLinejoin = "round";
|
|
5751
5813
|
const grayscale = {
|
|
5814
|
+
palette: {
|
|
5815
|
+
colors,
|
|
5816
|
+
grayscale: colorScale,
|
|
5817
|
+
qualitative,
|
|
5818
|
+
heatmap,
|
|
5819
|
+
warm,
|
|
5820
|
+
cool,
|
|
5821
|
+
red,
|
|
5822
|
+
green,
|
|
5823
|
+
blue
|
|
5824
|
+
},
|
|
5752
5825
|
area: Object.assign({
|
|
5753
5826
|
style: {
|
|
5754
5827
|
data: {
|
|
@@ -5863,7 +5936,7 @@ const grayscale = {
|
|
|
5863
5936
|
}
|
|
5864
5937
|
}, baseProps),
|
|
5865
5938
|
group: Object.assign({
|
|
5866
|
-
colorScale
|
|
5939
|
+
colorScale
|
|
5867
5940
|
}, baseProps),
|
|
5868
5941
|
histogram: Object.assign({
|
|
5869
5942
|
style: {
|
|
@@ -5876,7 +5949,7 @@ const grayscale = {
|
|
|
5876
5949
|
}
|
|
5877
5950
|
}, baseProps),
|
|
5878
5951
|
legend: {
|
|
5879
|
-
colorScale
|
|
5952
|
+
colorScale,
|
|
5880
5953
|
gutter: 10,
|
|
5881
5954
|
orientation: "vertical",
|
|
5882
5955
|
titleOrientation: "top",
|
|
@@ -5911,7 +5984,7 @@ const grayscale = {
|
|
|
5911
5984
|
padding: 20
|
|
5912
5985
|
})
|
|
5913
5986
|
},
|
|
5914
|
-
colorScale
|
|
5987
|
+
colorScale,
|
|
5915
5988
|
width: 400,
|
|
5916
5989
|
height: 400,
|
|
5917
5990
|
padding: 50
|
|
@@ -5927,7 +6000,7 @@ const grayscale = {
|
|
|
5927
6000
|
}
|
|
5928
6001
|
}, baseProps),
|
|
5929
6002
|
stack: Object.assign({
|
|
5930
|
-
colorScale
|
|
6003
|
+
colorScale
|
|
5931
6004
|
}, baseProps),
|
|
5932
6005
|
tooltip: {
|
|
5933
6006
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -5987,11 +6060,31 @@ const lime300 = "#DCE775";
|
|
|
5987
6060
|
const lightGreen500 = "#8BC34A";
|
|
5988
6061
|
const teal700 = "#00796B";
|
|
5989
6062
|
const cyan900 = "#006064";
|
|
5990
|
-
const
|
|
6063
|
+
const colorScale = [deepOrange600, yellow200, lime300, lightGreen500, teal700, cyan900];
|
|
5991
6064
|
const blueGrey50 = "#ECEFF1";
|
|
5992
6065
|
const blueGrey300 = "#90A4AE";
|
|
5993
6066
|
const blueGrey700 = "#455A64";
|
|
5994
6067
|
const grey900 = "#212121";
|
|
6068
|
+
const colors = {
|
|
6069
|
+
blue: "#4F7DA1",
|
|
6070
|
+
pink: "#E2A37F",
|
|
6071
|
+
teal: teal700,
|
|
6072
|
+
purple: "#DF948A",
|
|
6073
|
+
green: lightGreen500,
|
|
6074
|
+
orange: deepOrange600,
|
|
6075
|
+
cyan: cyan900,
|
|
6076
|
+
red: "#DF5A49",
|
|
6077
|
+
yellow: yellow200
|
|
6078
|
+
};
|
|
6079
|
+
const grayscale = [blueGrey50, blueGrey300, blueGrey700, grey900];
|
|
6080
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
6081
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
6082
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
6083
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
6084
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
6085
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
6086
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
6087
|
+
|
|
5995
6088
|
// *
|
|
5996
6089
|
// * Typography
|
|
5997
6090
|
// *
|
|
@@ -6029,6 +6122,17 @@ const strokeDasharray = "10, 5";
|
|
|
6029
6122
|
const strokeLinecap = "round";
|
|
6030
6123
|
const strokeLinejoin = "round";
|
|
6031
6124
|
const material = {
|
|
6125
|
+
palette: {
|
|
6126
|
+
colors,
|
|
6127
|
+
grayscale,
|
|
6128
|
+
qualitative,
|
|
6129
|
+
heatmap,
|
|
6130
|
+
warm,
|
|
6131
|
+
cool,
|
|
6132
|
+
red,
|
|
6133
|
+
green,
|
|
6134
|
+
blue
|
|
6135
|
+
},
|
|
6032
6136
|
area: Object.assign({
|
|
6033
6137
|
style: {
|
|
6034
6138
|
data: {
|
|
@@ -6161,7 +6265,7 @@ const material = {
|
|
|
6161
6265
|
}
|
|
6162
6266
|
}, baseProps),
|
|
6163
6267
|
group: Object.assign({
|
|
6164
|
-
colorScale
|
|
6268
|
+
colorScale
|
|
6165
6269
|
}, baseProps),
|
|
6166
6270
|
histogram: Object.assign({
|
|
6167
6271
|
style: {
|
|
@@ -6174,7 +6278,7 @@ const material = {
|
|
|
6174
6278
|
}
|
|
6175
6279
|
}, baseProps),
|
|
6176
6280
|
legend: {
|
|
6177
|
-
colorScale
|
|
6281
|
+
colorScale,
|
|
6178
6282
|
gutter: 10,
|
|
6179
6283
|
orientation: "vertical",
|
|
6180
6284
|
titleOrientation: "top",
|
|
@@ -6200,7 +6304,7 @@ const material = {
|
|
|
6200
6304
|
}
|
|
6201
6305
|
}, baseProps),
|
|
6202
6306
|
pie: Object.assign({
|
|
6203
|
-
colorScale
|
|
6307
|
+
colorScale,
|
|
6204
6308
|
style: {
|
|
6205
6309
|
data: {
|
|
6206
6310
|
padding,
|
|
@@ -6224,7 +6328,7 @@ const material = {
|
|
|
6224
6328
|
}
|
|
6225
6329
|
}, baseProps),
|
|
6226
6330
|
stack: Object.assign({
|
|
6227
|
-
colorScale
|
|
6331
|
+
colorScale
|
|
6228
6332
|
}, baseProps),
|
|
6229
6333
|
tooltip: {
|
|
6230
6334
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -8847,6 +8951,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8847
8951
|
/* harmony export */ "getColorScale": function() { return /* binding */ getColorScale; },
|
|
8848
8952
|
/* harmony export */ "toTransformString": function() { return /* binding */ toTransformString; }
|
|
8849
8953
|
/* harmony export */ });
|
|
8954
|
+
/* harmony import */ var _victory_theme_victory_theme__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../victory-theme/victory-theme */ "../../victory-core/es/victory-theme/victory-theme.js");
|
|
8955
|
+
|
|
8956
|
+
|
|
8850
8957
|
/**
|
|
8851
8958
|
* Given an object with CSS/SVG transform definitions, return the string value
|
|
8852
8959
|
* for use with the `transform` CSS property or SVG attribute. Note that we
|
|
@@ -8883,20 +8990,37 @@ const toTransformString = function (obj) {
|
|
|
8883
8990
|
* of 5 hex string values in that color scale. If no 'name' parameter
|
|
8884
8991
|
* is given, it will return the Victory default grayscale.
|
|
8885
8992
|
* @param {String} name The name of the color scale to return (optional).
|
|
8993
|
+
* @param {Object} theme The theme object to retrieve the color scale from (optional).
|
|
8886
8994
|
* @returns {Array} An array of 5 hex string values composing a color scale.
|
|
8887
8995
|
*/
|
|
8888
|
-
function getColorScale(name) {
|
|
8996
|
+
function getColorScale(name, theme) {
|
|
8997
|
+
if (theme === void 0) {
|
|
8998
|
+
theme = _victory_theme_victory_theme__WEBPACK_IMPORTED_MODULE_0__.VictoryTheme.material;
|
|
8999
|
+
}
|
|
9000
|
+
const {
|
|
9001
|
+
palette: {
|
|
9002
|
+
grayscale = ["#cccccc", "#969696", "#636363", "#252525"],
|
|
9003
|
+
qualitative = [],
|
|
9004
|
+
heatmap = [],
|
|
9005
|
+
warm = [],
|
|
9006
|
+
cool = [],
|
|
9007
|
+
red = [],
|
|
9008
|
+
blue = [],
|
|
9009
|
+
green = []
|
|
9010
|
+
} = {}
|
|
9011
|
+
} = theme;
|
|
8889
9012
|
const scales = {
|
|
8890
|
-
grayscale
|
|
8891
|
-
qualitative
|
|
8892
|
-
heatmap
|
|
8893
|
-
warm
|
|
8894
|
-
cool
|
|
8895
|
-
red
|
|
8896
|
-
blue
|
|
8897
|
-
green
|
|
9013
|
+
grayscale,
|
|
9014
|
+
qualitative,
|
|
9015
|
+
heatmap,
|
|
9016
|
+
warm,
|
|
9017
|
+
cool,
|
|
9018
|
+
red,
|
|
9019
|
+
blue,
|
|
9020
|
+
green
|
|
8898
9021
|
};
|
|
8899
|
-
|
|
9022
|
+
const selectedScale = name && scales[name]?.length ? scales[name] : scales.grayscale;
|
|
9023
|
+
return selectedScale;
|
|
8900
9024
|
}
|
|
8901
9025
|
|
|
8902
9026
|
/***/ }),
|
|
@@ -9522,34 +9646,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9522
9646
|
/* harmony export */ "getDomain": function() { return /* binding */ getDomain; },
|
|
9523
9647
|
/* harmony export */ "getDomainFromChildren": function() { return /* binding */ getDomainFromChildren; },
|
|
9524
9648
|
/* harmony export */ "getScale": function() { return /* binding */ getScale; },
|
|
9525
|
-
/* harmony export */ "getStringsFromCategories": function() { return /* binding */ getStringsFromCategories; },
|
|
9526
9649
|
/* harmony export */ "getStringsFromChildren": function() { return /* binding */ getStringsFromChildren; },
|
|
9650
|
+
/* harmony export */ "getStringsFromChildrenCategories": function() { return /* binding */ getStringsFromChildrenCategories; },
|
|
9527
9651
|
/* harmony export */ "getStringsFromData": function() { return /* binding */ getStringsFromData; },
|
|
9528
9652
|
/* harmony export */ "getStyle": function() { return /* binding */ getStyle; },
|
|
9529
9653
|
/* harmony export */ "getWidth": function() { return /* binding */ getWidth; }
|
|
9530
9654
|
/* harmony export */ });
|
|
9531
|
-
/* harmony import */ var
|
|
9532
|
-
/* harmony import */ var
|
|
9533
|
-
/* harmony import */ var
|
|
9534
|
-
/* harmony import */ var
|
|
9535
|
-
/* harmony import */ var
|
|
9536
|
-
/* harmony import */ var
|
|
9537
|
-
/* harmony import */ var
|
|
9538
|
-
/* harmony import */ var
|
|
9539
|
-
/* harmony import */ var
|
|
9540
|
-
/* harmony import */ var
|
|
9541
|
-
/* harmony import */ var
|
|
9542
|
-
/* harmony import */ var
|
|
9543
|
-
/* harmony import */ var
|
|
9544
|
-
/* harmony import */ var
|
|
9545
|
-
/* harmony import */ var
|
|
9546
|
-
/* harmony import */ var
|
|
9547
|
-
/* harmony import */ var
|
|
9548
|
-
/* harmony import */ var
|
|
9549
|
-
/* harmony import */ var
|
|
9550
|
-
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./scale */ "../../victory-core/es/victory-util/scale.js");
|
|
9551
|
-
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./log */ "../../victory-core/es/victory-util/log.js");
|
|
9552
|
-
|
|
9655
|
+
/* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/uniqBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqBy.js");
|
|
9656
|
+
/* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__);
|
|
9657
|
+
/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/groupBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/groupBy.js");
|
|
9658
|
+
/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1__);
|
|
9659
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/uniq */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniq.js");
|
|
9660
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_2__);
|
|
9661
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
9662
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_3__);
|
|
9663
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react");
|
|
9664
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
9665
|
+
/* harmony import */ var _axis__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./axis */ "../../victory-core/es/victory-util/axis.js");
|
|
9666
|
+
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./style */ "../../victory-core/es/victory-util/style.js");
|
|
9667
|
+
/* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./data */ "../../victory-core/es/victory-util/data.js");
|
|
9668
|
+
/* harmony import */ var _domain__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./domain */ "../../victory-core/es/victory-util/domain.js");
|
|
9669
|
+
/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./events */ "../../victory-core/es/victory-util/events.js");
|
|
9670
|
+
/* harmony import */ var _collection__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./collection */ "../../victory-core/es/victory-util/collection.js");
|
|
9671
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
9672
|
+
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./scale */ "../../victory-core/es/victory-util/scale.js");
|
|
9673
|
+
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./log */ "../../victory-core/es/victory-util/log.js");
|
|
9553
9674
|
|
|
9554
9675
|
|
|
9555
9676
|
|
|
@@ -9578,7 +9699,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
9578
9699
|
return child.type && child.type.role === "histogram";
|
|
9579
9700
|
});
|
|
9580
9701
|
if (someChildrenAreHistograms && !allChildrenAreHistograms) {
|
|
9581
|
-
|
|
9702
|
+
_log__WEBPACK_IMPORTED_MODULE_5__.warn("VictoryHistogram only supports being stacked with other VictoryHistogram components. Check to make sure that you are only passing VictoryHistogram components to VictoryStack");
|
|
9582
9703
|
}
|
|
9583
9704
|
|
|
9584
9705
|
// if we are stacking histograms, we need to generate explicit bins
|
|
@@ -9591,7 +9712,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
9591
9712
|
// if we have explicit bins then we don't need to calculate them
|
|
9592
9713
|
if (!Array.isArray(childBins)) {
|
|
9593
9714
|
const combinedData = children.reduce((memo, child) => {
|
|
9594
|
-
const xAccessor =
|
|
9715
|
+
const xAccessor = _helpers__WEBPACK_IMPORTED_MODULE_6__.createAccessor(child.props.x || "x");
|
|
9595
9716
|
return memo.concat(child.props.data.map(datum => ({
|
|
9596
9717
|
x: xAccessor(datum)
|
|
9597
9718
|
})));
|
|
@@ -9634,7 +9755,7 @@ function getDataFromChildren(props, childComponents) {
|
|
|
9634
9755
|
maxDomain
|
|
9635
9756
|
};
|
|
9636
9757
|
let stack = 0;
|
|
9637
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
9758
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
9638
9759
|
parentProps = addBinsToParentPropsIfHistogram({
|
|
9639
9760
|
children,
|
|
9640
9761
|
props,
|
|
@@ -9645,13 +9766,13 @@ function getDataFromChildren(props, childComponents) {
|
|
|
9645
9766
|
const childProps = Object.assign({}, child.props, parentProps);
|
|
9646
9767
|
let childData;
|
|
9647
9768
|
let childElement = child;
|
|
9648
|
-
if (!
|
|
9769
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
9649
9770
|
return null;
|
|
9650
|
-
} else if (child.type &&
|
|
9651
|
-
childElement = parent ? /*#__PURE__*/
|
|
9771
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
9772
|
+
childElement = parent ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().cloneElement(child, parent.props) : child;
|
|
9652
9773
|
childData = childElement.type.getData(childProps);
|
|
9653
9774
|
} else {
|
|
9654
|
-
childData =
|
|
9775
|
+
childData = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
9655
9776
|
}
|
|
9656
9777
|
stack += 1;
|
|
9657
9778
|
return childData.map((datum, index) => Object.assign({
|
|
@@ -9660,23 +9781,23 @@ function getDataFromChildren(props, childComponents) {
|
|
|
9660
9781
|
}, datum));
|
|
9661
9782
|
};
|
|
9662
9783
|
const stacked = children.filter(c => c.type && c.type.role === "stack").length;
|
|
9663
|
-
const combine = (memo, val) => memo.concat(
|
|
9664
|
-
const datasets =
|
|
9784
|
+
const combine = (memo, val) => memo.concat(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default()(val, "_group"));
|
|
9785
|
+
const datasets = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props, [], combine);
|
|
9665
9786
|
const group = stacked ? "_group" : "_stack";
|
|
9666
|
-
return Object.values(
|
|
9787
|
+
return Object.values(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default()(datasets, group));
|
|
9667
9788
|
}
|
|
9668
9789
|
function getData(props, childComponents) {
|
|
9669
9790
|
if (props.data) {
|
|
9670
|
-
return
|
|
9791
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
9671
9792
|
}
|
|
9672
|
-
return getDataFromChildren(props, childComponents ||
|
|
9793
|
+
return getDataFromChildren(props, childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children));
|
|
9673
9794
|
}
|
|
9674
9795
|
function getWidth(props, groupLength, seriesLength) {
|
|
9675
9796
|
const {
|
|
9676
9797
|
datasets,
|
|
9677
9798
|
horizontal
|
|
9678
9799
|
} = props;
|
|
9679
|
-
const range = horizontal ?
|
|
9800
|
+
const range = horizontal ? _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "y") : _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "x");
|
|
9680
9801
|
const extent = Math.abs(range[1] - range[0]);
|
|
9681
9802
|
const seriesLengthValue = seriesLength !== undefined ? seriesLength : Array.isArray(datasets[0]) && datasets[0].length || 1;
|
|
9682
9803
|
const groupLengthValue = groupLength || datasets.length;
|
|
@@ -9722,8 +9843,8 @@ function getDefaultDomainPadding(props, axis, childComponents) {
|
|
|
9722
9843
|
}
|
|
9723
9844
|
function getDomainFromChildren(props, axis, childComponents) {
|
|
9724
9845
|
// eslint-disable-line max-statements, complexity, max-len
|
|
9725
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
9726
|
-
const parentData = props.data ?
|
|
9846
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
9847
|
+
const parentData = props.data ? _data__WEBPACK_IMPORTED_MODULE_7__.getData(props) : undefined;
|
|
9727
9848
|
const {
|
|
9728
9849
|
polar,
|
|
9729
9850
|
startAngle,
|
|
@@ -9747,65 +9868,67 @@ function getDomainFromChildren(props, axis, childComponents) {
|
|
|
9747
9868
|
}) : baseParentProps;
|
|
9748
9869
|
const iteratee = child => {
|
|
9749
9870
|
const sharedProps = Object.assign({}, child.props, parentProps);
|
|
9750
|
-
if (!
|
|
9871
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
9751
9872
|
return null;
|
|
9752
|
-
} else if (child.type &&
|
|
9873
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getDomain)) {
|
|
9753
9874
|
return child.props && child.type.getDomain(sharedProps, axis);
|
|
9754
9875
|
}
|
|
9755
|
-
return
|
|
9876
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.getDomain(sharedProps, axis);
|
|
9756
9877
|
};
|
|
9757
|
-
const childDomains =
|
|
9758
|
-
const min = childDomains.length === 0 ? 0 :
|
|
9759
|
-
const max = childDomains.length === 0 ? 1 :
|
|
9878
|
+
const childDomains = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props);
|
|
9879
|
+
const min = childDomains.length === 0 ? 0 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue(childDomains);
|
|
9880
|
+
const max = childDomains.length === 0 ? 1 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue(childDomains);
|
|
9760
9881
|
return [min, max];
|
|
9761
9882
|
}
|
|
9762
9883
|
function getDomain(props, axis, childComponents) {
|
|
9763
|
-
const children = childComponents ||
|
|
9764
|
-
const propsDomain =
|
|
9884
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
9885
|
+
const propsDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromProps(props, axis);
|
|
9765
9886
|
const domainPadding = getDefaultDomainPadding(props, axis, children);
|
|
9766
9887
|
let domain;
|
|
9767
9888
|
if (propsDomain) {
|
|
9768
9889
|
domain = propsDomain;
|
|
9769
9890
|
} else {
|
|
9770
|
-
const minDomain =
|
|
9771
|
-
const maxDomain =
|
|
9772
|
-
const dataset = (props.data || props.y) &&
|
|
9773
|
-
const dataDomain = dataset ?
|
|
9891
|
+
const minDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMinFromProps(props, axis);
|
|
9892
|
+
const maxDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMaxFromProps(props, axis);
|
|
9893
|
+
const dataset = (props.data || props.y) && _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
9894
|
+
const dataDomain = dataset ? _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromData(props, axis, dataset) : [];
|
|
9774
9895
|
const childDomain = getDomainFromChildren(props, axis, children);
|
|
9775
|
-
const min = minDomain ||
|
|
9776
|
-
const max = maxDomain ||
|
|
9777
|
-
domain =
|
|
9896
|
+
const min = minDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue([...dataDomain, ...childDomain]);
|
|
9897
|
+
const max = maxDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue([...dataDomain, ...childDomain]);
|
|
9898
|
+
domain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromMinMax(min, max);
|
|
9778
9899
|
}
|
|
9779
|
-
return
|
|
9900
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.formatDomain(domain, Object.assign({
|
|
9780
9901
|
domainPadding
|
|
9781
9902
|
}, props), axis);
|
|
9782
9903
|
}
|
|
9783
9904
|
function getScale(props, axis, childComponents) {
|
|
9784
9905
|
if (props.data) {
|
|
9785
|
-
return
|
|
9906
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getBaseScale(props, axis);
|
|
9786
9907
|
}
|
|
9787
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
9908
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
9788
9909
|
const iteratee = child => {
|
|
9789
9910
|
const sharedProps = Object.assign({}, child.props, {
|
|
9790
9911
|
horizontal: props.horizontal
|
|
9791
9912
|
});
|
|
9792
|
-
return
|
|
9913
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleType(sharedProps, axis);
|
|
9793
9914
|
};
|
|
9794
|
-
const childScale =
|
|
9915
|
+
const childScale = lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()(_helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props));
|
|
9795
9916
|
|
|
9796
9917
|
// default to linear scale if more than one uniq scale type is given by children
|
|
9797
|
-
return childScale.length > 1 ?
|
|
9918
|
+
return childScale.length > 1 ? _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName("linear") : _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName(childScale[0]);
|
|
9798
9919
|
}
|
|
9799
9920
|
function getAllEvents(props) {
|
|
9800
9921
|
const components = ["groupComponent", "containerComponent", "labelComponent"];
|
|
9801
|
-
const componentEvents =
|
|
9922
|
+
const componentEvents = _events__WEBPACK_IMPORTED_MODULE_11__.getComponentEvents(props, components);
|
|
9802
9923
|
let events = props.events;
|
|
9803
9924
|
if (Array.isArray(componentEvents)) {
|
|
9804
9925
|
events = Array.isArray(props.events) ? componentEvents.concat(...props.events) : componentEvents;
|
|
9805
9926
|
}
|
|
9806
9927
|
return events || [];
|
|
9807
9928
|
}
|
|
9808
|
-
|
|
9929
|
+
|
|
9930
|
+
// eslint-disable-next-line max-params
|
|
9931
|
+
function getColor(calculatedProps, child, index, theme) {
|
|
9809
9932
|
// check for styles first
|
|
9810
9933
|
const {
|
|
9811
9934
|
style
|
|
@@ -9822,14 +9945,16 @@ function getColor(calculatedProps, child, index) {
|
|
|
9822
9945
|
if (!colorScale && !color) {
|
|
9823
9946
|
return undefined;
|
|
9824
9947
|
}
|
|
9825
|
-
const colors = Array.isArray(colorScale) ? colorScale :
|
|
9948
|
+
const colors = Array.isArray(colorScale) ? colorScale : _style__WEBPACK_IMPORTED_MODULE_12__.getColorScale(colorScale, theme);
|
|
9826
9949
|
return color || colors[index % colors.length];
|
|
9827
9950
|
}
|
|
9828
9951
|
function getStyle(theme, style, role) {
|
|
9829
9952
|
const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
|
|
9830
|
-
return
|
|
9953
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.getStyles(style, defaultStyle);
|
|
9831
9954
|
}
|
|
9832
|
-
|
|
9955
|
+
|
|
9956
|
+
// eslint-disable-next-line max-params
|
|
9957
|
+
function getChildStyle(child, index, calculatedProps, theme) {
|
|
9833
9958
|
const {
|
|
9834
9959
|
style,
|
|
9835
9960
|
role
|
|
@@ -9839,7 +9964,7 @@ function getChildStyle(child, index, calculatedProps) {
|
|
|
9839
9964
|
return childStyle;
|
|
9840
9965
|
}
|
|
9841
9966
|
const childRole = child.type && child.type.role;
|
|
9842
|
-
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index);
|
|
9967
|
+
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index, theme);
|
|
9843
9968
|
const defaultColor = childRole === "line" ? {
|
|
9844
9969
|
fill: "none",
|
|
9845
9970
|
stroke: defaultFill
|
|
@@ -9849,8 +9974,8 @@ function getChildStyle(child, index, calculatedProps) {
|
|
|
9849
9974
|
const dataWidth = role === "stack" ? {} : {
|
|
9850
9975
|
width: getWidth(calculatedProps)
|
|
9851
9976
|
};
|
|
9852
|
-
const dataStyle =
|
|
9853
|
-
const labelsStyle =
|
|
9977
|
+
const dataStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.data, Object.assign({}, dataWidth, style.data, defaultColor));
|
|
9978
|
+
const labelsStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.labels, style.labels);
|
|
9854
9979
|
return {
|
|
9855
9980
|
...childStyle,
|
|
9856
9981
|
parent: style.parent,
|
|
@@ -9858,28 +9983,26 @@ function getChildStyle(child, index, calculatedProps) {
|
|
|
9858
9983
|
labels: labelsStyle
|
|
9859
9984
|
};
|
|
9860
9985
|
}
|
|
9861
|
-
function
|
|
9986
|
+
function getStringsFromChildrenCategories(childComponents, axis) {
|
|
9862
9987
|
const iteratee = child => {
|
|
9863
|
-
|
|
9864
|
-
if (!_domain__WEBPACK_IMPORTED_MODULE_9__.isDomainComponent(child) || !childProps.categories) {
|
|
9988
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
9865
9989
|
return null;
|
|
9866
9990
|
}
|
|
9867
|
-
const
|
|
9868
|
-
|
|
9869
|
-
return categoryStrings ? _collection__WEBPACK_IMPORTED_MODULE_10__.removeUndefined(categoryStrings) : [];
|
|
9991
|
+
const childProps = child.props || {};
|
|
9992
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(childProps, axis);
|
|
9870
9993
|
};
|
|
9871
|
-
return
|
|
9994
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee);
|
|
9872
9995
|
}
|
|
9873
9996
|
function getStringsFromData(childComponents) {
|
|
9874
9997
|
const iteratee = child => {
|
|
9875
9998
|
const childProps = child.props || {};
|
|
9876
9999
|
let data;
|
|
9877
|
-
if (!
|
|
10000
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
9878
10001
|
return null;
|
|
9879
|
-
} else if (child.type &&
|
|
10002
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
9880
10003
|
data = child.type.getData(childProps);
|
|
9881
10004
|
} else {
|
|
9882
|
-
data =
|
|
10005
|
+
data = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
9883
10006
|
}
|
|
9884
10007
|
return data.map(d => ({
|
|
9885
10008
|
x: d.xName,
|
|
@@ -9898,28 +10021,28 @@ function getStringsFromData(childComponents) {
|
|
|
9898
10021
|
y: y !== undefined ? memo.y.concat(y) : memo.y
|
|
9899
10022
|
};
|
|
9900
10023
|
};
|
|
9901
|
-
return
|
|
10024
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
|
|
9902
10025
|
}
|
|
9903
10026
|
function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
|
|
9904
|
-
const categories =
|
|
9905
|
-
const axisComponent =
|
|
9906
|
-
const axisStrings = axisComponent ?
|
|
9907
|
-
const categoryStrings = categories
|
|
9908
|
-
return
|
|
10027
|
+
const categories = _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, axis);
|
|
10028
|
+
const axisComponent = _axis__WEBPACK_IMPORTED_MODULE_13__.getAxisComponent(childComponents, axis);
|
|
10029
|
+
const axisStrings = axisComponent ? _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
10030
|
+
const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
|
|
10031
|
+
return lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...categoryStrings, ...axisStrings].flat());
|
|
9909
10032
|
}
|
|
9910
10033
|
function getStringsFromChildren(props, childComponents) {
|
|
9911
|
-
const children = childComponents ||
|
|
10034
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
9912
10035
|
const xStrings = getCategoryAndAxisStringsFromChildren(props, "x", children);
|
|
9913
10036
|
const yStrings = getCategoryAndAxisStringsFromChildren(props, "y", children);
|
|
9914
10037
|
const dataStrings = getStringsFromData(children);
|
|
9915
10038
|
return {
|
|
9916
|
-
x:
|
|
9917
|
-
y:
|
|
10039
|
+
x: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...xStrings, ...dataStrings.x].flat()),
|
|
10040
|
+
y: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...yStrings, ...dataStrings.y].flat())
|
|
9918
10041
|
};
|
|
9919
10042
|
}
|
|
9920
10043
|
function getCategories(props, childComponents, allStrings) {
|
|
9921
|
-
const xPropCategories = props.categories &&
|
|
9922
|
-
const yPropCategories = props.categories &&
|
|
10044
|
+
const xPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "x");
|
|
10045
|
+
const yPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "y");
|
|
9923
10046
|
const fallbackRequired = !xPropCategories || !yPropCategories;
|
|
9924
10047
|
const fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
|
|
9925
10048
|
const xCategories = xPropCategories || fallbackProps.x;
|