-
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.
Browse files
Browse the repository at this point in the history
* [XY] Add opacity slider and dots size slider * [Lens] Adds fill opacity slider * Make the new sliders to appear fullwidth * Change property name and fix unit tests * Add a comment * useDebouncedValue hook Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
ecbdb51
commit 274ca39
Showing
36 changed files
with
437 additions
and
29 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/plugins/vis_type_vislib/public/__snapshots__/to_ast.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
2 changes: 2 additions & 0 deletions
2
...s_type_xy/public/editor/components/options/metrics_axes/__snapshots__/index.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
...xy/public/editor/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
...y/public/editor/components/options/metrics_axes/__snapshots__/point_options.test.tsx.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
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
44 changes: 44 additions & 0 deletions
44
src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/point_options.test.tsx
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,44 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { shallow, mount } from 'enzyme'; | ||
import { findTestSubject } from '@elastic/eui/lib/test'; | ||
|
||
import { SeriesParam } from '../../../../types'; | ||
import { PointOptions, PointOptionsParams } from './point_options'; | ||
import { seriesParam } from './mocks'; | ||
|
||
describe('PointOptions component', () => { | ||
let setChart: jest.Mock; | ||
let defaultProps: PointOptionsParams; | ||
let chart: SeriesParam; | ||
|
||
beforeEach(() => { | ||
setChart = jest.fn(); | ||
chart = { ...seriesParam }; | ||
|
||
defaultProps = { | ||
chart, | ||
setChart, | ||
}; | ||
}); | ||
|
||
it('should init with the default set of props', () => { | ||
const comp = shallow(<PointOptions {...defaultProps} />); | ||
|
||
expect(comp).toMatchSnapshot(); | ||
}); | ||
|
||
it('should disable the dots size range if the show dots switch is off', () => { | ||
chart.showCircles = false; | ||
const comp = mount(<PointOptions {...defaultProps} />); | ||
const range = findTestSubject(comp, 'circlesRadius'); | ||
expect(range.at(1).props().disabled).toBeTruthy(); | ||
}); | ||
}); |
63 changes: 63 additions & 0 deletions
63
src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/point_options.tsx
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,63 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { EuiRange, EuiFormRow, EuiSpacer } from '@elastic/eui'; | ||
|
||
import { SwitchOption } from '../../../../../../vis_default_editor/public'; | ||
|
||
import { SeriesParam } from '../../../../types'; | ||
import { SetChart } from './chart_options'; | ||
|
||
export interface PointOptionsParams { | ||
chart: SeriesParam; | ||
setChart: SetChart; | ||
} | ||
|
||
function PointOptions({ chart, setChart }: PointOptionsParams) { | ||
return ( | ||
<> | ||
<EuiSpacer size="m" /> | ||
<SwitchOption | ||
label={i18n.translate('visTypeXy.controls.pointSeries.series.showDotsLabel', { | ||
defaultMessage: 'Show dots', | ||
})} | ||
paramName="showCircles" | ||
value={chart.showCircles} | ||
setValue={setChart} | ||
/> | ||
<EuiSpacer size="m" /> | ||
<EuiFormRow | ||
label={i18n.translate('visTypeXy.controls.pointSeries.series.circlesRadius', { | ||
defaultMessage: 'Dots size', | ||
})} | ||
fullWidth | ||
display="rowCompressed" | ||
> | ||
<EuiRange | ||
data-test-subj="circlesRadius" | ||
value={chart.circlesRadius} | ||
min={1} | ||
max={10} | ||
step={1} | ||
fullWidth | ||
disabled={!chart.showCircles} | ||
showInput | ||
compressed | ||
onChange={(e) => { | ||
setChart('circlesRadius', Number(e.currentTarget.value)); | ||
}} | ||
/> | ||
</EuiFormRow> | ||
</> | ||
); | ||
} | ||
|
||
export { PointOptions }; |
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
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.