【问题标题】:special characters in title of charts of Charts JsCharts Js图表标题中的特殊字符
【发布时间】:2021-05-13 12:44:39
【问题描述】:

我正在使用Charts.js 来显示条形图和气泡图。 但是,我对这些图表的标题包含“&”,但它显示为 & 我怎样才能避免这种情况,以便在图表的标签和标题中显示“&”。 以下是我的代码:

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

【问题讨论】:

标签: ruby-on-rails highcharts ruby-on-rails-5 chart.js


【解决方案1】:

更换

&lt;%= group.first&amp;.name %&gt;

&lt;%= group.first&amp;.name&amp;.html_safe %&gt;

在标题的文本中为我解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-22
    • 1970-01-01
    • 2015-06-13
    • 2016-05-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多