@vizzly/dashboard 0.14.4-dev-04cdc366aba20e3ec13c6b9b5fa22cdcd72826c7 → 0.14.4-dev-f81c05d870985862e147c5e214f0dc91eb44478a
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.
|
@@ -64,7 +64,6 @@ var axis = require('@visx/axis');
|
|
|
64
64
|
var text$3 = require('@visx/text');
|
|
65
65
|
var grid = require('@visx/grid');
|
|
66
66
|
require('@visx/point');
|
|
67
|
-
var v2 = require('./charts/src/v2');
|
|
68
67
|
var VisibilitySensor = _interopDefault(require('react-visibility-sensor'));
|
|
69
68
|
var ExcelJS = _interopDefault(require('exceljs'));
|
|
70
69
|
var fileSaver = require('file-saver');
|
|
@@ -43321,6 +43320,432 @@ var Bar = function Bar(props) {
|
|
|
43321
43320
|
}, props.key);
|
|
43322
43321
|
};
|
|
43323
43322
|
|
|
43323
|
+
var useableId = function useableId(key, prefix) {
|
|
43324
|
+
var newKey = key.toLowerCase()
|
|
43325
|
+
// Remove characters that aren't letters, digits, underscores, or spaces
|
|
43326
|
+
.replace(/[^\w\s-]+/g, '')
|
|
43327
|
+
// Replace whitespace with hyphens
|
|
43328
|
+
.replace(/\s+/g, '-')
|
|
43329
|
+
// Remove leading or trailing hyphens
|
|
43330
|
+
.replace(/^-+|-+$/g, '');
|
|
43331
|
+
return prefix + '-' + newKey;
|
|
43332
|
+
};
|
|
43333
|
+
|
|
43334
|
+
function useVisibleYKeys(areas) {
|
|
43335
|
+
var _useState = React.useState(areas.map(function (legendItem) {
|
|
43336
|
+
return legendItem.yKey;
|
|
43337
|
+
})),
|
|
43338
|
+
visibleYKeysState = _useState[0],
|
|
43339
|
+
setVisibleYKeys = _useState[1];
|
|
43340
|
+
React.useEffect(function () {
|
|
43341
|
+
setVisibleYKeys(areas.map(function (legendItem) {
|
|
43342
|
+
return legendItem.yKey;
|
|
43343
|
+
}));
|
|
43344
|
+
return function () {
|
|
43345
|
+
setVisibleYKeys([]);
|
|
43346
|
+
};
|
|
43347
|
+
}, [areas]);
|
|
43348
|
+
return {
|
|
43349
|
+
visibleYKeys: visibleYKeysState,
|
|
43350
|
+
setVisibleYKeys: setVisibleYKeys
|
|
43351
|
+
};
|
|
43352
|
+
}
|
|
43353
|
+
|
|
43354
|
+
var thresholdId$1 = function thresholdId(args, idPrefix, position, uniqueId) {
|
|
43355
|
+
var rawIdKey = args.yKey + "_" + args.value + "_" + args.operator;
|
|
43356
|
+
return (position + "_" + idPrefix + "_" + uniqueId + "_" + btoa(rawIdKey)).replace(/=/g, '');
|
|
43357
|
+
};
|
|
43358
|
+
function buildClipPathId$1(rule, idPrefix, uniqueId) {
|
|
43359
|
+
var isGreater = rule.operator === '>=';
|
|
43360
|
+
var clipPathId = isGreater ? thresholdId$1(rule, idPrefix, 'above', uniqueId) : thresholdId$1(rule, idPrefix, 'below', uniqueId);
|
|
43361
|
+
return clipPathId;
|
|
43362
|
+
}
|
|
43363
|
+
function getRule(rules, yKey) {
|
|
43364
|
+
return rules.filter(function (threshold) {
|
|
43365
|
+
return threshold.yKey === yKey;
|
|
43366
|
+
});
|
|
43367
|
+
}
|
|
43368
|
+
|
|
43369
|
+
var ThresholdArea = function ThresholdArea(props) {
|
|
43370
|
+
var chartHeight = props.height - props.margin.top;
|
|
43371
|
+
return jsxRuntime.jsxs(React.Fragment, {
|
|
43372
|
+
children: [jsxRuntime.jsx("g", {
|
|
43373
|
+
transform: "translate(50, 0)",
|
|
43374
|
+
children: props.rules.map(function (thresh, index) {
|
|
43375
|
+
var _props$theme$stroke, _props$theme;
|
|
43376
|
+
var thresholdYCoord = props.yScale(thresh.value);
|
|
43377
|
+
return jsxRuntime.jsx("g", {
|
|
43378
|
+
children: jsxRuntime.jsx("line", {
|
|
43379
|
+
x1: 0,
|
|
43380
|
+
y1: thresholdYCoord,
|
|
43381
|
+
x2: props.width - props.margin.right - props.margin.left,
|
|
43382
|
+
y2: thresholdYCoord,
|
|
43383
|
+
stroke: (_props$theme$stroke = (_props$theme = props.theme) == null ? void 0 : _props$theme.stroke) != null ? _props$theme$stroke : '#F4F4F4',
|
|
43384
|
+
strokeWidth: "1",
|
|
43385
|
+
fill: "transparent",
|
|
43386
|
+
"data-themeapi": "charts.threshold.stroke"
|
|
43387
|
+
})
|
|
43388
|
+
}, "threshold-" + index);
|
|
43389
|
+
})
|
|
43390
|
+
}), jsxRuntime.jsx("defs", {
|
|
43391
|
+
children: props.rules.map(function (thresh, index) {
|
|
43392
|
+
var thresholdYCoord = props.yScale(thresh.value);
|
|
43393
|
+
if (!thresholdYCoord) return null;
|
|
43394
|
+
return jsxRuntime.jsxs(React.Fragment, {
|
|
43395
|
+
children: [jsxRuntime.jsx("clipPath", {
|
|
43396
|
+
id: thresholdId$1(thresh, props.idPrefix, 'above', props.uniqueId),
|
|
43397
|
+
children: jsxRuntime.jsx("rect", {
|
|
43398
|
+
x: "0",
|
|
43399
|
+
y: "0",
|
|
43400
|
+
width: "100%",
|
|
43401
|
+
height: thresholdYCoord
|
|
43402
|
+
})
|
|
43403
|
+
}), jsxRuntime.jsx("clipPath", {
|
|
43404
|
+
id: thresholdId$1(thresh, props.idPrefix, 'intermediate', props.uniqueId),
|
|
43405
|
+
children: jsxRuntime.jsx("rect", {
|
|
43406
|
+
x: "0",
|
|
43407
|
+
y: thresholdYCoord,
|
|
43408
|
+
width: "100%",
|
|
43409
|
+
height: 0
|
|
43410
|
+
})
|
|
43411
|
+
}), jsxRuntime.jsx("clipPath", {
|
|
43412
|
+
id: thresholdId$1(thresh, props.idPrefix, 'below', props.uniqueId),
|
|
43413
|
+
children: jsxRuntime.jsx("rect", {
|
|
43414
|
+
x: "0",
|
|
43415
|
+
y: thresholdYCoord,
|
|
43416
|
+
width: "100%",
|
|
43417
|
+
height: chartHeight - thresholdYCoord
|
|
43418
|
+
})
|
|
43419
|
+
})]
|
|
43420
|
+
}, "threshold-" + index);
|
|
43421
|
+
})
|
|
43422
|
+
})]
|
|
43423
|
+
});
|
|
43424
|
+
};
|
|
43425
|
+
|
|
43426
|
+
var AREA_GRADIENT_ID_PREFIX = 'area-gradient';
|
|
43427
|
+
|
|
43428
|
+
/*
|
|
43429
|
+
NOTES
|
|
43430
|
+
-----
|
|
43431
|
+
1. Control width of margins via props and truncate ticks using a fixed width
|
|
43432
|
+
2. (somehow) prevent overlapping of ticks
|
|
43433
|
+
3. Split out conditional formatting colours to show operator and values for each color
|
|
43434
|
+
4. Add axis titles
|
|
43435
|
+
5. Account for no xKey and showing 1 dot for a single yKey
|
|
43436
|
+
*/
|
|
43437
|
+
|
|
43438
|
+
var AreaChart$5 = function AreaChart(_ref) {
|
|
43439
|
+
var _theme$axis;
|
|
43440
|
+
var chart = _ref.chart,
|
|
43441
|
+
options = _ref.options,
|
|
43442
|
+
theme = _ref.theme,
|
|
43443
|
+
width = _ref.width,
|
|
43444
|
+
height = _ref.height,
|
|
43445
|
+
uniqueId = _ref.uniqueId;
|
|
43446
|
+
var _useTooltip = useTooltip$1(),
|
|
43447
|
+
tooltipOpen = _useTooltip.tooltipOpen,
|
|
43448
|
+
_useTooltip$tooltipLe = _useTooltip.tooltipLeft,
|
|
43449
|
+
tooltipLeft = _useTooltip$tooltipLe === void 0 ? 0 : _useTooltip$tooltipLe,
|
|
43450
|
+
_useTooltip$tooltipTo = _useTooltip.tooltipTop,
|
|
43451
|
+
tooltipTop = _useTooltip$tooltipTo === void 0 ? 0 : _useTooltip$tooltipTo,
|
|
43452
|
+
_useTooltip$lineLeft = _useTooltip.lineLeft,
|
|
43453
|
+
lineLeft = _useTooltip$lineLeft === void 0 ? 0 : _useTooltip$lineLeft,
|
|
43454
|
+
tooltipData = _useTooltip.tooltipData,
|
|
43455
|
+
hideTooltip = _useTooltip.hideTooltip,
|
|
43456
|
+
showTooltip = _useTooltip.showTooltip;
|
|
43457
|
+
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null);
|
|
43458
|
+
var _useVisibleYKeys = useVisibleYKeys(chart.areas),
|
|
43459
|
+
visibleYKeys = _useVisibleYKeys.visibleYKeys,
|
|
43460
|
+
setVisibleYKeys = _useVisibleYKeys.setVisibleYKeys;
|
|
43461
|
+
var innerWidth = width - margin.left - margin.right;
|
|
43462
|
+
var innerHeight = height - margin.top - margin.bottom - (options.showLegend ? 40 : 0);
|
|
43463
|
+
var xKey = chart.x.key;
|
|
43464
|
+
var xScaleKey = chart.x.scale.key;
|
|
43465
|
+
var xScaleDataType = chart.x.scale.dataType;
|
|
43466
|
+
var themeCSS = React.useMemo(function () {
|
|
43467
|
+
return getChartThemeCSS(theme);
|
|
43468
|
+
}, [theme]);
|
|
43469
|
+
var xScale = React.useMemo(function () {
|
|
43470
|
+
if (xScaleDataType === 'string') {
|
|
43471
|
+
return scale.scalePoint({
|
|
43472
|
+
range: [0, innerWidth],
|
|
43473
|
+
domain: xScaleKey ? [].concat(chart.data.map(function (d) {
|
|
43474
|
+
return d[xScaleKey] && d[xScaleKey].value !== null ? String(d[xScaleKey].value) : '';
|
|
43475
|
+
})) : []
|
|
43476
|
+
});
|
|
43477
|
+
}
|
|
43478
|
+
if (xScaleDataType === 'date_time') {
|
|
43479
|
+
return scale.scaleTime({
|
|
43480
|
+
range: [0, innerWidth],
|
|
43481
|
+
domain: chart.x.scale.ordering === 'asc' ? [chart.x.scale.min, chart.x.scale.max] : [chart.x.scale.max, chart.x.scale.min]
|
|
43482
|
+
});
|
|
43483
|
+
}
|
|
43484
|
+
if (xScaleDataType === 'number') {
|
|
43485
|
+
return scale.scaleLinear({
|
|
43486
|
+
range: [0, innerWidth],
|
|
43487
|
+
domain: chart.x.scale.ordering === 'asc' ? [chart.x.scale.min, chart.x.scale.max] : [chart.x.scale.max, chart.x.scale.min],
|
|
43488
|
+
nice: true
|
|
43489
|
+
});
|
|
43490
|
+
}
|
|
43491
|
+
return null;
|
|
43492
|
+
}, [innerWidth, chart.x, chart.data]);
|
|
43493
|
+
var _yScale = React.useMemo(function () {
|
|
43494
|
+
return scale.scaleLinear({
|
|
43495
|
+
range: [innerHeight, 0],
|
|
43496
|
+
domain: chart.y.scale.ordering === 'asc' ? [chart.y.scale.min, chart.y.scale.max] : [chart.y.scale.max, chart.y.scale.min],
|
|
43497
|
+
nice: true
|
|
43498
|
+
});
|
|
43499
|
+
}, [innerHeight, chart.y.scale]);
|
|
43500
|
+
var dataFlattened = useFlattenedData(xScaleKey, xScaleDataType, chart);
|
|
43501
|
+
var handleMouseMove = React.useCallback(function (event) {
|
|
43502
|
+
if (!xKey || !xScaleKey || xScale === null) return;
|
|
43503
|
+
var tooltipData = getTooltipData({
|
|
43504
|
+
data: chart.data,
|
|
43505
|
+
event: event,
|
|
43506
|
+
margin: margin,
|
|
43507
|
+
xScaleKey: xScaleKey,
|
|
43508
|
+
xScaleDataType: xScaleDataType,
|
|
43509
|
+
xOrdering: chart.x.scale.ordering,
|
|
43510
|
+
xScale: xScale,
|
|
43511
|
+
chartType: 'lines'
|
|
43512
|
+
});
|
|
43513
|
+
showTooltip({
|
|
43514
|
+
lineLeft: tooltipData == null ? void 0 : tooltipData.lineLeft,
|
|
43515
|
+
tooltipLeft: event.pageX,
|
|
43516
|
+
tooltipTop: event.pageY,
|
|
43517
|
+
tooltipData: tooltipData == null ? void 0 : tooltipData.tooltipData
|
|
43518
|
+
});
|
|
43519
|
+
}, [showTooltip, xScale, margin, xKey, xScaleKey, xScaleDataType, chart.x.scale.ordering, chart.data]);
|
|
43520
|
+
var handleMouseLeave = React.useCallback(function () {
|
|
43521
|
+
hideTooltip();
|
|
43522
|
+
}, [hideTooltip]);
|
|
43523
|
+
var areaCurve = React.useCallback(function () {
|
|
43524
|
+
var _options$curve;
|
|
43525
|
+
var curveMap = {
|
|
43526
|
+
natural: Curves.curveMonotoneX,
|
|
43527
|
+
step: Curves.curveStep,
|
|
43528
|
+
straight: Curves.curveLinear
|
|
43529
|
+
};
|
|
43530
|
+
return curveMap[(_options$curve = options.curve) != null ? _options$curve : 'monotoneX'];
|
|
43531
|
+
}, [options.curve]);
|
|
43532
|
+
if (width === 0 || height === 0 || xScale === null) return jsxRuntime.jsx(React__default.Fragment, {});
|
|
43533
|
+
var yTickValues = chart.y.ticks.map(function (tick) {
|
|
43534
|
+
return Number(tick.value);
|
|
43535
|
+
});
|
|
43536
|
+
return jsxRuntime.jsxs(React__default.Fragment, {
|
|
43537
|
+
children: [jsxRuntime.jsxs(ChartWrapper$1, {
|
|
43538
|
+
width: width,
|
|
43539
|
+
height: height,
|
|
43540
|
+
onMouseMove: handleMouseMove,
|
|
43541
|
+
onMouseLeave: handleMouseLeave,
|
|
43542
|
+
showLegend: options.showLegend,
|
|
43543
|
+
children: [jsxRuntime.jsxs(group.Group, {
|
|
43544
|
+
left: margin.left,
|
|
43545
|
+
top: margin.top,
|
|
43546
|
+
children: [jsxRuntime.jsx(GridRows, {
|
|
43547
|
+
ticks: yTickValues,
|
|
43548
|
+
yScale: _yScale,
|
|
43549
|
+
width: innerWidth,
|
|
43550
|
+
height: innerHeight,
|
|
43551
|
+
removeStroke: options.removeStroke,
|
|
43552
|
+
themeCSS: themeCSS
|
|
43553
|
+
}), jsxRuntime.jsx(AxisBottom, {
|
|
43554
|
+
x: chart.x,
|
|
43555
|
+
margin: margin,
|
|
43556
|
+
themeCSS: themeCSS,
|
|
43557
|
+
show: options.axis.showXAxisLabels,
|
|
43558
|
+
removeStroke: options.removeStroke,
|
|
43559
|
+
xScaleDataType: xScaleDataType,
|
|
43560
|
+
xScale: xScale,
|
|
43561
|
+
height: innerHeight
|
|
43562
|
+
}), jsxRuntime.jsx(AxisLeft, {
|
|
43563
|
+
show: options.axis.showYAxisLabels,
|
|
43564
|
+
y: chart.y,
|
|
43565
|
+
margin: margin,
|
|
43566
|
+
themeCSS: themeCSS,
|
|
43567
|
+
yScale: _yScale,
|
|
43568
|
+
ticks: yTickValues,
|
|
43569
|
+
stroke: theme == null || (_theme$axis = theme.axis) == null ? void 0 : _theme$axis.stroke
|
|
43570
|
+
}), jsxRuntime.jsxs(group.Group, {
|
|
43571
|
+
children: [chart.conditionalFormattingRules && chart.conditionalFormattingRules.length > 0 && jsxRuntime.jsx(ThresholdArea, {
|
|
43572
|
+
rules: chart.conditionalFormattingRules,
|
|
43573
|
+
height: height,
|
|
43574
|
+
margin: margin,
|
|
43575
|
+
idPrefix: AREA_GRADIENT_ID_PREFIX,
|
|
43576
|
+
theme: theme == null ? void 0 : theme.threshold,
|
|
43577
|
+
uniqueId: uniqueId,
|
|
43578
|
+
yScale: _yScale,
|
|
43579
|
+
width: width
|
|
43580
|
+
}), chart.y.keys.map(function (yKey) {
|
|
43581
|
+
var style = chart.areas.find(function (area) {
|
|
43582
|
+
return area.yKey === yKey;
|
|
43583
|
+
});
|
|
43584
|
+
return jsxRuntime.jsxs(React.Fragment, {
|
|
43585
|
+
children: [jsxRuntime.jsx(gradient.LinearGradient, {
|
|
43586
|
+
id: useableId(yKey, AREA_GRADIENT_ID_PREFIX),
|
|
43587
|
+
from: style == null ? void 0 : style.color,
|
|
43588
|
+
to: style == null ? void 0 : style.color,
|
|
43589
|
+
fromOpacity: style == null ? void 0 : style.style.fromOpacity,
|
|
43590
|
+
toOpacity: style == null ? void 0 : style.style.toOpacity
|
|
43591
|
+
}), getRule(chart.conditionalFormattingRules, yKey).map(function (areaThreshold, thresholdIndex) {
|
|
43592
|
+
return jsxRuntime.jsx(gradient.LinearGradient, {
|
|
43593
|
+
id: useableId(yKey + "-" + thresholdIndex, AREA_GRADIENT_ID_PREFIX),
|
|
43594
|
+
from: areaThreshold == null ? void 0 : areaThreshold.color,
|
|
43595
|
+
to: areaThreshold == null ? void 0 : areaThreshold.color,
|
|
43596
|
+
fromOpacity: style == null ? void 0 : style.style.fromOpacity,
|
|
43597
|
+
toOpacity: style == null ? void 0 : style.style.toOpacity,
|
|
43598
|
+
clipPath: "url(#" + buildClipPathId$1(areaThreshold, AREA_GRADIENT_ID_PREFIX, uniqueId) + ")"
|
|
43599
|
+
}, yKey + "-" + AREA_GRADIENT_ID_PREFIX + "_" + thresholdIndex);
|
|
43600
|
+
})]
|
|
43601
|
+
}, yKey + "-" + AREA_GRADIENT_ID_PREFIX);
|
|
43602
|
+
}), options.stacked && jsxRuntime.jsx(shape.AreaStack, {
|
|
43603
|
+
keys: chart.y.keys,
|
|
43604
|
+
data: dataFlattened,
|
|
43605
|
+
x: function x(d) {
|
|
43606
|
+
var _xScale;
|
|
43607
|
+
// @ts-ignore
|
|
43608
|
+
var xValue = d.data[xScaleKey];
|
|
43609
|
+
var xValueAdjusted = xScaleDataType === 'date_time' ? new Date(xValue) : xScaleDataType === 'number' ? Number(xValue) : String(xValue);
|
|
43610
|
+
// @ts-ignore
|
|
43611
|
+
return (_xScale = xScale(xValueAdjusted)) != null ? _xScale : 0;
|
|
43612
|
+
},
|
|
43613
|
+
y0: function y0(d) {
|
|
43614
|
+
return _yScale(d[0]);
|
|
43615
|
+
},
|
|
43616
|
+
y1: function y1(d) {
|
|
43617
|
+
return _yScale(d[1]);
|
|
43618
|
+
},
|
|
43619
|
+
curve: areaCurve(),
|
|
43620
|
+
children: function children(_ref2) {
|
|
43621
|
+
var stacks = _ref2.stacks,
|
|
43622
|
+
path = _ref2.path;
|
|
43623
|
+
return stacks.map(function (stack) {
|
|
43624
|
+
return jsxRuntime.jsx(React.Fragment, {
|
|
43625
|
+
children: jsxRuntime.jsx("path", {
|
|
43626
|
+
d: path(stack) || '',
|
|
43627
|
+
fill: "url(#" + useableId(stack.key, AREA_GRADIENT_ID_PREFIX) + ")"
|
|
43628
|
+
})
|
|
43629
|
+
}, "stack-" + stack.index + "-" + stack.key);
|
|
43630
|
+
});
|
|
43631
|
+
}
|
|
43632
|
+
}), !options.stacked && chart.y.keys.map(function (yKey) {
|
|
43633
|
+
if (xScaleKey === null) return null;
|
|
43634
|
+
return jsxRuntime.jsxs(React.Fragment, {
|
|
43635
|
+
children: [jsxRuntime.jsx(Area, {
|
|
43636
|
+
data: dataFlattened,
|
|
43637
|
+
yScale: _yScale,
|
|
43638
|
+
xScaleDataType: xScaleDataType,
|
|
43639
|
+
xKey: xScaleKey,
|
|
43640
|
+
xScale: xScale,
|
|
43641
|
+
yKey: yKey,
|
|
43642
|
+
curve: areaCurve()
|
|
43643
|
+
}), getRule(chart.conditionalFormattingRules, yKey).map(function (areaThreshold, thresholdIndex) {
|
|
43644
|
+
var id = useableId(yKey + "-" + thresholdIndex, AREA_GRADIENT_ID_PREFIX);
|
|
43645
|
+
return jsxRuntime.jsx(Area, {
|
|
43646
|
+
data: dataFlattened,
|
|
43647
|
+
yScale: _yScale,
|
|
43648
|
+
xScaleDataType: xScaleDataType,
|
|
43649
|
+
xKey: xScaleKey,
|
|
43650
|
+
xScale: xScale,
|
|
43651
|
+
yKey: yKey,
|
|
43652
|
+
curve: areaCurve(),
|
|
43653
|
+
stroke: "url(#" + id + ")",
|
|
43654
|
+
clipPath: "url(#" + buildClipPathId$1(areaThreshold, AREA_GRADIENT_ID_PREFIX, uniqueId) + ")",
|
|
43655
|
+
fill: "url(#" + id + ")"
|
|
43656
|
+
}, yKey + "-" + AREA_GRADIENT_ID_PREFIX + "-" + thresholdIndex);
|
|
43657
|
+
})]
|
|
43658
|
+
}, yKey + "-" + AREA_GRADIENT_ID_PREFIX);
|
|
43659
|
+
})]
|
|
43660
|
+
})]
|
|
43661
|
+
}), tooltipData && jsxRuntime.jsxs("g", {
|
|
43662
|
+
children: [jsxRuntime.jsx(Line, {
|
|
43663
|
+
x: lineLeft,
|
|
43664
|
+
margin: margin,
|
|
43665
|
+
height: innerHeight
|
|
43666
|
+
}), !options.stacked && jsxRuntime.jsx(CrosshairCircle, {
|
|
43667
|
+
yKeys: chart.y.keys,
|
|
43668
|
+
xKey: xScaleKey,
|
|
43669
|
+
dataType: xScaleDataType,
|
|
43670
|
+
legendItems: chart.areas,
|
|
43671
|
+
yScale: function yScale(yKey) {
|
|
43672
|
+
return _yScale(tooltipData[yKey].value !== null ? tooltipData[yKey].value : 0);
|
|
43673
|
+
}
|
|
43674
|
+
// @ts-ignore
|
|
43675
|
+
,
|
|
43676
|
+
xScale: xScale,
|
|
43677
|
+
margin: margin,
|
|
43678
|
+
tooltipData: tooltipData,
|
|
43679
|
+
conditionalFormattingRules: chart.conditionalFormattingRules,
|
|
43680
|
+
visibleYKeys: visibleYKeys
|
|
43681
|
+
})]
|
|
43682
|
+
}), jsxRuntime.jsx(GoalLines$1, {
|
|
43683
|
+
goalLines: chart.goalLines,
|
|
43684
|
+
y: function y(d) {
|
|
43685
|
+
return _yScale(d);
|
|
43686
|
+
},
|
|
43687
|
+
margin: margin,
|
|
43688
|
+
width: innerWidth
|
|
43689
|
+
})]
|
|
43690
|
+
}), options.showLegend && jsxRuntime.jsx(Legend$1, {
|
|
43691
|
+
legendItems: chart.areas,
|
|
43692
|
+
visibleYKeys: visibleYKeys,
|
|
43693
|
+
setVisibleYKeys: setVisibleYKeys,
|
|
43694
|
+
keys: chart.keys,
|
|
43695
|
+
conditionalFormattingRules: chart.conditionalFormattingRules,
|
|
43696
|
+
marginLeft: margin.left - margin.leftTitleOffset
|
|
43697
|
+
}), tooltipOpen && tooltipData && xKey && jsxRuntime.jsx(Tooltip$1, {
|
|
43698
|
+
tooltipData: tooltipData,
|
|
43699
|
+
tooltipLeft: tooltipLeft,
|
|
43700
|
+
tooltipTop: tooltipTop,
|
|
43701
|
+
xKey: xKey,
|
|
43702
|
+
keys: chart.keys,
|
|
43703
|
+
visibleYKeys: visibleYKeys,
|
|
43704
|
+
yKeys: chart.y.keys,
|
|
43705
|
+
legendItems: chart.areas,
|
|
43706
|
+
showRoundedTotal: options.showRoundedTotal,
|
|
43707
|
+
conditionalFormattingRules: chart.conditionalFormattingRules,
|
|
43708
|
+
theme: themeCSS.popoverMenus
|
|
43709
|
+
})]
|
|
43710
|
+
});
|
|
43711
|
+
};
|
|
43712
|
+
function Area(_ref3) {
|
|
43713
|
+
var data = _ref3.data,
|
|
43714
|
+
xScaleDataType = _ref3.xScaleDataType,
|
|
43715
|
+
xScale = _ref3.xScale,
|
|
43716
|
+
yScale = _ref3.yScale,
|
|
43717
|
+
yKey = _ref3.yKey,
|
|
43718
|
+
curve = _ref3.curve,
|
|
43719
|
+
clipPath = _ref3.clipPath,
|
|
43720
|
+
xKey = _ref3.xKey,
|
|
43721
|
+
fill = _ref3.fill,
|
|
43722
|
+
stroke = _ref3.stroke;
|
|
43723
|
+
return jsxRuntime.jsx(shape.AreaClosed, {
|
|
43724
|
+
data: data,
|
|
43725
|
+
x: function x(d) {
|
|
43726
|
+
var _xScale2;
|
|
43727
|
+
var xValue = d[xKey];
|
|
43728
|
+
var xValueAdjusted = xScaleDataType === 'date_time' ? new Date(xValue) : xScaleDataType === 'number' ? Number(xValue) : String(xValue);
|
|
43729
|
+
// @ts-ignore
|
|
43730
|
+
return (_xScale2 = xScale(xValueAdjusted)) != null ? _xScale2 : 0;
|
|
43731
|
+
},
|
|
43732
|
+
y: function y(d) {
|
|
43733
|
+
var _yScale2;
|
|
43734
|
+
var value = d[yKey];
|
|
43735
|
+
return value !== null ? (_yScale2 = yScale(value)) != null ? _yScale2 : 0 : 0;
|
|
43736
|
+
},
|
|
43737
|
+
defined: function defined(d) {
|
|
43738
|
+
return d !== null && d[yKey] !== null;
|
|
43739
|
+
},
|
|
43740
|
+
yScale: yScale,
|
|
43741
|
+
strokeWidth: 1,
|
|
43742
|
+
stroke: stroke != null ? stroke : "url(#" + useableId(yKey, AREA_GRADIENT_ID_PREFIX) + ")",
|
|
43743
|
+
fill: fill != null ? fill : "url(#" + useableId(yKey, AREA_GRADIENT_ID_PREFIX) + ")",
|
|
43744
|
+
curve: curve,
|
|
43745
|
+
clipPath: clipPath
|
|
43746
|
+
});
|
|
43747
|
+
}
|
|
43748
|
+
|
|
43324
43749
|
function getStyleDefinition(_ref) {
|
|
43325
43750
|
var colors = _ref.colors,
|
|
43326
43751
|
yKeys = _ref.yKeys,
|
|
@@ -49295,7 +49720,7 @@ var AreaChartV2View = function AreaChartV2View(props) {
|
|
|
49295
49720
|
children: function children(parent) {
|
|
49296
49721
|
var _props$attributes$vie2, _props$attributes$sta;
|
|
49297
49722
|
if (chartRepresentation.areas.length === 0) return jsxRuntime.jsx(LoadingComponent, {});
|
|
49298
|
-
return jsxRuntime.jsx(
|
|
49723
|
+
return jsxRuntime.jsx(AreaChart$5, {
|
|
49299
49724
|
width: parent.width,
|
|
49300
49725
|
height: parent.height,
|
|
49301
49726
|
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
@@ -66029,7 +66454,7 @@ var View$3 = /*#__PURE__*/function () {
|
|
|
66029
66454
|
};
|
|
66030
66455
|
return View;
|
|
66031
66456
|
}();
|
|
66032
|
-
var AreaChart$
|
|
66457
|
+
var AreaChart$6 = /*#__PURE__*/function (_View2) {
|
|
66033
66458
|
function AreaChart(attributes) {
|
|
66034
66459
|
return _View2.call(this, _extends({}, attributes, {
|
|
66035
66460
|
type: 'areaChart'
|
|
@@ -68110,7 +68535,7 @@ VizzlyServices.Dashboard = Dashboard$1;
|
|
|
68110
68535
|
VizzlyServices.Editor = Editor;
|
|
68111
68536
|
VizzlyServices.Header = Header;
|
|
68112
68537
|
VizzlyServices.Library = Library$1;
|
|
68113
|
-
VizzlyServices.AreaChart = AreaChart$
|
|
68538
|
+
VizzlyServices.AreaChart = AreaChart$6;
|
|
68114
68539
|
VizzlyServices.LineChart = LineChart$6;
|
|
68115
68540
|
VizzlyServices.BarChart = BarChart$6;
|
|
68116
68541
|
VizzlyServices.PieChart = PieChart$4;
|