带有外部CSV数据和动态脚注的静态Highcharts图形 [英] Static Highcharts graphic with external csv data and dynamic footnote
问题描述
我有一个高图图形,它由一个静态javascript代码和外部动态csv数据组成.(外部CSV数据每天更新,Javascript代码保持不变).现在,我想添加一个脚注,例如使用字幕",它也应该是动态的.如何使页脚动态?
I have a highcharts graphic, which consists of a static javascript code and external dynamic csv data. (The external CSV data is updated daily, the Javascript code remains unchanged). Now I would like to add a footnote, e.g. using "caption", which should also be dynamic. How can I make the footer dynamic?
jsfiddle示例在此处: https://jsfiddle.net/martindfurrer/kx5ebgny/
The jsfiddle example is here: 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.'
}
推荐答案
在 load
事件中获取csv数据,并使用格式化的存储库更新图表,例如:
You get csv data in load
event and update your chart with a formatted resposne, for example:
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
这篇关于带有外部CSV数据和动态脚注的静态Highcharts图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!