c3js / c3js/c3

Sanitize of Tooltip breaks the ability to style a tootlip or return multiple values

Open
#1,693 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

Adding the sanitize (issue #1536) has taken away the ability to style or do more complex things in the tooltip.

I was using the format value to have both the value and the ratio returned for a pie chart and styled it by returning a html string

``` javascript
tooltip: {
format: {
value: function(value, ratio) {
var percentFormat = d3.format('.1%');
var twoDecimal = d3.format('.2f');
return '

    ' +
    '
  • ' + percentFormat(ratio) + ' ' +
    '
  • ' + twoDecimal(value) + '
  • ' +
    '
      ';
      }
      }
      }
      ```

      now with the sanitize this breaks I am unable return multiple values returned or stylized tooltip values.

      maybe something like node plugin [sanitize-html](https://github.com/punkave/sanitize-html) and whitelist some tags instead of just putting it as a string.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.