优雅地处理没有数据的amcharts
问题描述:
我想知道我的dataProvider是否为空。当amCharts绘制默认空值。我如何动态处理它。优雅地处理没有数据的amcharts
var chart = AmCharts.makeChart("chartdiv", {
"theme": "none",
"type": "serial",
"dataProvider": data,
"valueAxes": [{
"title": "Income in millions, USD"
}]
如果数据应该为空。如何处理它..
答
你有两个真正的选择在这里。
您可以做的第一件事是在调用AmCharts.makeChart()
之前检查数据,并且只有在有数据时才执行该函数。如果没有任何数据,您可能会希望向用户显示某种消息。
您的第二个选择是在图表上显示一条消息。 Here is an example on the AmCharts website that can help achieve this.
我不明白你的要求是什么。数据提供者为空或空时会发生什么? – gerric 2015-04-08 11:01:33