javascript - Unable to load Json data in MG data table -
i'm new d3.js. created script can't load json data table.
d3.json('c:\software\data\dirk\development\d3_testlab\data\statustabel.json', function (data) { var table_data = data var table1 = mg.data_table({ data: table_data, //title: '', //description: 'a table has many of same properties 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: 'errors', label: 'errors', width: 170, font_size: 14, color: function(d){ return d > 0 ? '#f70101' : 'auto'; }) .number({ accessor: 'errors', label: 'errors', width: 190, font_size: 14, color: 'red', allign: 'center' }) .number({ accessor: 'shift', label: 'shift', width: 270, font_size: 14 }) .display(); })
i have not checked logic, few of points can suggest here are,
1) try changing url json file from: 'c:\software\data\dirk\development\d3_testlab\data\statustabel.json' to: 'file:///c:/software/data/dirk/development/d3_testlab/data/statustabel.json'
2) function(data) should have parameter error. i.e. function(error, data) { ... }
hope helps.
Comments
Post a Comment