Highcharts的Stacked percentage图表如何隐藏图例

q2104574 2011-11-30 11:37:57

如何去掉下面的那个 单击 隐藏



http://www.highcharts.com/demo/column-drilldown

。。我已经改成这样了,还要修改哪里
var chart;
$(document).ready(function () {
var colors = Highcharts.getOptions().colors,
categories = ['成功', '失败'],

data = [{
y: 55.11,
color: colors[0]
}, {
y: 11.94,
color: colors[2]
}];


chart = new Highcharts.Chart({
chart: {
renderTo: 'cc',
type: 'column'
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: {
categories: categories
},
yAxis: {
title: {
text: ''
}
},
plotOptions: {
column: {
cursor: 'pointer',

dataLabels: {
enabled: true,
color: colors[0],
style: {
fontWeight: 'bold'
},
formatter: function () {
return this.y + '(个)';
}
}
}
},
tooltip: {
formatter: function () {
var point = this.point,
s = '运行' + this.x + '的有' + ':<b>' + this.y + '个</b><br/>';
return s;
}
},
series: [{
name: '', //这边。一旦name=空或者null 会自动加上一个series1.,,series整个去掉的话,图又显示不出来。
data: data,
color: 'red'
}],
exporting: {
enabled: false
}
});
});
...全文
466 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
q2104574 2011-11-30
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 zswang 的回复:]

查api文档可以找到相关信息:
http://www.highcharts.com/ref/
[/Quote]

谢谢了。。。初次接触这个。- -

文档都是英文的。我晕啊。。怎么查看我所需的。。比如 你上面那个怎么找的showInLegend
王集鹄 2011-11-30
  • 打赏
  • 举报
回复
查api文档可以找到相关信息:
http://www.highcharts.com/ref/
王集鹄 2011-11-30
  • 打赏
  • 举报
回复
关键位置:
plotOptions: {
//.....
series: {
showInLegend: false
}
},
王集鹄 2011-11-30
  • 打赏
  • 举报
回复
测试例子:http://jsfiddle.net/9uMzq/

参考如下代码:
var chart;
$(document).ready(function () {
var colors = Highcharts.getOptions().colors,
categories = ['成功', '失败'],

data = [{
y: 55.11,
color: colors[0]
}, {
y: 11.94,
color: colors[2]
}];


chart = new Highcharts.Chart({
chart: {
renderTo: 'cc',
type: 'column'
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: {
categories: categories
},
yAxis: {
title: {
text: ''
}
},
plotOptions: {
column: {
cursor: 'pointer',

dataLabels: {
enabled: true,
color: colors[0],
style: {
fontWeight: 'bold'
},
formatter: function () {
return this.y + '(个)';
}
}
},
series: {
showInLegend: false
}
},
tooltip: {
formatter: function () {
var point = this.point,
s = '运行' + this.x + '的有' + ':<b>' + this.y + '个</b><br/>';
return s;
}
},

ignoreHiddenSeries: true,
series: [{
name: '',
//这边。一旦name=空或者null 会自动加上一个series1.,,series整个去掉的话,图又显示不出来。
data: data,
color: 'red'
}],
exporting: {
enabled: false
}
});
});

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧