Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix ordering expression for axes #1062

Closed
wants to merge 3 commits into from
Closed
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
23 changes: 17 additions & 6 deletions src/app/stores/app_store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1564,6 +1564,10 @@ export class AppStore extends BaseStore {
: null,
order:
yDataProperty.order !== undefined ? yDataProperty.order : null,
orderByExpression:
xDataProperty.orderByExpression !== undefined
? xDataProperty.orderByExpression
: null,
},
yDataProperty.rawExpression as string
);
Expand Down Expand Up @@ -1972,7 +1976,17 @@ export class AppStore extends BaseStore {
dataExpression.valueType,
values
);
dataBinding.orderByCategories = deepClone(categories);
try {
if (dataBinding.orderByExpression) {
dataBinding.orderByCategories = this.getCategoriesForOrderByColumn(
dataBinding
);
}
} finally {
if (!dataBinding.orderByExpression) {
dataBinding.orderByCategories = deepClone(categories);
}
}
dataBinding.order = order != undefined ? order : null;
dataBinding.allCategories = deepClone(categories);

Expand Down Expand Up @@ -2162,11 +2176,8 @@ export class AppStore extends BaseStore {
}
}

public getCategoriesForOrderByColumn(
orderExpression: string,
expression: string,
data: AxisDataBinding
) {
public getCategoriesForOrderByColumn(data: AxisDataBinding) {
const expression: string = data.expression;
const parsed = Expression.parse(expression);
let groupByExpression: string = null;
if (parsed instanceof Expression.FunctionCall) {
Expand Down