我正在开发Windows Phone 8.1应用程序。我需要在这个应用程序中将数据库中的数据绑定到highcharts。快速帮助将非常有帮助。如何在Windows Phone 8.1应用程序中将动态数据绑定到highcharts
在此先感谢。 Vikrant
我正在开发Windows Phone 8.1应用程序。我需要在这个应用程序中将数据库中的数据绑定到highcharts。快速帮助将非常有帮助。如何在Windows Phone 8.1应用程序中将动态数据绑定到highcharts
在此先感谢。 Vikrant
您可以使用JSON对象来填充Highcharts中的数据,但一种对我来说总是奏效的方法是在后面的代码中创建带有数据源的highchart js,然后将其写入页面。我没有一个样本,但它在过去对我有效。
将文字放置在HTML页面的HEAD部分。
而且你的代码隐藏(抱歉,这是VB)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim stringBuilder = New StringBuilder()
stringBuilder.Append("$(function() {")
stringBuilder.Append("$('#container').highcharts({")
stringBuilder.Append("title: {")
stringBuilder.Append("text: 'Monthly Average Temperature',")
stringBuilder.Append("x: -20 //center")
stringBuilder.Append("},")
stringBuilder.Append("subtitle: {")
stringBuilder.Append("text: 'Source: WorldClimate.com',")
stringBuilder.Append("x: -20")
stringBuilder.Append(" },")
stringBuilder.Append("xAxis: {")
stringBuilder.Append("categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',")
stringBuilder.Append("'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']")
stringBuilder.Append("},")
stringBuilder.Append("yAxis: {")
stringBuilder.Append("title: {")
stringBuilder.Append("text: 'Temperature (°C)'")
stringBuilder.Append("},")
stringBuilder.Append("plotLines: [{")
stringBuilder.Append("value: 0,")
stringBuilder.Append("width: 1,")
stringBuilder.Append("color: '#808080'")
stringBuilder.Append("}]")
stringBuilder.Append("},")
stringBuilder.Append("tooltip: {")
stringBuilder.Append("valueSuffix: '°C'")
stringBuilder.Append("},")
stringBuilder.Append("legend: {")
stringBuilder.Append("layout: 'vertical',")
stringBuilder.Append("align: 'right',")
stringBuilder.Append("verticalAlign: 'middle',")
stringBuilder.Append("borderWidth: 0")
stringBuilder.Append("},")
stringBuilder.Append("series: [{")
stringBuilder.Append("name: 'Tokyo',")
stringBuilder.Append("data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]")
stringBuilder.Append("}, {")
stringBuilder.Append("name: 'New York',")
stringBuilder.Append("data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]")
stringBuilder.Append("}, {")
stringBuilder.Append("name: 'Berlin',")
stringBuilder.Append("data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]")
stringBuilder.Append("}, {")
stringBuilder.Append("name: 'London',")
stringBuilder.Append("data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]")
stringBuilder.Append("}]")
stringBuilder.Append("});")
stringBuilder.Append("});")
ltHighchartsCode.Text = stringBuilder.ToString
End Sub
你可以在使用stringbuilder的代码中使用它来创建
我会尝试使用建议的逻辑。在此期间,如果您发现任何其他问题,请分享。再次感谢:) – vikbehal 2015-02-06 19:25:55
会做。祝你好运! – 2015-02-06 19:27:07
感谢快速回复英寸你能快速分享一块吗?这将是很大的帮助。我是Windows手机开发的新手。或任何可以指导我的博客。 – vikbehal 2015-02-06 19:09:48