Highcharts 集合饼图侦听器不工作
我创建了一个油炸圈饼图,但由于一些奇怪的原因,我无法让听众处理它。我尝试在系列和外部添加侦听器,但无法实现Highcharts 集合饼图侦听器不工作,highcharts,rally,Highcharts,Rally,我创建了一个油炸圈饼图,但由于一些奇怪的原因,我无法让听众处理它。我尝试在系列和外部添加侦听器,但无法实现 chartConfig: { chart: { type: 'pie', /*events: { click: function(event) {
chartConfig: {
chart: {
type: 'pie',
/*events: {
click: function(event) {
console.dir("Clicked");
}
}*/ /*THis works but it generates events only on click of the text on the pie charts*/
},
title: {
text: 'Defects per Release Status '
},
yAxis: {
title: {
text: 'Total Defects per project'
}
},
plotOptions: {
pie: {
shadow: false,
center: ['50%', '50%']
}
},
tooltip: {
valueSuffix: '%'
},
series: [{
name: 'Teams',
data: teamData,
size: '60%',
dataLabels: {
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
color: 'white',
distance: -40
}
}, {
name: 'Defects',
data: defectData,
size: '80%',
innerSize: '60%',
dataLabels: {
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
}
}
}]
},
listeners: {
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function(){ console.log('click el'); }
},
dblclick: {
element: 'body', //bind to the underlying body property on the panel
fn: function(){ console.log('dblclick body'); }
}
}
});
有人能告诉我我在这里遗漏了什么吗
下面是代码snipet
chartConfig: {
chart: {
type: 'pie',
/*events: {
click: function(event) {
console.dir("Clicked");
}
}*/ /*THis works but it generates events only on click of the text on the pie charts*/
},
title: {
text: 'Defects per Release Status '
},
yAxis: {
title: {
text: 'Total Defects per project'
}
},
plotOptions: {
pie: {
shadow: false,
center: ['50%', '50%']
}
},
tooltip: {
valueSuffix: '%'
},
series: [{
name: 'Teams',
data: teamData,
size: '60%',
dataLabels: {
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
color: 'white',
distance: -40
}
}, {
name: 'Defects',
data: defectData,
size: '80%',
innerSize: '60%',
dataLabels: {
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
}
}
}]
},
listeners: {
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function(){ console.log('click el'); }
},
dblclick: {
element: 'body', //bind to the underlying body property on the panel
fn: function(){ console.log('dblclick body'); }
}
}
});
var chart=Ext.create('Rally.ui.chart.chart',{
chartConfig: {
chart: {
type: 'pie',
/*events: {
click: function(event) {
console.dir("Clicked");
}
}*/ /*THis works but it generates events only on click of the text on the pie charts*/
},
title: {
text: 'Defects per Release Status '
},
yAxis: {
title: {
text: 'Total Defects per project'
}
},
plotOptions: {
pie: {
shadow: false,
center: ['50%', '50%']
}
},
tooltip: {
valueSuffix: '%'
},
series: [{
name: 'Teams',
data: teamData,
size: '60%',
dataLabels: {
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
color: 'white',
distance: -40
}
}, {
name: 'Defects',
data: defectData,
size: '80%',
innerSize: '60%',
dataLabels: {
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
}
}
}]
},
listeners: {
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function(){ console.log('click el'); }
},
dblclick: {
element: 'body', //bind to the underlying body property on the panel
fn: function(){ console.log('dblclick body'); }
}
}
});
chartConfig:{
图表:{
键入“pie”,
/*活动:{
单击:功能(事件){
console.dir(“单击”);
}
}*//*这可以工作,但它仅在单击饼图上的文本时生成事件*/
},
标题:{
文本:“每个发布状态的缺陷”
},
亚克斯:{
标题:{
文本:“每个项目的总缺陷”
}
},
打印选项:{
馅饼:{
影子:错,
中心:['50%,'50%']
}
},
工具提示:{
值后缀:''
},
系列:[{
名称:'团队',
数据:teamData,
大小:“60%”,
数据标签:{
格式化程序:函数(){
返回此.y>5?this.point.name:空;
},
颜色:'白色',
距离:-40
}
}, {
名称:“缺陷”,
数据:数据,
大小:“80%”,
内部尺寸:“60%”,
数据标签:{
格式化程序:函数(){
//仅当大于1时显示
返回this.y>1?''+this.point.name+':'+this.y+'%':null;
}
}
}]
},
听众:{
点击:{
元素:“el”,//绑定到面板上的基础el属性
fn:function(){console.log('click el');}
},
dblclick:{
元素:“body”,//绑定到面板上的基础body属性
fn:function(){console.log('dblclick body');}
}
}
});
将单击事件添加到chartConfig.plotOptions(如下所示)应该可以工作。您可以在中看到Rally TestCaseResults by Verdict饼图的完整示例
chartConfig: {
chart: {
type: 'pie',
/*events: {
click: function(event) {
console.dir("Clicked");
}
}*/ /*THis works but it generates events only on click of the text on the pie charts*/
},
title: {
text: 'Defects per Release Status '
},
yAxis: {
title: {
text: 'Total Defects per project'
}
},
plotOptions: {
pie: {
shadow: false,
center: ['50%', '50%']
}
},
tooltip: {
valueSuffix: '%'
},
series: [{
name: 'Teams',
data: teamData,
size: '60%',
dataLabels: {
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
color: 'white',
distance: -40
}
}, {
name: 'Defects',
data: defectData,
size: '80%',
innerSize: '60%',
dataLabels: {
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
}
}
}]
},
listeners: {
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function(){ console.log('click el'); }
},
dblclick: {
element: 'body', //bind to the underlying body property on the panel
fn: function(){ console.log('dblclick body'); }
}
}
});
你能试着在JSFIDLE中重现同样的东西吗?这实际上会帮助我们理解出什么地方出了问题。我当然可以尝试,但是我觉得这可能与Rally解释的方式有关,而不是与highCharts有关,因为这是一个Rally自定义应用程序。感谢我取得了一些进展。我将继续进一步发展