c# - System.Web.UI.DataVisualization.Charting charts are not displaying on IE8 -
i created chart using system.web.ui.datavisualization.charting. charts displayed on google chrome , safari. not visible on windows xp ie8. don't know how fix this.
here's code snippet on creation of charts.
<img src="/convertfiles/createactualsvsforecastchart/?actuals=@(thismonth)&forecast=@(prevmonth)" /> public fileresult createactualsvsforecastchart(string actuals, string forecast, string chartname) { //ilist<resultmodel> peoples = _resultservice.getresults(); if (actuals.equals("")) actuals = "0"; if (forecast.equals("")) forecast = "0"; chart chart = new chart(); chart.width = 350; chart.height = 400; chart.backcolor = color.fromargb(211, 223, 240); chart.borderlinedashstyle = chartdashstyle.solid; chart.backgradientstyle = gradientstyle.topbottom; chart.borderlinewidth = 1; chart.palette = chartcolorpalette.brightpastel; chart.borderlinecolor = color.fromargb(26, 59, 105); chart.rendertype = rendertype.binarystreaming; chart.borderskin.skinstyle = borderskinstyle.emboss; chart.antialiasing = antialiasingstyles.all; chart.textantialiasingquality = textantialiasingquality.normal; chart.titles.add(createtitle(chartname)); chart.legends.add(createlegend()); chart.series.add(createseries4(new list<chartkeyvalue>() { new chartkeyvalue(){ lable = "forecast", value = convert.todouble(forecast), iscurrent=true}, }, seriescharttype.column, "forecast", "pink")); chart.series.add(createseries4(new list<chartkeyvalue>() { new chartkeyvalue(){ lable = "actual", value = convert.todouble(actuals), iscurrent=true} }, seriescharttype.column, "actual", "blue")); chart.chartareas.add(createchartarea()); memorystream ms = new memorystream(); chart.saveimage(ms); return file(ms.getbuffer(), @"image/png"); }
any ideas on what's causing not displayed on ie8? thanks.
after going mad this, found ie8 doesn't resize parent container when chart being created. need put explicitly in dom. example:
<div> <asp:chart id="chart1" runat="server" suppressexceptions="true" width="1000px" height="600px"> </asp:chart> </div>
will not render in ie8 (the div's width 0px), but:
<div style="width: 1100px"> <asp:chart id="chart1" runat="server" suppressexceptions="true" width="1000px" height="600px"> </asp:chart> </div>
will. set container width pixel greater chart width.
Comments
Post a Comment