@vizzly/dashboard 0.14.4-dev-bb1215ca6cb16d6182d2617660ee9c9be91b265f → 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.
package/dist/dashboard.esm.js
CHANGED
|
@@ -34,7 +34,7 @@ import { LegendItem as LegendItem$1, LegendLabel } from '@visx/legend';
|
|
|
34
34
|
import { scaleOrdinal, scaleQuantize, scalePoint, scaleTime, scaleLinear, scaleBand } from '@visx/scale';
|
|
35
35
|
import Ordinal from '@visx/legend/lib/legends/Ordinal';
|
|
36
36
|
import { curveNatural, curveMonotoneX, curveMonotoneY, curveLinear, curveStep, curveStepBefore, curveStepAfter } from '@visx/curve';
|
|
37
|
-
import { Line as Line$1, LinePath, BarGroup as BarGroup$1, BarStack as BarStack$1 } from '@visx/shape';
|
|
37
|
+
import { Line as Line$1, LinePath, BarGroup as BarGroup$1, BarStack as BarStack$1, AreaStack as AreaStack$1, AreaClosed } from '@visx/shape';
|
|
38
38
|
import { Mercator, Graticule } from '@visx/geo';
|
|
39
39
|
import { feature } from 'topojson-client';
|
|
40
40
|
import ParentSize$1 from '@visx/responsive/lib/components/ParentSize';
|
|
@@ -55,7 +55,6 @@ import { AxisBottom as AxisBottom$1, AxisLeft as AxisLeft$1 } from '@visx/axis';
|
|
|
55
55
|
import { Text } from '@visx/text';
|
|
56
56
|
import { GridRows as GridRows$1 } from '@visx/grid';
|
|
57
57
|
import '@visx/point';
|
|
58
|
-
import { AreaChartV2 as AreaChartV2$1 } from './charts/src/v2';
|
|
59
58
|
import VisibilitySensor from 'react-visibility-sensor';
|
|
60
59
|
import ExcelJS from 'exceljs';
|
|
61
60
|
import { saveAs } from 'file-saver';
|
|
@@ -43379,6 +43378,432 @@ var Bar = function Bar(props) {
|
|
|
43379
43378
|
}, props.key);
|
|
43380
43379
|
};
|
|
43381
43380
|
|
|
43381
|
+
var useableId = function useableId(key, prefix) {
|
|
43382
|
+
var newKey = key.toLowerCase()
|
|
43383
|
+
// Remove characters that aren't letters, digits, underscores, or spaces
|
|
43384
|
+
.replace(/[^\w\s-]+/g, '')
|
|
43385
|
+
// Replace whitespace with hyphens
|
|
43386
|
+
.replace(/\s+/g, '-')
|
|
43387
|
+
// Remove leading or trailing hyphens
|
|
43388
|
+
.replace(/^-+|-+$/g, '');
|
|
43389
|
+
return prefix + '-' + newKey;
|
|
43390
|
+
};
|
|
43391
|
+
|
|
43392
|
+
function useVisibleYKeys(areas) {
|
|
43393
|
+
var _useState = useState(areas.map(function (legendItem) {
|
|
43394
|
+
return legendItem.yKey;
|
|
43395
|
+
})),
|
|
43396
|
+
visibleYKeysState = _useState[0],
|
|
43397
|
+
setVisibleYKeys = _useState[1];
|
|
43398
|
+
useEffect(function () {
|
|
43399
|
+
setVisibleYKeys(areas.map(function (legendItem) {
|
|
43400
|
+
return legendItem.yKey;
|
|
43401
|
+
}));
|
|
43402
|
+
return function () {
|
|
43403
|
+
setVisibleYKeys([]);
|
|
43404
|
+
};
|
|
43405
|
+
}, [areas]);
|
|
43406
|
+
return {
|
|
43407
|
+
visibleYKeys: visibleYKeysState,
|
|
43408
|
+
setVisibleYKeys: setVisibleYKeys
|
|
43409
|
+
};
|
|
43410
|
+
}
|
|
43411
|
+
|
|
43412
|
+
var thresholdId$1 = function thresholdId(args, idPrefix, position, uniqueId) {
|
|
43413
|
+
var rawIdKey = args.yKey + "_" + args.value + "_" + args.operator;
|
|
43414
|
+
return (position + "_" + idPrefix + "_" + uniqueId + "_" + btoa(rawIdKey)).replace(/=/g, '');
|
|
43415
|
+
};
|
|
43416
|
+
function buildClipPathId$1(rule, idPrefix, uniqueId) {
|
|
43417
|
+
var isGreater = rule.operator === '>=';
|
|
43418
|
+
var clipPathId = isGreater ? thresholdId$1(rule, idPrefix, 'above', uniqueId) : thresholdId$1(rule, idPrefix, 'below', uniqueId);
|
|
43419
|
+
return clipPathId;
|
|
43420
|
+
}
|
|
43421
|
+
function getRule(rules, yKey) {
|
|
43422
|
+
return rules.filter(function (threshold) {
|
|
43423
|
+
return threshold.yKey === yKey;
|
|
43424
|
+
});
|
|
43425
|
+
}
|
|
43426
|
+
|
|
43427
|
+
var ThresholdArea = function ThresholdArea(props) {
|
|
43428
|
+
var chartHeight = props.height - props.margin.top;
|
|
43429
|
+
return jsxs(Fragment, {
|
|
43430
|
+
children: [jsx("g", {
|
|
43431
|
+
transform: "translate(50, 0)",
|
|
43432
|
+
children: props.rules.map(function (thresh, index) {
|
|
43433
|
+
var _props$theme$stroke, _props$theme;
|
|
43434
|
+
var thresholdYCoord = props.yScale(thresh.value);
|
|
43435
|
+
return jsx("g", {
|
|
43436
|
+
children: jsx("line", {
|
|
43437
|
+
x1: 0,
|
|
43438
|
+
y1: thresholdYCoord,
|
|
43439
|
+
x2: props.width - props.margin.right - props.margin.left,
|
|
43440
|
+
y2: thresholdYCoord,
|
|
43441
|
+
stroke: (_props$theme$stroke = (_props$theme = props.theme) == null ? void 0 : _props$theme.stroke) != null ? _props$theme$stroke : '#F4F4F4',
|
|
43442
|
+
strokeWidth: "1",
|
|
43443
|
+
fill: "transparent",
|
|
43444
|
+
"data-themeapi": "charts.threshold.stroke"
|
|
43445
|
+
})
|
|
43446
|
+
}, "threshold-" + index);
|
|
43447
|
+
})
|
|
43448
|
+
}), jsx("defs", {
|
|
43449
|
+
children: props.rules.map(function (thresh, index) {
|
|
43450
|
+
var thresholdYCoord = props.yScale(thresh.value);
|
|
43451
|
+
if (!thresholdYCoord) return null;
|
|
43452
|
+
return jsxs(Fragment, {
|
|
43453
|
+
children: [jsx("clipPath", {
|
|
43454
|
+
id: thresholdId$1(thresh, props.idPrefix, 'above', props.uniqueId),
|
|
43455
|
+
children: jsx("rect", {
|
|
43456
|
+
x: "0",
|
|
43457
|
+
y: "0",
|
|
43458
|
+
width: "100%",
|
|
43459
|
+
height: thresholdYCoord
|
|
43460
|
+
})
|
|
43461
|
+
}), jsx("clipPath", {
|
|
43462
|
+
id: thresholdId$1(thresh, props.idPrefix, 'intermediate', props.uniqueId),
|
|
43463
|
+
children: jsx("rect", {
|
|
43464
|
+
x: "0",
|
|
43465
|
+
y: thresholdYCoord,
|
|
43466
|
+
width: "100%",
|
|
43467
|
+
height: 0
|
|
43468
|
+
})
|
|
43469
|
+
}), jsx("clipPath", {
|
|
43470
|
+
id: thresholdId$1(thresh, props.idPrefix, 'below', props.uniqueId),
|
|
43471
|
+
children: jsx("rect", {
|
|
43472
|
+
x: "0",
|
|
43473
|
+
y: thresholdYCoord,
|
|
43474
|
+
width: "100%",
|
|
43475
|
+
height: chartHeight - thresholdYCoord
|
|
43476
|
+
})
|
|
43477
|
+
})]
|
|
43478
|
+
}, "threshold-" + index);
|
|
43479
|
+
})
|
|
43480
|
+
})]
|
|
43481
|
+
});
|
|
43482
|
+
};
|
|
43483
|
+
|
|
43484
|
+
var AREA_GRADIENT_ID_PREFIX = 'area-gradient';
|
|
43485
|
+
|
|
43486
|
+
/*
|
|
43487
|
+
NOTES
|
|
43488
|
+
-----
|
|
43489
|
+
1. Control width of margins via props and truncate ticks using a fixed width
|
|
43490
|
+
2. (somehow) prevent overlapping of ticks
|
|
43491
|
+
3. Split out conditional formatting colours to show operator and values for each color
|
|
43492
|
+
4. Add axis titles
|
|
43493
|
+
5. Account for no xKey and showing 1 dot for a single yKey
|
|
43494
|
+
*/
|
|
43495
|
+
|
|
43496
|
+
var AreaChart$5 = function AreaChart(_ref) {
|
|
43497
|
+
var _theme$axis;
|
|
43498
|
+
var chart = _ref.chart,
|
|
43499
|
+
options = _ref.options,
|
|
43500
|
+
theme = _ref.theme,
|
|
43501
|
+
width = _ref.width,
|
|
43502
|
+
height = _ref.height,
|
|
43503
|
+
uniqueId = _ref.uniqueId;
|
|
43504
|
+
var _useTooltip = useTooltip$1(),
|
|
43505
|
+
tooltipOpen = _useTooltip.tooltipOpen,
|
|
43506
|
+
_useTooltip$tooltipLe = _useTooltip.tooltipLeft,
|
|
43507
|
+
tooltipLeft = _useTooltip$tooltipLe === void 0 ? 0 : _useTooltip$tooltipLe,
|
|
43508
|
+
_useTooltip$tooltipTo = _useTooltip.tooltipTop,
|
|
43509
|
+
tooltipTop = _useTooltip$tooltipTo === void 0 ? 0 : _useTooltip$tooltipTo,
|
|
43510
|
+
_useTooltip$lineLeft = _useTooltip.lineLeft,
|
|
43511
|
+
lineLeft = _useTooltip$lineLeft === void 0 ? 0 : _useTooltip$lineLeft,
|
|
43512
|
+
tooltipData = _useTooltip.tooltipData,
|
|
43513
|
+
hideTooltip = _useTooltip.hideTooltip,
|
|
43514
|
+
showTooltip = _useTooltip.showTooltip;
|
|
43515
|
+
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null);
|
|
43516
|
+
var _useVisibleYKeys = useVisibleYKeys(chart.areas),
|
|
43517
|
+
visibleYKeys = _useVisibleYKeys.visibleYKeys,
|
|
43518
|
+
setVisibleYKeys = _useVisibleYKeys.setVisibleYKeys;
|
|
43519
|
+
var innerWidth = width - margin.left - margin.right;
|
|
43520
|
+
var innerHeight = height - margin.top - margin.bottom - (options.showLegend ? 40 : 0);
|
|
43521
|
+
var xKey = chart.x.key;
|
|
43522
|
+
var xScaleKey = chart.x.scale.key;
|
|
43523
|
+
var xScaleDataType = chart.x.scale.dataType;
|
|
43524
|
+
var themeCSS = useMemo(function () {
|
|
43525
|
+
return getChartThemeCSS(theme);
|
|
43526
|
+
}, [theme]);
|
|
43527
|
+
var xScale = useMemo(function () {
|
|
43528
|
+
if (xScaleDataType === 'string') {
|
|
43529
|
+
return scalePoint({
|
|
43530
|
+
range: [0, innerWidth],
|
|
43531
|
+
domain: xScaleKey ? [].concat(chart.data.map(function (d) {
|
|
43532
|
+
return d[xScaleKey] && d[xScaleKey].value !== null ? String(d[xScaleKey].value) : '';
|
|
43533
|
+
})) : []
|
|
43534
|
+
});
|
|
43535
|
+
}
|
|
43536
|
+
if (xScaleDataType === 'date_time') {
|
|
43537
|
+
return scaleTime({
|
|
43538
|
+
range: [0, innerWidth],
|
|
43539
|
+
domain: chart.x.scale.ordering === 'asc' ? [chart.x.scale.min, chart.x.scale.max] : [chart.x.scale.max, chart.x.scale.min]
|
|
43540
|
+
});
|
|
43541
|
+
}
|
|
43542
|
+
if (xScaleDataType === 'number') {
|
|
43543
|
+
return scaleLinear({
|
|
43544
|
+
range: [0, innerWidth],
|
|
43545
|
+
domain: chart.x.scale.ordering === 'asc' ? [chart.x.scale.min, chart.x.scale.max] : [chart.x.scale.max, chart.x.scale.min],
|
|
43546
|
+
nice: true
|
|
43547
|
+
});
|
|
43548
|
+
}
|
|
43549
|
+
return null;
|
|
43550
|
+
}, [innerWidth, chart.x, chart.data]);
|
|
43551
|
+
var _yScale = useMemo(function () {
|
|
43552
|
+
return scaleLinear({
|
|
43553
|
+
range: [innerHeight, 0],
|
|
43554
|
+
domain: chart.y.scale.ordering === 'asc' ? [chart.y.scale.min, chart.y.scale.max] : [chart.y.scale.max, chart.y.scale.min],
|
|
43555
|
+
nice: true
|
|
43556
|
+
});
|
|
43557
|
+
}, [innerHeight, chart.y.scale]);
|
|
43558
|
+
var dataFlattened = useFlattenedData(xScaleKey, xScaleDataType, chart);
|
|
43559
|
+
var handleMouseMove = useCallback(function (event) {
|
|
43560
|
+
if (!xKey || !xScaleKey || xScale === null) return;
|
|
43561
|
+
var tooltipData = getTooltipData({
|
|
43562
|
+
data: chart.data,
|
|
43563
|
+
event: event,
|
|
43564
|
+
margin: margin,
|
|
43565
|
+
xScaleKey: xScaleKey,
|
|
43566
|
+
xScaleDataType: xScaleDataType,
|
|
43567
|
+
xOrdering: chart.x.scale.ordering,
|
|
43568
|
+
xScale: xScale,
|
|
43569
|
+
chartType: 'lines'
|
|
43570
|
+
});
|
|
43571
|
+
showTooltip({
|
|
43572
|
+
lineLeft: tooltipData == null ? void 0 : tooltipData.lineLeft,
|
|
43573
|
+
tooltipLeft: event.pageX,
|
|
43574
|
+
tooltipTop: event.pageY,
|
|
43575
|
+
tooltipData: tooltipData == null ? void 0 : tooltipData.tooltipData
|
|
43576
|
+
});
|
|
43577
|
+
}, [showTooltip, xScale, margin, xKey, xScaleKey, xScaleDataType, chart.x.scale.ordering, chart.data]);
|
|
43578
|
+
var handleMouseLeave = useCallback(function () {
|
|
43579
|
+
hideTooltip();
|
|
43580
|
+
}, [hideTooltip]);
|
|
43581
|
+
var areaCurve = useCallback(function () {
|
|
43582
|
+
var _options$curve;
|
|
43583
|
+
var curveMap = {
|
|
43584
|
+
natural: curveMonotoneX,
|
|
43585
|
+
step: curveStep,
|
|
43586
|
+
straight: curveLinear
|
|
43587
|
+
};
|
|
43588
|
+
return curveMap[(_options$curve = options.curve) != null ? _options$curve : 'monotoneX'];
|
|
43589
|
+
}, [options.curve]);
|
|
43590
|
+
if (width === 0 || height === 0 || xScale === null) return jsx(React__default.Fragment, {});
|
|
43591
|
+
var yTickValues = chart.y.ticks.map(function (tick) {
|
|
43592
|
+
return Number(tick.value);
|
|
43593
|
+
});
|
|
43594
|
+
return jsxs(React__default.Fragment, {
|
|
43595
|
+
children: [jsxs(ChartWrapper$1, {
|
|
43596
|
+
width: width,
|
|
43597
|
+
height: height,
|
|
43598
|
+
onMouseMove: handleMouseMove,
|
|
43599
|
+
onMouseLeave: handleMouseLeave,
|
|
43600
|
+
showLegend: options.showLegend,
|
|
43601
|
+
children: [jsxs(Group$2, {
|
|
43602
|
+
left: margin.left,
|
|
43603
|
+
top: margin.top,
|
|
43604
|
+
children: [jsx(GridRows, {
|
|
43605
|
+
ticks: yTickValues,
|
|
43606
|
+
yScale: _yScale,
|
|
43607
|
+
width: innerWidth,
|
|
43608
|
+
height: innerHeight,
|
|
43609
|
+
removeStroke: options.removeStroke,
|
|
43610
|
+
themeCSS: themeCSS
|
|
43611
|
+
}), jsx(AxisBottom, {
|
|
43612
|
+
x: chart.x,
|
|
43613
|
+
margin: margin,
|
|
43614
|
+
themeCSS: themeCSS,
|
|
43615
|
+
show: options.axis.showXAxisLabels,
|
|
43616
|
+
removeStroke: options.removeStroke,
|
|
43617
|
+
xScaleDataType: xScaleDataType,
|
|
43618
|
+
xScale: xScale,
|
|
43619
|
+
height: innerHeight
|
|
43620
|
+
}), jsx(AxisLeft, {
|
|
43621
|
+
show: options.axis.showYAxisLabels,
|
|
43622
|
+
y: chart.y,
|
|
43623
|
+
margin: margin,
|
|
43624
|
+
themeCSS: themeCSS,
|
|
43625
|
+
yScale: _yScale,
|
|
43626
|
+
ticks: yTickValues,
|
|
43627
|
+
stroke: theme == null || (_theme$axis = theme.axis) == null ? void 0 : _theme$axis.stroke
|
|
43628
|
+
}), jsxs(Group$2, {
|
|
43629
|
+
children: [chart.conditionalFormattingRules && chart.conditionalFormattingRules.length > 0 && jsx(ThresholdArea, {
|
|
43630
|
+
rules: chart.conditionalFormattingRules,
|
|
43631
|
+
height: height,
|
|
43632
|
+
margin: margin,
|
|
43633
|
+
idPrefix: AREA_GRADIENT_ID_PREFIX,
|
|
43634
|
+
theme: theme == null ? void 0 : theme.threshold,
|
|
43635
|
+
uniqueId: uniqueId,
|
|
43636
|
+
yScale: _yScale,
|
|
43637
|
+
width: width
|
|
43638
|
+
}), chart.y.keys.map(function (yKey) {
|
|
43639
|
+
var style = chart.areas.find(function (area) {
|
|
43640
|
+
return area.yKey === yKey;
|
|
43641
|
+
});
|
|
43642
|
+
return jsxs(Fragment, {
|
|
43643
|
+
children: [jsx(LinearGradient, {
|
|
43644
|
+
id: useableId(yKey, AREA_GRADIENT_ID_PREFIX),
|
|
43645
|
+
from: style == null ? void 0 : style.color,
|
|
43646
|
+
to: style == null ? void 0 : style.color,
|
|
43647
|
+
fromOpacity: style == null ? void 0 : style.style.fromOpacity,
|
|
43648
|
+
toOpacity: style == null ? void 0 : style.style.toOpacity
|
|
43649
|
+
}), getRule(chart.conditionalFormattingRules, yKey).map(function (areaThreshold, thresholdIndex) {
|
|
43650
|
+
return jsx(LinearGradient, {
|
|
43651
|
+
id: useableId(yKey + "-" + thresholdIndex, AREA_GRADIENT_ID_PREFIX),
|
|
43652
|
+
from: areaThreshold == null ? void 0 : areaThreshold.color,
|
|
43653
|
+
to: areaThreshold == null ? void 0 : areaThreshold.color,
|
|
43654
|
+
fromOpacity: style == null ? void 0 : style.style.fromOpacity,
|
|
43655
|
+
toOpacity: style == null ? void 0 : style.style.toOpacity,
|
|
43656
|
+
clipPath: "url(#" + buildClipPathId$1(areaThreshold, AREA_GRADIENT_ID_PREFIX, uniqueId) + ")"
|
|
43657
|
+
}, yKey + "-" + AREA_GRADIENT_ID_PREFIX + "_" + thresholdIndex);
|
|
43658
|
+
})]
|
|
43659
|
+
}, yKey + "-" + AREA_GRADIENT_ID_PREFIX);
|
|
43660
|
+
}), options.stacked && jsx(AreaStack$1, {
|
|
43661
|
+
keys: chart.y.keys,
|
|
43662
|
+
data: dataFlattened,
|
|
43663
|
+
x: function x(d) {
|
|
43664
|
+
var _xScale;
|
|
43665
|
+
// @ts-ignore
|
|
43666
|
+
var xValue = d.data[xScaleKey];
|
|
43667
|
+
var xValueAdjusted = xScaleDataType === 'date_time' ? new Date(xValue) : xScaleDataType === 'number' ? Number(xValue) : String(xValue);
|
|
43668
|
+
// @ts-ignore
|
|
43669
|
+
return (_xScale = xScale(xValueAdjusted)) != null ? _xScale : 0;
|
|
43670
|
+
},
|
|
43671
|
+
y0: function y0(d) {
|
|
43672
|
+
return _yScale(d[0]);
|
|
43673
|
+
},
|
|
43674
|
+
y1: function y1(d) {
|
|
43675
|
+
return _yScale(d[1]);
|
|
43676
|
+
},
|
|
43677
|
+
curve: areaCurve(),
|
|
43678
|
+
children: function children(_ref2) {
|
|
43679
|
+
var stacks = _ref2.stacks,
|
|
43680
|
+
path = _ref2.path;
|
|
43681
|
+
return stacks.map(function (stack) {
|
|
43682
|
+
return jsx(Fragment, {
|
|
43683
|
+
children: jsx("path", {
|
|
43684
|
+
d: path(stack) || '',
|
|
43685
|
+
fill: "url(#" + useableId(stack.key, AREA_GRADIENT_ID_PREFIX) + ")"
|
|
43686
|
+
})
|
|
43687
|
+
}, "stack-" + stack.index + "-" + stack.key);
|
|
43688
|
+
});
|
|
43689
|
+
}
|
|
43690
|
+
}), !options.stacked && chart.y.keys.map(function (yKey) {
|
|
43691
|
+
if (xScaleKey === null) return null;
|
|
43692
|
+
return jsxs(Fragment, {
|
|
43693
|
+
children: [jsx(Area, {
|
|
43694
|
+
data: dataFlattened,
|
|
43695
|
+
yScale: _yScale,
|
|
43696
|
+
xScaleDataType: xScaleDataType,
|
|
43697
|
+
xKey: xScaleKey,
|
|
43698
|
+
xScale: xScale,
|
|
43699
|
+
yKey: yKey,
|
|
43700
|
+
curve: areaCurve()
|
|
43701
|
+
}), getRule(chart.conditionalFormattingRules, yKey).map(function (areaThreshold, thresholdIndex) {
|
|
43702
|
+
var id = useableId(yKey + "-" + thresholdIndex, AREA_GRADIENT_ID_PREFIX);
|
|
43703
|
+
return jsx(Area, {
|
|
43704
|
+
data: dataFlattened,
|
|
43705
|
+
yScale: _yScale,
|
|
43706
|
+
xScaleDataType: xScaleDataType,
|
|
43707
|
+
xKey: xScaleKey,
|
|
43708
|
+
xScale: xScale,
|
|
43709
|
+
yKey: yKey,
|
|
43710
|
+
curve: areaCurve(),
|
|
43711
|
+
stroke: "url(#" + id + ")",
|
|
43712
|
+
clipPath: "url(#" + buildClipPathId$1(areaThreshold, AREA_GRADIENT_ID_PREFIX, uniqueId) + ")",
|
|
43713
|
+
fill: "url(#" + id + ")"
|
|
43714
|
+
}, yKey + "-" + AREA_GRADIENT_ID_PREFIX + "-" + thresholdIndex);
|
|
43715
|
+
})]
|
|
43716
|
+
}, yKey + "-" + AREA_GRADIENT_ID_PREFIX);
|
|
43717
|
+
})]
|
|
43718
|
+
})]
|
|
43719
|
+
}), tooltipData && jsxs("g", {
|
|
43720
|
+
children: [jsx(Line, {
|
|
43721
|
+
x: lineLeft,
|
|
43722
|
+
margin: margin,
|
|
43723
|
+
height: innerHeight
|
|
43724
|
+
}), !options.stacked && jsx(CrosshairCircle, {
|
|
43725
|
+
yKeys: chart.y.keys,
|
|
43726
|
+
xKey: xScaleKey,
|
|
43727
|
+
dataType: xScaleDataType,
|
|
43728
|
+
legendItems: chart.areas,
|
|
43729
|
+
yScale: function yScale(yKey) {
|
|
43730
|
+
return _yScale(tooltipData[yKey].value !== null ? tooltipData[yKey].value : 0);
|
|
43731
|
+
}
|
|
43732
|
+
// @ts-ignore
|
|
43733
|
+
,
|
|
43734
|
+
xScale: xScale,
|
|
43735
|
+
margin: margin,
|
|
43736
|
+
tooltipData: tooltipData,
|
|
43737
|
+
conditionalFormattingRules: chart.conditionalFormattingRules,
|
|
43738
|
+
visibleYKeys: visibleYKeys
|
|
43739
|
+
})]
|
|
43740
|
+
}), jsx(GoalLines$1, {
|
|
43741
|
+
goalLines: chart.goalLines,
|
|
43742
|
+
y: function y(d) {
|
|
43743
|
+
return _yScale(d);
|
|
43744
|
+
},
|
|
43745
|
+
margin: margin,
|
|
43746
|
+
width: innerWidth
|
|
43747
|
+
})]
|
|
43748
|
+
}), options.showLegend && jsx(Legend$1, {
|
|
43749
|
+
legendItems: chart.areas,
|
|
43750
|
+
visibleYKeys: visibleYKeys,
|
|
43751
|
+
setVisibleYKeys: setVisibleYKeys,
|
|
43752
|
+
keys: chart.keys,
|
|
43753
|
+
conditionalFormattingRules: chart.conditionalFormattingRules,
|
|
43754
|
+
marginLeft: margin.left - margin.leftTitleOffset
|
|
43755
|
+
}), tooltipOpen && tooltipData && xKey && jsx(Tooltip$1, {
|
|
43756
|
+
tooltipData: tooltipData,
|
|
43757
|
+
tooltipLeft: tooltipLeft,
|
|
43758
|
+
tooltipTop: tooltipTop,
|
|
43759
|
+
xKey: xKey,
|
|
43760
|
+
keys: chart.keys,
|
|
43761
|
+
visibleYKeys: visibleYKeys,
|
|
43762
|
+
yKeys: chart.y.keys,
|
|
43763
|
+
legendItems: chart.areas,
|
|
43764
|
+
showRoundedTotal: options.showRoundedTotal,
|
|
43765
|
+
conditionalFormattingRules: chart.conditionalFormattingRules,
|
|
43766
|
+
theme: themeCSS.popoverMenus
|
|
43767
|
+
})]
|
|
43768
|
+
});
|
|
43769
|
+
};
|
|
43770
|
+
function Area(_ref3) {
|
|
43771
|
+
var data = _ref3.data,
|
|
43772
|
+
xScaleDataType = _ref3.xScaleDataType,
|
|
43773
|
+
xScale = _ref3.xScale,
|
|
43774
|
+
yScale = _ref3.yScale,
|
|
43775
|
+
yKey = _ref3.yKey,
|
|
43776
|
+
curve = _ref3.curve,
|
|
43777
|
+
clipPath = _ref3.clipPath,
|
|
43778
|
+
xKey = _ref3.xKey,
|
|
43779
|
+
fill = _ref3.fill,
|
|
43780
|
+
stroke = _ref3.stroke;
|
|
43781
|
+
return jsx(AreaClosed, {
|
|
43782
|
+
data: data,
|
|
43783
|
+
x: function x(d) {
|
|
43784
|
+
var _xScale2;
|
|
43785
|
+
var xValue = d[xKey];
|
|
43786
|
+
var xValueAdjusted = xScaleDataType === 'date_time' ? new Date(xValue) : xScaleDataType === 'number' ? Number(xValue) : String(xValue);
|
|
43787
|
+
// @ts-ignore
|
|
43788
|
+
return (_xScale2 = xScale(xValueAdjusted)) != null ? _xScale2 : 0;
|
|
43789
|
+
},
|
|
43790
|
+
y: function y(d) {
|
|
43791
|
+
var _yScale2;
|
|
43792
|
+
var value = d[yKey];
|
|
43793
|
+
return value !== null ? (_yScale2 = yScale(value)) != null ? _yScale2 : 0 : 0;
|
|
43794
|
+
},
|
|
43795
|
+
defined: function defined(d) {
|
|
43796
|
+
return d !== null && d[yKey] !== null;
|
|
43797
|
+
},
|
|
43798
|
+
yScale: yScale,
|
|
43799
|
+
strokeWidth: 1,
|
|
43800
|
+
stroke: stroke != null ? stroke : "url(#" + useableId(yKey, AREA_GRADIENT_ID_PREFIX) + ")",
|
|
43801
|
+
fill: fill != null ? fill : "url(#" + useableId(yKey, AREA_GRADIENT_ID_PREFIX) + ")",
|
|
43802
|
+
curve: curve,
|
|
43803
|
+
clipPath: clipPath
|
|
43804
|
+
});
|
|
43805
|
+
}
|
|
43806
|
+
|
|
43382
43807
|
function getStyleDefinition(_ref) {
|
|
43383
43808
|
var colors = _ref.colors,
|
|
43384
43809
|
yKeys = _ref.yKeys,
|
|
@@ -49353,7 +49778,7 @@ var AreaChartV2View = function AreaChartV2View(props) {
|
|
|
49353
49778
|
children: function children(parent) {
|
|
49354
49779
|
var _props$attributes$vie2, _props$attributes$sta;
|
|
49355
49780
|
if (chartRepresentation.areas.length === 0) return jsx(LoadingComponent, {});
|
|
49356
|
-
return jsx(
|
|
49781
|
+
return jsx(AreaChart$5, {
|
|
49357
49782
|
width: parent.width,
|
|
49358
49783
|
height: parent.height,
|
|
49359
49784
|
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
@@ -66087,7 +66512,7 @@ var View$3 = /*#__PURE__*/function () {
|
|
|
66087
66512
|
};
|
|
66088
66513
|
return View;
|
|
66089
66514
|
}();
|
|
66090
|
-
var AreaChart$
|
|
66515
|
+
var AreaChart$6 = /*#__PURE__*/function (_View2) {
|
|
66091
66516
|
function AreaChart(attributes) {
|
|
66092
66517
|
return _View2.call(this, _extends({}, attributes, {
|
|
66093
66518
|
type: 'areaChart'
|
|
@@ -68168,7 +68593,7 @@ VizzlyServices.Dashboard = Dashboard$1;
|
|
|
68168
68593
|
VizzlyServices.Editor = Editor;
|
|
68169
68594
|
VizzlyServices.Header = Header;
|
|
68170
68595
|
VizzlyServices.Library = Library$1;
|
|
68171
|
-
VizzlyServices.AreaChart = AreaChart$
|
|
68596
|
+
VizzlyServices.AreaChart = AreaChart$6;
|
|
68172
68597
|
VizzlyServices.LineChart = LineChart$6;
|
|
68173
68598
|
VizzlyServices.BarChart = BarChart$6;
|
|
68174
68599
|
VizzlyServices.PieChart = PieChart$4;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizzly/dashboard",
|
|
3
3
|
"author": "james@vizzly.co",
|
|
4
|
-
"version": "0.14.4-dev-
|
|
4
|
+
"version": "0.14.4-dev-f81c05d870985862e147c5e214f0dc91eb44478a",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "./dist/dashboard/src/index.d.ts",
|
|
7
7
|
"module": "./dist/dashboard.esm.js",
|