… possible (#197453) (#199069)
# Backport
This will backport the following commits from `main` to `8.x`:
- [[ES|QL] [Discover] Keeps the preferred chart configuration when
possible (#197453)](#197453)
<!--- Backport version: 9.4.3 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)
<!--BACKPORT [{"author":{"name":"Stratoula
Kalafateli","email":"efstratia.kalafateli@elastic.co"},"sourceCommit":{"committedDate":"2024-11-05T22:56:17Z","message":"[ES|QL]
[Discover] Keeps the preferred chart configuration when possible
(#197453)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/184631\r\n\r\nIt keeps the
chart configuration when the user is doing actions\r\ncompatible with
the current query such as:\r\n\r\n- Adding a where filter (by clicking
the table, the sidebar, the chart)\r\n- Changes the breakdown field and
the field type is compatible with the\r\ncurrent chart\r\n- Changing to
a compatible chart type (from example from bar to line or\r\npie to
treemap)\r\n- Changing the query that doesnt affect the generated
columns mapped to\r\na chart. For example adding a limit or creating a
runtime field etc.\r\n\r\nThe logic depends on the suggestions. If the
suggestions return the\r\npreferred chart type, then we are going to use
this. So it really\r\ndepends on the api and the type / number of
columns. It is as smarter as\r\nit can in order to not create bugs. I am
quite happy with the result. It\r\nis much better than what we have so
far.\r\n\r\n\r\n\r\n\r\n###
Next steps\r\nI would love to do the same on the dahsboard too, needs
more time\r\nthough. But the changes made here will def work in
favor\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Marta Bondyra
<4283304+mbondyra@users.noreply.github.com>","sha":"ccbcab9623af4df0bdccb0e3e194b8484d2161a1","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","enhancement","v9.0.0","release_note:feature","Team:Obs
AI
Assistant","Feature:ES|QL","ci:project-deploy-observability","backport:version","v8.17.0"],"title":"[ES|QL]
[Discover] Keeps the preferred chart configuration when
possible","number":197453,"url":"https://github.com/elastic/kibana/pull/197453","mergeCommit":{"message":"[ES|QL]
[Discover] Keeps the preferred chart configuration when possible
(#197453)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/184631\r\n\r\nIt keeps the
chart configuration when the user is doing actions\r\ncompatible with
the current query such as:\r\n\r\n- Adding a where filter (by clicking
the table, the sidebar, the chart)\r\n- Changes the breakdown field and
the field type is compatible with the\r\ncurrent chart\r\n- Changing to
a compatible chart type (from example from bar to line or\r\npie to
treemap)\r\n- Changing the query that doesnt affect the generated
columns mapped to\r\na chart. For example adding a limit or creating a
runtime field etc.\r\n\r\nThe logic depends on the suggestions. If the
suggestions return the\r\npreferred chart type, then we are going to use
this. So it really\r\ndepends on the api and the type / number of
columns. It is as smarter as\r\nit can in order to not create bugs. I am
quite happy with the result. It\r\nis much better than what we have so
far.\r\n\r\n\r\n\r\n\r\n###
Next steps\r\nI would love to do the same on the dahsboard too, needs
more time\r\nthough. But the changes made here will def work in
favor\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Marta Bondyra
<4283304+mbondyra@users.noreply.github.com>","sha":"ccbcab9623af4df0bdccb0e3e194b8484d2161a1"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197453","number":197453,"mergeCommit":{"message":"[ES|QL]
[Discover] Keeps the preferred chart configuration when possible
(#197453)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/184631\r\n\r\nIt keeps the
chart configuration when the user is doing actions\r\ncompatible with
the current query such as:\r\n\r\n- Adding a where filter (by clicking
the table, the sidebar, the chart)\r\n- Changes the breakdown field and
the field type is compatible with the\r\ncurrent chart\r\n- Changing to
a compatible chart type (from example from bar to line or\r\npie to
treemap)\r\n- Changing the query that doesnt affect the generated
columns mapped to\r\na chart. For example adding a limit or creating a
runtime field etc.\r\n\r\nThe logic depends on the suggestions. If the
suggestions return the\r\npreferred chart type, then we are going to use
this. So it really\r\ndepends on the api and the type / number of
columns. It is as smarter as\r\nit can in order to not create bugs. I am
quite happy with the result. It\r\nis much better than what we have so
far.\r\n\r\n\r\n\r\n\r\n###
Next steps\r\nI would love to do the same on the dahsboard too, needs
more time\r\nthough. But the changes made here will def work in
favor\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Marta Bondyra
<4283304+mbondyra@users.noreply.github.com>","sha":"ccbcab9623af4df0bdccb0e3e194b8484d2161a1"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Summary
Closes #184631
It keeps the chart configuration when the user is doing actions compatible with the current query such as:
The logic depends on the suggestions. If the suggestions return the preferred chart type, then we are going to use this. So it really depends on the api and the type / number of columns. It is as smarter as it can in order to not create bugs. I am quite happy with the result. It is much better than what we have so far.
Next steps
I would love to do the same on the dahsboard too, needs more time though. But the changes made here will def work in favor
Checklist