自己写的highcharts级联(点击事件)
- $.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级联(点击事件)的更多相关文章
- android 开发 写一个RecyclerView布局的聊天室,并且添加RecyclerView的点击事件
实现思维顺序: 1.首先我们需要准备2张.9的png图片(一张图片为左边聊天泡泡,一个图片为右边的聊天泡泡),可以使用draw9patch.bat工具制作,任何图片导入到drawable中. 2.需要 ...
- 简单运用 activity 的 button 点击事件
今天我们要讲的主要是四大组件之一Activity Activity 在英文中是活动的意思.活动就是我们与用户进行交互的一个场所. activity 整个的活动流程是什么呢?我们用一个图来看下 当然今天 ...
- 动态生成的DOM做点击事件无效
有时候我们的标签都是从后台获取的数据,然后利用JS添加到页面上,当我们写生成的标签的点击事件(click)时没有效果. 例如: <section> 测试动态生成的DOM点击事件 <b ...
- RecyclerView的点击事件
RecyclerView 一.简单介绍 这个是谷歌官方出的控件.使我们能够很easy的做出列表装的一个控件,当然recyclerview的功能不止这些,它还能够做出瀑布流的效果,这是一个很强大的控件, ...
- 事件处理之二:点击事件监听器的五种写法 分类: H1_ANDROID 2013-09-11 10:32 4262人阅读 评论(1) 收藏
首选方法二! 方法一:写一个内部类,在类中实现点击事件 1.在父类中调用点击事件 bt_dail.setOnClickListener(new MyButtonListener()); 2.创建内部类 ...
- 四种方式写按钮点击事件和Android 中常用的布局
1.匿名内部类的方式 2.创建一个类实现onClickListener,实现onClick方法,设置控件点击时传一个类的对象 3.让当前类实现onClickListener,设置控件点击事件时传递一个 ...
- highcharts图表组件入门教程:如何监听柱状图柱子点击事件动态更新当前数据点数值和所对应X轴刻度
highcharts图表组件入门教程:如何监听柱状图柱子点击事件动态更新当前数据点数值和所对应X轴刻度 作者:highcharts | 时间:2014-6-11 14:07:05 | [小 大] | ...
- Android 四种方法写按钮点击事件
1.匿名内部类的方式 2. 创建一个类实现onclickListener,实现onclick方法,设置控件点击事件时传一个类的对象. 3. 让当前类实现onclickListener,设置控件点击事件 ...
- Android笔记——Button点击事件几种写法
Button点击事件:大概可以分为以下几种: 匿名内部类 定义内部类,实现OnClickListener接口 定义的构造方法 用Activity实现OnClickListener接口 指定Button ...
随机推荐
- jQuery之DOM操作大全
jQuery属性操作 获取元素属性的语法:attr(name) 例子:$("#img1").attr("src"); 设置元素单个属性的语法:attr(key, ...
- PHP字符串函数大全
无论哪种编程语言,字符串操作都是一个重要的基础,往往简单而重要.PHP为我们提供了大量的字符串操作函数,功能强大,使用也比较简单.在这里结合实例总结分析PHP字符串函数的功能. 1.addcslash ...
- cocos2dx打飞机项目笔记四:Enemy类和EnemyLayer类
Enemy类没什么内容,就create和init方法,根据参数来创建不同的敌机,头文件代码如下: //飞机的类型 enum planeType {smallPlane, midPlane, bigPl ...
- php5.6 连接SQL SERVER
PHP Fatal error: Call to undefined function sqlsrv_connect() in php链接sqlserver出现该错误: 原因是:php5.3 及以上版 ...
- MIPI DBI\DPI\DSI简介【转】
本文转载自:http://blog.csdn.net/longxiaowu/article/details/24249971 (1)DBI接口 A,也就是通常所讲的MCU借口,俗称80 system接 ...
- [转载]Spring配置文件详解一:
原文地址:与base-package="com.xx">Spring配置文件详解一:<context:annotation-config/>与<contex ...
- SpringMVC中响应json数据(异步传送)
1.首先导入3个jar包: jackson-annotations-2.1.5.jar jackson-core-2.1.5.jar jackson-databind-2.1.5.jar JSON所需 ...
- ZooKeeper-znode概念与使用
可以将ZK看作一个具有高可用性特征的文件系统.这个文件系统中没有文件和目录,而是统一使用节点(znode)的概念,称为znode.znode既可以作为保存数据的容器(如同文件),也可以作为保存其他zn ...
- yum 源的配置与使用
一.yum 简介 yum,是Yellow dog Updater, Modified 的简称,是杜克大学为了提高RPM 软件包安装性而开发的一种软件包管理器.起初是由yellow dog 这一发行版的 ...
- bzoj 2656 [Zjoi2012]数列(sequence) 递推+高精度
2656: [Zjoi2012]数列(sequence) Time Limit: 2 Sec Memory Limit: 128 MB[Submit][Status][Discuss] Descri ...