charts.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881
  1. /* --------------------------------------------------------
  2. Flot Charts
  3. -----------------------------------------------------------*/
  4. //Line Chart
  5. $(function () {
  6. var data = [];
  7. data.push({
  8. "label": "昨天",
  9. "data": [[1, 39], [3, 20], [5, 12], [7, 13], [9, 25], [11, 20], [13, 31],[15, 21],[17, 11],[19, 41],[21, 34],[23, 28]]
  10. },{
  11. "label": "今天",
  12. "data": [[1, 29], [3, 30], [5, 6], [7, 23], [9, 15], [11, 27], [13, 9],[15, 31],[17, 21],[19, 11],[21, 30],[23, 18]]
  13. });
  14. if ($('#line-chart')[0]) {
  15. $.plot('#line-chart', data,
  16. {
  17. series: {
  18. lines: {
  19. show: true,
  20. lineWidth: 1,
  21. fill: 0.25,
  22. },
  23. //color: 'rgba(255,255,255,0.7)',
  24. shadowSize: 0,
  25. points: {
  26. show: true,
  27. }
  28. },
  29. yaxis: {
  30. min: 0,
  31. max: 100,
  32. tickColor: 'rgba(255,255,255,0.15)',
  33. tickDecimals: 0,
  34. font :{
  35. lineHeight: 13,
  36. style: "normal",
  37. color: "rgba(255,255,255,0.8)",
  38. },
  39. shadowSize: 0,
  40. },
  41. xaxis: {
  42. tickColor: 'rgba(255,255,255,0)',
  43. tickDecimals: 0,
  44. ticks: [[1, "01:00"], [3, "03:00"], [5, "05:00"], [7, "07:00"], [9, "09:00"], [11, "11:00"],[13,"13:00"],[15,"15:00"],[17,"17:00"],[19,"19:00"],[21,"21:00"],[23,"23:00"]],
  45. font :{
  46. lineHeight: 13,
  47. style: "normal",
  48. color: "rgba(255,255,255,0.8)",
  49. }
  50. },
  51. grid: {
  52. borderWidth: 1,
  53. borderColor: 'rgba(255,255,255,0.25)',
  54. labelMargin:10,
  55. hoverable: true,
  56. clickable: true,
  57. mouseActiveRadius:6,
  58. },
  59. legend: {
  60. show: true,
  61. position:"se",
  62. backgroundColor:'rgba(243,249,241,0.35)',
  63. noColumns:2
  64. }
  65. });
  66. $("#line-chart").bind("plothover", function (event, pos, item) {
  67. if (item) {
  68. var x = item.datapoint[0].toFixed(2),
  69. y = item.datapoint[1].toFixed(2);
  70. $("#linechart-tooltip").html(item.series.label + " of " + x + " = " + y).css({top: item.pageY+5, left: item.pageX+5}).fadeIn(200);
  71. }
  72. else {
  73. $("#linechart-tooltip").hide();
  74. }
  75. });
  76. $("<div id='linechart-tooltip' class='chart-tooltip'></div>").appendTo("body");
  77. }
  78. });
  79. //Bar Chart
  80. $(function () {
  81. if ($("#bar-chart")[0]) {
  82. var data1 = [[1,60], [2,30], [3,50], [4,100], [5,10], [6,90], [7,85], [8,40], [9,5]];
  83. var data2 = [[1,20], [2,90], [3,60], [4,40], [5,100], [6,25], [7,65], [8,5], [9,70]];
  84. var data3 = [[1,100], [2,20], [3,60], [4,90], [5,80], [6,10], [7,5], [8,15], [9,50]];
  85. var barData = new Array();
  86. barData.push({
  87. data : data1,
  88. label: 'Product 1',
  89. bars : {
  90. show : true,
  91. barWidth : 0.1,
  92. order : 1,
  93. fill:1,
  94. lineWidth: 0,
  95. fillColor: 'rgba(255,255,255,0.6)'
  96. }
  97. });
  98. barData.push({
  99. data : data2,
  100. label: 'Product 2',
  101. bars : {
  102. show : true,
  103. barWidth : 0.1,
  104. order : 2,
  105. fill:1,
  106. lineWidth: 0,
  107. fillColor: 'rgba(255,255,255,0.8)'
  108. }
  109. });
  110. barData.push({
  111. data : data3,
  112. label: 'Product 3',
  113. bars : {
  114. show : true,
  115. barWidth : 0.1,
  116. order : 3,
  117. fill:1,
  118. lineWidth: 0,
  119. fillColor: 'rgba(255,255,255,0.3)'
  120. },
  121. });
  122. //Display graph
  123. $.plot($("#bar-chart"), barData, {
  124. grid : {
  125. borderWidth: 1,
  126. borderColor: 'rgba(255,255,255,0.25)',
  127. show : true,
  128. hoverable : true,
  129. clickable : true,
  130. },
  131. yaxis: {
  132. tickColor: 'rgba(255,255,255,0.15)',
  133. tickDecimals: 0,
  134. font :{
  135. lineHeight: 13,
  136. style: "normal",
  137. color: "rgba(255,255,255,0.8)",
  138. },
  139. shadowSize: 0,
  140. },
  141. xaxis: {
  142. tickColor: 'rgba(255,255,255,0)',
  143. tickDecimals: 0,
  144. font :{
  145. lineHeight: 13,
  146. style: "normal",
  147. color: "rgba(255,255,255,0.8)",
  148. },
  149. shadowSize: 0,
  150. },
  151. legend : true,
  152. tooltip : true,
  153. tooltipOpts : {
  154. content : "<b>%x</b> = <span>%y</span>",
  155. defaultTheme : false
  156. }
  157. });
  158. $("#bar-chart").bind("plothover", function (event, pos, item) {
  159. if (item) {
  160. var x = item.datapoint[0].toFixed(2),
  161. y = item.datapoint[1].toFixed(2);
  162. $("#barchart-tooltip").html(item.series.label + " of " + x + " = " + y).css({top: item.pageY+5, left: item.pageX+5}).fadeIn(200);
  163. }
  164. else {
  165. $("#barchart-tooltip").hide();
  166. }
  167. });
  168. $("<div id='barchart-tooltip' class='chart-tooltip'></div>").appendTo("body");
  169. }
  170. });
  171. //Pie Chart
  172. $(function(){
  173. var pieData = [
  174. {data: 1, color: 'rgba(255,255,255,0.2)'},
  175. {data: 2, color: 'rgba(255,255,255,0.8)'},
  176. {data: 3, color: 'rgba(255,255,255,0.5)'},
  177. {data: 4, color: 'rgba(255,255,255,0.1)'},
  178. {data: 4, color: 'rgba(255,255,255,0.9)'},
  179. ];
  180. if($('#donut-chart')[0]){
  181. $.plot('#donut-chart', pieData, {
  182. series: {
  183. pie: {
  184. innerRadius: 0.5,
  185. show: true,
  186. stroke: {
  187. width: 0,
  188. },
  189. fill: 1,
  190. fillColor: {
  191. colors : ['rgba(255, 255, 255, 0.5)', 'rgba(0, 215, 76, 0.8)', 'rgba(255,255,255,0.8)']
  192. }
  193. }
  194. }
  195. });
  196. }
  197. if($('#pie-chart')[0]){
  198. $.plot('#pie-chart', pieData, {
  199. series: {
  200. pie: {
  201. show: true,
  202. stroke: {
  203. width: 0,
  204. },
  205. /*label: {
  206. show: true,
  207. radius: 3/4,
  208. formatter: function(label, series){
  209. return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">'+label+'<br/>'+Math.round(series.percent)+'%</div>';
  210. },
  211. background: {
  212. opacity: 0.5,
  213. color: '#000'
  214. }
  215. }*/
  216. }
  217. }
  218. });
  219. }
  220. });
  221. //Dynamic Chart
  222. $(function() {
  223. if ($('#dynamic-chart')[0]) {
  224. var data = [],
  225. totalPoints = 300;
  226. function getRandomData() {
  227. if (data.length > 0)
  228. data = data.slice(1);
  229. while (data.length < totalPoints) {
  230. var prev = data.length > 0 ? data[data.length - 1] : 50,
  231. y = prev + Math.random() * 10 - 5;
  232. if (y < 0) {
  233. y = 0;
  234. } else if (y > 90) {
  235. y = 90;
  236. }
  237. data.push(y);
  238. }
  239. var res = [];
  240. for (var i = 0; i < data.length; ++i) {
  241. res.push([i, data[i]])
  242. }
  243. return res;
  244. }
  245. var updateInterval = 300;
  246. var plot = $.plot("#dynamic-chart", [ getRandomData() ], {
  247. series: {
  248. label: "Data",
  249. lines: {
  250. show: true,
  251. lineWidth: 1,
  252. fill: 0.25,
  253. fillColor: {
  254. colors: [{
  255. opacity: 0.1
  256. }, {
  257. opacity: 1
  258. }]
  259. }
  260. },
  261. color: 'rgba(173,255,47,0.4)',
  262. shadowSize: 1,
  263. },
  264. yaxis: {
  265. min: 0,
  266. max: 100,
  267. tickColor: 'rgba(255,255,255,0.15)',
  268. font :{
  269. lineHeight: 13,
  270. style: "normal",
  271. color: "rgba(255,255,255,0.8)",
  272. },
  273. shadowSize: 0,
  274. },
  275. xaxis: {
  276. tickColor: 'rgba(255,255,255,0.15)',
  277. show: true,
  278. font :{
  279. lineHeight: 13,
  280. style: "normal",
  281. color: "rgba(255,255,255,0.8)",
  282. },
  283. shadowSize: 0,
  284. min: 0,
  285. max: 250
  286. },
  287. grid: {
  288. borderWidth: 1,
  289. borderColor: 'rgba(255,255,255,0.25)',
  290. labelMargin:10,
  291. hoverable: true,
  292. clickable: true,
  293. mouseActiveRadius:6,
  294. },
  295. legend: {
  296. show: false
  297. }
  298. });
  299. function update() {
  300. plot.setData([getRandomData()]);
  301. // Since the axes don't change, we don't need to call plot.setupGrid()
  302. plot.draw();
  303. setTimeout(update, updateInterval);
  304. }
  305. update();
  306. $("#dynamic-chart").bind("plothover", function (event, pos, item) {
  307. if (item) {
  308. var x = item.datapoint[0].toFixed(2),
  309. y = item.datapoint[1].toFixed(2);
  310. $("#dynamic-chart-tooltip").html(item.series.label + " of " + x + " = " + y).css({top: item.pageY+5, left: item.pageX+5}).fadeIn(200);
  311. }
  312. else {
  313. $("#dynamic-chart-tooltip").hide();
  314. }
  315. });
  316. $("<div id='dynamic-chart-tooltip' class='chart-tooltip'></div>").appendTo("body");
  317. }
  318. });
  319. /* --------------------------------------------------------
  320. Sparkline
  321. -----------------------------------------------------------*/
  322. (function(){
  323. //Bar
  324. $("#stats-bar-1").sparkline([6,4,8,6,5,6,7,8,3,5,9,5,8,3], {
  325. type: 'bar',
  326. height: '50px',
  327. barWidth: 4,
  328. barColor: '#fff',
  329. barSpacing: 3,
  330. });
  331. $("#stats-bar-2").sparkline([4,7,6,2,5,3,8,6], {
  332. type: 'bar',
  333. height: '50px',
  334. barWidth: 4,
  335. barColor: '#fff',
  336. barSpacing: 3
  337. });
  338. $("#stats-bar-3").sparkline([4,7,6,2,5,3,8,6], {
  339. type: 'bar',
  340. height: '50px',
  341. barWidth: 4,
  342. barColor: '#fff',
  343. barSpacing: 3
  344. });
  345. //Line
  346. //Line Chart
  347. $(function () {
  348. var data = [];
  349. var data1 = [];
  350. var data2 = [];
  351. var data3 = [];
  352. var data4 = [];
  353. data.push({
  354. "label": "2016",
  355. "data": [[1, 39], [2, 20], [3, 12], [4, 13], [5, 25], [6, 20], [7, 31],[8, 33],[9, 41],[10, 21],[11, 13],[12, 42]]
  356. },{
  357. "label": "2015",
  358. "data": [[1, 29], [2, 10], [3, 22], [4, 18.5], [5, 29], [6, 23], [7, 13.8],[8, 37],[9, 21],[10, 21],[11, 23],[12, 32]]
  359. });
  360. data1.push({
  361. "label": "2016",
  362. "data": [[1, 9], [2, 18], [3, 12.7], [4, 23.6], [5, 16.5], [6, 30.7], [7, 23.9],[8, 33.9],[9, 32.8],[10, 21.7],[11, 23],[12, 32.6]]
  363. },{
  364. "label": "2015",
  365. "data": [[1, 19], [2, 20], [3, 12], [4, 18.5], [5, 29.7], [6, 23], [7, 33.8],[8, 27],[9, 31],[10, 21.6],[11, 23.9],[12, 22]]
  366. });
  367. data2.push({
  368. "label": "2016",
  369. "data": [[1, 12], [2, 30], [3, 22], [4, 13], [5, 15], [6, 30], [7, 21],[8, 13],[9, 31],[10, 29],[11, 33],[12, 22]]
  370. },{
  371. "label": "2015",
  372. "data": [[1, 21], [2, 20], [3, 12], [4, 18.5], [5, 19], [6, 33], [7, 23.8],[8, 27],[9, 23],[10, 31],[11, 13],[12, 32]]
  373. });
  374. data3.push({
  375. "label": "2016",
  376. "data": [[1, 39], [2, 10], [3, 22], [4, 18], [5, 15], [6, 30], [7, 21],[8, 13],[9, 31],[10, 29],[11, 13],[12, 42]]
  377. },{
  378. "label": "2015",
  379. "data": [[1, 29], [2, 10], [3, 22], [4, 18.5], [5, 29], [6, 23], [7, 13.8],[8, 37],[9, 21],[10, 11],[11, 33],[12, 22.8]]
  380. });
  381. data4.push({
  382. "label": "2016",
  383. "data": [[1, 29], [2, 10], [3, 18.6], [4, 13.3], [5, 25.7], [6, 20.6], [7, 21.2],[8, 23.8],[9, 11.9],[10, 21.7],[11, 33.2],[12, 12]]
  384. },{
  385. "label": "2015",
  386. "data": [[1, 29], [2, 10], [3, 22], [4, 18.5], [5, 29], [6, 23], [7, 13.8],[8, 37],[9, 21],[10, 21],[11, 23],[12, 32]]
  387. });
  388. if ($('#stats-line-2')[0]) {
  389. /**总能耗*/
  390. $.plot('#stats-line-2', data,
  391. {
  392. series: {
  393. lines: {
  394. show: true,
  395. lineWidth: 1,
  396. fill: 0.25,
  397. },
  398. //color: 'rgba(255,255,255,0.7)',
  399. shadowSize: 0,
  400. points: {
  401. show: true,
  402. }
  403. },
  404. yaxis: {
  405. min: 0,
  406. max: 40,
  407. tickColor: 'rgba(255,255,255,0.15)',
  408. tickDecimals: 0,
  409. font :{
  410. lineHeight: 13,
  411. style: "normal",
  412. color: "rgba(255,255,255,0.8)",
  413. },
  414. shadowSize: 0,
  415. },
  416. xaxis: {
  417. tickColor: 'rgba(255,255,255,0)',
  418. tickDecimals: 0,
  419. font :{
  420. lineHeight: 13,
  421. style: "normal",
  422. color: "rgba(255,255,255,0.8)",
  423. }
  424. },
  425. grid: {
  426. borderWidth: 1,
  427. borderColor: 'rgba(255,255,255,0.25)',
  428. labelMargin:10,
  429. hoverable: true,
  430. clickable: true,
  431. mouseActiveRadius:6,
  432. },
  433. legend: {
  434. show: true,
  435. noColumns: 2,
  436. backgroundColor:'rgba(240,240,244,1)',
  437. position:'se'
  438. }
  439. });
  440. $.plot('#stats-line-3', data1,
  441. {
  442. series: {
  443. lines: {
  444. show: true,
  445. lineWidth: 1,
  446. fill: 0.25,
  447. },
  448. //color: 'rgba(255,255,255,0.7)',
  449. shadowSize: 0,
  450. points: {
  451. show: true,
  452. }
  453. },
  454. yaxis: {
  455. min: 0,
  456. max: 40,
  457. tickColor: 'rgba(255,255,255,0.15)',
  458. tickDecimals: 0,
  459. font :{
  460. lineHeight: 13,
  461. style: "normal",
  462. color: "rgba(255,255,255,0.8)",
  463. },
  464. shadowSize: 0,
  465. },
  466. xaxis: {
  467. tickColor: 'rgba(255,255,255,0)',
  468. tickDecimals: 0,
  469. font :{
  470. lineHeight: 13,
  471. style: "normal",
  472. color: "rgba(255,255,255,0.8)",
  473. }
  474. },
  475. grid: {
  476. borderWidth: 1,
  477. borderColor: 'rgba(255,255,255,0.25)',
  478. labelMargin:10,
  479. hoverable: true,
  480. clickable: true,
  481. mouseActiveRadius:6,
  482. },
  483. legend: {
  484. show: true,
  485. noColumns: 2,
  486. backgroundColor:'rgba(240,240,244,1)',
  487. position:'se'
  488. }
  489. });
  490. $.plot('#stats-line-4', data2,
  491. {
  492. series: {
  493. lines: {
  494. show: true,
  495. lineWidth: 1,
  496. fill: 0.25,
  497. },
  498. //color: 'rgba(255,255,255,0.7)',
  499. shadowSize: 0,
  500. points: {
  501. show: true,
  502. }
  503. },
  504. yaxis: {
  505. min: 0,
  506. max: 40,
  507. tickColor: 'rgba(255,255,255,0.15)',
  508. tickDecimals: 0,
  509. font :{
  510. lineHeight: 13,
  511. style: "normal",
  512. color: "rgba(255,255,255,0.8)",
  513. },
  514. shadowSize: 0,
  515. },
  516. xaxis: {
  517. tickColor: 'rgba(255,255,255,0)',
  518. tickDecimals: 0,
  519. font :{
  520. lineHeight: 13,
  521. style: "normal",
  522. color: "rgba(255,255,255,0.8)",
  523. }
  524. },
  525. grid: {
  526. borderWidth: 1,
  527. borderColor: 'rgba(255,255,255,0.25)',
  528. labelMargin:10,
  529. hoverable: true,
  530. clickable: true,
  531. mouseActiveRadius:6,
  532. },
  533. legend: {
  534. show: true,
  535. noColumns: 2,
  536. backgroundColor:'rgba(240,240,244,1)',
  537. position:'se'
  538. }
  539. });
  540. $.plot('#stats-line', data3,
  541. {
  542. series: {
  543. lines: {
  544. show: true,
  545. lineWidth: 1,
  546. fill: 0.25,
  547. },
  548. //color: 'rgba(255,255,255,0.7)',
  549. shadowSize: 0,
  550. points: {
  551. show: true,
  552. }
  553. },
  554. yaxis: {
  555. min: 0,
  556. max: 40,
  557. tickColor: 'rgba(255,255,255,0.15)',
  558. tickDecimals: 0,
  559. font :{
  560. lineHeight: 13,
  561. style: "normal",
  562. color: "rgba(255,255,255,0.8)",
  563. },
  564. shadowSize: 0,
  565. },
  566. xaxis: {
  567. tickColor: 'rgba(255,255,255,0)',
  568. tickDecimals: 0,
  569. font :{
  570. lineHeight: 13,
  571. style: "normal",
  572. color: "rgba(255,255,255,0.8)",
  573. }
  574. },
  575. grid: {
  576. borderWidth: 1,
  577. borderColor: 'rgba(255,255,255,0.25)',
  578. labelMargin:10,
  579. hoverable: true,
  580. clickable: true,
  581. mouseActiveRadius:6,
  582. },
  583. legend: {
  584. show: true,
  585. noColumns: 2,
  586. backgroundColor:'rgba(240,240,244,1)',
  587. position:'se'
  588. }
  589. });
  590. $.plot('#stats-line-x', data4,
  591. {
  592. series: {
  593. lines: {
  594. show: true,
  595. lineWidth: 1,
  596. fill: 0.25,
  597. },
  598. //color: 'rgba(255,255,255,0.7)',
  599. shadowSize: 0,
  600. points: {
  601. show: true,
  602. }
  603. },
  604. yaxis: {
  605. min: 0,
  606. max: 40,
  607. tickColor: 'rgba(255,255,255,0.15)',
  608. tickDecimals: 0,
  609. font :{
  610. lineHeight: 13,
  611. style: "normal",
  612. color: "rgba(255,255,255,0.8)",
  613. },
  614. shadowSize: 0,
  615. },
  616. xaxis: {
  617. tickColor: 'rgba(255,255,255,0)',
  618. tickDecimals: 0,
  619. font :{
  620. lineHeight: 13,
  621. style: "normal",
  622. color: "rgba(255,255,255,0.8)",
  623. }
  624. },
  625. grid: {
  626. borderWidth: 1,
  627. borderColor: 'rgba(255,255,255,0.25)',
  628. labelMargin:10,
  629. hoverable: true,
  630. clickable: true,
  631. mouseActiveRadius:6,
  632. },
  633. legend: {
  634. show: true,
  635. noColumns: 2,
  636. backgroundColor:'rgba(240,240,244,1)',
  637. position:'se'
  638. }
  639. });
  640. $("div[id^='stats-line-']").bind("plothover", function (event, pos, item) {
  641. if (item) {
  642. var x = item.datapoint[0]+"月",
  643. y = item.datapoint[1].toFixed(2);
  644. $("#linechart-tooltip").html(item.series.label + " 年 " + x + " = " + y).css({top: item.pageY+5, left: item.pageX+5}).fadeIn(200);
  645. }
  646. else {
  647. $("#linechart-tooltip").hide();
  648. }
  649. });
  650. $("<div id='linechart-tooltip' class='chart-tooltip'></div>").appendTo("body");
  651. }
  652. });
  653. $("#stats-line-5").sparkline([10,9,12,10,9,13,11,12,11,10,12], {
  654. type: 'line',
  655. height: '65',
  656. width: '80',
  657. lineColor: 'rgba(255,255,255,0.4)',
  658. fillColor: 'rgba(0,0,0,0.2)',
  659. lineWidth: 1.25,
  660. barWidth: 5,
  661. barColor: '#C5CED6',
  662. });
  663. $("#stats-line-6").sparkline([7,2,7,5,7,6,5,6,3,5,9,8,6,7,4], {
  664. type: 'line',
  665. height: '65',
  666. width: '80',
  667. lineColor: 'rgba(255,255,255,0.85)',
  668. fillColor: 'rgba(0,0,0,0.2)',
  669. barWidth: 5,
  670. barColor: '#C5CED6',
  671. lineWidth: 1.25,
  672. });
  673. //Tristate
  674. $("#stats-tristate").sparkline([2,2,-2,2,-2,-2,2,2,2,2,2], {
  675. type: 'tristate',
  676. width: '100%',
  677. height: '52',
  678. barWidth: 4,
  679. barSpacing: 3,
  680. zeroAxis: false,
  681. posBarColor: '#fff',
  682. negBarColor: '#fff',
  683. zeroBarColor: '#fff',
  684. lineWidth: 0,
  685. lineColor: 'rgba(0,0,0,0)',
  686. });
  687. })();
  688. /* --------------------------------------------------------
  689. Map
  690. -----------------------------------------------------------*/
  691. $(function(){
  692. //USA Map
  693. if($('#usa-map')[0]) {
  694. $('#usa-map').vectorMap({
  695. map: 'us_aea_en',
  696. backgroundColor: 'rgba(0,0,0,0.25)',
  697. regionStyle: {
  698. initial: {
  699. fill: 'rgba(255,2552,255,0.7)'
  700. },
  701. hover: {
  702. fill: '#fff'
  703. },
  704. },
  705. zoomMin:0.88,
  706. focusOn:{
  707. x: 5,
  708. y: 1,
  709. scale: 1.8
  710. },
  711. markerStyle: {
  712. initial: {
  713. fill: '#e80000',
  714. stroke: 'rgba(0,0,0,0.4)',
  715. "fill-opacity": 2,
  716. "stroke-width": 7,
  717. "stroke-opacity": 0.5,
  718. r: 4
  719. },
  720. hover: {
  721. stroke: 'black',
  722. "stroke-width": 2,
  723. },
  724. selected: {
  725. fill: 'blue'
  726. },
  727. selectedHover: {
  728. }
  729. },
  730. zoomOnScroll: false,
  731. markers :[
  732. {latLng: [33, -86], name: '西宁移动1#基站能耗过高'},
  733. {latLng: [33.7, -93], name: '青海移动设计院办公室空调系统故障'},
  734. {latLng: [36, -79], name: '移动设计院锅炉出现故障'},
  735. {latLng: [29, -99], name: '移动3#基站信号故障'},
  736. {latLng: [33, -95], name: '海东市移动公司新风系统温度过高'},
  737. {latLng: [31, -92], name: '移动2#基站供暖系统故障'},
  738. ],
  739. });
  740. }
  741. //World Map
  742. if($('#world-map')[0]) {
  743. $('#world-map').vectorMap({
  744. map: 'world_mill_en',
  745. backgroundColor: 'rgba(0,0,0,0)',
  746. series: {
  747. regions: [{
  748. scale: ['#C8EEFF', '#0071A4'],
  749. normalizeFunction: 'polynomial'
  750. }]
  751. },
  752. regionStyle: {
  753. initial: {
  754. fill: 'rgba(255,2552,255,0.7)'
  755. },
  756. hover: {
  757. fill: '#fff'
  758. },
  759. },
  760. });
  761. }
  762. });
  763. /* --------------------------------------------------------
  764. Easy Pie Charts
  765. -----------------------------------------------------------*/
  766. $(function() {
  767. $('.pie-chart-tiny').easyPieChart({
  768. easing: 'easeOutBounce',
  769. barColor: 'rgba(0,255,255,0.75)',
  770. trackColor: 'rgba(0,0,0,0.3)',
  771. scaleColor: 'rgba(255,255,255,0.3)',
  772. lineCap: 'square',
  773. lineWidth: 4,
  774. size: 100,
  775. animate: 3000,
  776. onStep: function(from, to, percent) {
  777. $(this.el).find('.percent').text(Math.round(percent));
  778. }
  779. });
  780. var chart = window.chart = $('.pie-chart-tiny').data('easyPieChart');
  781. $('.pie-chart-tiny .pie-title > i').on('click', function() {
  782. $(this).closest('.pie-chart-tiny').data('easyPieChart').update(Math.random()*200-100);
  783. });
  784. });