2016-11-07 38 views

回答

3

非常好的問題!在您的JSON配置中,您可以定義nodata屬性。

var myConfig = { 
 
    \t type: "bar", 
 
    \t noData:{ 
 
    \t text:"Empty Series", 
 
    \t backgroundColor: "#20b2db" 
 
    \t }, 
 
    \t series:[ 
 
     { 
 
     values:[] 
 
     } 
 
    ] 
 
}; 
 
    
 
zingchart.render({ 
 
\t id : 'myChart', 
 
\t data : myConfig, 
 
\t height: 400, 
 
\t width: 600 
 
});
<!DOCTYPE html> 
 
<html> 
 
\t <head> 
 
\t \t <script src= "https://cdn.zingchart.com/zingchart.min.js"></script> 
 
    </head> 
 
\t <body> 
 
\t \t <div id='myChart'></div> 
 
\t </body> 
 
</html>

你甚至可以使用背景圖片就像一個載入畫面。在下面的示例中,我在等待圖表數據進入時顯示海綿寶寶。因此,我最初呈現的圖表沒有定義系列值和nodata。在Ajax調用異步發生時顯示圖像。

demo

+0

謝謝!它像一個魅力一樣工作! –

相關問題