flotr2 dynamic chart invisible

977 views Asked by At

I am trying to create a flotr2 chart dynamically, but it is invisible and or disappears. The dynamic chart works if I paste in the code (static) so I know it should work. Please try the code below.

<html>
<body>
<style type="text/css"> #div1 { position: relative; } body { margin: 0px; padding: 0px; } .container { width : 600px; height: 384px; margin: 8px auto; border: 1px solid red; } </style>
<script type="text/javascript" src="flotr2.min.js"> //Some Comment </script><!-- [if IE]><script type="text/javascript" src="flashcanvas.js"></script><![endif] -->
<div id="myDiv"><div id="div1"><div id="container_Cavaliers_1_h" class="container" title="container_Cavaliers_1_h"><script type="text/javascript">(function basic_radar(container_Cavaliers_1_h) { var s1 = { label: "Before", data: [ [0,"0"],[1,"968"],[2,"295"],[3,"831"],[4,"558"],[5,"629"],[6,"0"],[7,"347"],[8,"169"],[9,"188"],[10,"237"],[11,"737"] ] }, s2 = { label: "After", data: [ [0,"0"],[1,"0"],[2,"0"],[3,"0"],[4,"0"],[5,"0"],[6,"0"],[7,"0"],[8,"0"],[9,"0"],[10,"0"],[11,"0"] ] }, graph, ticks; ticks = [ [0,""],[1,"SG-s"],[2,"SF-s"],[3,"PG-s"],[4,"PF-s"],[5,"CN-s"],[6,""],[7,"SG-r"],[8,"SF-r"],[9,"PG-r"],[10,"PF-r"],[11,"CN-r"] ]; graph = Flotr.draw(container_Cavaliers_1_h, [s1, s2], { radar: { show: true }, grid: { circular: true, minorHorizontalLines: true }, yaxis: { min: 1, max: 1000, minorTickFreq: 249.75 }, xaxis: { ticks: ticks }, title: 'container_Cavaliers_1_h', subtitle: 'container_Cavaliers_1_h' });})(document.getElementById("container_Cavaliers_1_h"));</script></div></div></div>
</body>
</html>
0

There are 0 answers