$.fn.extend({
Zhu: function (option) {
var id = $(this).attr("id");
$('#' + id).highcharts({
chart: {
type: 'column'
},
title: {
text: option.title
},
xAxis: {
categories: option.cate,
crosshair: true
},
yAxis: {
min: 0,
title: {
text: option.ytext
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f} ' + option.unit + '</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: option.series
});
},
Pie: function (option) {
var id = $(this).attr("id");
$('#' + id).highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: option.title
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: option.name,
data: option.series
}]
})
},
BarPlus: function (option) {
var id = $(this).attr("id");
$('#' + id).highcharts({
chart: {
type: 'bar'
},
title: {
text: option.title
},
xAxis: {
categories: option.cate
},
yAxis: {
min: 0,
title: {
text: option.ytext
}
},
legend: {
reversed: true
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: option.series
});
},
PieCol: function (option) {
var id = $(this).attr("id");
$('<div class="chart1" id="' + id + '1">')
.appendTo('#' + id)
.highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: option.title
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: option.name,
data: option.series,
events: {
click: function (event) {
$.post(option.url, { pKey: event.point.name, begin: $("#dtpBegin").val(), end: $("#dtpEnd").val(), brand: $("#brand").val() }, function (e) {
var obj = eval('(' + e + ')');
$('#' + id + "2").highcharts({
chart: {
type: 'column'
},
title: {
text: event.point.name
},
xAxis: {
categories: [event.point.name],
visible: false
},
yAxis: {
min: 0,
title: {
text: ''
},
visible: false
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
shared: true
},
plotOptions: {
column: {
stacking: 'percent'
}
},
series: obj
});
})
}
}
}]
});
$('<div class="chart2" id="' + id + '2">').appendTo('#' + id);
},
PiePie: function (option) {
var id = $(this).attr("id");
$('<div class="chart3" id="' + id + '1">')
.appendTo('#' + id)
.highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: option.title
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: option.name,
data: option.series,
events: {
click: function (event) {
$.post(option.url, { pKey: event.point.name, begin: $("#dtpBegin").val(), end: $("#dtpEnd").val(), brand: $("#brand").val() }, function (e) {
var obj = eval('(' + e + ')');
$('#' + id + "2").highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: event.point.name
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: '占比',
data: obj,
events: {
click: function (event) {
if (cb1 != null && cb1 != undefined) {
cb1(event);
}
}
}
}]
});
})
}
}
}]
});
$('<div class="chart4" id="' + id + '2">').appendTo('#' + id);
},
BarLeft: function (option) {
var id = $(this).attr("id");
var cate = ['描述相符', '服务态度', '物流服务'];
$('#' + id).highcharts({
chart: {
type: 'bar'
},
title: {
text: option.title
},
xAxis: [{
categories: cate,
reversed: false,
labels: {
step: 1
}
}, { // mirror axis on right side
opposite: true,
reversed: false,
categories: cate,
linkedTo: 0,
labels: {
step: 1
}
}],
yAxis: {
title: {
text: null
},
labels: {
formatter: function () {
return this.value;
}
},
min: -10,
max: 10
},
plotOptions: {
series: {
stacking: 'normal'
}
},
tooltip: {
formatter: function () {
return '<b>' + this.series.name + ', ' + this.point.category + '</b><br/>' +
'数量: ' + Highcharts.numberFormat(Math.abs(this.point.y), 0);
}
},
series: [{
name: '低于4.7(不含)店铺',
data: option.series1,
events: {
click: function (event) {
if (cb2 != null && cb2 != undefined) {
cb2(event, this);
}
}
}
}, {
name: '高于4.9(不含)店铺',
data: option.series2,
events: {
click: function (event) {
if (cb2 != null && cb2 != undefined) {
cb2(event, this);
}
}
}
}]
});
}
})
var cb1, cb2;

自己写的highcharts级联(点击事件)的更多相关文章

  1. android 开发 写一个RecyclerView布局的聊天室,并且添加RecyclerView的点击事件

    实现思维顺序: 1.首先我们需要准备2张.9的png图片(一张图片为左边聊天泡泡,一个图片为右边的聊天泡泡),可以使用draw9patch.bat工具制作,任何图片导入到drawable中. 2.需要 ...

  2. 简单运用 activity 的 button 点击事件

    今天我们要讲的主要是四大组件之一Activity Activity 在英文中是活动的意思.活动就是我们与用户进行交互的一个场所. activity 整个的活动流程是什么呢?我们用一个图来看下 当然今天 ...

  3. 动态生成的DOM做点击事件无效

    有时候我们的标签都是从后台获取的数据,然后利用JS添加到页面上,当我们写生成的标签的点击事件(click)时没有效果. 例如: <section> 测试动态生成的DOM点击事件 <b ...

  4. RecyclerView的点击事件

    RecyclerView 一.简单介绍 这个是谷歌官方出的控件.使我们能够很easy的做出列表装的一个控件,当然recyclerview的功能不止这些,它还能够做出瀑布流的效果,这是一个很强大的控件, ...

  5. 事件处理之二:点击事件监听器的五种写法 分类: H1_ANDROID 2013-09-11 10:32 4262人阅读 评论(1) 收藏

    首选方法二! 方法一:写一个内部类,在类中实现点击事件 1.在父类中调用点击事件 bt_dail.setOnClickListener(new MyButtonListener()); 2.创建内部类 ...

  6. 四种方式写按钮点击事件和Android 中常用的布局

    1.匿名内部类的方式 2.创建一个类实现onClickListener,实现onClick方法,设置控件点击时传一个类的对象 3.让当前类实现onClickListener,设置控件点击事件时传递一个 ...

  7. highcharts图表组件入门教程:如何监听柱状图柱子点击事件动态更新当前数据点数值和所对应X轴刻度

    highcharts图表组件入门教程:如何监听柱状图柱子点击事件动态更新当前数据点数值和所对应X轴刻度 作者:highcharts | 时间:2014-6-11 14:07:05 | [小  大] | ...

  8. Android 四种方法写按钮点击事件

    1.匿名内部类的方式 2. 创建一个类实现onclickListener,实现onclick方法,设置控件点击事件时传一个类的对象. 3. 让当前类实现onclickListener,设置控件点击事件 ...

  9. Android笔记——Button点击事件几种写法

    Button点击事件:大概可以分为以下几种: 匿名内部类 定义内部类,实现OnClickListener接口 定义的构造方法 用Activity实现OnClickListener接口 指定Button ...

随机推荐

  1. Java final static关键字

    Java中的final关键字 使用 final 关键字做标识有 “最终的” 含义. final 可以修饰 类.方法.属性.变量 final 修饰类: 则该类不允许被继承 final 修饰方法:则该方法 ...

  2. Whitewidow:SQL 漏洞自动扫描工具

    Whitewidow 是一个开源的 SQL 漏洞自动扫描器,可用通过文件列表运行,或者从 Google 爬取并发现有潜在漏洞的网站. 这个工具支持自动格式化文件.随机用户代理.IP 地址.服务器信息. ...

  3. MySQL/MariaDB数据库备份与恢复之mysqlpump入门操作

    创建测试用表:MariaDB [music]>  create table summary(id int,info char(128));Query OK, 0 rows affected (0 ...

  4. Hessian与Spring整合

    1.服务端与Spring的整合 1.1:web.xml中配置控制器 <servlet> <servlet-name>hessian</servlet-name> & ...

  5. HDFS请求接口

    通过HTTP来访问HDFS有两种方法:直接访问,HDFS后台进程直接服务于来自客户端的请求:通过代理(一对多)访问,客户端通常使用DistributedFileSystemAPI访问HDFS.第一种情 ...

  6. STL视频_02

    [01:05]主要讲一下几个要点: 1.模板.函数模板 类模板 以及它们的用法 2.容器.什么是容器 和 容器的分类,各种容器的数据结构 3.容器vector的具体用法,包括迭代器的具体用法 [01: ...

  7. keystone DB in devstack

    ~$ mysql -u -p root mysql> use keystone; mysql> show tables;+------------------------+| Tables ...

  8. github-如何设置SSH Key

    设置SSH Key 在注册好github账号后,打开你的电脑桌面上的一个文件夹,这就建立了一个本地工作库,在里面点击鼠标右键,找到你的git bash here-点击开,如图所示:进行下面操作: 输入 ...

  9. 解决:Eclipse安装Pydev插件报错: An error occurred while collecting items to be installed session context was:(profile=...

    今天在Elipse上安装Pydev插件时报错: An error occurred while collecting items to be installed session context was ...

  10. handsontable 给单元格自定义属性

    setHotAttr(hotObj,rowHeader,colHeader){// 给handsongtable绑定行列属性 console.log(hotObj); console.log(colH ...