如何在动态Highcharts图表的y轴中放置图标? [英] How do I put Icons in the y Axis for a Dynamic Highcharts chart?

查看:58
本文介绍了如何在动态Highcharts图表的y轴中放置图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人有一个动态Highcharts的示例,其中y轴使用图标(例如,笑脸/鬼脸等)而不是字母数字字符吗?

Does anyone have an example for Dynamic Highcharts where the y axis uses icons (smiley/frowney faces for example) instead of alphanumeric characters?

推荐答案

您需要在yAxis标签的格式化程序功能中将useHTML设置为true.请参见下面的代码和

You need to set useHTML true in formatter function of yAxis label.See the code below and working fiddle here

对于动态图像,可以将图像路径作为变量.如果不想显示轴值,请从格式化程序功能中删除"this.value"

for dynamic image, you can put image path as variable. If you don't want to show axis value remove "this.value" from formatter function

yAxis: { labels: {
        formatter: function() {
            return '<img src="http://highcharts.com/demo/gfx/sun.png" alt="" style="vertical-align: middle; width: 32px; height: 32px"/>'+ this.value;
        },
        useHTML: true
    }
    }

这篇关于如何在动态Highcharts图表的y轴中放置图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆