Hi Stackoverflow people.
Im trying to use a javascript graph in a test twig view. This is the view:
<h1>test</h1>
{% javascripts '@AcmeFooBundle/Resources/public/js/*' %}
<script src="{{ asset_url }}" type="text/javascript">
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
title:{
text: "Fruits"
},
data: [//array of dataSeries
{ //dataSeries object
/*** Change type "column" to "bar", "area", "line" or "pie"***/
type: "column",
dataPoints: [
{ label: "banana", y: 18 },
{ label: "orange", y: 29 },
{ label: "apple", y: 40 },
{ label: "mango", y: 34 },
{ label: "grape", y: 24 }
]
}
]
});
chart.render();
}
</script>
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
<body>
<div id="chartContainer" style="height: 300px; width: 100%;">
</div>
</body>
So the problem is that the javascript library is not installed because it returns to me this error message:
An exception has been thrown during the compilation of a template ("You must add PreditBundle to the assetic.bundle config to use the {% javascripts %} tag in PreditBundle:Default:test.html.twig.") in "PreditBundle:Default:test.html.twig".
Things I've tryed:
-Follow step by step the page "how to use assetic for asset management -Use the console comands : assets:install and assetic:dump
Thanks for your answers