在Highcharts中向下钻取时更改标题
Change title when drilldown in Highcharts
我正在寻找一种在Highcharts中显示信息文本的方法。我想要一个文本,告诉我的访问者,另一个图表已经显示。例如标题:"新图表-更多关于动物"
http://jsfiddle.net/6zYmJ/你知道怎么做吗?
$(function () {
// Create the chart
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Basic drilldown'
},
xAxis: {
type: 'category'
},
legend: {
enabled: false
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true,
}
}
},
series: [{
name: 'Things',
colorByPoint: true,
data: [{
name: 'Animals',
y: 5,
drilldown: 'animals'
}, {
name: 'Fruits',
y: 2,
drilldown: 'fruits'
}, {
name: 'Cars',
y: 4,
drilldown: 'cars'
}]
}, {
name: 'Things',
colorByPoint: true,
data: [{
name: 'Animals2',
y: 5,
drilldown: 'animals2'
}, {
name: 'Fruits2',
y: 2,
drilldown: 'fruits2'
}, {
name: 'Cars2',
y: 4,
drilldown: 'cars2'
}]
}],
drilldown: {
series: [{
id: 'animals',
data: [
['Cats', 4],
['Dogs', 2],
['Cows', 1],
['Sheep', 2],
['Pigs', 1]
]
}, {
id: 'fruits',
data: [
['Apples', 4],
['Oranges', 2]
]
}, {
id: 'cars',
data: [
['Toyota', 4],
['Opel', 2],
['Volkswagen', 2]
]
},{
id: 'animals2',
data: [
['Cats', 4],
['Dogs', 2],
['Cows', 1],
['Sheep', 2],
['Pigs', 1]
]
}, {
id: 'fruits2',
data: [
['Apples', 4],
['Oranges', 2]
]
}, {
id: 'cars2',
data: [
['Toyota', 4],
['Opel', 2],
['Volkswagen', 2]
]
}]
}
})
});
例如使用drilldown
和drillup
事件(API),一对变量和Chart.setTitle
(API)。这样的:
var defaultTitle = "Basic drilldown";
var drilldownTitle = "More about ";
var chart = new Highcharts.Chart({
chart: {
type: 'column',
renderTo: 'container',
events: {
drilldown: function(e) {
chart.setTitle({ text: drilldownTitle + e.point.name });
},
drillup: function(e) {
chart.setTitle({ text: defaultTitle });
}
}
},
title: {
text: defaultTitle
},
// ... more options
});
相关文章:
- 带有向下钻取的 Amchart 图表工作正常,但“后退”按钮不起作用
- 如何通过向下钻取制作高图表箱形图
- 使用 json 的 Highcharts 动态钻取
- Highcharts甜甜圈工具提示格式使用钻取数据
- 章节文本标签没有't显示在D3.JS向下钻取饼图中
- Highchart向下钻取到同时存在的多个系列和y轴
- 动态钻取嵌套的对象数组
- 高位图向下钻取不起作用
- 具有向下钻取的 Highcharts 列会导致主图表中的数据标签模糊,但向下钻取的列除外
- 数据表 - 忽略使用 colspan 向下钻取的行
- 带有“日期时间”x轴的图表 - 在向下钻取时使用类别
- 钻取$scope以获取复杂的自动完成DOM中的特定元素
- 突出显示:在向下钻取之前获取事件
- amCharts多级向下钻取
- 高图钻取问题
- 在 hplot R 的饼图中向下钻取
- 高图表 将向下钻取(三层)重置为初始状态
- 在 URL 中传递特殊字符以钻取 SSRS
- Highcharts向下钻取调整向下钻取/向上钻取时Y轴的大小
- 在Highcharts中向下钻取时更改标题