TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
L A
NA
170
171.1k
Unable to show Highcharts graph - ASP.Net MVC
Nov 2 2017 8:22 PM
Hi,
Trying to bind data to Highchart & display but couldn't show on webpage.
<script type=
"text/javascript"
>
$(document).ready(
function
() {
$.ajax({
url:
'@Url.Action("getChartData", "Default")'
,
dataType:
'json'
,
type:
'GET'
,
success:
function
(resData) {
debugger
;
let dataArray =
new
Array();
for
(let i
in
resData) {
let series =
new
Array(resData[i].ProductName, resData[i].ProductSales);
dataArray.push(series);
}
drawChart(dataArray);
},
error:
function
() {
alert(
'server could not process request'
);
}
});
});
function
drawChart(resData) {
debugger
;
$(
'#highchartData'
).highcharts({
chart: {
type:
"column"
},
title: {
text:
'Product Sales for year 1997'
},
series: {
data: resData
},
plotOptions: {
column: {
dataLabels: { enabled:
true
}
}
},
xAxis: {
scrollbar: {
enabled:
true
},
},
credits: {
enabled:
false
},
tooltip: {
pointFormat:
'{series.name}: <b>{point.percentage:.1f}%</b>'
}
});
}
</script>
data returned from c# code as shown below.
graph doesn't show up
Couldn't figure out my mistake, your response is appreciated. Thanks
Reply
Answers (
2
)
Book Download error How to unlock Unlimited downloads
System.IndexOutOfRangeException