我有一个firePie.aspx
页面,c#
其中只有一个按钮,当它被点击时,
protected void Button1_Click(object sender, EventArgs e)
{
string cadenaValor, valores;
cadenaValor = "Audi(28%)','BMW(29%)','Mercedes(22%)" ;
valores = "28,29,22";
Response.Redirect("pieChart.aspx?values="+cadenaValor+"&valores="+valores);
}
参数是带有逗号分隔值的字符串,我想将此值传递piechart.aspx
给函数以javascript
捕获这些参数并打印饼图,代码pieChart.aspx
为:
<body>
<canvas id="cvs" width="450" height="300">[No canvas support]</canvas>
<form id="frm" method="get" >
<script type ="text/javascript" >
var pie1 = new RGraph.Pie('cvs', ['<%=this.Request.QueryString["valores"]%>']);
pie1.Set('chart.radius', 100);
pie1.Set('chart.tooltips', ['<%=this.Request.QueryString["values"]%>']);
pie1.Set('chart.labels', ['<%=this.Request.QueryString["values"]%>']);
pie1.Set('chart.strokestyle', 'white');
pie1.Set('chart.linewidth', 5);
pie1.Set('chart.shadow', true);
pie1.Set('chart.shadow.blur', 10);
pie1.Set('chart.shadow.offsetx', 0);
pie1.Set('chart.shadow.offsety', 0);
pie1.Set('chart.shadow.color', '#000');
pie1.Set('chart.text.color', '#999');
var explode = 20;
function myExplode (obj)
{
window.__pie__ = pie1;
for (var i=0; i<obj.data.length; ++i) {
setTimeout('window.__pie__.Explode('+i+',10)', i * 50);
}
}
if (RGraph.isOld()) {
pie1.Draw();
} else if (navigator.userAgent.toLowerCase().indexOf('firefox') >= 0) {
RGraph.Effects.Pie.RoundRobin(pie1);
} else {
/**
* The RoundRobin callback initiates the exploding
*/
RGraph.Effects.Pie.RoundRobin(pie1, null, myExplode);
RGraph.Effects.Pie.Implode(pie1);
}
</script>
</form>
</body>
QueryString["valores"]
不工作,如果我写原始字符串,我的意思是,28,29,22 在var pie1 = new RGraph.Pie('cvs'...
它工作的行中,我认为出于任何原因javascript
都没有识别这个值,但QueryString["values"]
被正确捕获。你能帮我吗?