Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Data Frame Analytics: Fix field name escaping for Vega based sca…
…tterplot matrix. (#193386) ## Summary Field names with `\n` would fail to render the DFA scatterplot matrix: <img width="804" alt="image" src="https://github.com/user-attachments/assets/26e356b8-236d-4255-b556-2ebc2e5db4fc"> This fixes the escaping and adds unit tests. The fix isn't 100% ideal because there are cases when we may end up with an additional backslash being rendered for labels of the scatterplot. However, all other variations I tried caused rendering problems of the charts and rendering would fail completely. For example, just escaping `\n` without the general backslash escaping causes the following Vega error: `Duplicate scale or projection name: "child__row_my_numbercolumn_my_number_x"` On the other hand escaping just the backslash without the additional `\n` escaping causes an "expression parse error" in in Vega and the chart wouldn't render. Note this PR just focuses on escaping for the Vega spec for the scatterplot matrix. There are still other places in the UI (data grid headers, fields selector). <img width="792" alt="image" src="https://github.com/user-attachments/assets/35532741-7a13-4707-b8da-c72dcc8c935b"> ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- Loading branch information