In my example, but also in jsfiddle (//jsfiddle.net/QwZuf/690) you can reproduce the issue adding the 2 lines at the top of the scripts, before the “var chart” declaration:
var d=document.domain;
document.domain=d;
var chart = new CanvasJS.Chart("chartContainer",
{
data: [
{
type: "column",
dataPoints: [
{ x: 10, y: 100 },
{ x: 20, y: 55 },
{ x: 30, y: 50 },
{ x: 40, y: 65 },
{ x: 50, y: 95 },
{ x: 60, y: 68 },
{ x: 70, y: 28 },
{ x: 80, y: 34 },
{ x: 90, y: 14 }
]
}
]
});
chart.render();
In my case I had to set the document.domain in order to let other functions work, so I “solved” the problem using a workaround and I reload the page after the other scripts are executer:
document.domain="<%=Constants.JS_DOCUMENT_DOMAIN %>";
//var d = document.domain;
//functions that need the document.domain set
window.parent.document.getElementById('idmenu1').classList.add('current');
window.parent.document.getElementById('idmenu2').classList.remove('current');
window.parent.getMenu('menu3');
//document.domain=d;//function commented, it's the one preventing chart from working
//reload
window.parent.loadPortafoglioModello('<%=portafoglioModello.getId()%>');
Thank you for your help