Home > Software engineering >  How to add font awesome icons on x-axis in highcharts
How to add font awesome icons on x-axis in highcharts

Time:02-25

I have created multiple charts for dynamic data . I want to add font awesome icons on x-axis instead of displaying names. Please help on how can I add icon on x-axis instead of category, thank you.

CodePudding user response:

You need to enable useHTML for the xAxis labels.

xAxis: {
    type:"category",
    crosshair: true,
    labels: {
        useHTML: true
    }
  },

and then you can use fontAwesome icons in the category names or replace the category names by icons.

  data: [
    ['<i ></i>  car', 10],
    ['<i ></i>  bus', 63],
    ['<i ></i>  truck', 50],
    ['<i ></i>  train', 54],
  ]

https://jsfiddle.net/r7b0123s/1/

  • Related