努力中的小峰
2015-06-03 23:35:54
等
highcharts两种数据赋值方法为什么第二种无法显示?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
var data = ["['DS',23105]", "['CSS',19778]", "['ZDS',4639]"];
var xdata = '['+data.join(",")+']';
console.info(xdata);
var chart;
// data = data.join(",");
$(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() {
// console.info(this.point.name +"=="+this.point.y);
return '机型:<b>'+ this.point.name +'</b> 台数:<b>'+this.point.y+'</b>百分比: '+ this.percentage.toFixed(2) +' %';
}
}
}
},
series: [{
type: 'pie',
name: 'Browser share',
data : [['DS',23105],['CSS',19778],['ZDS',4639]]
}]
});
// console.info(xdata);
// chart.series[0].setData(xdata);
});
</script>
</head>
<body>
<script src="../js/highcharts.js"></script>
<script src="../js/highcharts-more.js"></script>
<script src="../js/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</body>
</html>
上述描述可以完成展示
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
var data = ["['DS',23105]", "['CSS',19778]", "['ZDS',4639]"];
var xdata = '['+data.join(",")+']';
console.info(xdata);
var chart;
// data = data.join(",");
$(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() {
// console.info(this.point.name +"=="+this.point.y);
return '机型:<b>'+ this.point.name +'</b> 台数:<b>'+this.point.y+'</b>百分比: '+ this.percentage.toFixed(2) +' %';
}
}
}
},
series: [{
type: 'pie',
name: 'Browser share',
data : xdata
}]
});
// console.info(xdata);
// chart.series[0].setData(xdata);
});
</script>
</head>
<body>
<script src="../js/highcharts.js"></script>
<script src="../js/highcharts-more.js"></script>
<script src="../js/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</body>
</html>
用上述方式就不行;
两种方法只是赋值方法不同,我下述方式那里不对,求指点!!
评论
- 等 最代码怎么获取牛币啊?
- 完 谁来告诉我最代码上线的时间,答对者给5牛币,先来先得
- 等 牛友们,大家好,你们做程序员多久了?现在还好吗?
- 完 在微信打开的页面里进行app下载
- 等 最代码2014年欢乐聚声会
- 完 mysql如何查询表数据并且对3个字段降序的SQL?
- 完 最代码牛币机制改革
- 完 成功的在bae上使用了自定义运行环境 jetty+nginx的组合,大家对jetty+nginx优化有哪些心得?
- 完 进来分享一下各位牛牛是如何加入最代码大家庭的?
- 等 为什么java BufferedImage类处理大图直接抛出内存溢出的异常?
- 等 最代码是否开发手机app客户端?
- 完 java程序员学习哪些java的技术?java有哪些框架?都能做哪方面的开发?
- 等 php格式网页文件怎么运行?
- 等 Java volatile值获取的问题
- 等 前端vue,拦截了登录后台后,返回的token,requests拦截token,但是发送请求的时候,就出现跨越异常
- 等 大专本科计算机科班怎么找到Java工作?
- 等 eclipse怎么把三个java swing游戏项目合成一个项目?
- 完 伙伴们,大家都有什么好的解压方式么,分享一下~
- 完 三四线城市,6、7k,运维工作,索然无味,想去辞职上培训,各位牛牛有什么建议嘛
- 等 jsp页面输入中文变成问号
- 等 JPA在线上运行一段时间后报错Caused by: java.lang.IncompatibleClassChangeError: null
- 等 PHP 这个规则用preg_match_all怎么写
- 等 大佬们,有没有知道Alfresco如何配置LDAP登录呢?
- 等 php的install目录是框架带的吗?
相关问答
最近浏览
微信网友_5951283377328128
2022年5月9日
暂无贡献等级
YorkHu LV17
2018年7月4日
zjzheng6666 LV2
2018年1月30日
liuadmingang LV1
2017年11月21日
jpplhpp LV2
2017年10月19日
xxf123
2017年5月16日
暂无贡献等级
carllos LV1
2017年4月27日
hdq123123123 LV1
2017年4月5日
cymideaman LV2
2017年3月20日
xiomara LV1
2017年1月13日




所有回答列表(1)
