Skip to content

Commit f204945

Browse files
authored
Merge branch 'main' into feat/remove-beta-tag
2 parents 741741e + 2a8d00a commit f204945

34 files changed

+914
-504
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,21 @@ You can also check the
1414
- Features
1515
- Allowed previewing of charts in states different than CONFIGURING_CHART
1616
(iframe `/preview` page)
17+
- Improved some wording and added an explanation to the `Concepts` navigation
18+
menu
19+
- Filters and components are now grouped in the left panel and dropdowns in
20+
case of working with merged cubes
21+
- Improved default chart selection when adding a new cube (by default the
22+
application will try to use dual-line chart with measures from different
23+
cubes)
1724
- Fixes
1825
- Introduced a `componentId` concept which makes the dimensions and measures
1926
unique by adding an unversioned cube iri to the unversioned component iri on
2027
the server-side. With this we correctly handle multiple dimensions with the
2128
same iri that come from different cubes (when merging cubes)
2229
- Map legend is now correctly updated (in some cases it was rendered
2330
incorrectly on the initial render)
31+
- Vertical Axis measure names are now correctly displayed in the left panel
2432
- Performance
2533
- We no longer load non-key dimensions when initializing a chart
2634
- Maintenance
@@ -40,6 +48,8 @@ You can also check the
4048
- Improved chart tooltips on small screens
4149
- % mode toggle no longer overlaps with the Y axis title
4250
- Merging of cubes beta tag has been removed
51+
- Dual line Chart Tooltip indicators are now fixed for smaller screens
52+
4353

4454
# [4.9.4] - 2024-11-06
4555

app/browser/dataset-browse.tsx

+19-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
SearchFieldProps,
3232
} from "@/components/form";
3333
import { Loading, LoadingDataError } from "@/components/hint";
34+
import { InfoIconTooltip } from "@/components/info-icon-tooltip";
3435
import MaybeLink from "@/components/maybe-link";
3536
import { MaybeTooltip } from "@/components/maybe-tooltip";
3637
import {
@@ -584,7 +585,6 @@ const NavSectionTitle = ({
584585
sx={{
585586
alignItems: "center",
586587
p: 3,
587-
cursor: "pointer",
588588
backgroundColor: theme.backgroundColor,
589589
borderRadius: 2,
590590
height: "2.5rem",
@@ -626,6 +626,7 @@ const NavSection = ({
626626
);
627627
}, [counts, items]);
628628
const { isOpen, open, close } = useDisclosure(!!currentFilter);
629+
629630
return (
630631
<div>
631632
<NavSectionTitle theme={theme} sx={{ mb: "block" }}>
@@ -882,7 +883,21 @@ export const SearchFilters = ({
882883
counts={counts}
883884
filters={filters}
884885
icon={<SvgIcOrganisations width={20} height={20} />}
885-
label={<Trans id="browse-panel.termsets">Concepts</Trans>}
886+
label={
887+
<Stack direction="row" gap={2} alignItems="center">
888+
<Trans id="browse-panel.termsets">Concepts</Trans>
889+
<InfoIconTooltip
890+
variant="secondary"
891+
placement="right"
892+
title={
893+
<Trans id="browse-panel.termsets.explanation">
894+
Concepts represent values that can be shared across different
895+
dimensions and datasets.
896+
</Trans>
897+
}
898+
/>
899+
</Stack>
900+
}
886901
extra={null}
887902
disableLinks={disableNavLinks}
888903
/>
@@ -1206,8 +1221,8 @@ export const DatasetResult = ({
12061221
dimension.termsets.length > 0 ? (
12071222
<>
12081223
<Typography variant="body2">
1209-
<Trans id="dataset-result.dimension-termset-contains">
1210-
Contains values from
1224+
<Trans id="dataset-result.dimension-joined-by">
1225+
Joined by
12111226
</Trans>
12121227
<Stack gap={1} flexDirection="row" mt={1}>
12131228
{dimension.termsets.map((termset) => {

app/charts/combo/chart-combo-line-dual.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ const ChartComboLineDual = memo((props: ChartProps<ComboLineDualConfig>) => {
2929
const { chartConfig } = props;
3030
const { interactiveFiltersConfig } = chartConfig;
3131
const [{ dashboardFilters }] = useConfiguratorState(hasChartConfigs);
32-
32+
3333
return (
3434
<ComboLineDualChart {...props}>
3535
<ChartContainer>
3636
<ChartSvg>
3737
<ComboLineContainer>
38-
<AxisHeightLinearDual orientation="left" />
39-
<AxisHeightLinearDual orientation="right" />
40-
<AxisTime />
41-
<AxisTimeDomain />
42-
<ComboLineDual />
43-
<InteractionHorizontal />
44-
{shouldShowBrush(
45-
interactiveFiltersConfig,
46-
dashboardFilters?.timeRange
47-
) && <BrushTime />}
38+
<AxisHeightLinearDual orientation="left" />
39+
<AxisHeightLinearDual orientation="right" />
40+
<AxisTime />
41+
<AxisTimeDomain />
42+
<ComboLineDual />
43+
<InteractionHorizontal />
44+
{shouldShowBrush(
45+
interactiveFiltersConfig,
46+
dashboardFilters?.timeRange
47+
) && <BrushTime />}
4848
</ComboLineContainer>
4949
</ChartSvg>
5050
<HoverDotMultiple />
+22-20
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
import { ReactNode } from 'react';
1+
import { ReactNode } from "react";
22

3-
import { getTextWidth } from '@/utils/get-text-width';
3+
import { getTextWidth } from "@/utils/get-text-width";
44

5-
import { TICK_PADDING } from '../shared/axis-height-linear';
6-
import { useChartState } from '../shared/chart-state';
7-
import { useChartTheme } from '../shared/use-chart-theme';
5+
import { TICK_PADDING } from "../shared/axis-height-linear";
6+
import { useChartState } from "../shared/chart-state";
7+
import { useChartTheme } from "../shared/use-chart-theme";
88

9-
import { ComboLineColumnState } from './combo-line-column-state';
10-
import { ComboLineDualState } from './combo-line-dual-state';
9+
import { ComboLineColumnState } from "./combo-line-column-state";
10+
import { ComboLineDualState } from "./combo-line-dual-state";
1111

1212
export const TITLE_VPADDING = 4;
1313

1414
export const ComboLineContainer = ({ children }: { children: ReactNode }) => {
15-
const { axisLabelFontSize } = useChartTheme();
16-
const { y, bounds } = useChartState() as ComboLineDualState | ComboLineColumnState;
15+
const { axisLabelFontSize } = useChartTheme();
16+
const { y, bounds } = useChartState() as
17+
| ComboLineDualState
18+
| ComboLineColumnState;
1719
const axisTitle = y.left.label;
1820
const axisTitleWidth =
1921
getTextWidth(axisTitle, { fontSize: axisLabelFontSize }) + TICK_PADDING;
2022
const otherAxisTitle = y.right.label;
21-
const otherAxisTitleWidth = getTextWidth(otherAxisTitle, { fontSize: axisLabelFontSize }) + TICK_PADDING;
22-
const overLappingTitles = axisTitleWidth + otherAxisTitleWidth > bounds.chartWidth;
23-
24-
25-
return (
26-
<g transform={`translate(0, ${overLappingTitles ? (axisLabelFontSize + TITLE_VPADDING) * 2 : 0})`}>
27-
{children}
28-
</g>
29-
30-
)
31-
}
23+
const otherAxisTitleWidth =
24+
getTextWidth(otherAxisTitle, { fontSize: axisLabelFontSize }) +
25+
TICK_PADDING;
26+
const overLappingTitles =
27+
axisTitleWidth + otherAxisTitleWidth > bounds.chartWidth;
28+
29+
const yAdjustment = overLappingTitles
30+
? (axisLabelFontSize + TITLE_VPADDING) * 2
31+
: 0;
32+
return <g transform={`translate(0, ${yAdjustment})`}>{children}</g>;
33+
};

app/charts/combo/combo-line-dual-state.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,19 @@ const useComboLineDualState = (
152152
const topMarginAxisTitleAdjustment = 50 + axisTitleAdjustment;
153153

154154
const right = Math.max(maxRightTickWidth, 40);
155+
155156
const margins = getMargins({
156157
left,
157158
right,
158159
bottom,
159160
top: topMarginAxisTitleAdjustment,
160161
});
161-
const bounds = useChartBounds(width, margins, height);
162+
163+
const bounds = useChartBounds(width, margins, height, {
164+
leftLabel: variables.y.left.label,
165+
rightLabel: variables.y.right.label,
166+
});
167+
162168
const { chartWidth, chartHeight } = bounds;
163169
const xScales = [xScale, xScaleTimeRange];
164170
const yScales = [yScale, yScaleLeft, yScaleRight];

app/charts/index.spec.ts

+64-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { ColumnConfig, ScatterPlotConfig, TableFields } from "@/configurator";
1+
import {
2+
ColumnConfig,
3+
ComboLineDualConfig,
4+
ScatterPlotConfig,
5+
TableFields,
6+
} from "@/configurator";
27
import { Dimension, Measure } from "@/domain/data";
38
import { stringifyComponentId } from "@/graphql/make-component-id";
49
import { TimeUnit } from "@/graphql/resolver-types";
@@ -436,4 +441,62 @@ describe("chart type switch", () => {
436441
oldChartConfig.fields.x.componentId
437442
);
438443
});
444+
445+
it("should prefer to use components from different cubes if merging cubes, otherwise not", () => {
446+
const oldChartConfig = {
447+
chartType: "column",
448+
cubes: [{ iri: "A" }],
449+
fields: {
450+
x: {
451+
componentId: "A_D1",
452+
},
453+
y: {
454+
componentId: "A_M1",
455+
},
456+
},
457+
} as any as ColumnConfig;
458+
const dimensions = [
459+
{ id: "A_D1", cubeIri: "A" },
460+
{ __typename: "TemporalDimension", id: "B_D1", cubeIri: "B" },
461+
] as any as Dimension[];
462+
const measures = [
463+
{ __typename: "NumericalMeasure", id: "A_M1", cubeIri: "A", unit: "X" },
464+
{ __typename: "NumericalMeasure", id: "A_M2", cubeIri: "A", unit: "Y" },
465+
{ __typename: "NumericalMeasure", id: "B_M1", cubeIri: "B", unit: "Z" },
466+
] as any as Measure[];
467+
468+
const newChartConfigMergingOfCubes = getChartConfigAdjustedToChartType({
469+
chartConfig: oldChartConfig,
470+
newChartType: "comboLineDual",
471+
dimensions,
472+
measures,
473+
isAddingNewCube: true,
474+
}) as ComboLineDualConfig;
475+
476+
expect(
477+
newChartConfigMergingOfCubes.fields.y.rightAxisComponentId.startsWith("A")
478+
).toEqual(true);
479+
expect(
480+
newChartConfigMergingOfCubes.fields.y.leftAxisComponentId.startsWith("B")
481+
).toEqual(true);
482+
483+
const newChartConfigNotMergingOfCubes = getChartConfigAdjustedToChartType({
484+
chartConfig: oldChartConfig,
485+
newChartType: "comboLineDual",
486+
dimensions,
487+
measures,
488+
isAddingNewCube: false,
489+
}) as ComboLineDualConfig;
490+
491+
expect(
492+
newChartConfigNotMergingOfCubes.fields.y.rightAxisComponentId.startsWith(
493+
"A"
494+
)
495+
).toEqual(true);
496+
expect(
497+
newChartConfigNotMergingOfCubes.fields.y.leftAxisComponentId.startsWith(
498+
"A"
499+
)
500+
).toEqual(true);
501+
});
439502
});

0 commit comments

Comments
 (0)