2

我有一个基于参数的高度不同的图表,因此当高度小于标题长度时,y 轴标题在顶部被切断。

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

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

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

4

1 回答 1

3

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

    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"
                }
            }

你的小提琴在这里更新

于 2016-11-16T07:49:47.503 回答