-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lens] Allows the users to change the axis orientation (#106369)
* [Lens] Allows the users to change the axis orientation * Disable orientation if ticklabels are off Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
8d30072
commit c656608
Showing
17 changed files
with
380 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
x-pack/plugins/lens/common/expressions/xy_chart/labels_orientation_config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { i18n } from '@kbn/i18n'; | ||
import type { ExpressionFunctionDefinition } from '../../../../../../src/plugins/expressions/common'; | ||
|
||
export interface LabelsOrientationConfig { | ||
x: number; | ||
yLeft: number; | ||
yRight: number; | ||
} | ||
|
||
export type LabelsOrientationConfigResult = LabelsOrientationConfig & { | ||
type: 'lens_xy_labelsOrientationConfig'; | ||
}; | ||
|
||
export const labelsOrientationConfig: ExpressionFunctionDefinition< | ||
'lens_xy_labelsOrientationConfig', | ||
null, | ||
LabelsOrientationConfig, | ||
LabelsOrientationConfigResult | ||
> = { | ||
name: 'lens_xy_labelsOrientationConfig', | ||
aliases: [], | ||
type: 'lens_xy_labelsOrientationConfig', | ||
help: `Configure the xy chart's tick labels orientation`, | ||
inputTypes: ['null'], | ||
args: { | ||
x: { | ||
types: ['number'], | ||
options: [0, -90, -45], | ||
help: i18n.translate('xpack.lens.xyChart.xAxisLabelsOrientation.help', { | ||
defaultMessage: 'Specifies the labels orientation of the x-axis.', | ||
}), | ||
}, | ||
yLeft: { | ||
types: ['number'], | ||
options: [0, -90, -45], | ||
help: i18n.translate('xpack.lens.xyChart.yLeftAxisLabelsOrientation.help', { | ||
defaultMessage: 'Specifies the labels orientation of the left y-axis.', | ||
}), | ||
}, | ||
yRight: { | ||
types: ['number'], | ||
options: [0, -90, -45], | ||
help: i18n.translate('xpack.lens.xyChart.yRightAxisLabelsOrientation.help', { | ||
defaultMessage: 'Specifies the labels orientation of the right y-axis.', | ||
}), | ||
}, | ||
}, | ||
fn: function fn(input: unknown, args: LabelsOrientationConfig) { | ||
return { | ||
type: 'lens_xy_labelsOrientationConfig', | ||
...args, | ||
}; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/lens/public/xy_visualization/__snapshots__/to_expression.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.