$.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. 九度oj-题目1103:二次方程计算器

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2799 解决:633 题目描述: 设计一个二次方程计算器 输入: 每个案例是关于x的一个二次方程表达式,为了简单,每个系数都是整数形式. 输 ...

  2. 如何开启和禁止Linux系统的ping功能

    在日常的网络维护和使用过程中,ping命令是最为常用的一个检测命令,它所使用的是ICMP协议,但是为了保护主机,很多时候我们需要禁止ICMP协议,在这种情况下,终端再使用ping命令检测,服务器是不会 ...

  3. Nginad广告生成代码分析

    大家都知道实时竞价的广告一般会在一个iframe中,这个iframe会有一个复杂的src.那么这个iframe是如何生成的? 这里分析NginAd作为exchange时,如何让媒体网站通过引用一段ad ...

  4. 【转】服务器.htaccess 详解以及 .htaccess 参数说明

    htaccess文件(或者”分布式配置文件”)提供了针对目录改变配置的方法, 即,在一个特定的文档目录中放置一个包含一个或多个指令的文件, 以作用于此目录及其所有子目录.作为用户,所能使用的命令受到限 ...

  5. Codeforces Round #374 (Div. 2) D. Maxim and Array 线段树+贪心

    D. Maxim and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. iOS中,Framework和.a的打包及使用

    最近在做一个小项目,需要给客户一个demo测试,有一部分核心代码暂时不想让客户知道,就想到了打包成framework或.a库.库有两种: 静态库:.a和.framework 动态库:.tbd和.fra ...

  7. Membership如何得到当前登录的用户名称

        System.Web.Security.Membership     Membership.GetUser().UserName可以得到当前登录的用户信息.

  8. 安装SQL 2008失败 (win7 旗舰版 32位)

    本机系统 win7 32位 旗舰版 机器已经有sql 2005了,2008 不能安装成功,而且无任何错误提示. 那么通过windows install clean up (下载 windows ins ...

  9. git将代码上传到coding分支

    分支 我理解的分支 分支,简单地讲就是一个项目的不同分支存放不同的代码,这样的话一个项目就有了几分代码,但是最终的代码一般放在主分支里面,即master分支里,分支在实际中可以方便的隔离开发. 假设你 ...

  10. 计算客网络赛 Coin 二项式定理+逆元

    https://nanti.jisuanke.com/t/17115 Bob has a not even coin, every time he tosses the coin, the proba ...