mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Observability] [Exploratory View] only show y axis label for a single series (#113989)
This commit is contained in:
parent
d65715b6d7
commit
7f1adb8d95
2 changed files with 25 additions and 1 deletions
|
@ -246,6 +246,24 @@ describe('Lens Attribute', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should hide y axis when there are multiple series', function () {
|
||||
const lensAttrWithMultiSeries = new LensAttributes([layerConfig, layerConfig]).getJSON() as any;
|
||||
expect(lensAttrWithMultiSeries.state.visualization.axisTitlesVisibilitySettings).toEqual({
|
||||
x: true,
|
||||
yLeft: false,
|
||||
yRight: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('should show y axis when there is a single series', function () {
|
||||
const lensAttrWithMultiSeries = new LensAttributes([layerConfig]).getJSON() as any;
|
||||
expect(lensAttrWithMultiSeries.state.visualization.axisTitlesVisibilitySettings).toEqual({
|
||||
x: true,
|
||||
yLeft: true,
|
||||
yRight: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should return first layer', function () {
|
||||
expect(lnsAttr.getLayers()).toEqual({
|
||||
layer0: {
|
||||
|
|
|
@ -98,6 +98,7 @@ export class LensAttributes {
|
|||
layers: Record<string, PersistedIndexPatternLayer>;
|
||||
visualization: XYState;
|
||||
layerConfigs: LayerConfig[];
|
||||
isMultiSeries: boolean;
|
||||
|
||||
constructor(layerConfigs: LayerConfig[]) {
|
||||
this.layers = {};
|
||||
|
@ -114,6 +115,7 @@ export class LensAttributes {
|
|||
});
|
||||
|
||||
this.layerConfigs = layerConfigs;
|
||||
this.isMultiSeries = layerConfigs.length > 1;
|
||||
this.layers = this.getLayers();
|
||||
this.visualization = this.getXyState();
|
||||
}
|
||||
|
@ -612,7 +614,11 @@ export class LensAttributes {
|
|||
valueLabels: 'hide',
|
||||
fittingFunction: 'Linear',
|
||||
curveType: 'CURVE_MONOTONE_X' as XYCurveType,
|
||||
axisTitlesVisibilitySettings: { x: true, yLeft: true, yRight: true },
|
||||
axisTitlesVisibilitySettings: {
|
||||
x: true,
|
||||
yLeft: !this.isMultiSeries,
|
||||
yRight: !this.isMultiSeries,
|
||||
},
|
||||
tickLabelsVisibilitySettings: { x: true, yLeft: true, yRight: true },
|
||||
gridlinesVisibilitySettings: { x: true, yLeft: true, yRight: true },
|
||||
preferredSeriesType: 'line',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue