Reply To: Cumton list Chart not loaded

Forums SPJS Charts for SharePoint Cumton list Chart not loaded Reply To: Cumton list Chart not loaded

#31938
nk.franklin
Participant

Hello Alexander,

Thanx for the answer.

I choose to replace the text field “Equipe” by people picker.
it’s Look like the java script is working now.
But the chart still not loading.
See Error in the picture below

Java script files:
function getChartCustomDatasource(chartId) {
var deferred = jQuery.Deferred(), deferreds = [];
if (spjs.charts.customData === undefined) {
spjs.charts.customData = {};
}
spjs.charts.customData[chartId] = [];
deferreds.push(getDataList1(chartId));
deferreds.push(getDataList2(chartId));
jQuery.when.apply(jQuery, deferreds).then(function () {
deferred.resolve(spjs.charts.customData[chartId]);
});
return deferred.promise();
}

// Get data from list 1
function getDataList1(chartId) {
var d = jQuery.Deferred();
spjs.charts.getItemsREST({
“listId”: “{566BEAF5-742B-43CA-A2B7-74CA72B02067}”,
“listBaseUrl”: _spPageContextInfo.webServerRelativeUrl,
“select”: [
“ID”,
“Title”,
“NBMATCH”,
“Equipe/Title”
],
“expand”: [“Equipe”],
“filter”: “”
}).done(function (data) {
jQuery.each(data, function (i, item) {
// A people picker is returned as an object and need to be changed to a string.
item.Equipe = item.Equipe.Title;
spjs.charts.customData[chartId].push(item);
});
d.resolve();
}).fail(function (err) {
// console.log(err);
});
return d.promise();
}

// Get data from list 2
function getDataList2(chartId) {
var d = jQuery.Deferred();
spjs.charts.getItemsREST({
“listId”: “{970B6E59-A6A2-42D6-81B2-9AC114AC4011}”,
“listBaseUrl”: _spPageContextInfo.webServerRelativeUrl,
“select”: [
“ID”,
“Title”,
“NBWIN”,
“Equipe/Title”
],
“expand”: [“Equipe”],
“filter”: “”
}).done(function (data) {
jQuery.each(data, function (i, item) {
// A people picker is returned as an object and need to be changed to a string.
item.Equipe = item.Equipe.Title;
// If the fields are not the same in list 1 and 2 you must map the value to the correct field name like this:
// item.field_name_in_list_1 = item.field_name_in_list_2;
spjs.charts.customData[chartId].push(item);
});
d.resolve();
}).fail(function (err) {
// console.log(err);
});
return d.promise();
}