如何在 highchart 的标签中使用 line-height 属性

how to use line-height property in highchart's labels

尝试在 highchart 的标签选项中的行之间给出 space。

但不能用 css 属性 做任何事情,比如 line-height ,如果你们知道任何与此等同的东西,请告诉我...

labels:{
  items:[{
        html:"This is first lineof the  label<br>this second line of the 
              label<br>this is third line of the label",
        style:{
                 top:5,
                 left:30
              }
          },{
        html:"This is first lineof the  second label<br>this second line of 
           the second label<br>this is third line of the label",
        style:{
            top:5,
            left:250
         }
     }]

},   

这是我的 fiddle

您可以在 style 中设置 line-height,如下所示:

Highcharts.chart('container', {
  labels: {
    items: [{
      html: "This is first lineof the  label<br>this second line of the label<br>this is third line of the label",
      style: {
        top: 5,
        left: 30,
        lineHeight: '30px' // set style here
      }
    }, {
      html: "This is first lineof the  second label<br>this second line of the second label<br>this is third line of the label",
      style: {
        top: 5,
        left: 250,
        lineHeight: '30px' // set style here
      }
    }]
  },
  plotOptions: {
    series: {
      label: {
        connectorAllowed: false
      },
      pointStart: 2010
    }
  },
  legend: {
    enabled: false
  },
  credits: {
    enabled: false
  },
  series: [{
    name: 'Installation',
    data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
  }]
});
#container {
  min-width: 310px;
  max-width: 800px;
  height: 400px;
  margin: 0 auto
}

#container text tspan {
  line-height: 12px;
}
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>

<div id="container"></div>