Highcharts 第二课setOptions(二)
来源:互联网 发布:淘宝收藏代码在线生成 编辑:程序博客网 时间:2024/06/02 06:33
<1>全局选项(GLOBAL OPTIONS)
(1)使用Highcharts.setOptions
(2)实例一:
Highcharts.setOptions({ chart: { backgroundColor: { linearGradient: [0, 0, 500, 500], stops: [ [0, 'rgb(255, 255, 255)'], [1, 'rgb(240, 240, 255)'] ] }, borderWidth: 2, plotBackgroundColor: 'rgba(255, 255, 255, .9)', plotShadow: true, plotBorderWidth: 1 } });
(3)实例二:
// global Highcharts settings Highcharts.setOptions({ chart: { style: { fontFamily: '"Helvetica", sans-serif' }, events: { click: function() { Notifications.notify(Notifications.event.CLOSE_DROPDOWN); } } }, plotOptions: { series: { events: { click: function() { Notifications.notify(Notifications.event.CLOSE_DROPDOWN); } } } } });
<2>可以阅读的代码习惯
(1)坏的代码习惯:
// Bad code:var options = new Object();options.chart = new Object();options.chart.renderTo = 'container';options.chart.type = 'bar';options.series = new Array();options.series[0] = new Object();options.series[0].name = 'Jane';options.series[0].data = new Array(1, 0, 4);
(2)好的代码习惯:
// Good code:var options = { chart: { renderTo: 'container', type: 'bar' }, series: [{ name: 'Jane', data: [1, 0, 4] }]};
备注:上面两个代码片的结果是一样的。
(3)将上面的代码添加到Highcharts中
$(document).ready(function() { var chart = new Highcharts.Chart(options);});
(4)因为options.series是数组,所以用数组的方式添加。
用符号点(. )(dot notation)添加。
options.series.push({ name: 'John', data: [3, 4, 2]})(5)options.renderTo 和 options['renderTo'] 效果一样
0 0
- Highcharts 第二课setOptions(二)
- highcharts曲线图(二)
- Highcharts标题Title(二)
- Java与Highcharts实例(二) - Hello Highcharts
- Highcharts(二)之基本属性
- Java与Highcharts实例(二)
- Highcharts翻译系列之二十:曲线图例子(二)
- Highcharts 第三课 解释Highcharts 的构建(三)
- Highcharts使用二示例
- highcharts 学习二
- HighCharts资料(二)
- Highcharts 翻译系列之十八:x轴样式(二)
- 新手学HighCharts(二)----对比柱状图的动态加载
- Highcharts(二) 基础柱状图 ajax动态刷新
- highCharts(一)Highcharts 基本组成
- 第二周作业(二)
- 第二周任务(二)
- 第二周习题(二)
- Linux如何实现镜像端口
- 进程与线程之间的联系与区别
- 怎么使用telnet入侵其他主机
- 黑马程序员-06.C字符串和指针
- CInternetSession的简单使用例子
- Highcharts 第二课setOptions(二)
- Scrapy复习
- VC项目配置基础 (VC6.0 和VC2005)
- SQL Server错误代码大全及解释
- STM32F103RB的 Bootloader软件安全设计方案
- SQL Server report server使用
- Java基础:面向对象
- gdb 带参数调试
- Linux 查看当前时间