I am trying to build some visuals in Sharepoint to present the list data in a more useful fashion.
charts.js appears to be a free resource for this purpose so i have been playing with that and have managed to have some working charts.
This link showed me how to extract data
The above link used the code
function GetChartData() {
seriesarray = [];
var currentcontext = new SP.ClientContext.get_current();
var splist = currentcontext.get_web().get_lists().getByTitle('Fruit Consumption');
var splistquery = new SP.CamlQuery();
splistitems = splist.getItems(splistquery);
currentcontext.load(splistitems)
Which worked fine when on the page containing the list. allitems.aspx However when I use that same code to add into a webpart on a new page it doesn't call the list data.
I guess something needs to be changed in
var splist = currentcontext.get_web().get_lists().getByTitle('Fruit Consumption');
due to the data being on a different page.
Would anyone know what I need to change to make it work?
Many thanks
