@vizzly/dashboard 0.15.0-dev-adc0ad5ca8785acecefbc70dee9842ac6230d1c1 → 0.15.0-dev-9247c7b21e49fb5e3915574eb5264b609426a7b6
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/charts/src/v2/components/Axis/AxisBottom.d.ts +2 -1
- package/dist/charts/src/v2/components/BarChart/BarChart.d.ts +1 -0
- package/dist/charts/src/v2/components/HorizontalBarChart/HorizontalBarChart.d.ts +1 -0
- package/dist/dashboard.cjs.development.js +74 -44
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +74 -44
- package/package.json +1 -1
package/dist/dashboard.esm.js
CHANGED
|
@@ -44869,7 +44869,7 @@ var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, h
|
|
|
44869
44869
|
var bottom = showDetailedSubGroupingLabels ? 90 : 40;
|
|
44870
44870
|
var left = showYTicks ? max([maxWidth, MINIMUM_Y_AXIS_WIDTH]) : MINIMUM_Y_AXIS_WIDTH;
|
|
44871
44871
|
return {
|
|
44872
|
-
top: 15,
|
|
44872
|
+
top: showDetailedSubGroupingLabels ? 25 : 15,
|
|
44873
44873
|
right: MINIMUM_Y_AXIS_WIDTH,
|
|
44874
44874
|
bottom: 30 + xAxisTitleOffset,
|
|
44875
44875
|
left: left + yAxisTitleOffset,
|
|
@@ -44948,7 +44948,9 @@ function AxisBottom(_ref) {
|
|
|
44948
44948
|
xScaleDataType = _ref.xScaleDataType,
|
|
44949
44949
|
xScale = _ref.xScale,
|
|
44950
44950
|
height = _ref.height,
|
|
44951
|
-
baselineShift = _ref.baselineShift
|
|
44951
|
+
baselineShift = _ref.baselineShift,
|
|
44952
|
+
_ref$adjustLabelProps = _ref.adjustLabelPropsDueToSubgroupLabels,
|
|
44953
|
+
adjustLabelPropsDueToSubgroupLabels = _ref$adjustLabelProps === void 0 ? false : _ref$adjustLabelProps;
|
|
44952
44954
|
var tickFormat = useCallback(function (value) {
|
|
44953
44955
|
var tick = null;
|
|
44954
44956
|
if (xScaleDataType === 'date_time' && value instanceof Date) {
|
|
@@ -44970,14 +44972,13 @@ function AxisBottom(_ref) {
|
|
|
44970
44972
|
}
|
|
44971
44973
|
return '';
|
|
44972
44974
|
}, [x.ticks, xScaleDataType]);
|
|
44973
|
-
|
|
44974
|
-
|
|
44975
|
-
return jsx(AxisBottom$1, {
|
|
44975
|
+
var hasOnlyTitle = !show && x.title != null && x.title.trim() !== '';
|
|
44976
|
+
return xScale && jsx(AxisBottom$1, {
|
|
44976
44977
|
label: x.title || undefined,
|
|
44977
44978
|
labelProps: {
|
|
44978
44979
|
style: AXIS_TITLE_STYLES
|
|
44979
44980
|
},
|
|
44980
|
-
labelOffset: margin.bottomTitleOffset,
|
|
44981
|
+
labelOffset: margin.bottomTitleOffset - (hasOnlyTitle ? 20 : 0),
|
|
44981
44982
|
hideTicks: true,
|
|
44982
44983
|
top: height,
|
|
44983
44984
|
scale: xScale,
|
|
@@ -44988,10 +44989,11 @@ function AxisBottom(_ref) {
|
|
|
44988
44989
|
tickComponent: function tickComponent(_ref2) {
|
|
44989
44990
|
var formattedValue = _ref2.formattedValue,
|
|
44990
44991
|
tickProps = _objectWithoutPropertiesLoose(_ref2, _excluded$e);
|
|
44991
|
-
return jsx(Text, _extends({
|
|
44992
|
+
return show && jsx(Text, _extends({
|
|
44992
44993
|
style: themeCSS.labels
|
|
44993
44994
|
}, tickProps, {
|
|
44994
44995
|
baselineShift: baselineShift != null ? baselineShift : tickProps.baselineShift,
|
|
44996
|
+
dy: adjustLabelPropsDueToSubgroupLabels ? 60 : 0,
|
|
44995
44997
|
children: formattedValue
|
|
44996
44998
|
}));
|
|
44997
44999
|
},
|
|
@@ -45018,7 +45020,6 @@ var AxisLeft = function AxisLeft(_ref) {
|
|
|
45018
45020
|
}
|
|
45019
45021
|
return item.formattedValue || item.value.toString();
|
|
45020
45022
|
}, [y.ticks]);
|
|
45021
|
-
if (!show) return null;
|
|
45022
45023
|
return jsx(AxisLeft$1, {
|
|
45023
45024
|
labelOffset: margin.leftTitleOffset,
|
|
45024
45025
|
label: y.title || undefined,
|
|
@@ -45034,7 +45035,7 @@ var AxisLeft = function AxisLeft(_ref) {
|
|
|
45034
45035
|
tickComponent: function tickComponent(_ref2) {
|
|
45035
45036
|
var formattedValue = _ref2.formattedValue,
|
|
45036
45037
|
tickProps = _objectWithoutPropertiesLoose(_ref2, _excluded$f);
|
|
45037
|
-
return jsx(Text, _extends({
|
|
45038
|
+
return show && jsx(Text, _extends({
|
|
45038
45039
|
width: 10,
|
|
45039
45040
|
style: themeCSS.labels
|
|
45040
45041
|
}, tickProps, {
|
|
@@ -46168,8 +46169,8 @@ var useGroupingAxisBaseLineShift = function useGroupingAxisBaseLineShift(_ref) {
|
|
|
46168
46169
|
};
|
|
46169
46170
|
}
|
|
46170
46171
|
return {
|
|
46171
|
-
groupingAxisBaselineShift:
|
|
46172
|
-
bottomOffset:
|
|
46172
|
+
groupingAxisBaselineShift: hasLeftTitle ? -65 : -60,
|
|
46173
|
+
bottomOffset: hasLeftTitle ? -15 : 10,
|
|
46173
46174
|
leftOffset: hasLeftTitle ? -10 : 0
|
|
46174
46175
|
};
|
|
46175
46176
|
};
|
|
@@ -46230,9 +46231,11 @@ var BarChart$5 = function BarChart(_ref) {
|
|
|
46230
46231
|
tooltipData = _useTooltip.tooltipData,
|
|
46231
46232
|
hideTooltip = _useTooltip.hideTooltip,
|
|
46232
46233
|
showTooltip = _useTooltip.showTooltip;
|
|
46233
|
-
var showDetailedSubGroupingLabels = !options.stacked && numberOfDimensions === 2 && width > 450;
|
|
46234
|
-
var
|
|
46235
|
-
var
|
|
46234
|
+
var showDetailedSubGroupingLabels = !options.stacked && options.showSublabels === true && numberOfDimensions === 2 && width > 450;
|
|
46235
|
+
var isFirefox = typeof window !== 'undefined' && 'InstallTrigger' in window;
|
|
46236
|
+
var adjustAxisBottomLabelProps = isFirefox && showDetailedSubGroupingLabels;
|
|
46237
|
+
var hasBottomTitle = chart.x.title != null && chart.x.title.trim() !== '';
|
|
46238
|
+
var hasLeftTitle = chart.y.title != null && chart.y.title.trim() !== '';
|
|
46236
46239
|
var isStacked100 = options.stacked === '100%';
|
|
46237
46240
|
var _useGroupingAxisBaseL = useGroupingAxisBaseLineShift({
|
|
46238
46241
|
hasBottomTitle: hasBottomTitle,
|
|
@@ -46410,7 +46413,8 @@ var BarChart$5 = function BarChart(_ref) {
|
|
|
46410
46413
|
xScaleDataType: xScaleDataType,
|
|
46411
46414
|
xScale: xScale,
|
|
46412
46415
|
height: innerHeight,
|
|
46413
|
-
baselineShift: groupingAxisBaselineShift
|
|
46416
|
+
baselineShift: groupingAxisBaselineShift,
|
|
46417
|
+
adjustLabelPropsDueToSubgroupLabels: adjustAxisBottomLabelProps
|
|
46414
46418
|
}), jsx(AxisLeft, {
|
|
46415
46419
|
show: options.axis.showYAxisLabels,
|
|
46416
46420
|
y: yAxisConfig,
|
|
@@ -47334,7 +47338,7 @@ var HorizontalBarChart$3 = function HorizontalBarChart(_ref) {
|
|
|
47334
47338
|
tooltipData = _useTooltip.tooltipData,
|
|
47335
47339
|
hideTooltip = _useTooltip.hideTooltip,
|
|
47336
47340
|
showTooltip = _useTooltip.showTooltip;
|
|
47337
|
-
var showDetailedSubGroupingLabels = !options.stacked && numberOfDimensions === 2 && width > 450;
|
|
47341
|
+
var showDetailedSubGroupingLabels = !options.stacked && options.showSublabels === true && numberOfDimensions === 2 && width > 450;
|
|
47338
47342
|
var hasBottomTitle = chart.x.title != null;
|
|
47339
47343
|
var hasLeftTitle = chart.y.title != null;
|
|
47340
47344
|
var _useGroupingAxisBaseL = useGroupingAxisBaseLineShift({
|
|
@@ -50910,6 +50914,7 @@ var BarChartV2View = function BarChartV2View(props) {
|
|
|
50910
50914
|
showRoundedTotal: false,
|
|
50911
50915
|
showLegend: props.attributes.legend,
|
|
50912
50916
|
showLabels: (_props$attributes$lab = props.attributes.labels) != null ? _props$attributes$lab : false,
|
|
50917
|
+
showSublabels: props.attributes.approxXAxisLabelCount === 2,
|
|
50913
50918
|
axis: {
|
|
50914
50919
|
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
50915
50920
|
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
@@ -54688,6 +54693,7 @@ var HorizontalBarChartV2View = function HorizontalBarChartV2View(props) {
|
|
|
54688
54693
|
showRoundedTotal: false,
|
|
54689
54694
|
showLegend: props.attributes.legend,
|
|
54690
54695
|
showLabels: (_props$attributes$lab = props.attributes.labels) != null ? _props$attributes$lab : false,
|
|
54696
|
+
showSublabels: props.attributes.approxYAxisLabelCount === 2,
|
|
54691
54697
|
axis: {
|
|
54692
54698
|
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
54693
54699
|
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
@@ -64973,11 +64979,11 @@ var SelectNumberFormat = function SelectNumberFormat(props) {
|
|
|
64973
64979
|
};
|
|
64974
64980
|
|
|
64975
64981
|
var AxisPreferenceSection = function AxisPreferenceSection(props) {
|
|
64976
|
-
var _props$attributes, _props$attributes2, _props$attributes3, _props$attributes4, _props$section, _props$section2, _props$section$y, _props$section$y$form, _props$section$y$axis, _props$attributes$axi, _props$section$x$form, _props$section$x$form2, _props$section$x$axis, _props$attributes$axi2;
|
|
64982
|
+
var _props$attributes, _props$attributes2, _props$attributes3, _props$attributes4, _props$attributes5, _props$section, _props$section2, _props$section$y, _props$section$y$form, _props$section$y$axis, _props$attributes$axi, _props$section$x$form, _props$section$x$form2, _props$section$x$axis, _props$attributes$axi2;
|
|
64977
64983
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
64978
64984
|
textOverride = _useDashboardBehaviou.textOverride,
|
|
64979
64985
|
dateTimeFormatOptions = _useDashboardBehaviou.dateTimeFormatOptions;
|
|
64980
|
-
var
|
|
64986
|
+
var axisLabelCountOptionsItems = [{
|
|
64981
64987
|
label: textOverride('auto', 'Auto'),
|
|
64982
64988
|
value: 'auto'
|
|
64983
64989
|
}, {
|
|
@@ -64987,6 +64993,16 @@ var AxisPreferenceSection = function AxisPreferenceSection(props) {
|
|
|
64987
64993
|
label: textOverride('None', 'None'),
|
|
64988
64994
|
value: 0
|
|
64989
64995
|
}];
|
|
64996
|
+
var axisLabelSettingsOptionsItems = [{
|
|
64997
|
+
label: textOverride('hideAllLabels', 'Hide All Labels'),
|
|
64998
|
+
value: 0
|
|
64999
|
+
}, {
|
|
65000
|
+
label: textOverride('hideSublabels', 'Hide Sublabels'),
|
|
65001
|
+
value: 'auto'
|
|
65002
|
+
}, {
|
|
65003
|
+
label: textOverride('showEverything', 'Show Everything'),
|
|
65004
|
+
value: 2
|
|
65005
|
+
}];
|
|
64990
65006
|
var dateTimeFormatOptionsItems = Object.keys(dateTimeFormatOptions).map(function (key) {
|
|
64991
65007
|
var option = dateTimeFormatOptions[key];
|
|
64992
65008
|
return {
|
|
@@ -64994,10 +65010,12 @@ var AxisPreferenceSection = function AxisPreferenceSection(props) {
|
|
|
64994
65010
|
value: key
|
|
64995
65011
|
};
|
|
64996
65012
|
});
|
|
64997
|
-
var
|
|
65013
|
+
var isBarChartV2 = props.attributes.type == 'barChartV2' || props.attributes.type == 'horizontalBarChartV2';
|
|
65014
|
+
var isHorizontalBarChart = props.attributes.type == 'horizontalBarChart' || props.attributes.type == 'horizontalBarChartV2';
|
|
64998
65015
|
var showXAxisNumberFormatter = ((_props$attributes = props.attributes) == null || (_props$attributes = _props$attributes.dimension) == null ? void 0 : _props$attributes.length) > 0 && findField(props.dataSet, (_props$attributes2 = props.attributes) == null || (_props$attributes2 = _props$attributes2.dimension[0]) == null ? void 0 : _props$attributes2.field).dataType === 'number' && !((_props$attributes3 = props.attributes) != null && _props$attributes3.timeDimension);
|
|
64999
65016
|
var showXAxisDateFormatOptions = !!((_props$attributes4 = props.attributes) != null && _props$attributes4.timeDimension);
|
|
65000
|
-
var
|
|
65017
|
+
var showXAxisLabelSettings = isBarChartV2 && ((_props$attributes5 = props.attributes) == null || (_props$attributes5 = _props$attributes5.dimension) == null ? void 0 : _props$attributes5.length) > 1;
|
|
65018
|
+
var _ref = isHorizontalBarChart ? {
|
|
65001
65019
|
x: 'y',
|
|
65002
65020
|
y: 'x'
|
|
65003
65021
|
} : {
|
|
@@ -65006,8 +65024,37 @@ var AxisPreferenceSection = function AxisPreferenceSection(props) {
|
|
|
65006
65024
|
},
|
|
65007
65025
|
x = _ref.x,
|
|
65008
65026
|
y = _ref.y;
|
|
65009
|
-
var labelCount =
|
|
65010
|
-
var metricAxisLabelCount =
|
|
65027
|
+
var labelCount = isHorizontalBarChart ? 'approxYAxisLabelCount' : 'approxXAxisLabelCount';
|
|
65028
|
+
var metricAxisLabelCount = isHorizontalBarChart ? 'approxXAxisLabelCount' : 'approxYAxisLabelCount';
|
|
65029
|
+
var xAxisLabelSettingsSelectInput = jsx(FormatSelectInput, {
|
|
65030
|
+
id: "axis-" + x + "-label-settings",
|
|
65031
|
+
label: "Label Settings",
|
|
65032
|
+
currentValue: props.attributes[labelCount],
|
|
65033
|
+
onSelect: function onSelect(value) {
|
|
65034
|
+
var _props$setAttributes;
|
|
65035
|
+
return props.setAttributes((_props$setAttributes = {}, _props$setAttributes[labelCount] = value, _props$setAttributes));
|
|
65036
|
+
},
|
|
65037
|
+
options: axisLabelSettingsOptionsItems
|
|
65038
|
+
});
|
|
65039
|
+
var xAxisDateFormatLabelSelectInput = showXAxisLabelSettings ? xAxisLabelSettingsSelectInput : jsx(FormatSelectInput, {
|
|
65040
|
+
id: "axis-" + x + "-label-count",
|
|
65041
|
+
label: props.section[x].count.title,
|
|
65042
|
+
currentValue: props.attributes[labelCount],
|
|
65043
|
+
onSelect: function onSelect(value) {
|
|
65044
|
+
var _props$setAttributes2;
|
|
65045
|
+
return props.setAttributes((_props$setAttributes2 = {}, _props$setAttributes2[labelCount] = value, _props$setAttributes2));
|
|
65046
|
+
},
|
|
65047
|
+
options: axisLabelCountOptionsItems
|
|
65048
|
+
});
|
|
65049
|
+
var xAxisOtherFormatsLabelSelectInput = showXAxisLabelSettings ? xAxisLabelSettingsSelectInput : jsx(Checkbox, {
|
|
65050
|
+
label: textOverride('hide_labels', 'Hide Labels'),
|
|
65051
|
+
onChange: function onChange(event) {
|
|
65052
|
+
var _props$setAttributes3;
|
|
65053
|
+
return props.setAttributes((_props$setAttributes3 = {}, _props$setAttributes3[labelCount] = event ? 0 : 'auto', _props$setAttributes3));
|
|
65054
|
+
},
|
|
65055
|
+
id: "hide-labels",
|
|
65056
|
+
currentValue: props.attributes[labelCount] === 0 ? true : false
|
|
65057
|
+
});
|
|
65011
65058
|
return jsx(Section, {
|
|
65012
65059
|
title: (_props$section = props.section) == null ? void 0 : _props$section.title,
|
|
65013
65060
|
tooltip: (_props$section2 = props.section) == null ? void 0 : _props$section2.description,
|
|
@@ -65056,10 +65103,10 @@ var AxisPreferenceSection = function AxisPreferenceSection(props) {
|
|
|
65056
65103
|
label: props.section[y].count.title,
|
|
65057
65104
|
currentValue: props.attributes[metricAxisLabelCount],
|
|
65058
65105
|
onSelect: function onSelect(value) {
|
|
65059
|
-
var _props$
|
|
65060
|
-
return props.setAttributes((_props$
|
|
65106
|
+
var _props$setAttributes4;
|
|
65107
|
+
return props.setAttributes((_props$setAttributes4 = {}, _props$setAttributes4[metricAxisLabelCount] = value, _props$setAttributes4));
|
|
65061
65108
|
},
|
|
65062
|
-
options:
|
|
65109
|
+
options: axisLabelCountOptionsItems
|
|
65063
65110
|
})]
|
|
65064
65111
|
}), jsx(Section.Grid, {
|
|
65065
65112
|
children: props.section[y].axisTitle && jsx(TextInput, {
|
|
@@ -65123,25 +65170,8 @@ var AxisPreferenceSection = function AxisPreferenceSection(props) {
|
|
|
65123
65170
|
});
|
|
65124
65171
|
},
|
|
65125
65172
|
options: dateTimeFormatOptionsItems
|
|
65126
|
-
}),
|
|
65127
|
-
|
|
65128
|
-
label: props.section[x].count.title,
|
|
65129
|
-
currentValue: props.attributes[labelCount],
|
|
65130
|
-
onSelect: function onSelect(value) {
|
|
65131
|
-
var _props$setAttributes2;
|
|
65132
|
-
return props.setAttributes((_props$setAttributes2 = {}, _props$setAttributes2[labelCount] = value, _props$setAttributes2));
|
|
65133
|
-
},
|
|
65134
|
-
options: axisOptions
|
|
65135
|
-
})]
|
|
65136
|
-
}) : jsx(Checkbox, {
|
|
65137
|
-
label: textOverride('hide_labels', 'Hide Labels'),
|
|
65138
|
-
onChange: function onChange(event) {
|
|
65139
|
-
var _props$setAttributes3;
|
|
65140
|
-
return props.setAttributes((_props$setAttributes3 = {}, _props$setAttributes3[labelCount] = event ? 0 : 'auto', _props$setAttributes3));
|
|
65141
|
-
},
|
|
65142
|
-
id: "hide-labels",
|
|
65143
|
-
currentValue: props.attributes[labelCount] === 0 ? true : false
|
|
65144
|
-
})]
|
|
65173
|
+
}), xAxisDateFormatLabelSelectInput]
|
|
65174
|
+
}) : xAxisOtherFormatsLabelSelectInput]
|
|
65145
65175
|
})
|
|
65146
65176
|
}), jsx(Section.Grid, {
|
|
65147
65177
|
children: props.section[x].axisTitle && jsx(TextInput, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizzly/dashboard",
|
|
3
3
|
"author": "james@vizzly.co",
|
|
4
|
-
"version": "0.15.0-dev-
|
|
4
|
+
"version": "0.15.0-dev-9247c7b21e49fb5e3915574eb5264b609426a7b6",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "./dist/dashboard/src/index.d.ts",
|
|
7
7
|
"module": "./dist/dashboard.esm.js",
|