1. $.fn.extend({
  2. Zhu: function (option) {
  3. var id = $(this).attr("id");
  4. $('#' + id).highcharts({
  5. chart: {
  6. type: 'column'
  7. },
  8. title: {
  9. text: option.title
  10. },
  11. xAxis: {
  12. categories: option.cate,
  13. crosshair: true
  14. },
  15. yAxis: {
  16. min: 0,
  17. title: {
  18. text: option.ytext
  19. }
  20. },
  21. tooltip: {
  22. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  23. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  24. '<td style="padding:0"><b>{point.y:.1f} ' + option.unit + '</b></td></tr>',
  25. footerFormat: '</table>',
  26. shared: true,
  27. useHTML: true
  28. },
  29. plotOptions: {
  30. column: {
  31. pointPadding: 0.2,
  32. borderWidth: 0
  33. }
  34. },
  35. series: option.series
  36. });
  37. },
  38. Pie: function (option) {
  39. var id = $(this).attr("id");
  40. $('#' + id).highcharts({
  41. chart: {
  42. plotBackgroundColor: null,
  43. plotBorderWidth: null,
  44. plotShadow: false
  45. },
  46. title: {
  47. text: option.title
  48. },
  49. tooltip: {
  50. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  51. },
  52. plotOptions: {
  53. pie: {
  54. allowPointSelect: true,
  55. cursor: 'pointer',
  56. dataLabels: {
  57. enabled: false
  58. },
  59. showInLegend: true
  60. }
  61. },
  62. series: [{
  63. type: 'pie',
  64. name: option.name,
  65. data: option.series
  66. }]
  67. })
  68. },
  69. BarPlus: function (option) {
  70. var id = $(this).attr("id");
  71. $('#' + id).highcharts({
  72. chart: {
  73. type: 'bar'
  74. },
  75. title: {
  76. text: option.title
  77. },
  78. xAxis: {
  79. categories: option.cate
  80. },
  81. yAxis: {
  82. min: 0,
  83. title: {
  84. text: option.ytext
  85. }
  86. },
  87. legend: {
  88. reversed: true
  89. },
  90. plotOptions: {
  91. series: {
  92. stacking: 'normal'
  93. }
  94. },
  95. series: option.series
  96. });
  97. },
  98. PieCol: function (option) {
  99. var id = $(this).attr("id");
  100. $('<div class="chart1" id="' + id + '1">')
  101. .appendTo('#' + id)
  102. .highcharts({
  103. chart: {
  104. plotBackgroundColor: null,
  105. plotBorderWidth: null,
  106. plotShadow: false
  107. },
  108. title: {
  109. text: option.title
  110. },
  111. tooltip: {
  112. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  113. },
  114. plotOptions: {
  115. pie: {
  116. allowPointSelect: true,
  117. cursor: 'pointer',
  118. dataLabels: {
  119. enabled: false
  120. },
  121. showInLegend: true
  122. }
  123. },
  124. series: [{
  125. type: 'pie',
  126. name: option.name,
  127. data: option.series,
  128. events: {
  129. click: function (event) {
  130. $.post(option.url, { pKey: event.point.name, begin: $("#dtpBegin").val(), end: $("#dtpEnd").val(), brand: $("#brand").val() }, function (e) {
  131. var obj = eval('(' + e + ')');
  132. $('#' + id + "2").highcharts({
  133. chart: {
  134. type: 'column'
  135. },
  136. title: {
  137. text: event.point.name
  138. },
  139. xAxis: {
  140. categories: [event.point.name],
  141. visible: false
  142. },
  143. yAxis: {
  144. min: 0,
  145. title: {
  146. text: ''
  147. },
  148. visible: false
  149. },
  150. tooltip: {
  151. pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
  152. shared: true
  153. },
  154. plotOptions: {
  155. column: {
  156. stacking: 'percent'
  157. }
  158. },
  159. series: obj
  160. });
  161. })
  162. }
  163. }
  164. }]
  165. });
  166. $('<div class="chart2" id="' + id + '2">').appendTo('#' + id);
  167. },
  168. PiePie: function (option) {
  169. var id = $(this).attr("id");
  170. $('<div class="chart3" id="' + id + '1">')
  171. .appendTo('#' + id)
  172. .highcharts({
  173. chart: {
  174. plotBackgroundColor: null,
  175. plotBorderWidth: null,
  176. plotShadow: false
  177. },
  178. title: {
  179. text: option.title
  180. },
  181. tooltip: {
  182. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  183. },
  184. plotOptions: {
  185. pie: {
  186. allowPointSelect: true,
  187. cursor: 'pointer',
  188. dataLabels: {
  189. enabled: false
  190. },
  191. showInLegend: true
  192. }
  193. },
  194. series: [{
  195. type: 'pie',
  196. name: option.name,
  197. data: option.series,
  198. events: {
  199. click: function (event) {
  200. $.post(option.url, { pKey: event.point.name, begin: $("#dtpBegin").val(), end: $("#dtpEnd").val(), brand: $("#brand").val() }, function (e) {
  201. var obj = eval('(' + e + ')');
  202. $('#' + id + "2").highcharts({
  203. chart: {
  204. plotBackgroundColor: null,
  205. plotBorderWidth: null,
  206. plotShadow: false
  207. },
  208. title: {
  209. text: event.point.name
  210. },
  211. tooltip: {
  212. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  213. },
  214. plotOptions: {
  215. pie: {
  216. allowPointSelect: true,
  217. cursor: 'pointer',
  218. dataLabels: {
  219. enabled: false
  220. },
  221. showInLegend: true
  222. }
  223. },
  224. series: [{
  225. type: 'pie',
  226. name: '占比',
  227. data: obj,
  228. events: {
  229. click: function (event) {
  230. if (cb1 != null && cb1 != undefined) {
  231. cb1(event);
  232. }
  233. }
  234. }
  235. }]
  236. });
  237. })
  238. }
  239. }
  240. }]
  241. });
  242. $('<div class="chart4" id="' + id + '2">').appendTo('#' + id);
  243. },
  244. BarLeft: function (option) {
  245. var id = $(this).attr("id");
  246. var cate = ['描述相符', '服务态度', '物流服务'];
  247. $('#' + id).highcharts({
  248. chart: {
  249. type: 'bar'
  250. },
  251. title: {
  252. text: option.title
  253. },
  254. xAxis: [{
  255. categories: cate,
  256. reversed: false,
  257. labels: {
  258. step: 1
  259. }
  260. }, { // mirror axis on right side
  261. opposite: true,
  262. reversed: false,
  263. categories: cate,
  264. linkedTo: 0,
  265. labels: {
  266. step: 1
  267. }
  268. }],
  269. yAxis: {
  270. title: {
  271. text: null
  272. },
  273. labels: {
  274. formatter: function () {
  275. return this.value;
  276. }
  277. },
  278. min: -10,
  279. max: 10
  280. },
  281. plotOptions: {
  282. series: {
  283. stacking: 'normal'
  284. }
  285. },
  286. tooltip: {
  287. formatter: function () {
  288. return '<b>' + this.series.name + ', ' + this.point.category + '</b><br/>' +
  289. '数量: ' + Highcharts.numberFormat(Math.abs(this.point.y), 0);
  290. }
  291. },
  292. series: [{
  293. name: '低于4.7(不含)店铺',
  294. data: option.series1,
  295. events: {
  296. click: function (event) {
  297. if (cb2 != null && cb2 != undefined) {
  298. cb2(event, this);
  299. }
  300. }
  301. }
  302. }, {
  303. name: '高于4.9(不含)店铺',
  304. data: option.series2,
  305. events: {
  306. click: function (event) {
  307. if (cb2 != null && cb2 != undefined) {
  308. cb2(event, this);
  309. }
  310. }
  311. }
  312. }]
  313. });
  314. }
  315. })
  316. 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. jQuery之DOM操作大全

    jQuery属性操作 获取元素属性的语法:attr(name) 例子:$("#img1").attr("src"); 设置元素单个属性的语法:attr(key, ...

  2. PHP字符串函数大全

    无论哪种编程语言,字符串操作都是一个重要的基础,往往简单而重要.PHP为我们提供了大量的字符串操作函数,功能强大,使用也比较简单.在这里结合实例总结分析PHP字符串函数的功能. 1.addcslash ...

  3. cocos2dx打飞机项目笔记四:Enemy类和EnemyLayer类

    Enemy类没什么内容,就create和init方法,根据参数来创建不同的敌机,头文件代码如下: //飞机的类型 enum planeType {smallPlane, midPlane, bigPl ...

  4. php5.6 连接SQL SERVER

    PHP Fatal error: Call to undefined function sqlsrv_connect() in php链接sqlserver出现该错误: 原因是:php5.3 及以上版 ...

  5. MIPI DBI\DPI\DSI简介【转】

    本文转载自:http://blog.csdn.net/longxiaowu/article/details/24249971 (1)DBI接口 A,也就是通常所讲的MCU借口,俗称80 system接 ...

  6. [转载]Spring配置文件详解一:

    原文地址:与base-package="com.xx">Spring配置文件详解一:<context:annotation-config/>与<contex ...

  7. SpringMVC中响应json数据(异步传送)

    1.首先导入3个jar包: jackson-annotations-2.1.5.jar jackson-core-2.1.5.jar jackson-databind-2.1.5.jar JSON所需 ...

  8. ZooKeeper-znode概念与使用

    可以将ZK看作一个具有高可用性特征的文件系统.这个文件系统中没有文件和目录,而是统一使用节点(znode)的概念,称为znode.znode既可以作为保存数据的容器(如同文件),也可以作为保存其他zn ...

  9. yum 源的配置与使用

    一.yum 简介 yum,是Yellow dog Updater, Modified 的简称,是杜克大学为了提高RPM 软件包安装性而开发的一种软件包管理器.起初是由yellow dog 这一发行版的 ...

  10. bzoj 2656 [Zjoi2012]数列(sequence) 递推+高精度

    2656: [Zjoi2012]数列(sequence) Time Limit: 2 Sec  Memory Limit: 128 MB[Submit][Status][Discuss] Descri ...