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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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