0

I am using Charts.js to display bar graphs and bubble charts. However, my titles for these graphs contain '&' but it is shown as & How can I avoid this so that '&' is displayed as it is in the labels and titles of charts. Below is my code:

window.myBar = new Chart(ctx, {
        type: 'bubble',
        data: {
            datasets: data_sets
        },
        options: {
            legend: {
                position: 'bottom',
            },
            title: {
                display: true,
                fontSize: 20,
                text: '<%= group.first&.name%>'
            }
        }
    });
Saqib Shahzad
  • 982
  • 12
  • 28

1 Answers1

1

Replacing

<%= group.first&.name %>

with

<%= group.first&.name&.html_safe %>

in the text of the title fixed the issue for me.

Saqib Shahzad
  • 982
  • 12
  • 28