asp.net - Dynamic Plotly graphs from codebehind in C# -
i'm trying create webpage dynamically creates new plotly graphs based on dynamically changing files. i'm having trouble accessing plotly functions codebehind using scriptmanager.registerclientscriptblock. maybe approaching wrong direction here gist of doing.
codebehind:
scriptmanager.registerclientscriptblock(page, page.gettype(), "daypop", "<script>dograph();</script>", false);
html:
<div id="mydiv" style="width: 480px; height: 400px;"><!-- plotly chart drawn inside div --></div>
script:
<script> var trace1 = { mode: 'lines', x: [1, 2, 3, 4], y: [10, 15, 13, 17] }; var data = [trace1]; //dograph('mydiv'); function dograph() { var graphone = document.getelementbyid('mydiv'); plotly.newplot(graphone, data); } </script>
everything works great when use commented out line not codebehind. maybe here has experience doing this?
<script> $( document ).ready(function() { dograph(); }); </script>
the problem that, suppose using jquery code should script. possible call dograph()
, before browser render div, because of should execute after page loaded. if don't use jquery can attach method on body onload function. advise take jquery.
Comments
Post a Comment