Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparative Category Widget #505

Merged
merged 27 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ccd1eda
feat(ui): implement ComparativeFormulaWidgetUI
juandjara Oct 24, 2022
2ef27fe
add storybook for ComparativeFormulaWidgetUI
juandjara Oct 24, 2022
f76ccb7
add changelog entry
juandjara Oct 24, 2022
faca867
add JSDoc for ComparativeFormulaWidgetUI
juandjara Oct 24, 2022
c711fc3
add JSDoc for AnimatedNumber
juandjara Oct 24, 2022
831f9cf
export type not exported
juandjara Oct 24, 2022
0cfe6fa
implement comparative category widget UI
juandjara Oct 24, 2022
67918b6
finish comparative category widget ui addons
juandjara Oct 25, 2022
99d15f1
add changelog entry
juandjara Oct 25, 2022
67e294d
implement custom animation hook to replace npm lib
juandjara Oct 26, 2022
aa2738c
Merge branch 'feature/comparative-formula-widget' into feature/compar…
juandjara Oct 26, 2022
6a84ad4
fix animation options exported type
juandjara Oct 26, 2022
eb4f8ff
Merge branch 'feature/comparative-formula-widget' into feature/compar…
juandjara Oct 26, 2022
83b0adb
fix types and naming for comparative category widget
juandjara Oct 26, 2022
0eec2fc
Merge branch 'master' of github.com:CartoDB/carto-react into feature/…
juandjara Oct 28, 2022
207056e
fix storybook for comparative category widget
juandjara Oct 28, 2022
5036fcd
fix bug for empty comparative data
juandjara Oct 31, 2022
fc2c1ab
fix layout bug in bullets
juandjara Oct 31, 2022
7ab9e50
reuse ORDER_TYPES from CategoryWidgetUI in ComparativeCategoryWidgetUI
juandjara Oct 31, 2022
3a1f9c0
move comparative widgets to their own folder
juandjara Oct 31, 2022
7e09a14
split comparative category widgets in many files
juandjara Oct 31, 2022
74de180
remove unused class
juandjara Oct 31, 2022
e483417
fix layout for long overflowing category labels
juandjara Nov 3, 2022
5b9b327
fix compare value case for small reference value
juandjara Nov 3, 2022
d68dac7
fix edge case for empty color array
juandjara Nov 9, 2022
d011829
add tests for comparative category widget
juandjara Nov 9, 2022
256240b
Merge branch 'master' of github.com:CartoDB/carto-react into feature/…
juandjara Nov 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

## Not released

- AnimatedNumber component with hook wrapping `animateValue` [#509](https://github.com/CartoDB/carto-react/pull/509)
- Implement ComparativeFormulaWidgetUI [#504](https://github.com/CartoDB/carto-react/pull/504)
- Implement ComparativeCategoryWidgetUI [#505](https://github.com/CartoDB/carto-react/pull/505)
- AnimatedNumber component with hook wrapping `animateValue` [#509](https://github.com/CartoDB/carto-react/pull/509)

## 1.5

Expand Down
5 changes: 4 additions & 1 deletion packages/react-ui/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import TableWidgetUI from './widgets/TableWidgetUI/TableWidgetUI';
import NoDataAlert from './widgets/NoDataAlert';
import FeatureSelectionWidgetUI from './widgets/FeatureSelectionWidgetUI';
import ComparativeFormulaWidgetUI from './widgets/ComparativeFormulaWidgetUI';
import ComparativeCategoryWidgetUI, { ORDER_TYPES } from './widgets/ComparativeCategoryWidgetUI';

export {
cartoThemeOptions,
Expand All @@ -39,11 +40,13 @@ export {
useTimeSeriesInteractivity,
TimeSeriesProvider,
CHART_TYPES as TIME_SERIES_CHART_TYPES,
FeatureSelectionWidgetUI,
TableWidgetUI,
LegendWidgetUI,
RangeWidgetUI,
FeatureSelectionWidgetUI,
ComparativeFormulaWidgetUI,
ComparativeCategoryWidgetUI,
ORDER_TYPES as CATEGORY_ORDER_TYPES,
LEGEND_TYPES,
NoDataAlert,
LegendCategories,
Expand Down
9 changes: 7 additions & 2 deletions packages/react-ui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import TimeSeriesWidgetUI from './widgets/TimeSeriesWidgetUI/TimeSeriesWidgetUI'
import FeatureSelectionWidgetUI from './widgets/FeatureSelectionWidgetUI';
import RangeWidgetUI from './widgets/RangeWidgetUI';
import ComparativeFormulaWidgetUI from './widgets/ComparativeFormulaWidgetUI';
import ComparativeCategoryWidgetUI, {
ORDER_TYPES
} from './widgets/ComparativeCategoryWidgetUI';
import { CHART_TYPES } from './widgets/TimeSeriesWidgetUI/utils/constants';
import TableWidgetUI from './widgets/TableWidgetUI/TableWidgetUI';
import NoDataAlert from './widgets/NoDataAlert';
Expand All @@ -41,13 +44,15 @@ export {
BarWidgetUI,
PieWidgetUI,
ScatterPlotWidgetUI,
TimeSeriesWidgetUI,
FeatureSelectionWidgetUI,
ComparativeFormulaWidgetUI,
TimeSeriesWidgetUI,
CHART_TYPES as TIME_SERIES_CHART_TYPES,
TableWidgetUI,
LegendWidgetUI,
RangeWidgetUI,
ComparativeFormulaWidgetUI,
ComparativeCategoryWidgetUI,
ORDER_TYPES as CATEGORY_ORDER_TYPES,
LEGEND_TYPES,
NoDataAlert,
featureSelectionIcons,
Expand Down
26 changes: 26 additions & 0 deletions packages/react-ui/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,29 @@ export type ComparativeFormulaWidgetUI = {
animationOptions?: AnimationOptions;
formatter?: (n: number) => React.ReactNode;
};

export enum ORDER_TYPES {
RANKING = 'ranking',
FIXED = 'fixed',
}

type CategoryData = {
name: string;
value: number;
};

export type ComparativeCategoryWidgetUI = {
names: string[];
data: CategoryData[][];
labels?: string[];
colors?: string[];
maxItems?: number;
order?: ORDER_TYPES;
animation?: boolean;
animationOptions?: AnimationOptions;
searchable?: boolean;
filterable?: boolean;
selectedCategories?: string[];
onSelectedCategoriesChange?: (categories: string[]) => any;
formatter?: (v: any) => string;
};
Loading