我正在尝试在我正在处理的报告页面上制作一个简单的饼图。我的客户端在其所有系统中使用IE8。 RGraph提供了我认为最好的图形和我老板要求我使用的图形工具。所以说服我不要改变 我也在使用asp.net
<script type="text/javascript" src="/js/RGraph/libraries/RGraph.common.key.js"></script>
<script type="text/javascript" src="/js/RGraph/libraries/RGraph.drawing.rect.js"></script>
<script type="text/javascript" src="/js/RGraph/libraries/RGraph.common.core.js"></script>
<script type="text/javascript" src="/js/RGraph/libraries/RGraph.common.dynamic.js"></script>
<script type="text/javascript" src="/js/RGraph/libraries/RGraph.common.tooltips.js"></script>
<script type="text/javascript" src="/js/RGraph/librarieslibraries/RGraph.pie.js"></script>
<!--[if lt IE 9]><script src="/js/RGraph/excanvas/excanvas.js"></script><![endif]-->
<script type="text/javascript">
function renderMap() {
<%= GetPie() %>;
}
$(document).ready(function () {
renderMap();
});
</script>
和我的画布
<canvas id="myPie" width="500" height="300">[No Canvas Support]</canvas>
和我的.net在代码部分后面
protected string GetCounts()
{
// cut out code //
// var longs = [1,2,3,4]
// var names = ["program1", "program2", "program3", "program4"]
// var precents = ["1.2%", "1.3%", "1.4%", "1.5%"]
// these values are hard coded on here not on my page
// its for my clients protection that i use false data
StringBuilder output = new StringBuilder();
output.Append("var pie = new RGraph.Pie('myPie', [");
output.Append(TotalEmployeeList.Count - totalOfthese + ", ");
output.Append(longs);
output.Append("])");
output.Append(".Set('labels', [");
output.Append("\"" + GetPercent(Utility.ToDouble(TotalEmployeeList.Count - totalOfthese)) + " Unqualified\", ");
output.Append(percent);
output.Append("])");
output.Append(".Set('labels.sticks', [true])");
output.Append(".Set('labels.sticks.length', 20)");
output.Append(".Set('key', ['Unqualified',");
output.Append(names);
output.Append("])");
output.Append(".Set('key.colors', ['#a7a8aa','#003057','#009fdf','#e87722','#a7a8aa','#003057', '#009fdf'])");
output.Append(".Set('key.interactive', true)");
output.Append(".Set('key.position', 'gutter')");
output.Append(".Set('key.position.y', 275)");
output.Append(".Set('key.rounded', false)");
output.Append(".Set('colors', ['#a7a8aa','#003057','#009fdf','#e87722','#a7a8aa','#003057','#009fdf'])");
output.Append(".Set('strokestyle', 'white')");
output.Append(".Set('linewidth', 3)");
output.Append(".Set('shadow', true)");
output.Append(".Set('shadow.offsetx', 2)");
output.Append(".Set('shadow.offsety', 2)");
output.Append(".Set('shadow.blur', 3)");
output.Append(".Set('exploded', 7)");
output.Append(".Set('chart.radius', 100)");
output.Append(".Set('origin', 0)");
output.Append(".Draw();");
return output.ToString();
}
我的问题是,密钥和饼图在所有浏览器中都可以工作,但不是8 ..而是部分在ie 9.是否有任何我缺少的东西?这将阻止IE正常工作?
答案 0 :(得分:0)
从它的外观来看,你没有使用window.onload函数来创建你的图表 - 我注意到ExCanvas似乎需要它。例如:
window.onload = function (e)
{
// Create chart here (NB: the bar variable must be declared using the var keyword)
var bar = new RGraph.Bar('cvs', [4,8,6,3,5,2,4]);
bar.Draw();
}
更多关于IE的信息:
http://www.rgraph.net/docs/microsoft-internet-explorer-support.html