외부 csv 데이터 및 동적 각주가 포함 된 정적 Highcharts 그래픽
Nov 24 2020
정적 자바 스크립트 코드와 외부 동적 CSV 데이터로 구성된 하이 차트 그래픽이 있습니다. (외부 CSV 데이터는 매일 업데이트되며 Javascript 코드는 변경되지 않습니다.) 이제 동적이어야하는 "캡션"을 사용하여 각주를 추가하고 싶습니다. 바닥 글을 동적으로 만들려면 어떻게해야합니까?
jsfiddle 예제는 다음과 같습니다. https://jsfiddle.net/martindfurrer/kx5ebgny/
caption: {
text: 'The Javascript code is static, the data is in a csv file. This text
should also be dynamic, i.e. should be read out of the csv file.'
}
답변
1 ppotaczek Nov 25 2020 at 08:59
load
이벤트 에서 csv 데이터를 가져 오고 형식이 지정된 resposne으로 차트를 업데이트합니다. 예를 들면 다음과 같습니다.
chart: {
events: {
load: function() {
fetch('https://demo-live-data.highcharts.com/vs-load.csv')
.then(response => response.text())
.then(data => {
this.update({
caption: {
text: data
}
});
});
}
}
}
라이브 데모 : jsfiddle
API 참조 : api.highcharts.com