我有这个带有这个表的数据库,我想把它放在我用基本 HTML 编码的 .jsp 页面上。该项目在 Spring mvc 中。
CREATE TABLE `status` (
`idStatus` int(11) NOT NULL AUTO_INCREMENT,
`timeStamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`value` varchar(45) NOT NULL,
`unit` varchar(45) NOT NULL,
`idCategory` int(11) NOT NULL,
PRIMARY KEY (`idStatus`),
UNIQUE KEY `idStatus_UNIQUE` (`idStatus`),
KEY `timeStampIndex` (`timeStamp`),
KEY `statusTocategory_idx` (`idCategory`),
CONSTRAINT `statusTocategory` FOREIGN KEY (`idCategory`) REFERENCES `category` (`idCategory`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8$$
到目前为止,我可以在网页上获得基本的谷歌折线图,但不能获得值。我希望它显示基于时间的价值。
这是我到目前为止的代码:
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {
packages : [ "corechart" ]
});
google.setOnLoadCallback(drawChart);
function drawChart(serverData) {
var serverData = [ [ 'Year', 'Sales', 'Expenses' ],
[ '2004', 1000, 400 ], [ '2005', 1170, 460 ],
[ '2006', 660, 1120 ], [ '2007', 1030, 540 ] ];
var data = google.visualization.arrayToDataTable(serverData);
var options = {
title : 'Company Performance'
};
var chart = new google.visualization.LineChart(document
.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
随着时间的推移,如何将 Serverdata 输入替换为 Value?(我对 php 一无所知) google 代码是用 javascript 编写的,但是将它与纯 java 或 php 代码合并是否有效?请帮忙!