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

fix: RTL reverse data order #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions packages/ez-react/src/components/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ export const Chart: FC<ChartProps> = ({

const chartData = useMemo(() => {
const values = Object.values(dataDict);
return isRTL ? values.reverse() : values;
}, [dataDict, isRTL]);
return values;
}, [dataDict]);

const onLegendResize = useCallback(
({ height }: Dimensions) => setLegendHeight(height),
Expand Down
1 change: 1 addition & 0 deletions packages/ez-react/src/recipes/column/ColumnChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const ColumnChart: FC<ColumnChartProps> = ({
definition: {
direction: Direction.HORIZONTAL,
domainKey: xAxis.domainKey,
reverse: isRTL,
},
}}
yScaleConfig={{
Expand Down
2 changes: 2 additions & 0 deletions packages/ez-react/src/recipes/column/LineColumnChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export const LineColumnChart: FC<LineColumnChartProps> = ({
definition: {
direction: Direction.HORIZONTAL,
domainKey: xAxis.domainKey,
reverse: isRTL,
},
}}
yScaleConfig={{
Expand Down Expand Up @@ -122,6 +123,7 @@ export const LineColumnChart: FC<LineColumnChartProps> = ({
definition: {
direction: Direction.HORIZONTAL,
domainKey: xAxis.domainKey,
reverse: isRTL,
},
}}
yScaleConfig={{
Expand Down
2 changes: 1 addition & 1 deletion packages/ez-vue/src/components/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default class Chart extends Vue {
@Watch('chart.dataDict', { deep: true })
onDataDictChange() {
const data = Object.values(this.chart.dataDict);
this.chart.data = this.isRTL ? data.reverse() : data;
this.chart.data = data;
}

@Watch('isRTL')
Expand Down
1 change: 1 addition & 0 deletions packages/ez-vue/src/recipes/column/ColumnChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export default class ColumnChart extends mixins(ToggleDatumMixin) {
definition: {
direction: Direction.HORIZONTAL,
domainKey: xAxis.domainKey,
reverse: isRTL,
},
}}
yScaleConfig={{
Expand Down
2 changes: 2 additions & 0 deletions packages/ez-vue/src/recipes/column/LineColumnChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ export default class LineColumnChart extends mixins(ToggleDatumMixin) {
definition: {
direction: Direction.HORIZONTAL,
domainKey: xAxis.domainKey,
reverse: isRTL,
},
}}
yScaleConfig={{
Expand Down Expand Up @@ -255,6 +256,7 @@ export default class LineColumnChart extends mixins(ToggleDatumMixin) {
definition: {
direction: Direction.HORIZONTAL,
domainKey: xAxis.domainKey,
reverse: isRTL,
},
}}
yScaleConfig={{
Expand Down