soujasK opened a new pull request, #21809:
URL: https://github.com/apache/echarts/pull/21809

   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   ### What does this PR do?
   
   Applies the fix from #21751 to the other string formatter templates 
(`{value}`, `{name}`, `{a}`), so names and values containing `$$`, `$&`, `` $` 
`` or `$'` are shown as they are.
   
   ### Fixed issues
   
   None reported. Follow-up to #21751 and #21787, which fixed the same problem 
in `formatTpl` and the aria labels.
   
   ## Details
   
   ### Before: What was the problem?
   
   Several components fill a string formatter with 
`formatter.replace('{value}', text)`. When the replacement is a string, 
`String.prototype.replace` interprets `$` sequences in it, so the inserted name 
or value is changed:
   
   - `xAxis: { type: 'category', data: ['$$'], axisLabel: { formatter: 
'<{value}>' } }` shows `<$>`; a category `$&` shows `<{value}>`.
   - `legend.formatter: '[{name}]'` with a series named `US$$` shows `[US$]`.
   - The same applies to `radar.axisName.formatter`, `visualMap.formatter` 
(piecewise categories), `dataZoom.labelFormatter`, the axis pointer label 
`formatter` and `geo.label.formatter`.
   
   Price tiers (`$`, `$$`, `$$$`) as axis categories or series names are a 
realistic example.
   
   ### After: How does it behave after the fixing?
   
   These calls pass a function as the replacement, as #21751 did in 
`formatTpl`, so the inserted text is used literally. Formatters that only 
insert numbers (gauge, boxplot item names, the scrollable legend page counter) 
are unchanged.
   
   `test/ut/spec/component/formatterLiteralDollar.test.ts` checks the axis 
label, legend, radar indicator name and visualMap category text with each of 
the four sequences: all 16 cases fail on `release` and pass with this change. 
The full unit test suite (242 tests), `npx tsc --noEmit` and eslint on the 
changed files pass.
   
   ## Document Info
   
   One of the following should be checked.
   
   - [x] This PR doesn't relate to document changes
   - [ ] The document should be updated later
   - [ ] The document changes have been made in apache/echarts-doc#xxx
   
   ## Misc
   
   ### Security Checking
   
   - [ ] This PR uses security-sensitive Web APIs.
   
   ### ZRender Changes
   
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   N.A.
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merging.
   
   ### Other information
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to