情况很简单。我在VB.NET中有一个Web应用程序。在某些页面中,我使用数据库中的数据生成报告。在同一页面上,我需要生成一个包含来自数据库的相同数据的图表。我使用了一个简单的折线图和HighCharts.js
我只需要用数据库中的数据填充hightcharts javascript
查看下面的代码
$(function () {
$('#container').highcharts({
title: {
text: 'Feedbacks',
x: -20 //center
},
subtitle: {
text: 'Report',
x: -20
},
xAxis: {
categories: [ /* here I need to put data from data base */ ]
},
yAxis: {
title: {
text: 'Total'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [{
name: 'Positive',
data: [ /* here I need to put data from data base */ ]
}, {
name: 'Neutral',
data: [ /* here I need to put data from data base */ ]
}, {
name: 'Negative',
data: [ /* here I need to put data from data base */ ]
}]
});
});
非常感谢您的支持!
答案 0 :(得分:0)
您可以准备从数据库中获取数据并创建JSON的脚本,然后在高级图表中,您可以使用getJSON()
并粘贴数据,例如:http://jsfiddle.net/usgxh/1/