Skip to content

Commit

Permalink
fix: correct axis schema to clarify which properties support expression
Browse files Browse the repository at this point in the history
fix #6986
  • Loading branch information
kanitw committed Jan 4, 2021
1 parent a645313 commit 72b7cf4
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 96 deletions.
132 changes: 38 additions & 94 deletions build/vega-lite-schema.json
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
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

0 comments on commit 72b7cf4

Please sign in to comment.