highcharts 如何在甘特中更改字体和文本颜色,边框颜色?

m4pnthwp  于 2023-06-23  发布在  Highcharts
关注(0)|答案(1)|浏览(251)

我想改变字体家族,字体大小,字体颜色,使我的整个图表应该有相同的字体和颜色。我知道使用样式api我可以做到这一点,但它只在某些地方改变Here i want blue border everywhere but I see option to set border color for xAxis, YAxis, and chart ](https://i.stack.imgur.com/llOp9.png
但情况不妙。有没有办法我可以设置边框颜色,字体大小,字体家族,字体颜色所有这些CSS样式,使整个图表看起来统一给我。

[Code Pen](https://codepen.io/manshi44/pen/OJaXOOr)

尝试了API https://api.highcharts.com/highstock/chart.style和其他一些更改样式

pinkon5k

pinkon5k1#

要更改字体,只需设置chart.style.fontFamily属性:

chart: {
  style: {
    fontFamily: 'Fasthand'
  }
}

至于文本颜色,您可以为每个元素设置样式,您可以为title,axis labelscredits和所有其他元素设置样式:

title: {
  style: {
    color: 'red'
  }
}

您需要记住的边框颜色关于所有轴的gridticklines,默认情况下gant中有2个x轴,月份分开,年份分开:

xAxis: [{
  gridLineColor: 'blue',
  tickColor: 'blue',
  lineColor: 'blue'
}, {
  labels: {
    style: {
      color: 'red'
    }
  },
  tickColor: 'blue',
  lineColor: 'blue'
}]

Demohttps://jsfiddle.net/BlackLabel/5Lj6xbo8/
APIhttps://api.highcharts.com/highstock/chart.style

https://api.highcharts.com/highcharts/xAxis.labels.style.color
https://api.highcharts.com/highcharts/title.style.color
https://api.highcharts.com/highcharts/credits.style.color

相关问题