I have a situation where in I need to show a chart in MVC3 view. Till now I have done the following in my controller
public ActionResult MyChart()
{
var bytes = new Chart(width: 400, height: 200)
.AddSeries(
chartType: "bar",
xValue: new[] {"Math", "English", "Computer", "Urdu"},
yValues: new[] {"60", "70", "68", "88"})
.GetBytes("png");
return File(bytes, "image/png");
}
in my Jquery file
function getChart() {
$.ajax({
url: ('/Home/MyChart'),
type: 'GET',
cache: false,
success: function (result) {
alert(result.length);
$('#BottomGrid').html(result);
},
error: function () { alert("error"); }
});
}
and in my view I am simply calling the getChart() method. my view is an .aspx view and bottomgrid is a div on the view where I need to show the chart.
Running the above code in IE gives me a png sign and in firefox it shows me special characters.
Any Idea where am I going wrong?