目标
我正在使用Highcharts Heatmap来显示必须有两个YAxis显示的数据(左侧和右侧)。两者都属于"类别"类型(也就是说由字符串驱动,而不是数值)。
问题
当定义多个Y轴时,仅显示第一个的标签。
守则
Here is a fiddle with my code。我特别提请你注意这些方面:
yAxis: [{
categories: ["For instance, on the planet Earth, man had always assumed that he was more intelligent than dolphins because he had achieved so much—the wheel, New York, wars and so on—whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man—for precisely the same reasons",
'The man who invented the Total Perspective Vortex did so basically in order to annoy his wife.',
'The major problem - one of the major problems, for there are several - one of the many major problems with governing people is that of whom you get to do it; or rather of who manages to get people to let them do it to them.',
'My doctor says that I have a malformed public-duty gland and a natural deficiency in moral fibre',
'He felt uncertain as to whether the fourth drink had understood all that, so he sent down a fifth to explain the plan more fully and a sixth for moral support.'],
title: null,
gridLineWidth: 0,
labels: {
style: {
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
float: 'left'
}
}
},{
categories: ["1/7", "2/7", "3/7", "4/7", "5/7"],
title: null,
opposite: true,
// Note: The following two lines appear to be unnecessary
type: 'category',
visible: true
}],
观察到第一个yAxis列沿图表左侧正确显示。另请注意,没有第二个yAxis的可视化表示(设置为显示在图形的右侧,在图和图例之间)。
有趣的是,如果我对两个Y轴进行重新排序,则会出现右侧的类别,左侧的类别会消失。另外有趣;如果轴被赋予标题(title: null
被删除或更改),标题将显示在正确的位置。
文档
代码似乎与the official examples for dual Y axes完全一致。即使复制该示例代码也会导致同样的失败。我知道HeatMap图表类型不一定是核心库的一部分,但我没有发现这个不应该与Heatmap一起使用。
结论
任何可以帮助Y轴标签显示在图表两侧的帮助都将非常感激。提前谢谢。
答案 0 :(得分:1)
您可以使用linkedTo参数。
yAxis: [{
type: 'category',
categories: ["For instance, on the planet Earth, man had always assumed that he was more intelligent than dolphins because he had achieved so much—the wheel, New York, wars and so on—whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man—for precisely the same reasons", 'The man who invented the Total Perspective Vortex did so basically in order to annoy his wife.', 'The major problem - one of the major problems, for there are several - one of the many major problems with governing people is that of whom you get to do it; or rather of who manages to get people to let them do it to them.', 'My doctor says that I have a malformed public-duty gland and a natural deficiency in moral fibre', 'He felt uncertain as to whether the fourth drink had understood all that, so he sent down a fifth to explain the plan more fully and a sixth for moral support.'],
title: null,
gridLineWidth: 0,
labels: {
style: {
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
float: 'left'
}
}
},{
linkedTo: 0,
categories: ["1/7", "2/7", "3/7", "4/7", "5/7"],
title: null,
opposite: true,
// Note: The following two lines appear to be unnecessary
type: 'category',
visible: true
}],
示例: