0
NVD3를 사용하고 있지만 클릭 할 때 발생하는 이벤트를 일부 추가하기로 결정했습니다. 가로 막대 차트를 사용하는 예를 발견했습니다.NVD3 차트에서 콜백을 사용하는 방법
vm.qcoptions = {
chart: {
type: 'multiBarHorizontalChart',
//type: 'discreteBarChart',
height: 450,
margin: {
top: 20,
right: 20,
bottom: 50,
left: 55
},
x: function (d) { return d.label; },
y: function (d) { return d.value + (1e-10); },
showValues: true,
valueFormat: function (d) {
return d3.format(',.4f')(d);
},
duration: 500,
xAxis: {
axisLabel: ''
},
yAxis: {
axisLabel: '',
axisLabelDistance: -10
},
callback: function (chart) {
chart.multibar.dispatch.on('elementClick', function (e) {
console.log('elementClick in callback', e.data);
});
}
}
};
이 라인에서 multiBarHorizonatChart를 사용하여,하지만 난 discreteBarChart로 전환 할 때이 오류가 발생하면 "정의되지 않은 재산 '파견'을 읽을 수 없습니다"작품 위의 예는
chart.multibar.dispatch.on('elementClick', function (e) {
나는 시도 차트를 검사하고 가로 막 대형 차트에 대해 chart.multibar 대신에 내가 무엇을 넣어야 할지를 결정할 수 있지만 나는 곤난을 당한다. 누구든지 이것에 대해 어떤 생각을 밝힐 수 있습니까?