@datawheel/data-explorer 0.3.7-rc.2 → 0.3.7-rc.4
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/main.d.mts +2 -0
- package/dist/main.mjs +19 -8
- package/package.json +1 -1
package/dist/main.d.mts
CHANGED
|
@@ -760,8 +760,10 @@ declare const defaultTranslation: {
|
|
|
760
760
|
series: string;
|
|
761
761
|
series_members: string;
|
|
762
762
|
main: string;
|
|
763
|
+
measure_over_period: string;
|
|
763
764
|
main_over_period: string;
|
|
764
765
|
main_on_period: string;
|
|
766
|
+
measure_on_period: string;
|
|
765
767
|
total: string;
|
|
766
768
|
};
|
|
767
769
|
transient: {
|
package/dist/main.mjs
CHANGED
|
@@ -471,8 +471,10 @@ var defaultTranslation = {
|
|
|
471
471
|
series: "{{series}}",
|
|
472
472
|
series_members: "{{series}} ({{members}})",
|
|
473
473
|
main: "{{values}} by {{series}}",
|
|
474
|
+
measure_over_period: "{{values}} over {{time}}",
|
|
474
475
|
main_over_period: "{{values}} by {{series}} over {{time}}",
|
|
475
476
|
main_on_period: "{{values}} by {{series}} on {{time_period}}",
|
|
477
|
+
measure_on_period: "{{measure}} on {{period}}",
|
|
476
478
|
total: "Total: {{value}}"
|
|
477
479
|
},
|
|
478
480
|
transient: {
|
|
@@ -3332,7 +3334,6 @@ function CubeTree({
|
|
|
3332
3334
|
() => getKeys2(graph.items, "topic", locale),
|
|
3333
3335
|
[graph.items, locale]
|
|
3334
3336
|
);
|
|
3335
|
-
topics = [topics[0], topics[1]];
|
|
3336
3337
|
if (input.length > 0 && map && !(map.size > 0)) {
|
|
3337
3338
|
return /* @__PURE__ */ React19__default.createElement(Text, { ta: "center", fz: "xs", my: "sm", italic: true }, t("params.label_no_results"));
|
|
3338
3339
|
}
|
|
@@ -8058,18 +8059,23 @@ function buildDonutConfig(chart, params) {
|
|
|
8058
8059
|
return config;
|
|
8059
8060
|
}
|
|
8060
8061
|
function buildLineplotConfig(chart, params) {
|
|
8061
|
-
const { datagroup, values, series,
|
|
8062
|
+
const { datagroup, values, series, timeline } = chart;
|
|
8062
8063
|
const { fullMode, getFormatter, t } = params;
|
|
8063
8064
|
const { columns, dataset, locale } = datagroup;
|
|
8064
8065
|
const measureFormatter = getFormatter(values.measure);
|
|
8065
8066
|
const config = {
|
|
8066
8067
|
data: dataset,
|
|
8067
8068
|
discrete: "x",
|
|
8068
|
-
label: (d) =>
|
|
8069
|
+
label: (d) => {
|
|
8070
|
+
return series.map((series2) => d[series2.level.name]).join("\n") || t("vizbuilder.title.measure_on_period", {
|
|
8071
|
+
measure: values.measure.caption,
|
|
8072
|
+
period: d[timeline.level.name]
|
|
8073
|
+
});
|
|
8074
|
+
},
|
|
8069
8075
|
legend: fullMode,
|
|
8070
8076
|
locale,
|
|
8071
|
-
groupBy: series.map((series2) => series2.name),
|
|
8072
|
-
time:
|
|
8077
|
+
groupBy: series.length ? series.map((series2) => series2.name) : void 0,
|
|
8078
|
+
time: timeline.level.name,
|
|
8073
8079
|
timeline: fullMode,
|
|
8074
8080
|
timelineConfig: {
|
|
8075
8081
|
brushing: true,
|
|
@@ -8084,9 +8090,9 @@ function buildLineplotConfig(chart, params) {
|
|
|
8084
8090
|
},
|
|
8085
8091
|
total: false,
|
|
8086
8092
|
totalFormat: (d) => t("vizbuilder.title.total", { value: measureFormatter(d, locale) }),
|
|
8087
|
-
x:
|
|
8093
|
+
x: timeline.level.name,
|
|
8088
8094
|
xConfig: {
|
|
8089
|
-
title:
|
|
8095
|
+
title: timeline.level.caption
|
|
8090
8096
|
},
|
|
8091
8097
|
y: values.measure.name,
|
|
8092
8098
|
yConfig: {
|
|
@@ -8162,7 +8168,9 @@ function _buildTitle(t, chart) {
|
|
|
8162
8168
|
const [mainSeries, otherSeries] = series;
|
|
8163
8169
|
const { measure } = values;
|
|
8164
8170
|
const timeline = chart.timeline || chart.time;
|
|
8171
|
+
console.log({ chart });
|
|
8165
8172
|
const seriesStr = (series2) => {
|
|
8173
|
+
if (!series2) return "";
|
|
8166
8174
|
const { members } = series2.captions[series2.level.name];
|
|
8167
8175
|
if (series2.members.length < 5) {
|
|
8168
8176
|
return t("vizbuilder.title.series_members", {
|
|
@@ -8181,14 +8189,17 @@ function _buildTitle(t, chart) {
|
|
|
8181
8189
|
return (data) => {
|
|
8182
8190
|
const aggregator = measure.annotations.aggregation_method || measure.aggregator;
|
|
8183
8191
|
const valuesKey = `vizbuilder.aggregator.${aggregator.toLowerCase()}`;
|
|
8184
|
-
const values2 = t(valuesKey, { measure: measure.caption });
|
|
8192
|
+
const values2 = otherSeries ? t(valuesKey, { measure: measure.caption }) : measure.caption;
|
|
8185
8193
|
const config = {
|
|
8186
8194
|
values: values2 === valuesKey ? measure.caption : values2,
|
|
8195
|
+
measure: values2 === valuesKey ? measure.caption : values2,
|
|
8187
8196
|
series: otherSeries ? _buildTranslatedList(t, [seriesStr(mainSeries), seriesStr(otherSeries)]) : seriesStr(mainSeries),
|
|
8188
8197
|
time: timeline == null ? void 0 : timeline.level.caption,
|
|
8198
|
+
period: timeline == null ? void 0 : timeline.level.caption,
|
|
8189
8199
|
time_period: timeline ? getLast(getMembers(data, timeline)) : ""
|
|
8190
8200
|
};
|
|
8191
8201
|
if (isOneOf(chart.type, ["lineplot", "stackedarea"])) {
|
|
8202
|
+
if (!series.length) return t("vizbuilder.title.measure_over_period", config);
|
|
8192
8203
|
return t("vizbuilder.title.main_over_period", config);
|
|
8193
8204
|
}
|
|
8194
8205
|
if (timeline) return t("vizbuilder.title.main_on_period", config);
|