解决方案 »
- (超级求助)js this这个如何 在其他地方模拟这个this
- 关于img标签显示图片时,等到加载完成后再显示图片问题,ie浏览器出现溢出问题?
- 请教一个关于解析数据的小问题
- js能否实现ftp连接
- 向老大们请教一个JS问题
- 如何在javascript中实现画线和圆等功能?
- ^\d{5}(-\d{4})?$ 这验证规则代表什么?在线等待
- 目录树中实现右键显示菜单
- 请教用now()不同时间获得的两个时间的差值的单位是多少?比如说半个小时的差值是多大?
- 在JAVASCRIPT中怎么样使SELECT下拉框只可读数据而不可写入数据?
- 请问这个问题怎么解决,关于获取超链接的value
- JS中怎么用input type="file"上传与下载文件呢
要先将这些通过parseJSON转换成数组。具体的parseJSON自己去查一下资料吧。
sb.Append("["); foreach (DataRowView drv in dt.DefaultView)
{
if (type == "data")
{
sb.Append(drv[type].ToString());
sb.Append(",");
}
else
{
sb.Append("'");
sb.Append(drv[type].ToString());
sb.Append("',");
}
} return sb.Replace(",", "", sb.Length - 1, 1).Append("]").ToString(); //这里是去掉最后一个多余的逗号(,)
}
var chart;
$(document).ready(function() {
var options = {
chart: {
renderTo: 'container',
defaultSeriesType: 'line',
marginRight: 130,
marginBottom: 25
},
title: {
text: 'Hourly Visits',
x: -20 //center
},
subtitle: {
text: '',
x: -20
},
xAxis: {
type: 'datetime',
tickInterval: 3600 * 1000, // one hour
tickWidth: 0,
gridLineWidth: 1,
labels: {
align: 'center',
x: -3,
y: 20,
formatter: function() {
return Highcharts.dateFormat('%l%p', this.value);
}
}
},
yAxis: {
title: {
text: 'Visits'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
formatter: function() {
return Highcharts.dateFormat('%l%p', this.x-(1000*3600)) +'-'+ Highcharts.dateFormat('%l%p', this.x) +': <b>'+ this.y + '</b>';
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: [{
name: 'Count'
}]
}
// Load data asynchronously using jQuery. On success, add the data
// to the options and initiate the chart.
// This data is obtained by exporting a GA custom report to TSV.
// http://api.jquery.com/jQuery.get/
jQuery.get('data.php', null, function(tsv) {
var lines = [];
traffic = [];
try {
// split the data return into lines and parse them
tsv = tsv.split(/\n/g);
jQuery.each(tsv, function(i, line) {
line = line.split(/\t/);
date = Date.parse(line[0] +' UTC');
traffic.push([
date,
parseInt(line[1].replace(',', ''), 10)
]);
});
} catch (e) { }
options.series[0].data = traffic;
chart = new Highcharts.Chart(options);
});
});
</script><?php
$con = mysql_connect("localhost","user","");if (!$con) {
die('Could not connect: ' . mysql_error());
}mysql_select_db("highcharts", $con);$result = mysql_query("SELECT * FROM highcharts_php");while($row = mysql_fetch_array($result)) {
echo $row['timespan'] . "\t" . $row['visits']. "\n";
}mysql_close($con);
?>