0
Dygraph GVizChart 열의 가시성을 변경하려고합니다.Dygraphs set 열의 유효성
이 작동 :
function drawChart() {
data = getData();
window.chart1 = new Dygraph.GVizChart(
document.getElementById('dygraphs')).draw(data, {
});
}
을 또한이 작품 :
function drawChart() {
data = getData();
window.chart1 = new Dygraph.GVizChart(
document.getElementById('dygraphs')).draw(data, {
visibility: [false, true, true, true]
});
}
그러나 내부 drawChart
, 즉 코드 뒤에, 나는 다음 줄을 추가 할 때,
function drawChart() {
data = getData();
window.chart1 = new Dygraph.GVizChart(
document.getElementById('dygraphs')).draw(data, {
});
window.chart1.setVisibility(0, true);
window.chart1.setVisibility(1, false);
}
내가 오류가 발생합니다 :
Uncaught TypeError: Cannot call method 'setVisibility' of undefined. drawChart
this question을 읽은 후 실행시에 chart1
이 준비되지 않았을 수도 있습니다. 그래서이 기능을 추가 :
function showChange() {
alert('show chart1:' + window.chart1);
window.chart1.setVisibility(3, false);
}
<a href="#" onclick='showChange();return false;'>showChange</a>
을하지만 showChange
링크를 클릭 할 때, 나는 같은 오류가 발생합니다 : Uncaught TypeError: Cannot call method 'setVisibility' of undefined
그리고 경고 창이 show chart1: undefined