【发布时间】:2016-11-11 00:41:16
【问题描述】:
我正在尝试创建一个网页,该网页根据动态更改的文件动态创建新的绘图图。我无法使用 ScriptManager.RegisterClientScriptBlock 从代码隐藏访问 plotly 函数。也许我从错误的方向接近这个,但这是我正在做的事情的要点。
代码隐藏:
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "dayPop", "<script>doGraph();</script>", false);
HTML:
<div id="myDiv" style="width: 480px; height: 400px;"><!-- Plotly chart will be drawn inside this DIV --></div>
脚本:
<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>
当我使用注释掉的行但不是来自代码隐藏时,一切都很好。也许这里有人有这样做的经验?
【问题讨论】:
标签: c# asp.net code-behind plotly