Axis: Add separate show axis option (#74117)

Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
This commit is contained in:
Ihor Yeromin 2023-08-31 03:57:44 +02:00 committed by GitHub
parent d5e7b184dd
commit f97e1c81e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 45 additions and 19 deletions

View File

@ -34,6 +34,7 @@ It extends [AxisConfig](#axisconfig) and [HideableFieldConfig](#hideablefieldcon
| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
@ -55,6 +56,7 @@ TODO docs
| `axisGridShow` | boolean | No | | | | `axisGridShow` | boolean | No | | |
| `axisLabel` | string | No | | | | `axisLabel` | string | No | | |
| `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | |
| `axisSoftMax` | number | No | | | | `axisSoftMax` | number | No | | |
| `axisSoftMin` | number | No | | | | `axisSoftMin` | number | No | | |
| `axisWidth` | number | No | | | | `axisWidth` | number | No | | |

View File

@ -59,6 +59,7 @@ It extends [LineConfig](#lineconfig) and [FillConfig](#fillconfig) and [PointsCo
| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
@ -96,6 +97,7 @@ TODO docs
| `axisGridShow` | boolean | No | | | | `axisGridShow` | boolean | No | | |
| `axisLabel` | string | No | | | | `axisLabel` | string | No | | |
| `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | |
| `axisSoftMax` | number | No | | | | `axisSoftMax` | number | No | | |
| `axisSoftMin` | number | No | | | | `axisSoftMin` | number | No | | |
| `axisWidth` | number | No | | | | `axisWidth` | number | No | | |

View File

@ -184,6 +184,7 @@ It extends [AxisConfig](#axisconfig).
| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
@ -205,6 +206,7 @@ TODO docs
| `axisGridShow` | boolean | No | | | | `axisGridShow` | boolean | No | | |
| `axisLabel` | string | No | | | | `axisLabel` | string | No | | |
| `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | |
| `axisSoftMax` | number | No | | | | `axisSoftMax` | number | No | | |
| `axisSoftMin` | number | No | | | | `axisSoftMin` | number | No | | |
| `axisWidth` | number | No | | | | `axisWidth` | number | No | | |

View File

@ -34,6 +34,7 @@ It extends [AxisConfig](#axisconfig) and [HideableFieldConfig](#hideablefieldcon
| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
@ -54,6 +55,7 @@ TODO docs
| `axisGridShow` | boolean | No | | | | `axisGridShow` | boolean | No | | |
| `axisLabel` | string | No | | | | `axisLabel` | string | No | | |
| `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | |
| `axisSoftMax` | number | No | | | | `axisSoftMax` | number | No | | |
| `axisSoftMin` | number | No | | | | `axisSoftMin` | number | No | | |
| `axisWidth` | number | No | | | | `axisWidth` | number | No | | |

View File

@ -36,6 +36,7 @@ It extends [LineConfig](#lineconfig) and [FillConfig](#fillconfig) and [PointsCo
| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
@ -73,6 +74,7 @@ TODO docs
| `axisGridShow` | boolean | No | | | | `axisGridShow` | boolean | No | | |
| `axisLabel` | string | No | | | | `axisLabel` | string | No | | |
| `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | |
| `axisSoftMax` | number | No | | | | `axisSoftMax` | number | No | | |
| `axisSoftMin` | number | No | | | | `axisSoftMin` | number | No | | |
| `axisWidth` | number | No | | | | `axisWidth` | number | No | | |

View File

@ -36,6 +36,7 @@ It extends [LineConfig](#lineconfig) and [FillConfig](#fillconfig) and [PointsCo
| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
@ -73,6 +74,7 @@ TODO docs
| `axisGridShow` | boolean | No | | | | `axisGridShow` | boolean | No | | |
| `axisLabel` | string | No | | | | `axisLabel` | string | No | | |
| `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | |
| `axisSoftMax` | number | No | | | | `axisSoftMax` | number | No | | |
| `axisSoftMin` | number | No | | | | `axisSoftMin` | number | No | | |
| `axisWidth` | number | No | | | | `axisWidth` | number | No | | |

View File

@ -38,6 +38,7 @@ It extends [HideableFieldConfig](#hideablefieldconfig) and [AxisConfig](#axiscon
| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | | `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* |
@ -63,6 +64,7 @@ TODO docs
| `axisGridShow` | boolean | No | | | | `axisGridShow` | boolean | No | | |
| `axisLabel` | string | No | | | | `axisLabel` | string | No | | |
| `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | |
| `axisSoftMax` | number | No | | | | `axisSoftMax` | number | No | | |
| `axisSoftMin` | number | No | | | | `axisSoftMin` | number | No | | |
| `axisWidth` | number | No | | | | `axisWidth` | number | No | | |
@ -206,6 +208,7 @@ It extends [FieldConfig](#fieldconfig).
| `axisGridShow` | boolean | No | | *(Inherited from [FieldConfig](#fieldconfig))* | | `axisGridShow` | boolean | No | | *(Inherited from [FieldConfig](#fieldconfig))* |
| `axisLabel` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))* | | `axisLabel` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))* |
| `axisPlacement` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | | `axisPlacement` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))*<br/>TODO docs<br/>Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. |
| `axisShow` | boolean | No | | *(Inherited from [FieldConfig](#fieldconfig))* |
| `axisSoftMax` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* | | `axisSoftMax` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* |
| `axisSoftMin` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* | | `axisSoftMin` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* |
| `axisWidth` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* | | `axisWidth` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* |

View File

@ -358,6 +358,7 @@ export interface AxisConfig {
axisGridShow?: boolean; axisGridShow?: boolean;
axisLabel?: string; axisLabel?: string;
axisPlacement?: AxisPlacement; axisPlacement?: AxisPlacement;
axisShow?: boolean;
axisSoftMax?: number; axisSoftMax?: number;
axisSoftMin?: number; axisSoftMin?: number;
axisWidth?: number; axisWidth?: number;

View File

@ -94,7 +94,8 @@ AxisConfig: {
axisSoftMax?: number axisSoftMax?: number
axisGridShow?: bool axisGridShow?: bool
scaleDistribution?: ScaleDistributionConfig scaleDistribution?: ScaleDistributionConfig
axisCenteredZero?: bool axisCenteredZero?: bool
axisShow?: bool
} @cuetsy(kind="interface") } @cuetsy(kind="interface")
// TODO docs // TODO docs

View File

@ -32,6 +32,11 @@ exports[`GraphNG utils preparePlotConfigBuilder 1`] = `
"values": [Function], "values": [Function],
}, },
{ {
"border": {
"show": false,
"stroke": "rgb(204, 204, 220)",
"width": 1,
},
"filter": undefined, "filter": undefined,
"font": "12px "Inter", "Helvetica", "Arial", sans-serif", "font": "12px "Inter", "Helvetica", "Arial", sans-serif",
"gap": 5, "gap": 5,
@ -51,9 +56,9 @@ exports[`GraphNG utils preparePlotConfigBuilder 1`] = `
"splits": undefined, "splits": undefined,
"stroke": "rgb(204, 204, 220)", "stroke": "rgb(204, 204, 220)",
"ticks": { "ticks": {
"show": true, "show": false,
"size": 4, "size": 4,
"stroke": "rgba(240, 250, 255, 0.09)", "stroke": "rgb(204, 204, 220)",
"width": 1, "width": 1,
}, },
"timeZone": undefined, "timeZone": undefined,

View File

@ -294,21 +294,18 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<{
} }
} }
let axisColorOpts = {}; const axisDisplayOptions = {
border: {
if (axisColor) { show: customConfig.axisShow || false,
axisColorOpts = { width: 1,
border: { stroke: axisColor || theme.colors.text.primary,
show: true, },
width: 1, ticks: {
stroke: axisColor, show: customConfig.axisShow || false,
}, stroke: axisColor || theme.colors.text.primary,
ticks: { },
stroke: axisColor, color: axisColor || theme.colors.text.primary,
}, };
color: customConfig.axisColorMode === AxisColorMode.Series ? axisColor : undefined,
};
}
let incrs: uPlot.Axis.Incrs | undefined; let incrs: uPlot.Axis.Incrs | undefined;
@ -339,7 +336,7 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<{
splits, splits,
values, values,
incrs, incrs,
...axisColorOpts, ...axisDisplayOptions,
}, },
field field
) )

View File

@ -77,6 +77,12 @@ export function addAxisConfig(
{ value: AxisColorMode.Series, label: 'Series' }, { value: AxisColorMode.Series, label: 'Series' },
], ],
}, },
})
.addBooleanSwitch({
path: 'axisShow',
name: 'Show axis',
category,
defaultValue: false,
}); });
// options for scale range // options for scale range

View File

@ -38,6 +38,7 @@ export const defaultGraphConfig: GraphFieldConfig = {
}, },
axisGridShow: true, axisGridShow: true,
axisCenteredZero: false, axisCenteredZero: false,
axisShow: false,
}; };
const categoryStyles = ['Graph styles']; const categoryStyles = ['Graph styles'];