gpt4 book ai didi

c# - RGraph 和 IE 8 无法正确渲染图形

转载 作者:行者123 更新时间:2023-11-28 08:58:24 24 4
gpt4 key购买 nike

我正在尝试在我正在处理的报告页面上制作一个简单的饼图。我的客户在他们的所有系统中都使用 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

  <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();
}

我的问题是,按键和饼图在所有浏览器中都可以工作,但不能在 ie 8 中工作,部分在 ie 9 中工作。有什么我遗漏的吗?这会阻止 IE 正常工作吗?

最佳答案

从表面上看,您没有使用 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();
}

关于c# - RGraph 和 IE 8 无法正确渲染图形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18132350/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com