Skip to content
Advertisement

How to add an array of objects to chartjs?

How to add an array of objects to chartjs.The controller of that view sends to the template twig an array through the variable {{cg}}. The way I am doing it I get an error that what I’m going through is an array of array. In the labels attribute I want put the arrangement of months and in the attribute data the fix of imp. Please have any idea of ​​this? Controller:

//————– //- AREA CHART – //————–

throws the following error:

Key “mes” for array with keys “0, 1, 2, 3, 4, 5” does not exist in defaultconsultag1.html.twig at line 55

Advertisement

Answer

This is the solution, through the raw function {{result | raw}}, I get the value that the controller sends to the view and ready

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement