如何从高级图表中获取数据形式的sql server并显示。 [英] how to get the data form sql server and display in high charts.

查看:62
本文介绍了如何从高级图表中获取数据形式的sql server并显示。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用高图表,因为最近两天我正在尝试如何将数据表值绑定到高图表..我没有得到任何解决方案..请任何人帮助我这个我需要这个紧急 ...

一步一步的过程我想要

am using high charts in my application since last two days am trying to how to bind datatable values to high charts.. i didnt get any solution.. pls any one help me for this i need this urgent...
step by step process i want

推荐答案

Hello Santosh,



下面的代码片段显示了在High Charts中呈现折线图的典型脚本,这是一个纯JavaScript图表解决方案。

Hello Santosh,

Below code snippet shows a typical script for rendering a Line chart in High Charts which is a pure JavaScript Charting Solution.


function (){


' #container')。highcharts({
chart:{
type:' line'
},
title:{
text:' 每月平均温度'
},
副标题:{
text:' 来源:WorldClimate。 com'
},
xAxis:{
categories:[' Jan'' 2月' ' Mar'' Apr'' 可能'' Jun'' Jul'' Aug'' Sep'' Oct'' 11月'' Dec']
},
yAxis:{
title:{
text:' 温度(°C)'
}
},
工具提示:{
enabled: false
格式化程序: function (){
return ' < b>' + this .series.name + ' < / b>< br />' +
.x + ' :' + this .y + ' °C';
}
},
plotOptions:{
line:{
dataLabels:{
enabled: true
},
enableMouseTracking: false
}
},
系列:[{
名称:' 东京'
数据:[ 7 0 6 9 9 5 14 5 18 4 21 5 25 2 26 5 23 3 18 3 13 9 9 6 ]
},{
name:' < span class =code-string> London'

data:[ 3 9 4 2 5 7 8 5 11 9 15 。< span class =code-digit> 2 , 17 0 16 6 14 . 2 10 3 6 6 4 8 ]
}]
});
});
('#container').highcharts({ chart: { type: 'line' }, title: { text: 'Monthly Average Temperature' }, subtitle: { text: 'Source: WorldClimate.com' }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { title: { text: 'Temperature (°C)' } }, tooltip: { enabled: false, formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y +'°C'; } }, plotOptions: { line: { dataLabels: { enabled: true }, enableMouseTracking: false } }, series: [{ name: 'Tokyo', data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] }, { name: 'London', 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] }] }); });



查看此脚本将立即告诉您有关渲染折线图所需的两个最基本的东西,它们是:


Looking at this script will immediately tell you about two bare minimum things that are required in order to render the line chart, these are:



  1. 要在X / Y轴上显示的字符串标签数组
  2. 实际使用的数值数组图表呈现



这意味着为了呈现这些图表,您需要先从数据库中获取数据,然后创建这些数组并在JavaScript中输出。然后在页面加载(在浏览器中)调用图表javascript api来呈现图表。作为一个javascript库,它不支持像数据绑定这样的东西。



问候,


What this means is that in order to render these charts you need to first fetch the data from database and then create these arrays and output those in JavaScript. And then on page load (in browser) call the chart javascript api to render the chart. Being a javascript library it won't support things like databinding.

Regards,


这篇关于如何从高级图表中获取数据形式的sql server并显示。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆