react-google-charts icon indicating copy to clipboard operation
react-google-charts copied to clipboard

[Bug]: Diff tooltips prefix option

Open rodrigorz opened this issue 2 years ago • 0 comments

Would you like to work on a fix?

  • [ ] Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

Currently the old data tooltip is not displaying correctly, se the image below:

image

The '&' character present in the old data tooltip (gray) is from index 1 of the new data tooltip (blue). If the new data tooltip is "LAbel", the old data tooltip will be 'A'.

To reproduce: codesandbox

Add these options to Chart at App.tsx:

      options={{
        diff: {
          oldData: {
            tooltip: {
              prefix: 'OLD',
            },
          },
          newData: {
            tooltip: {
              prefix: 'L&bel 2',
            },
          },
        },
      }}

Reproduction

https://codesandbox.io/s/github/RakanNimer/react-google-charts/tree/master/sandboxes/column-chart/diff?from-embed=&file=/App.tsx:531-787

react-google-charts version

v4.0.0

Possible solution

Check the logic of the old data tooltip to get from the option diff.oldData.tooltip.prefix.

rodrigorz avatar Oct 29 '22 14:10 rodrigorz