Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Vis: Default Editor] EUIficate 'Metrics & Axis' tab #43772

Merged
merged 103 commits into from
Sep 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
7113847
EUIficate pointe-series and grid
maryia-lapata Aug 7, 2019
aa3ec42
Merge branch 'master' into point-series
maryia-lapata Aug 8, 2019
950f4d5
Apply TS
maryia-lapata Aug 8, 2019
d120cb3
Show grid on a panel
maryia-lapata Aug 8, 2019
5c02bda
Remove extra space
maryia-lapata Aug 8, 2019
2815308
Merge branch 'master' into point-series
maryia-lapata Aug 9, 2019
b5296a1
Add TS
maryia-lapata Aug 9, 2019
7c04623
Use BasicOptions
maryia-lapata Aug 9, 2019
581d200
Adjust func test
maryia-lapata Aug 9, 2019
79cac99
Add dataTestSubj prop to SelectOption
maryia-lapata Aug 12, 2019
6f27b2d
Merge branch 'master' into point-series
maryia-lapata Aug 12, 2019
44f061d
Use id instead of data-sest-subj
maryia-lapata Aug 12, 2019
162b5cd
Disable show x-axis lines when there is histogram agg
maryia-lapata Aug 13, 2019
a9ac07b
Merge branch 'master' into point-series
maryia-lapata Aug 14, 2019
b4ec159
Add tooltip for disabled 'Show x-axis lines' config
maryia-lapata Aug 14, 2019
c3e73d1
Add series_options.tsx
maryia-lapata Aug 14, 2019
4273682
Merge branch 'master' into series-options
maryia-lapata Aug 15, 2019
02ac64b
Migrate series
maryia-lapata Aug 15, 2019
c33df01
Improve changeValueAxis
maryia-lapata Aug 16, 2019
c3baff1
Merge branch 'master' into series-options
maryia-lapata Aug 16, 2019
7949329
Create CategoryAxisPanel
maryia-lapata Aug 16, 2019
d24335a
Create ValueAxesPanel
maryia-lapata Aug 16, 2019
abaaed5
Create CustomExtentsOptions
maryia-lapata Aug 19, 2019
9516076
File renaming
maryia-lapata Aug 19, 2019
be9612e
Use TruncateLabelsOption
maryia-lapata Aug 19, 2019
e7d8885
Set min value
maryia-lapata Aug 19, 2019
3993f10
Add validation
maryia-lapata Aug 20, 2019
46ec9e3
Refactoring
maryia-lapata Aug 20, 2019
723f1f8
Merge branch 'master' into series-options
maryia-lapata Aug 21, 2019
4e16fdf
Move types upper
maryia-lapata Aug 21, 2019
3b8729a
Convert series logic
maryia-lapata Aug 21, 2019
29cd4ca
Convert valueAxes logic
maryia-lapata Aug 21, 2019
260d32f
Rename function
maryia-lapata Aug 21, 2019
77a88c3
Add validation and refactoring
maryia-lapata Aug 22, 2019
91a6d46
Adjust styles
maryia-lapata Aug 22, 2019
ac06733
Fix rotates
maryia-lapata Aug 22, 2019
1eefe3e
Apply config for other vis
maryia-lapata Aug 22, 2019
8aeddeb
Remove old directives
maryia-lapata Aug 22, 2019
b1f3247
Fix useHook usage
maryia-lapata Aug 22, 2019
460f97c
Update vislib_vis_type.js
maryia-lapata Aug 22, 2019
42532df
Fix
maryia-lapata Aug 22, 2019
fb26a2f
Merge branch 'master' into series-options
maryia-lapata Aug 23, 2019
1b93973
Move Threshold line panel into a separate component
maryia-lapata Aug 23, 2019
5b1ea48
Remove unused translations
maryia-lapata Aug 23, 2019
a006887
Apply ui suggestions
maryia-lapata Aug 23, 2019
ada9809
Update functional tests
maryia-lapata Aug 23, 2019
c4599d4
Remove angular unit test
maryia-lapata Aug 23, 2019
6b3953d
Refactoring
maryia-lapata Aug 23, 2019
41b4de7
Fix dependencies
maryia-lapata Aug 23, 2019
f07f618
Refactoring
maryia-lapata Aug 23, 2019
c9d9296
Merge branch 'master' into series-options
maryia-lapata Aug 26, 2019
ed47a59
Add validation
maryia-lapata Aug 26, 2019
0e78db0
Add validation for other vis
maryia-lapata Aug 26, 2019
290801e
Refactoring of onPositionChanged handler
maryia-lapata Aug 26, 2019
5b2e860
Refactoring of addValueAxis
maryia-lapata Aug 26, 2019
3ee84eb
Get rid of a useEffect
maryia-lapata Aug 26, 2019
1560efa
Refactoring of updateAxisTitle
maryia-lapata Aug 26, 2019
239d0c5
Update useCallback
maryia-lapata Aug 26, 2019
cabf1b0
Refactoring
maryia-lapata Aug 26, 2019
438691d
Merge branch 'master' into series-options
maryia-lapata Aug 27, 2019
d3466b1
Refactoring of collections config
maryia-lapata Aug 27, 2019
69ea75f
Refactoring of setChartValueByIndex and setValueAxisByIndex
maryia-lapata Aug 27, 2019
1ffa936
Update metrics_axes_options.tsx
maryia-lapata Aug 27, 2019
76e2f1b
Watch current tab for correct accordion height
maryia-lapata Aug 27, 2019
28396b1
Revert axis title logic
maryia-lapata Aug 27, 2019
2d43ce7
Fix axis id and name number
maryia-lapata Aug 27, 2019
a90c144
Fix code review comments
maryia-lapata Aug 28, 2019
c717ea2
Fix functional tests
maryia-lapata Aug 28, 2019
150d717
Update visualize_page.js
maryia-lapata Aug 28, 2019
9cd23a5
Merge branch 'master' into series-options
maryia-lapata Sep 2, 2019
84a9794
Move option tabs in common
maryia-lapata Sep 2, 2019
456f1d4
Fix code review comments
maryia-lapata Sep 2, 2019
214a70f
Update index.tsx
maryia-lapata Sep 2, 2019
ede9abd
Refactoring
maryia-lapata Sep 2, 2019
2c448e7
Merge branch 'master' into series-options
maryia-lapata Sep 3, 2019
e1c702f
Fix merge conflict
maryia-lapata Sep 3, 2019
4edad88
Show ThresholdPanel when it's configured
maryia-lapata Sep 3, 2019
26ee1b9
Fix passing a current tab to vis-options
maryia-lapata Sep 3, 2019
37e21f9
Localize 'Count' text
maryia-lapata Sep 3, 2019
e4d45ee
Pass one axis to CategoryAxisPanel
maryia-lapata Sep 3, 2019
d9f2bdf
Fix y-axis name number when x-axis position changed
maryia-lapata Sep 3, 2019
4653bfc
Fix Y-axis name number when position Y-axis changed
maryia-lapata Sep 3, 2019
14cd7ec
Merge branch 'master' into series-options
maryia-lapata Sep 4, 2019
4ee7618
Fix refresh loop
maryia-lapata Sep 4, 2019
dfeb375
Re-organize controls
maryia-lapata Sep 5, 2019
82310bd
Apply code review comments
maryia-lapata Sep 5, 2019
6b8be4e
Refactoring
maryia-lapata Sep 5, 2019
0b35a45
Merge branch 'master' into series-options
maryia-lapata Sep 6, 2019
a8e6791
Fix extents empty value
maryia-lapata Sep 6, 2019
f196788
Update y_extents.tsx
maryia-lapata Sep 6, 2019
e45e773
Merge branch 'master' of github.com:elastic/kibana into series-options
maryia-lapata Sep 9, 2019
f1e2de6
Fix code review comments
maryia-lapata Sep 10, 2019
44f945f
Fix updating several seriesParams when removing axis
maryia-lapata Sep 10, 2019
a2ffe93
Add thresholdLine config to horizontal bar
maryia-lapata Sep 10, 2019
63cb6a6
Refactoring
maryia-lapata Sep 10, 2019
646c40a
Merge branch 'master' into series-options
maryia-lapata Sep 10, 2019
086c94c
Reset grid.valueAxis when the axis deleted
maryia-lapata Sep 10, 2019
0bafa6f
Fix refresh loop
maryia-lapata Sep 10, 2019
4301f62
Set interpolate config for line
maryia-lapata Sep 10, 2019
b3127d5
Merge branch 'master' of github.com:elastic/kibana into series-options
maryia-lapata Sep 11, 2019
da85bf5
Merge branch 'master' into series-options
maryia-lapata Sep 12, 2019
b4ab409
Enable "show dots"
maryia-lapata Sep 12, 2019
5df31a0
Merge branch 'master' of github.com:elastic/kibana into series-options
maryia-lapata Sep 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 49 additions & 67 deletions src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,25 @@
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { i18n } from '@kbn/i18n';
import { Schemas } from 'ui/vis/editors/default/schemas';
import { PointSeriesOptions } from './components/options';
import { getLegendPositions, LegendPositions } from './utils/legend_positions';
import { AggGroupNames } from 'ui/vis/editors/default';
import {
Positions,
ChartTypes,
ChartModes,
InterpolationModes,
AxisTypes,
ScaleTypes,
AxisModes,
Rotates,
ThresholdLineStyles,
getConfigCollections,
} from './utils/collections';
import { getAreaOptionTabs, getCountLabel } from './utils/common_config';
import { palettes } from '@elastic/eui/lib/services';

export default function PointSeriesVisType(Private) {
const VisFactory = Private(VisFactoryProvider);
const countLabel = getCountLabel();

return VisFactory.createVislibVisualization({
name: 'area',
Expand All @@ -42,12 +55,12 @@ export default function PointSeriesVisType(Private) {
categoryAxes: [
{
id: 'CategoryAxis-1',
type: 'category',
position: 'bottom',
type: AxisTypes.CATEGORY,
position: Positions.BOTTOM,
show: true,
style: {},
scale: {
type: 'linear'
type: ScaleTypes.LINEAR,
},
labels: {
show: true,
Expand All @@ -61,93 +74,62 @@ export default function PointSeriesVisType(Private) {
{
id: 'ValueAxis-1',
name: 'LeftAxis-1',
type: 'value',
position: 'left',
type: AxisTypes.VALUE,
position: Positions.LEFT,
show: true,
style: {},
scale: {
type: 'linear',
mode: 'normal'
type: ScaleTypes.LINEAR,
mode: AxisModes.NORMAL,
},
labels: {
show: true,
rotate: 0,
rotate: Rotates.HORIZONTAL,
filter: false,
truncate: 100
},
title: {
text: 'Count'
text: countLabel
}
}
],
seriesParams: [{
show: 'true',
type: 'area',
mode: 'stacked',
data: {
label: 'Count',
id: '1'
},
drawLinesBetweenPoints: true,
showCircles: true,
interpolate: 'linear',
valueAxis: 'ValueAxis-1'
}],
seriesParams: [
{
show: true,
type: ChartTypes.AREA,
mode: ChartModes.STACKED,
data: {
label: countLabel,
id: '1'
},
drawLinesBetweenPoints: true,
lineWidth: 2,
showCircles: true,
interpolate: InterpolationModes.LINEAR,
valueAxis: 'ValueAxis-1',
}
],
addTooltip: true,
addLegend: true,
legendPosition: LegendPositions.RIGHT,
legendPosition: Positions.RIGHT,
times: [],
addTimeMarker: false,
thresholdLine: {
show: false,
value: 10,
width: 1,
style: 'full',
style: ThresholdLineStyles.FULL,
color: palettes.euiPaletteColorBlind.colors[9]
},
labels: {}
},
},
editorConfig: {
collections: {
legendPositions: getLegendPositions(),
positions: ['top', 'left', 'right', 'bottom'],
chartTypes: [{
value: 'line',
text: 'line'
}, {
value: 'area',
text: 'area'
}, {
value: 'histogram',
text: 'bar'
}],
axisModes: ['normal', 'percentage', 'wiggle', 'silhouette'],
scaleTypes: ['linear', 'log', 'square root'],
chartModes: ['normal', 'stacked'],
interpolationModes: [{
value: 'linear',
text: 'straight',
}, {
value: 'cardinal',
text: 'smoothed',
}, {
value: 'step-after',
text: 'stepped',
}],
},
optionTabs: [
{
name: 'advanced',
title: 'Metrics & Axes',
editor: '<div><vislib-series></vislib-series><vislib-value-axes>' +
'</vislib-value-axes><vislib-category-axis></vislib-category-axis></div>'
},
{ name: 'options', title: 'Panel Settings', editor: PointSeriesOptions },
],
collections: getConfigCollections(),
optionTabs: getAreaOptionTabs(),
schemas: new Schemas([
{
group: 'metrics',
group: AggGroupNames.Metrics,
name: 'metric',
title: i18n.translate('kbnVislibVisTypes.area.metricsTitle', { defaultMessage: 'Y-axis' }),
aggFilter: ['!geo_centroid', '!geo_bounds'],
Expand All @@ -157,31 +139,31 @@ export default function PointSeriesVisType(Private) {
]
},
{
group: 'metrics',
group: AggGroupNames.Metrics,
name: 'radius',
title: i18n.translate('kbnVislibVisTypes.area.radiusTitle', { defaultMessage: 'Dot size' }),
min: 0,
max: 1,
aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality']
},
{
group: 'buckets',
group: AggGroupNames.Buckets,
name: 'segment',
title: i18n.translate('kbnVislibVisTypes.area.segmentTitle', { defaultMessage: 'X-axis' }),
min: 0,
max: 1,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter']
},
{
group: 'buckets',
group: AggGroupNames.Buckets,
name: 'group',
title: i18n.translate('kbnVislibVisTypes.area.groupTitle', { defaultMessage: 'Split series' }),
min: 0,
max: 3,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter']
},
{
group: 'buckets',
group: AggGroupNames.Buckets,
name: 'split',
title: i18n.translate('kbnVislibVisTypes.area.splitTitle', { defaultMessage: 'Split chart' }),
min: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ export { SelectOption } from './select';
export { SwitchOption } from './switch';
export { TextInputOption } from './text_input';
export { TruncateLabelsOption } from './truncate_labels';
export { ValidationWrapper, ValidationVisOptionsProps } from './validation_wrapper';
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,39 @@ import React from 'react';
import { EuiFormRow, EuiFieldNumber } from '@elastic/eui';

interface NumberInputOptionProps<ParamName extends string> {
disabled?: boolean;
error?: string[];
isInvalid?: boolean;
label?: React.ReactNode;
max?: number;
min?: number;
step?: string | number;
paramName: ParamName;
step?: number;
value?: number | '';
'data-test-subj'?: string;
setValue: (paramName: ParamName, value: number | '') => void;
}

function NumberInputOption<ParamName extends string>({
disabled,
error,
isInvalid,
label,
max,
min,
paramName,
step,
value = '',
setValue,
'data-test-subj': dataTestSubj,
}: NumberInputOptionProps<ParamName>) {
return (
<EuiFormRow label={label} fullWidth compressed>
<EuiFormRow label={label} error={error} isInvalid={isInvalid} fullWidth compressed>
<EuiFieldNumber
data-test-subj={dataTestSubj}
disabled={disabled}
fullWidth
isInvalid={isInvalid}
step={step}
max={max}
min={min}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React from 'react';
import { EuiFormRow, EuiSelect } from '@elastic/eui';

interface SelectOptionProps<ParamName extends string, ValidParamValues extends string> {
interface SelectOptionProps<ParamName extends string, ValidParamValues extends string | number> {
disabled?: boolean;
helpText?: React.ReactNode;
id?: string;
Expand All @@ -34,7 +34,7 @@ interface SelectOptionProps<ParamName extends string, ValidParamValues extends s

const emptyValue = { text: '', value: 'EMPTY_VALUE', disabled: true, hidden: true };

function SelectOption<ParamName extends string, ValidParamValues extends string>({
function SelectOption<ParamName extends string, ValidParamValues extends string | number>({
disabled,
helpText,
id,
Expand All @@ -57,7 +57,7 @@ function SelectOption<ParamName extends string, ValidParamValues extends string>
<EuiSelect
disabled={disabled}
options={[emptyValue, ...options]}
value={value || emptyValue.value}
value={value === undefined ? emptyValue.value : value}
onChange={ev => setValue(paramName, ev.target.value as ValidParamValues)}
fullWidth={true}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ interface SwitchOptionProps<ParamName extends string> {
tooltip?: string;
disabled?: boolean;
value?: boolean;
noStyle?: boolean;
paramName: ParamName;
setValue: (paramName: ParamName, value: boolean) => void;
}
Expand All @@ -36,12 +37,13 @@ function SwitchOption<ParamName extends string>({
tooltip,
label,
disabled,
noStyle = false,
paramName,
value = false,
setValue,
}: SwitchOptionProps<ParamName>) {
return (
<div className="visEditorSidebar__switchOptionFormRow">
<div className={noStyle ? undefined : 'visEditorSidebar__switchOptionFormRow'}>
<EuiToolTip content={tooltip} delay="long" position="right">
<EuiSwitch
label={label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ interface TextInputOptionProps<ParamName extends string> {
label?: React.ReactNode;
paramName: ParamName;
value?: string;
'data-test-subj'?: string;
setValue: (paramName: ParamName, value: string) => void;
}

function TextInputOption<ParamName extends string>({
'data-test-subj': dataTestSubj,
disabled,
helpText,
label,
Expand All @@ -41,6 +43,7 @@ function TextInputOption<ParamName extends string>({
<EuiFormRow helpText={helpText} label={label} fullWidth compressed>
<EuiFieldText
fullWidth
data-test-subj={dataTestSubj}
disabled={disabled}
value={value}
onChange={ev => setValue(paramName, ev.target.value)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ import { i18n } from '@kbn/i18n';
import { EuiFormRow, EuiFieldNumber } from '@elastic/eui';

interface TruncateLabelsOptionProps {
disabled?: boolean;
value: number | null;
setValue: (paramName: 'truncate', value: null | number) => void;
}

function TruncateLabelsOption({ value, setValue }: TruncateLabelsOptionProps) {
function TruncateLabelsOption({ disabled, value, setValue }: TruncateLabelsOptionProps) {
const onChange = (ev: ChangeEvent<HTMLInputElement>) =>
setValue('truncate', ev.target.value === '' ? null : parseFloat(ev.target.value));

Expand All @@ -35,10 +36,15 @@ function TruncateLabelsOption({ value, setValue }: TruncateLabelsOptionProps) {
label={i18n.translate('kbnVislibVisTypes.controls.truncateLabel', {
defaultMessage: 'Truncate',
})}
fullWidth={true}
fullWidth
compressed
>
<EuiFieldNumber value={value === null ? '' : value} onChange={onChange} fullWidth={true} />
<EuiFieldNumber
disabled={disabled}
value={value === null ? '' : value}
onChange={onChange}
fullWidth
/>
</EuiFormRow>
);
}
Expand Down
Loading