yoosb
November 24, 2015, 8:27am
1
i receive complex data like this.
{
dataset:[
{id:1,value:1},
{id:2,value:2},
{id:3,value:3},
{id:4,value:4},
],
columns:[
{id:1,value:1},
{id:1,value:1},
{id:1,value:1},
{id:1,value:1},
],
list:[
{id:1,value:1},
{id:1,value:1},
{id:1,value:1},
]
}
use this data , make ‘bar chart’ , ‘template’, ‘label’
how to use this data?
can i use data property or url property?
What exactly you want to build? a bar chart? a table?
Try to define your data like this:
var dataset = [
{id:1,value:1}, {id:2,value:2}, {id:3,value:3}
];
var columns = [...];
and so on.
In this case, you should include your data as a .js-file and use the data
property, e.g. data:dataset
.
Helga
November 24, 2015, 5:28pm
4
You cannot use url
or data
property, but supposing that you have received this data in response of the Ajax request, you can dynamically define any part of this data data for the needed component(s):
webix.ajax("data.php", function(res){
//var data = res.json();
//came from server
var data = { dataset:[...], columns:[...], list:[...] };
chart.parse(data.dataset);
// and so on
});
yoosb
November 25, 2015, 12:08am
5
@Helga @Listopad
thank`s a lot
there is one more question…
how to response of the ajax request when this page open? T.T
Helga
November 25, 2015, 9:57am
6
Please, look at the sample related to this topic: http://docs.webix.com/samples/15_datatable/01_loading/10_custom_configuration_format.html
As you can see, the the request "data/configdata.json"
returns an object with two properties (check the console):
{ "config": [...], "rows":[...]}
And then this data is used to build the datatable - config
is taken for columns, rows
is parsed as data.