@classic-homes/charts-react 0.3.0 → 0.4.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/dist/index.cjs +17 -4
- package/dist/index.js +21 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1107,6 +1107,7 @@ var BarChart = React7.forwardRef(
|
|
|
1107
1107
|
orientation = "vertical",
|
|
1108
1108
|
stacked = false,
|
|
1109
1109
|
showValues = false,
|
|
1110
|
+
showTotal = false,
|
|
1110
1111
|
valueFormat,
|
|
1111
1112
|
locale,
|
|
1112
1113
|
labelFormatter,
|
|
@@ -1192,6 +1193,14 @@ var BarChart = React7.forwardRef(
|
|
|
1192
1193
|
focus: "series"
|
|
1193
1194
|
}
|
|
1194
1195
|
}));
|
|
1196
|
+
const format2 = (0, import_charts_core7.resolveValueFormatter)(valueFormat, locale);
|
|
1197
|
+
const stackedSeries = data.series.map((s) => ({ data: s.data }));
|
|
1198
|
+
const totalSeries = showTotal ? (0, import_charts_core7.buildStackTotalSeries)(data.categories, stackedSeries, {
|
|
1199
|
+
stacked,
|
|
1200
|
+
position: labelPosition,
|
|
1201
|
+
format: format2
|
|
1202
|
+
}) : [];
|
|
1203
|
+
const endLabels = !isHorizontal ? [] : totalSeries.length ? [...(0, import_charts_core7.stackTotals)(stackedSeries, stacked).values()].flat().map((t) => (0, import_charts_core7.formatValue)(t, format2)) : showValues ? plotted.flatMap((s) => s.data.map((value) => (0, import_charts_core7.formatValue)(value, formatters.format))) : [];
|
|
1195
1204
|
return (0, import_charts_core7.mergeChartOption)(
|
|
1196
1205
|
{
|
|
1197
1206
|
grid: {
|
|
@@ -1200,7 +1209,10 @@ var BarChart = React7.forwardRef(
|
|
|
1200
1209
|
bottom: "3%",
|
|
1201
1210
|
containLabel: true,
|
|
1202
1211
|
...(0, import_charts_core7.withZoomInset)(
|
|
1203
|
-
(0, import_charts_core7.
|
|
1212
|
+
(0, import_charts_core7.withEndLabelInset)(
|
|
1213
|
+
(0, import_charts_core7.gridInset)(legendConfig, builtInLegend, xAxisConfig, yAxisConfig),
|
|
1214
|
+
endLabels
|
|
1215
|
+
),
|
|
1204
1216
|
dataZoom,
|
|
1205
1217
|
zoomAxis
|
|
1206
1218
|
)
|
|
@@ -1233,7 +1245,7 @@ var BarChart = React7.forwardRef(
|
|
|
1233
1245
|
isHorizontal ? categoryAxis : valueAxis,
|
|
1234
1246
|
isHorizontal ? yAxisConfig : formatters.axis(yAxisConfig)
|
|
1235
1247
|
),
|
|
1236
|
-
series: (0, import_charts_core7.withReferenceMarks)(series, referenceLines, referenceBands, {
|
|
1248
|
+
series: (0, import_charts_core7.withReferenceMarks)([...series, ...totalSeries], referenceLines, referenceBands, {
|
|
1237
1249
|
valueAxis: isHorizontal ? "x" : "y",
|
|
1238
1250
|
inverse: isHorizontal,
|
|
1239
1251
|
format: formatters.format,
|
|
@@ -1253,6 +1265,7 @@ var BarChart = React7.forwardRef(
|
|
|
1253
1265
|
isPercent,
|
|
1254
1266
|
stacked,
|
|
1255
1267
|
showValues,
|
|
1268
|
+
showTotal,
|
|
1256
1269
|
valueFormat,
|
|
1257
1270
|
locale,
|
|
1258
1271
|
labelFormatter,
|
|
@@ -2651,7 +2664,7 @@ var GaugeChart = React14.forwardRef(
|
|
|
2651
2664
|
animation = true,
|
|
2652
2665
|
splitNumber = 10,
|
|
2653
2666
|
showProgress = true,
|
|
2654
|
-
formatValue,
|
|
2667
|
+
formatValue: formatValue2,
|
|
2655
2668
|
showTooltip = true,
|
|
2656
2669
|
valueFormat,
|
|
2657
2670
|
locale,
|
|
@@ -2674,7 +2687,7 @@ var GaugeChart = React14.forwardRef(
|
|
|
2674
2687
|
() => (0, import_charts_core14.resolveValueFormatter)(valueFormat, locale),
|
|
2675
2688
|
[valueFormat, locale]
|
|
2676
2689
|
);
|
|
2677
|
-
const valueFormatter =
|
|
2690
|
+
const valueFormatter = formatValue2 ?? format;
|
|
2678
2691
|
const option = React14.useMemo(() => {
|
|
2679
2692
|
return (0, import_charts_core14.mergeChartOption)(
|
|
2680
2693
|
{
|
package/dist/index.js
CHANGED
|
@@ -1065,9 +1065,11 @@ import {
|
|
|
1065
1065
|
buildDataLabel as buildDataLabel2,
|
|
1066
1066
|
buildDataZoom as buildDataZoom2,
|
|
1067
1067
|
buildLegend as buildLegend2,
|
|
1068
|
+
buildStackTotalSeries,
|
|
1068
1069
|
buildTooltip as buildTooltip2,
|
|
1069
1070
|
categoryTable as categoryTable2,
|
|
1070
1071
|
chartFormatters as chartFormatters2,
|
|
1072
|
+
formatValue,
|
|
1071
1073
|
generateBarChartDescription,
|
|
1072
1074
|
getChartColors as getChartColors2,
|
|
1073
1075
|
gridInset as gridInset2,
|
|
@@ -1075,7 +1077,9 @@ import {
|
|
|
1075
1077
|
resolveChartHeight,
|
|
1076
1078
|
resolveValueFormatter as resolveValueFormatter2,
|
|
1077
1079
|
seriesLabelLookup as seriesLabelLookup2,
|
|
1080
|
+
stackTotals,
|
|
1078
1081
|
toPercentStack as toPercentStack2,
|
|
1082
|
+
withEndLabelInset,
|
|
1079
1083
|
withPointLabels as withPointLabels2,
|
|
1080
1084
|
withReferenceMarks as withReferenceMarks2,
|
|
1081
1085
|
withZoomInset as withZoomInset2
|
|
@@ -1109,6 +1113,7 @@ var BarChart = React7.forwardRef(
|
|
|
1109
1113
|
orientation = "vertical",
|
|
1110
1114
|
stacked = false,
|
|
1111
1115
|
showValues = false,
|
|
1116
|
+
showTotal = false,
|
|
1112
1117
|
valueFormat,
|
|
1113
1118
|
locale,
|
|
1114
1119
|
labelFormatter,
|
|
@@ -1194,6 +1199,14 @@ var BarChart = React7.forwardRef(
|
|
|
1194
1199
|
focus: "series"
|
|
1195
1200
|
}
|
|
1196
1201
|
}));
|
|
1202
|
+
const format2 = resolveValueFormatter2(valueFormat, locale);
|
|
1203
|
+
const stackedSeries = data.series.map((s) => ({ data: s.data }));
|
|
1204
|
+
const totalSeries = showTotal ? buildStackTotalSeries(data.categories, stackedSeries, {
|
|
1205
|
+
stacked,
|
|
1206
|
+
position: labelPosition,
|
|
1207
|
+
format: format2
|
|
1208
|
+
}) : [];
|
|
1209
|
+
const endLabels = !isHorizontal ? [] : totalSeries.length ? [...stackTotals(stackedSeries, stacked).values()].flat().map((t) => formatValue(t, format2)) : showValues ? plotted.flatMap((s) => s.data.map((value) => formatValue(value, formatters.format))) : [];
|
|
1197
1210
|
return mergeChartOption2(
|
|
1198
1211
|
{
|
|
1199
1212
|
grid: {
|
|
@@ -1202,7 +1215,10 @@ var BarChart = React7.forwardRef(
|
|
|
1202
1215
|
bottom: "3%",
|
|
1203
1216
|
containLabel: true,
|
|
1204
1217
|
...withZoomInset2(
|
|
1205
|
-
|
|
1218
|
+
withEndLabelInset(
|
|
1219
|
+
gridInset2(legendConfig, builtInLegend, xAxisConfig, yAxisConfig),
|
|
1220
|
+
endLabels
|
|
1221
|
+
),
|
|
1206
1222
|
dataZoom,
|
|
1207
1223
|
zoomAxis
|
|
1208
1224
|
)
|
|
@@ -1235,7 +1251,7 @@ var BarChart = React7.forwardRef(
|
|
|
1235
1251
|
isHorizontal ? categoryAxis : valueAxis,
|
|
1236
1252
|
isHorizontal ? yAxisConfig : formatters.axis(yAxisConfig)
|
|
1237
1253
|
),
|
|
1238
|
-
series: withReferenceMarks2(series, referenceLines, referenceBands, {
|
|
1254
|
+
series: withReferenceMarks2([...series, ...totalSeries], referenceLines, referenceBands, {
|
|
1239
1255
|
valueAxis: isHorizontal ? "x" : "y",
|
|
1240
1256
|
inverse: isHorizontal,
|
|
1241
1257
|
format: formatters.format,
|
|
@@ -1255,6 +1271,7 @@ var BarChart = React7.forwardRef(
|
|
|
1255
1271
|
isPercent,
|
|
1256
1272
|
stacked,
|
|
1257
1273
|
showValues,
|
|
1274
|
+
showTotal,
|
|
1258
1275
|
valueFormat,
|
|
1259
1276
|
locale,
|
|
1260
1277
|
labelFormatter,
|
|
@@ -2763,7 +2780,7 @@ var GaugeChart = React14.forwardRef(
|
|
|
2763
2780
|
animation = true,
|
|
2764
2781
|
splitNumber = 10,
|
|
2765
2782
|
showProgress = true,
|
|
2766
|
-
formatValue,
|
|
2783
|
+
formatValue: formatValue2,
|
|
2767
2784
|
showTooltip = true,
|
|
2768
2785
|
valueFormat,
|
|
2769
2786
|
locale,
|
|
@@ -2786,7 +2803,7 @@ var GaugeChart = React14.forwardRef(
|
|
|
2786
2803
|
() => resolveValueFormatter9(valueFormat, locale),
|
|
2787
2804
|
[valueFormat, locale]
|
|
2788
2805
|
);
|
|
2789
|
-
const valueFormatter =
|
|
2806
|
+
const valueFormatter = formatValue2 ?? format;
|
|
2790
2807
|
const option = React14.useMemo(() => {
|
|
2791
2808
|
return mergeChartOption9(
|
|
2792
2809
|
{
|