【问题标题】:Highchart - Custom Images for Labels by using htmlHighchart - 使用 html 自定义标签图像
【发布时间】:2018-09-21 17:18:14
【问题描述】:

我有一个 highchart 条形图,并尝试在每个条形图中显示一些自定义图像作为标签。我通过像这样配置 plotOptions 来尝试它:

plotOptions: {
        column: {
            grouping: false,
            borderWidth: 0,
            groupPadding: 0,
            dataLabels: {
                enabled: true,
                useHtml: true,
                formatter: function () {
                    var score = '<img src="../Images/Icon_VPP_5Punkte" alt="5 Punkte" >';
                    if (this.color === "#e30613") score = '<img src="../Images/Icon_VPP_1Punkt" alt="1 Punkt">Test';
                    if (this.color === "#ed8c05") score = '<img src="../Images/Icon_VPP_3Punkte" alt="3 Punkte" >';
                    console.log(score);
                    return score;
                },
                inside: 'center',
                color: 'black',
                shadow: false,
                style: {
                    textOutline: "0px contrast"
                }
            }
        }

    }

如您所见,我将 useHtml 设置为“true”,并设置了一些自定义格式化程序功能,如在此处推荐: Highchart Doc

但不会显示任何图像。 JS Fiddle

谁能帮我解决这个问题?

【问题讨论】:

    标签: highcharts label


    【解决方案1】:

    您的代码中有“useHtml”而不是“useHTML”;)

    useHTML: true,
    

    JS Fiddle

    【讨论】:

    • 天哪**!对不起。我已经搜索了几个小时,只是为了检查一个错字。感谢您的帮助
    猜你喜欢
    • 2017-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多