diff --git a/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/data_config_panel_item.tsx b/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/data_config_panel_item.tsx index 87d6802d0..1de41c912 100644 --- a/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/data_config_panel_item.tsx +++ b/dashboards-observability/public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/data_config_panel_item.tsx @@ -156,14 +156,17 @@ export const DataConfigPanelItem = ({ fieldOptionList, visualizations }: any) => }; const isPositionButtonVisible = (sectionName: string) => - sectionName === 'metrics' && visualizations.vis.name === visChartTypes.Line; + sectionName === 'metrics' && + (visualizations.vis.name === visChartTypes.Line || + visualizations.vis.name === visChartTypes.Scatter); const getOptionsAvailable = (sectionName: string) => { const selectedFields = {}; const unselectedFields = fieldOptionList.filter((field) => !selectedFields[field.label]); return sectionName === 'metrics' ? unselectedFields - : visualizations.vis.name === visChartTypes.Line + : visualizations.vis.name === visChartTypes.Line || + visualizations.vis.name === visChartTypes.Scatter ? unselectedFields.filter((i) => i.type === 'timestamp') : unselectedFields; }; @@ -285,7 +288,9 @@ export const DataConfigPanelItem = ({ fieldOptionList, visualizations }: any) => color="primary" onClick={() => handleServiceAdd(sectionName)} disabled={ - sectionName === 'dimensions' && visualizations.vis.name === visChartTypes.Line + sectionName === 'dimensions' && + (visualizations.vis.name === visChartTypes.Line || + visualizations.vis.name === visChartTypes.Scatter) } > Add diff --git a/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/gauge.test.tsx.snap b/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/gauge.test.tsx.snap index ad8e359f1..742cbbc53 100644 --- a/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/gauge.test.tsx.snap +++ b/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/gauge.test.tsx.snap @@ -384,139 +384,82 @@ exports[`Gauge component Renders gauge component 1`] = ` } } > - -
- - + className="euiText euiText--extraSmall lnsChart__empty" + data-test-subj="vizWorkspace__noData" + > + +
+ +
+ + + + + + +
+ +

+ + + No results found + + +

+
+ +
+ +
+ + `; diff --git a/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/pie.test.tsx.snap b/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/pie.test.tsx.snap index e36bda4ca..ec6cad064 100644 --- a/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/pie.test.tsx.snap +++ b/dashboards-observability/public/components/visualizations/charts/__tests__/__snapshots__/pie.test.tsx.snap @@ -553,177 +553,82 @@ exports[`Pie component Renders pie component 1`] = ` } } > - -
- - + className="euiText euiText--extraSmall lnsChart__empty" + data-test-subj="vizWorkspace__noData" + > + +
+ +
+ + + + + + +
+ +

+ + + No results found + + +

+
+ +
+ +
+ + `; diff --git a/dashboards-observability/public/components/visualizations/charts/lines/line.tsx b/dashboards-observability/public/components/visualizations/charts/lines/line.tsx index c5d55ffef..7234d4430 100644 --- a/dashboards-observability/public/components/visualizations/charts/lines/line.tsx +++ b/dashboards-observability/public/components/visualizations/charts/lines/line.tsx @@ -77,18 +77,14 @@ export const Line = ({ visualizations, layout, config }: any) => { dataConfig.colorTheme.find((colorSelected) => colorSelected.name.name === field.name) ?.color) || PLOTLY_COLOR[index % PLOTLY_COLOR.length]; - /** - * determine x axis - */ - const xaxis = useMemo(() => { - // span selection - const timestampField = find(fields, (field) => field.type === 'timestamp'); - if (dataConfig.span && dataConfig.span.time_field && timestampField) { - return [timestampField, ...dataConfig.dimensions]; - } + let xaxis; + const timestampField = find(fields, (field) => field.type === 'timestamp'); - return dataConfig.dimensions; - }, [dataConfig.dimensions]); + if (dataConfig.span && dataConfig.span.time_field && timestampField) { + xaxis = [timestampField, ...dataConfig.dimensions]; + } else { + xaxis = dataConfig.dimensions; + } if (isEmpty(xaxis) || isEmpty(yaxis)) return ;