highcharts y-axis 标题换行

highcharts y-axis title wrap

我有一个高度根据参数变化的图表,因此当高度小于标题长度时,y-axis 标题在顶部被截断。

http://api.highcharts.com/highcharts/yAxis.title 的 highchart api 指定了一种样式 属性,其中可以给出 CSS 标题样式,但是 javascript wordWrap:'break-word' 在这里不起作用。

我的问题是 - 在这种情况下,是否有任何 属性 可以包装 y-axis 的标题?

注意:我搜索了 SO 并发现了一个问题 - Highcharts Y-axis title text length is more than chart's height,但这并没有回答我的情况,因为我没有静态标题并且不能强制使用
标签换行符。

只需在样式中添加固定宽度和步长:

    title: {
                enabled: true,
                text: 'very long title text here that will get cut off at the top when height becomes less than the length of the title',
                style: { 
                    font: 'bold 10pt "Arial Narrow"',                       
                    color: 'rgb(0,0,0)',
                    wordWrap:'break-word',
      // Add these        
                    width : "200px"
                }
            }

你的Fiddle updated here