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

Custom Sort Order #3423

Merged
merged 14 commits into from
Mar 29, 2018
Prev Previous commit
Next Next commit
update schema and fix import error
sirahd committed Mar 18, 2018
commit f83592bf189cb30e958fe43325cba6cd76b9889e
8 changes: 4 additions & 4 deletions build/vega-lite-schema.json
Original file line number Diff line number Diff line change
@@ -1002,7 +1002,7 @@
"type": "null"
}
],
"description": "Sort order for the encoded field.\nSupported `sort` values include `\"ascending\"`, `\"descending\"`, `\"array specifying the preferred order of values\"` and `null` (no sorting).\nFor fields with discrete domains, `sort` can also be a [sort field definition object](https://vega.github.io/vega-lite/docs/sort.html#sort-field).\nFor `sort` as an \"array specifying the preferred order of values\", the sort order will obey the values in the array, followed by any unspecified values in their original order.\n\n__Default value:__ `\"ascending\"`"
"description": "Sort order for the encoded field.\nSupported `sort` values include `\"ascending\"`, `\"descending\"`, `array specifying the preferred order of values` and `null` (no sorting).\nFor fields with discrete domains, `sort` can also be a [sort field definition object](https://vega.github.io/vega-lite/docs/sort.html#sort-field).\nFor `sort` as an [array specifying the preferred order of values](https://vega.github.io/vega-lite/docs/sort.html#sort-array), the sort order will obey the values in the array, followed by any unspecified values in their original order.\n\n__Default value:__ `\"ascending\"`"
},
"test": {
"$ref": "#/definitions/LogicalOperand<Predicate>"
@@ -1215,7 +1215,7 @@
"type": "null"
}
],
"description": "Sort order for the encoded field.\nSupported `sort` values include `\"ascending\"`, `\"descending\"`, `\"array specifying the preferred order of values\"` and `null` (no sorting).\nFor fields with discrete domains, `sort` can also be a [sort field definition object](https://vega.github.io/vega-lite/docs/sort.html#sort-field).\nFor `sort` as an \"array specifying the preferred order of values\", the sort order will obey the values in the array, followed by any unspecified values in their original order.\n\n__Default value:__ `\"ascending\"`"
"description": "Sort order for the encoded field.\nSupported `sort` values include `\"ascending\"`, `\"descending\"`, `array specifying the preferred order of values` and `null` (no sorting).\nFor fields with discrete domains, `sort` can also be a [sort field definition object](https://vega.github.io/vega-lite/docs/sort.html#sort-field).\nFor `sort` as an [array specifying the preferred order of values](https://vega.github.io/vega-lite/docs/sort.html#sort-array), the sort order will obey the values in the array, followed by any unspecified values in their original order.\n\n__Default value:__ `\"ascending\"`"
},
"timeUnit": {
"$ref": "#/definitions/TimeUnit",
@@ -2351,7 +2351,7 @@
"type": "null"
}
],
"description": "Sort order for the encoded field.\nSupported `sort` values include `\"ascending\"`, `\"descending\"`, `\"array specifying the preferred order of values\"` and `null` (no sorting).\nFor fields with discrete domains, `sort` can also be a [sort field definition object](https://vega.github.io/vega-lite/docs/sort.html#sort-field).\nFor `sort` as an \"array specifying the preferred order of values\", the sort order will obey the values in the array, followed by any unspecified values in their original order.\n\n__Default value:__ `\"ascending\"`"
"description": "Sort order for the encoded field.\nSupported `sort` values include `\"ascending\"`, `\"descending\"`, `array specifying the preferred order of values` and `null` (no sorting).\nFor fields with discrete domains, `sort` can also be a [sort field definition object](https://vega.github.io/vega-lite/docs/sort.html#sort-field).\nFor `sort` as an [array specifying the preferred order of values](https://vega.github.io/vega-lite/docs/sort.html#sort-array), the sort order will obey the values in the array, followed by any unspecified values in their original order.\n\n__Default value:__ `\"ascending\"`"
},
"timeUnit": {
"$ref": "#/definitions/TimeUnit",
@@ -4406,7 +4406,7 @@
"type": "null"
}
],
"description": "Sort order for the encoded field.\nSupported `sort` values include `\"ascending\"`, `\"descending\"`, `\"array specifying the preferred order of values\"` and `null` (no sorting).\nFor fields with discrete domains, `sort` can also be a [sort field definition object](https://vega.github.io/vega-lite/docs/sort.html#sort-field).\nFor `sort` as an \"array specifying the preferred order of values\", the sort order will obey the values in the array, followed by any unspecified values in their original order.\n\n__Default value:__ `\"ascending\"`"
"description": "Sort order for the encoded field.\nSupported `sort` values include `\"ascending\"`, `\"descending\"`, `array specifying the preferred order of values` and `null` (no sorting).\nFor fields with discrete domains, `sort` can also be a [sort field definition object](https://vega.github.io/vega-lite/docs/sort.html#sort-field).\nFor `sort` as an [array specifying the preferred order of values](https://vega.github.io/vega-lite/docs/sort.html#sort-array), the sort order will obey the values in the array, followed by any unspecified values in their original order.\n\n__Default value:__ `\"ascending\"`"
},
"stack": {
"anyOf": [
15 changes: 0 additions & 15 deletions src/compile/data/parse.ts
Original file line number Diff line number Diff line change
@@ -204,20 +204,6 @@ export function parseData(model: Model): DataComponent {
head = BinNode.makeFromEncoding(head, model) || head;
}

<<<<<<< 4fccae71f7ba4b48158615939dd425fa708fbf0f
head = TimeUnitNode.makeFromEncoding(head, model) || head;
||||||| merged common ancestors
for (const geopoint of GeoPointNode.makeAll(model)) {
geopoint.parent = head;
head = geopoint;
}

const tu = TimeUnitNode.makeFromEncoding(model);
if (tu) {
tu.parent = head;
head = tu;
}
=======
for (const geopoint of GeoPointNode.makeAll(model)) {
geopoint.parent = head;
head = geopoint;
@@ -233,7 +219,6 @@ export function parseData(model: Model): DataComponent {
calculate.parent = head;
head = calculate;
}
>>>>>>> reuse calculate node to generate new sort field
}

// add an output node pre aggregation
4 changes: 2 additions & 2 deletions src/sort.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {AggregateOp} from './aggregate';
import {AggregateOp} from 'vega';
import {isArray, isString} from 'vega-util';
import {SortField} from './sort';
import {isArray, isString} from './util';

export type SortOrder = 'ascending' | 'descending' | null;