dkahgld

AAChartView.html 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <!---->
  2. <!-- Created by An An on 17/1/16.-->
  3. <!-- Copyright © 2017年 An An. All rights reserved.-->
  4. <!-- source code ----*** https://github.com/AAChartModel/AAChartKit ***--- source code-->
  5. <!---->
  6. <!--/*-->
  7. <!---->
  8. <!--* --------------------------------------------------------------------------------->
  9. <!--*-->
  10. <!--* ❀❀❀ WARM TIPS!!! ❀❀❀-->
  11. <!--*-->
  12. <!--* Please contact me on GitHub,if there are any problems encountered in use.-->
  13. <!--* GitHub Issues : https://github.com/AAChartModel/AAChartKit/issues-->
  14. <!--* --------------------------------------------------------------------------------->
  15. <!--* And if you want to contribute for this project, please contact me as well-->
  16. <!--* GitHub : https://github.com/AAChartModel-->
  17. <!--* StackOverflow : https://stackoverflow.com/users/7842508/codeforu-->
  18. <!--* JianShu : http://www.jianshu.com/u/f1e6753d4254-->
  19. <!--* SegmentFault : https://segmentfault.com/u/huanghunbieguan-->
  20. <!--*-->
  21. <!--* --------------------------------------------------------------------------------->
  22. <!---->
  23. <!--*/-->
  24. <html>
  25. <head>
  26. <meta charset="UTF-8" />
  27. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=3.0,user-scalable = no">
  28. <script src="AAJQueryLibrary.js">
  29. </script>
  30. <script src="AAHighchartsLibrary.js">
  31. </script>
  32. <script src="AAHighchartsMore.js">
  33. </script>
  34. <!-- <script src="AAHighcharts-3d.js">-->
  35. <!-- </script>-->
  36. <script src="AAFunnel.js">
  37. </script>
  38. <!-- <script src="AADrilldown.js">-->
  39. <!-- </script>-->
  40. <!-- 若介意本地js代码体积(5M左右,工程打包压缩后实际体积远小于此)过大,可换用加载网络js代码 -->
  41. <!-- <script src="https://img.hcharts.cn/jquery/jquery-1.8.3.min.js">-->
  42. <!-- </script>-->
  43. <!-- <script src="https://img.hcharts.cn/highcharts/highcharts.js">-->
  44. <!-- </script>-->
  45. <!-- <script src="https://img.hcharts.cn/highcharts/highcharts-more.js">-->
  46. <!-- </script>-->
  47. <style>
  48. *{
  49. -webkit-user-select: none;
  50. user-select: none;
  51. }
  52. </style>
  53. </head>
  54. <body>
  55. <div id="container" style="width:min-450px; height: 200px; margin: 0 auto">
  56. </div>
  57. <script >
  58. var chartMax;
  59. function loadTheHighChartView (sender,receivedWidth,receivedHeight) {
  60. var container = document.getElementById('container');//获得元素
  61. if (receivedWidth != 0) {
  62. container.style.width = receivedWidth;//设置宽度
  63. }
  64. container.style.height = receivedHeight;//设置高度
  65. var JavaScriptObject = JSON.parse(sender);
  66. if (JavaScriptObject.gradientColorEnable == true) { //开启图表渐变色功能
  67. var colors = JavaScriptObject.colors;
  68. JavaScriptObject.colors = Highcharts.map(colors, function (color) {
  69. return {
  70. linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1},
  71. stops: [
  72. [0, color],
  73. [1, Highcharts.Color(color).setOpacity(0.3).get('rgba')]
  74. ]
  75. };
  76. });
  77. }
  78. JavaScriptObject.credits = {enabled:false};//去掉表格右下角版权信息
  79. var animation = JavaScriptObject.plotOptions.series.animation;
  80. if (animation) {
  81. var animationEasingType = animation.easing;
  82. JavaScriptObject.plotOptions.series.animation.easing = configureTheChartAnimationEasingType(animationEasingType);
  83. }
  84. chartMax = Highcharts.chart('container', JavaScriptObject );
  85. }
  86. function onlyRefreshTheChartDataWithSeries (receivedSeries) {
  87. var receivedSeriesElementArr = JSON.parse(receivedSeries);
  88. for (var i = 0; i < receivedSeriesElementArr.length; i++) {
  89. var receivedSeriesData = receivedSeriesElementArr[i].data;
  90. // 获取series
  91. var chartSeries = $('#container').highcharts().series[i];
  92. // 执行只刷新数据的函数
  93. chartSeries.setData(receivedSeriesData);
  94. }
  95. }
  96. function chartSeriesContentHideOrShow (hidden) {
  97. for (var i = 0; i < chartMax.series.length; i++) {
  98. var series = chartMax.series[i];
  99. if (hidden == true) {
  100. series.hide();
  101. } else {
  102. series.show();
  103. }
  104. }
  105. }
  106. function showTheSeriesElementContentWithIndex (elementIndex) {
  107. var series = chartMax.series[elementIndex];
  108. series.show();
  109. }
  110. function configureTheChartAnimationEasingType (easingType) {
  111. var animationObject = {
  112. easeInQuad: function(pos) {
  113. return Math.pow(pos, 2);
  114. },
  115. easeOutQuad: function(pos) {
  116. return -(Math.pow((pos-1), 2) -1);
  117. },
  118. easeInOutQuad: function(pos) {
  119. if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,2);
  120. return -0.5 * ((pos-=2)*pos - 2);
  121. },
  122. easeInCubic: function(pos) {
  123. return Math.pow(pos, 3);
  124. },
  125. easeOutCubic: function(pos) {
  126. return (Math.pow((pos-1), 3) +1);
  127. },
  128. easeInOutCubic: function(pos) {
  129. if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,3);
  130. return 0.5 * (Math.pow((pos-2),3) + 2);
  131. },
  132. easeInQuart: function(pos) {
  133. return Math.pow(pos, 4);
  134. },
  135. easeOutQuart: function(pos) {
  136. return -(Math.pow((pos-1), 4) -1);
  137. },
  138. easeInOutQuart: function(pos) {
  139. if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,4);
  140. return -0.5 * ((pos-=2)*Math.pow(pos,3) - 2);
  141. },
  142. easeInQuint: function(pos) {
  143. return Math.pow(pos, 5);
  144. },
  145. easeOutQuint: function(pos) {
  146. return (Math.pow((pos-1), 5) +1);
  147. },
  148. easeInOutQuint: function(pos) {
  149. if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,5);
  150. return 0.5 * (Math.pow((pos-2),5) + 2);
  151. },
  152. easeInSine: function(pos) {
  153. return -Math.cos(pos * (Math.PI/2)) + 1;
  154. },
  155. easeOutSine: function(pos) {
  156. return Math.sin(pos * (Math.PI/2));
  157. },
  158. easeInOutSine: function(pos) {
  159. return (-0.5 * (Math.cos(Math.PI*pos) -1));
  160. },
  161. easeInExpo: function(pos) {
  162. return (pos===0) ? 0 : Math.pow(2, 10 * (pos - 1));
  163. },
  164. easeOutExpo: function(pos) {
  165. return (pos===1) ? 1 : -Math.pow(2, -10 * pos) + 1;
  166. },
  167. easeInOutExpo: function(pos) {
  168. if (pos===0) return 0;
  169. if (pos===1) return 1;
  170. if ((pos/=0.5) < 1) return 0.5 * Math.pow(2,10 * (pos-1));
  171. return 0.5 * (-Math.pow(2, -10 * --pos) + 2);
  172. },
  173. easeInCirc: function(pos) {
  174. return -(Math.sqrt(1 - (pos*pos)) - 1);
  175. },
  176. easeOutCirc: function(pos) {
  177. return Math.sqrt(1 - Math.pow((pos-1), 2));
  178. },
  179. easeInOutCirc: function(pos) {
  180. if ((pos/=0.5) < 1) return -0.5 * (Math.sqrt(1 - pos*pos) - 1);
  181. return 0.5 * (Math.sqrt(1 - (pos-=2)*pos) + 1);
  182. },
  183. easeOutBounce: function(pos) {
  184. if ((pos) < (1/2.75)) {
  185. return (7.5625*pos*pos);
  186. } else if (pos < (2/2.75)) {
  187. return (7.5625*(pos-=(1.5/2.75))*pos + 0.75);
  188. } else if (pos < (2.5/2.75)) {
  189. return (7.5625*(pos-=(2.25/2.75))*pos + 0.9375);
  190. } else {
  191. return (7.5625*(pos-=(2.625/2.75))*pos + 0.984375);
  192. }
  193. },
  194. easeInBack: function(pos) {
  195. var s = 1.70158;
  196. return (pos)*pos*((s+1)*pos - s);
  197. },
  198. easeOutBack: function(pos) {
  199. var s = 1.70158;
  200. return (pos=pos-1)*pos*((s+1)*pos + s) + 1;
  201. },
  202. easeInOutBack: function(pos) {
  203. var s = 1.70158;
  204. if ((pos/=0.5) < 1) return 0.5*(pos*pos*(((s*=(1.525))+1)*pos -s));
  205. return 0.5*((pos-=2)*pos*(((s*=(1.525))+1)*pos +s) +2);
  206. },
  207. elastic: function(pos) {
  208. return -1 * Math.pow(4,-8*pos) * Math.sin((pos*6-1)*(2*Math.PI)/2) + 1;
  209. },
  210. swingFromTo: function(pos) {
  211. var s = 1.70158;
  212. return ((pos/=0.5) < 1) ? 0.5*(pos*pos*(((s*=(1.525))+1)*pos - s)) :
  213. 0.5*((pos-=2)*pos*(((s*=(1.525))+1)*pos + s) + 2);
  214. },
  215. swingFrom: function(pos) {
  216. var s = 1.70158;
  217. return pos*pos*((s+1)*pos - s);
  218. },
  219. swingTo: function(pos) {
  220. var s = 1.70158;
  221. return (pos-=1)*pos*((s+1)*pos + s) + 1;
  222. },
  223. bounce: function(pos) {
  224. if (pos < (1/2.75)) {
  225. return (7.5625*pos*pos);
  226. } else if (pos < (2/2.75)) {
  227. return (7.5625*(pos-=(1.5/2.75))*pos + 0.75);
  228. } else if (pos < (2.5/2.75)) {
  229. return (7.5625*(pos-=(2.25/2.75))*pos + 0.9375);
  230. } else {
  231. return (7.5625*(pos-=(2.625/2.75))*pos + 0.984375);
  232. }
  233. },
  234. bouncePast: function(pos) {
  235. if (pos < (1/2.75)) {
  236. return (7.5625*pos*pos);
  237. } else if (pos < (2/2.75)) {
  238. return 2 - (7.5625*(pos-=(1.5/2.75))*pos + 0.75);
  239. } else if (pos < (2.5/2.75)) {
  240. return 2 - (7.5625*(pos-=(2.25/2.75))*pos + 0.9375);
  241. } else {
  242. return 2 - (7.5625*(pos-=(2.625/2.75))*pos + 0.984375);
  243. }
  244. },
  245. easeFromTo: function(pos) {
  246. if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,4);
  247. return -0.5 * ((pos-=2)*Math.pow(pos,3) - 2);
  248. },
  249. easeFrom: function(pos) {
  250. return Math.pow(pos,4);
  251. },
  252. easeTo: function(pos) {
  253. return Math.pow(pos,0.25);
  254. }
  255. }
  256. return animationObject[easingType];
  257. }
  258. </script>
  259. </body>
  260. </html>