highcharts - Highchart - 使用 html 为标签自定义图像
问题描述
我有一个 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小提琴
谁能帮我这个?
解决方案
推荐阅读
- python - 在scrapy中以异步方法发出内联请求时无法使用`headers`或`dont_filter = True`
- awk - 如何使用awk对csv文件中的记录进行排序
- android - 如何在 Chromebook 上的 Android 应用程序的窗口边框上隐藏后退按钮
- css - Sweetalert 2中的输入在材料UI模式反应js中不可输入
- django - 如何使用通用 ListCreateAPIView 在嵌套序列化程序中更新用户及其配置文件?
- javascript - 如何从 dxf 文件解析 nurbs 表面?或者您知道用于解析它的库(对于 js,如果存在或任何其他语言)?
- android-espresso - 用于单击父节点或下一个节点的 Espresso 或 UIAutomation 解决方案
- python - Django User.date_joined.date 使用 UTC 时间?
- python - Python Selenium 并行验证两个元素并单击一个
- android - 如何解决此错误:无法在 Android Studio 中开始监控 emulator-5554