$.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. C/C++ 字符串操作函数 思维导图梳理

    这些常用的字符串操作函数都是包在string.h头文件中. 分享此图,方便大家记忆 <(^-^)> 选中图片点击右键,在新标签页中打开图片会更清晰

  2. INSPIRED启示录 读书笔记 - 第29章 大公司如何创新

    大公司实现创新的方法 20%法则:谷歌的程序员有20%的工作时间可以用来从事创新研究,这个方法最早是从施乐帕克研究所学来的.20%法则鼓励普通员工自己尝试各种想法,让员工打心底愿意倾注更多的激情和汗水 ...

  3. .NET CORE 动态调用泛型方法

    using System; using System.Reflection; namespace DynamicCall { class Program { static void Main(stri ...

  4. MongoDB快速入门(六)- 更新文档

    更新文档 MongoDB的update()和save()方法用于更新文档到一个集合. update()方法将现有的文档中的值更新,而save()方法使用传递到save()方法的文档替换现有的文档. M ...

  5. 关于发邮件报错535 Error:authentication failed&553 authentication is required

    553 authentication is required:这个错误的意思是你必须需要认证. 也就是说,你连接smtp服务器的时候必须使用密码来连接:下面代码红色那句 代码: @Override p ...

  6. 经典的MapReduce1中的失败

    经典的MapReduce1中的失败在MapReduce1运行时,主要考虑三种失败的模式,运行任务失败.tasktracker失败以及jobtracker失败1. 任务运行失败首先考虑子任务失败的情况. ...

  7. this和super用法

    1. this能分清混淆,形参名与当前对象的某个成员有相同的名字,需要明确使用this关键字来指明你要使用某个成员,使用方法是“this.成员名”. 一般以this.形参数名=形参名,代表送进来赋值的 ...

  8. linux中动态链接库的创建与使用

    LINUX系统中动态链接库的创建与使用 http://www.cnblogs.com/ardar/articles/357321.html 正常C源文件编写,编译时-shared即可得到SO, gcc ...

  9. XE8_TPaintBox画

    1. procedure TForm1.PaintBox1Paint(Sender: TObject; Canvas: TCanvas); var bitmap :TBitMap; pt1, pt2 ...

  10. windows live writer 设置默认字体

      下载 Text Template 插件 设置默认字体添加模版. <p style="padding-bottom: 0px; line-height: 130%; margin-t ...