這個插件對靜態值工作正常。但我想使用數據庫中的值。這是一個3d圖表。我已經嘗試了一切,但找不到任何解決方案。這對我來說非常緊迫。所以幫助。我嘗試了各種各樣的東西。搜索可能解釋這一點的每個可能的網站。但迄今爲止還沒有任何幫助。甚至搜索了這種插件的網站,但沒有找到適當的文檔。對於其他想要將任何jQuery插件與其數據庫集成在一起的開發人員來說,這也會變得很糟糕。集成jQuery插件和數據庫
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<script type="text/javascript">
var mysuperdata= null;
jQuery.ajax({
url: url: "Default2.aspx/GetData",
contentType: "application/json; charset=utf-8",
data: { "param1": p1, "inicialDate": inicialDate, "finalDate": finalDate },
dataType: "jsonp",
success: function (d) { mysuperdata = d }
});
</script>
<script
type="text/javascript"
src=
"http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Browser market
shares at a specific website, 2010'
},
tooltip: {
pointFormat: '{series.name}:
<b>{point.percentage}%</b>',
percentageDecimals: 1
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
return '<b>' + this.point.name +
'</b>: ' + this.percentage + ' %';
}
}
}
},
series: [{
type: 'pie',
name: 'Browser share',
data: mysuperdata
}]
});
});
});
</script>
</head>
<body>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height:
400px; margin: 0 auto"></div>
</body>
</html> using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Web.Script.Services;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, XmlSerializeString = false)]
public static Array GetData()
{
return new Dictionary<string, double>()
{
{ "Firefox", 45 },
{ "IE", 24.8 },
{ "Chrome", 12.8 },
{ "Safari", 8.5 },
{ "Opera", 5.2 },
{ "Outros", 3.7 },
}.ToArray();
}
}
我編輯了代碼adriano,但它仍然不工作。它顯示一個空白頁面。我不知道現在該做什麼。也許你可以複製&將我的代碼粘貼到你的Visual Studio中,看看有什麼不對。 Buddy幫忙。我會馬上給你我的賞金。我只想要一種方法來做到這一點
[鏈接](http://stackoverflow.com/questions/15871794/jquery-plugin-to-integrate-with-database):兩個幾乎相同的問題從不同的人在幾分鐘內彼此:發生了什麼? – 2013-04-08 06:16:29