2015-05-18 24 views
-1

此腳本不加載任何數據。在mg表中加載json給出的數據未定義

<script lang="JavaScript"> 
    d3.json('file:///C:/Software/Data/dirk/development/D3_TestLab/data/StatusTabel.json', function (error,data) { 

     console.log(JSON.stringify(data)); 

     var table_data = data 

     var table1 = MG.data_table({ 
      data: data, //table_data, 
      //title: '', 
      //description: 'A table has many of the same properties as any other data graphic.', 
      show_tooltips: true 
     }) 

      .target('#div1') 

      .number({ accessor: 'BU', label: 'BU', width: 120, font_size: 14, layout: 'center' }) 
      .number({ accessor: 'Lines', label: 'Lines', width: 190, font_size: 14, layout: 'center' }) 
      .number({ accessor: 'Shift', label: 'Shift', width: 270, font_size: 14 }) 

      .display(); 
    }) 
</script> 

我得到的錯誤:

TypeError: a.data is undefined.

誰能幫助我?

+0

代碼標籤也請更具體你試圖做什麼你有什麼嘗試? – Tony

+0

請合成你的代碼。 – pceccon

+0

{「BU」:「過濾」,「線條」:400,「錯誤」:1,「Shift」:「Early」}, {「BU」:「過濾」,「線條」錯誤「:1,」Shift「:」遲到「} ] 這是我的JSON,但仍然沒有加載數據。 –

回答

0

我嘗試從存儲在我的筆記本電腦上的文件夾中加載json數據到度量圖形數據表中。 加載由D3.json完成,然後通過 MG.data_table函數完成數據。

只有D3.json不會加載數據。