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: correct axis schema to clarify which properties support expression #7148

Merged
merged 1 commit into from
Jan 4, 2021
Merged
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
132 changes: 38 additions & 94 deletions build/vega-lite-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1065,15 +1065,8 @@
]
},
"domain": {
"anyOf": [
{
"description": "A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.\n\n__Default value:__ `true`",
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
]
"description": "A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.\n\n__Default value:__ `true`",
"type": "boolean"
},
"domainCap": {
"anyOf": [
Expand Down Expand Up @@ -1506,15 +1499,8 @@
]
},
"labels": {
"anyOf": [
{
"description": "A boolean flag indicating if labels should be included as part of the axis.\n\n__Default value:__ `true`.",
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
]
"description": "A boolean flag indicating if labels should be included as part of the axis.\n\n__Default value:__ `true`.",
"type": "boolean"
},
"maxExtent": {
"anyOf": [
Expand All @@ -1539,8 +1525,15 @@
]
},
"offset": {
"description": "The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.\n\n__Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)",
"type": "number"
"anyOf": [
{
"type": "number"
},
{
"$ref": "#/definitions/ExprRef"
}
],
"description": "The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.\n\n__Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)"
},
"orient": {
"anyOf": [
Expand Down Expand Up @@ -1675,15 +1668,8 @@
]
},
"tickExtra": {
"anyOf": [
{
"description": "Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `\"bandPosition\": 1` and an axis `\"padding\"` value of `0`.",
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
]
"description": "Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `\"bandPosition\": 1` and an axis `\"padding\"` value of `0`.",
"type": "boolean"
},
"tickMinStep": {
"anyOf": [
Expand Down Expand Up @@ -1722,15 +1708,8 @@
]
},
"tickRound": {
"anyOf": [
{
"description": "Boolean flag indicating if pixel position values should be rounded to the nearest integer.\n\n__Default value:__ `true`",
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
]
"description": "Boolean flag indicating if pixel position values should be rounded to the nearest integer.\n\n__Default value:__ `true`",
"type": "boolean"
},
"tickSize": {
"anyOf": [
Expand Down Expand Up @@ -1763,15 +1742,8 @@
]
},
"ticks": {
"anyOf": [
{
"description": "Boolean value that determines whether the axis should include ticks.\n\n__Default value:__ `true`",
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
]
"description": "Boolean value that determines whether the axis should include ticks.\n\n__Default value:__ `true`",
"type": "boolean"
},
"title": {
"anyOf": [
Expand Down Expand Up @@ -2050,15 +2022,8 @@
"type": "boolean"
},
"domain": {
"anyOf": [
{
"description": "A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.\n\n__Default value:__ `true`",
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
]
"description": "A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.\n\n__Default value:__ `true`",
"type": "boolean"
},
"domainCap": {
"anyOf": [
Expand Down Expand Up @@ -2491,15 +2456,8 @@
]
},
"labels": {
"anyOf": [
{
"description": "A boolean flag indicating if labels should be included as part of the axis.\n\n__Default value:__ `true`.",
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
]
"description": "A boolean flag indicating if labels should be included as part of the axis.\n\n__Default value:__ `true`.",
"type": "boolean"
},
"maxExtent": {
"anyOf": [
Expand All @@ -2524,8 +2482,15 @@
]
},
"offset": {
"description": "The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.\n\n__Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)",
"type": "number"
"anyOf": [
{
"type": "number"
},
{
"$ref": "#/definitions/ExprRef"
}
],
"description": "The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.\n\n__Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)"
},
"orient": {
"anyOf": [
Expand Down Expand Up @@ -2660,15 +2625,8 @@
]
},
"tickExtra": {
"anyOf": [
{
"description": "Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `\"bandPosition\": 1` and an axis `\"padding\"` value of `0`.",
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
]
"description": "Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `\"bandPosition\": 1` and an axis `\"padding\"` value of `0`.",
"type": "boolean"
},
"tickMinStep": {
"anyOf": [
Expand Down Expand Up @@ -2707,15 +2665,8 @@
]
},
"tickRound": {
"anyOf": [
{
"description": "Boolean flag indicating if pixel position values should be rounded to the nearest integer.\n\n__Default value:__ `true`",
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
]
"description": "Boolean flag indicating if pixel position values should be rounded to the nearest integer.\n\n__Default value:__ `true`",
"type": "boolean"
},
"tickSize": {
"anyOf": [
Expand Down Expand Up @@ -2748,15 +2699,8 @@
]
},
"ticks": {
"anyOf": [
{
"description": "Boolean value that determines whether the axis should include ticks.\n\n__Default value:__ `true`",
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
]
"description": "Boolean value that determines whether the axis should include ticks.\n\n__Default value:__ `true`",
"type": "boolean"
},
"title": {
"anyOf": [
Expand Down
39 changes: 37 additions & 2 deletions src/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,49 @@ interface AxisOverrideMixins<ES extends ExprRef | SignalRef> {
*/
tickMinStep?: number | ES;

// Override comments to be Vega-Lite specific
// ---------- Properties that do not support signal / expression ----------
/**
* A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.
*
* __Default value:__ `true`
*/
domain?: boolean;

/**
* A boolean flag indicating if grid lines should be included as part of the axis
*
* __Default value:__ `true` for [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous) that are not binned; otherwise, `false`.
*/
grid?: boolean;

/**
* A boolean flag indicating if labels should be included as part of the axis.
*
* __Default value:__ `true`.
*/
labels?: boolean;

/**
* Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `"bandPosition": 1` and an axis `"padding"` value of `0`.
*/
tickExtra?: boolean;

/**
* Boolean flag indicating if pixel position values should be rounded to the nearest integer.
*
* __Default value:__ `true`
*/
tickRound?: boolean;

/**
* Boolean value that determines whether the axis should include ticks.
*
* __Default value:__ `true`
*/
ticks?: boolean;

// Override comments to be Vega-Lite specific

/**
* Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.
*
Expand All @@ -66,7 +101,7 @@ interface AxisOverrideMixins<ES extends ExprRef | SignalRef> {
*
* __Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)
*/
offset?: number;
offset?: number | ES;

/**
* The orientation of the axis. One of `"top"`, `"bottom"`, `"left"` or `"right"`. The orientation can be used to further specialize the axis type (e.g., a y-axis oriented towards the right edge of the chart).
Expand Down