jqplot.html 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>AdminLTE - jQplot</title>
  5. <meta charset="UTF-8">
  6. <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
  7. <!-- bootstrap 3.0.2 -->
  8. <link href="../css/bootstrap.min.css" rel="stylesheet" />
  9. <!-- font Awesome -->
  10. <link href="../css/font-awesome.min.css" rel="stylesheet" />
  11. <!-- jqplot stylesheet -->
  12. <link href="../js/jqplot/jquery.jqplot.css" rel="stylesheet"/>
  13. <!-- Theme style -->
  14. <link href="../theme/theme.css" rel="stylesheet" />
  15. <!-- Google font Signika -->
  16. <link href='http://fonts.googleapis.com/css?family=Signika+Negative' rel='stylesheet' type='text/css'>
  17. </head>
  18. <body>
  19. <nav class="navbar navbar-theme bg-blue navbar-static-top" role="navigation">
  20. <!-- Brand and toggle get grouped for better mobile display -->
  21. <div class="navbar-header">
  22. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
  23. <span class="sr-only">Toggle navigation</span>
  24. <span class="icon-bar"></span>
  25. <span class="icon-bar"></span>
  26. <span class="icon-bar"></span>
  27. </button>
  28. <a class="navbar-brand" href="../index.html"><span class="fa fa-shield"></span> AdminLTE</a>
  29. <a href="#" class='lte-menu-sm visible-xs navbar-brand'>
  30. <span class="fa fa-list"></span>
  31. </a>
  32. </div>
  33. <!-- Collect the nav links, forms, and other content for toggling -->
  34. <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
  35. <ul class="nav navbar-nav navbar-right">
  36. <li class="dropdown">
  37. <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-gears"></i></a>
  38. <ul class="dropdown-menu navbar-selector">
  39. <li role="presentation" class="dropdown-header font-primary noClick">Navbar Color</li>
  40. <li class="font-primary" data-color="bg-primary"><a href="#"><i class="fa fa-gear"></i> Primary</a></li>
  41. <li class="font-blue" data-color="bg-blue"><a href="#"><i class="fa fa-gear"></i> Blue <small class="text-muted">(default)</small></a></li>
  42. <li class="font-light-blue" data-color="bg-light-blue"><a href="#"><i class="fa fa-gear"></i> Light Blue</a></li>
  43. <li class="font-green" data-color="bg-green"><a href="#"><i class="fa fa-gear"></i> Green</a></li>
  44. <li class="font-yellow" data-color="bg-yellow"><a href="#"><i class="fa fa-gear"></i> Yellow</a></li>
  45. <li class="font-purple" data-color="bg-purple"><a href="#"><i class="fa fa-gear"></i> Purple</a></li>
  46. <li class="font-red" data-color="bg-red"><a href="#"><i class="fa fa-gear"></i> Red</a></li>
  47. </ul>
  48. </li>
  49. <li><a href="#"><i class="fa fa-bullhorn"></i></a></li>
  50. <li><a href="#"><i class="fa fa-envelope"></i></a></li>
  51. <li class="dropdown">
  52. <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i></a>
  53. <ul class="dropdown-menu">
  54. <li><a href="#">Profile</a></li>
  55. <li><a href="#">Friends</a></li>
  56. <li><a href="#">Settings</a></li>
  57. <li class="divider"></li>
  58. <li><a href="#">Privacy</a></li>
  59. </ul>
  60. </li>
  61. </ul>
  62. <form class="navbar-form navbar-right">
  63. <div class="form-group">
  64. <input type="text" name="search" class="form-control" placeholder="..."/>
  65. </div>
  66. </form>
  67. </div><!-- /.navbar-collapse -->
  68. </nav>
  69. <div class="lte-main-content">
  70. <!-- side bar -->
  71. <div class="lte-sidebar col-md-2 col-sm-3 hidden-xs">
  72. <ul class="lte-sidebar-menu">
  73. <li><a href="../index.html"><i class="fa fa-dashboard"></i> Dashboard</a></li>
  74. <li class="lte-tree active">
  75. <a href="#"><i class="fa fa-bar-chart-o"></i> Charts<i class="pull-right fa fa-angle-right"></i></a>
  76. <ul class="lte-tree-menu">
  77. <li><a href="../charts/flot.html"><i class="fa fa-bar-chart-o"></i> Flot</a></li>
  78. <li class="active"><a href="../charts/jqplot.html"><i class="fa fa-bar-chart-o"></i> JQplot</a></li>
  79. <li><a href="../charts/xcharts.html"><i class="fa fa-bar-chart-o"></i> xCharts</a></li>
  80. </ul>
  81. </li>
  82. <li><a href="../ui.html"><i class="fa fa-tint"></i> User Interface </a></li>
  83. <!--<li><a href="../widgets.html"><i class="fa fa-gear"></i> Widgets</a></li>-->
  84. <li class="lte-tree">
  85. <a href="#"><i class="fa fa-pagelines"></i> Example Pages <i class="pull-right fa fa-angle-right"></i></a>
  86. <ul class="lte-tree-menu">
  87. <li><a href="../examples/invoice.html"><i class="fa fa-money"></i> Invoice</a></li>
  88. <li><a href="../examples/login.html"><i class="fa fa-sign-in"></i> Login</a></li>
  89. <li><a href="../examples/register.html"><i class="fa fa-lock"></i> Register</a></li>
  90. <li><a href="../examples/blank_page.html"><i class="fa fa-paperclip"></i> Blank Page</a></li>
  91. <li><a href="../examples/404.html"><i class="fa fa-unlink"></i> 404 Error Page</a></li>
  92. <li><a href="../examples/500.html"><i class="fa fa-unlink"></i> 500 Error Page</a></li>
  93. </ul>
  94. </li>
  95. <li><a href="../forms.html"><i class="fa fa-edit"></i> Forms</a></li>
  96. <li><a href="../typography.html"><i class="fa fa-text-width"></i> Typography</a></li>
  97. <li><a href="../calendar.html"><i class="fa fa-calendar"></i> Calendar</a></li>
  98. <li class="lte-tree">
  99. <a href="#"><i class="fa fa-pagelines"></i> Multilevel Dropdown<i class="pull-right fa fa-angle-right"></i></a>
  100. <ul class="lte-tree-menu">
  101. <li class="lte-tree">
  102. <a href="#"><i class="fa fa-pagelines"></i> Level 1<i class="pull-right fa fa-angle-right"></i></a>
  103. <ul class="lte-tree-menu">
  104. <li class="lte-tree">
  105. <a href="#"><i class="fa fa-pagelines"></i> Level 2<i class="pull-right fa fa-angle-right"></i></a>
  106. <ul class="lte-tree-menu">
  107. <li><a href="#"><i class="fa fa-pagelines"></i> Level 3</a></li>
  108. </ul>
  109. </li>
  110. </ul>
  111. </li>
  112. </ul>
  113. </li>
  114. </ul>
  115. </div>
  116. <!-- /.side-bar-->
  117. <div class="lte-main-container col-md-10 col-sm-9">
  118. <!-- main content -->
  119. <div class="page-header">
  120. <i class="fa fa-bar-chart-o"></i> Jqplot Charts <small>example page</small>
  121. </div>
  122. <!-- /.page-header -->
  123. <div class='lte-dashboard'>
  124. <div class='row'>
  125. <div class='col-sm-12'>
  126. <div class='box box-blue'>
  127. <div class='box-header'>
  128. <h3 class="box-title"><i class="fa fa-bar-chart-o"></i> Line Chart</h3>
  129. <div class="box-tools">
  130. <i class="fa fa-gear"></i>
  131. <i class="fa fa-angle-down lte-hider"></i>
  132. <i class="off fa fa-times"></i>
  133. </div>
  134. </div>
  135. <div class='box-body'>
  136. <div id='chart1' class='lte-chart'></div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. <div class='row'>
  142. <div class='col-sm-6 col-sm-12'>
  143. <div class='box box-blue'>
  144. <div class='box-header'>
  145. <h3 class="box-title"><i class="fa fa-bar-chart-o"></i> Line Chart</h3>
  146. <div class="box-tools">
  147. <i class="fa fa-gear"></i>
  148. <i class="fa fa-angle-down lte-hider"></i>
  149. <i class="off fa fa-times"></i>
  150. </div>
  151. </div>
  152. <div class='box-body'>
  153. <div id='chart2' class='lte-chart'></div>
  154. </div>
  155. </div>
  156. </div>
  157. <div class='col-sm-6 col-sm-12'>
  158. <div class='box box-blue'>
  159. <div class='box-header'>
  160. <h3 class="box-title"><i class="fa fa-bar-chart-o"></i> Line Chart</h3>
  161. <div class="box-tools">
  162. <i class="fa fa-gear"></i>
  163. <i class="fa fa-angle-down lte-hider"></i>
  164. <i class="off fa fa-times"></i>
  165. </div>
  166. </div>
  167. <div class='box-body'>
  168. <div id='chart3' class='lte-chart'></div>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. <div class='row'>
  174. <div class='col-md-4 col-sm-12'>
  175. <div class='box box-blue'>
  176. <div class='box-header'>
  177. <h3 class="box-title"><i class="fa fa-bar-chart-o"></i> Pie Chart</h3>
  178. <div class="box-tools">
  179. <i class="fa fa-gear"></i>
  180. <i class="fa fa-angle-down lte-hider"></i>
  181. <i class="off fa fa-times"></i>
  182. </div>
  183. </div>
  184. <div class='box-body'>
  185. <div id='pie-chart3' class='lte-chart'></div>
  186. </div>
  187. </div>
  188. </div>
  189. <div class='col-md-4 col-sm-12'>
  190. <div class='box box-blue'>
  191. <div class='box-header'>
  192. <h3 class="box-title"><i class="fa fa-bar-chart-o"></i> Pie Chart - 2</h3>
  193. <div class="box-tools">
  194. <i class="fa fa-gear"></i>
  195. <i class="fa fa-angle-down lte-hider"></i>
  196. <i class="off fa fa-times"></i>
  197. </div>
  198. </div>
  199. <div class='box-body'>
  200. <div id='pie-chart1' class='lte-chart'></div>
  201. </div>
  202. </div>
  203. </div>
  204. <div class='col-md-4 col-sm-12'>
  205. <div class='box box-blue'>
  206. <div class='box-header'>
  207. <h3 class="box-title"><i class="fa fa-bar-chart-o"></i> Pie Chart - 3</h3>
  208. <div class="box-tools">
  209. <i class="fa fa-gear"></i>
  210. <i class="fa fa-angle-down lte-hider"></i>
  211. <i class="off fa fa-times"></i>
  212. </div>
  213. </div>
  214. <div class='box-body'>
  215. <div id='pie-chart2' class='lte-chart'></div>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. <div class='row'>
  221. <div class='col-md-4 col-sm-12'>
  222. <div class='box box-blue'>
  223. <div class='box-header'>
  224. <h3 class="box-title"><i class="fa fa-bar-chart-o"></i> Bar Chart</h3>
  225. <div class="box-tools">
  226. <i class="fa fa-gear"></i>
  227. <i class="fa fa-angle-down lte-hider"></i>
  228. <i class="off fa fa-times"></i>
  229. </div>
  230. </div>
  231. <div class='box-body'>
  232. <div id='bar-chart1' class='lte-chart'></div>
  233. </div>
  234. </div>
  235. </div>
  236. <div class='col-md-4 col-sm-12'>
  237. <div class='box box-blue'>
  238. <div class='box-header'>
  239. <h3 class="box-title"><i class="fa fa-bar-chart-o"></i> Bar Chart - 2</h3>
  240. <div class="box-tools">
  241. <i class="fa fa-gear"></i>
  242. <i class="fa fa-angle-down lte-hider"></i>
  243. <i class="off fa fa-times"></i>
  244. </div>
  245. </div>
  246. <div class='box-body'>
  247. <div id='bar-chart2' class='lte-chart'></div>
  248. </div>
  249. </div>
  250. </div>
  251. <div class='col-md-4 col-sm-12'>
  252. <div class='box box-blue'>
  253. <div class='box-header'>
  254. <h3 class="box-title"><i class="fa fa-bar-chart-o"></i> Bar Chart - 3</h3>
  255. <div class="box-tools">
  256. <i class="fa fa-gear"></i>
  257. <i class="fa fa-angle-down lte-hider"></i>
  258. <i class="off fa fa-times"></i>
  259. </div>
  260. </div>
  261. <div class='box-body'>
  262. <div id='bar-chart3' class='lte-chart'></div>
  263. </div>
  264. </div>
  265. </div>
  266. </div>
  267. </div><!-- /.lte-dashboard -->
  268. </div><!-- ./lte-main-container -->
  269. </div>
  270. <!-- ./.lte-main-content -->
  271. <footer>
  272. Copyright &copy; 2013 - <a>Preview</a> - <a>Purchase</a> - Built with <a target="blank" href="http://getbootstrap.com">Bootstrap 3</a>
  273. </footer>
  274. <!-- JQuery 1.10.2 -> Important -->
  275. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  276. <!-- Bootstrap -> Important-->
  277. <script src="../js/bootstrap.min.js" type="text/javascript"></script>
  278. <!-- LTE Tree -> Important -->
  279. <script src="../js/lteTree.js" type="text/javascript"></script>
  280. <!-- LTE App -->
  281. <script src="../js/lteApp.js" type="text/javascript"></script>
  282. <!-- jqplot -->
  283. <script src="../js/jqplot/jquery.jqplot.min.js" type="text/javascript"></script>
  284. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.dateAxisRenderer.min.js"></script>
  285. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.logAxisRenderer.min.js"></script>
  286. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>
  287. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js"></script>
  288. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
  289. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.highlighter.min.js"></script>
  290. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.barRenderer.min.js"></script>
  291. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.pieRenderer.min.js"></script>
  292. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.donutRenderer.min.js"></script>
  293. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>
  294. <script type="text/javascript" src="../js/jqplot/plugins/jqplot.pointLabels.min.js"></script>
  295. <script type="text/javascript">
  296. $(function() {
  297. $.jqplot._noToImageButton = true;
  298. var currYear = [["2011-08-01", 796.01], ["2011-08-02", 510.5], ["2011-08-03", 527.8],
  299. ["2011-08-05", 420.36], ["2011-08-06", 219.47], ["2011-08-07", 333.82], ["2011-08-08", 660.55],
  300. ["2011-08-10", 521], ["2011-08-11", 660.68], ["2011-08-12", 928.65], ["2011-08-13", 864.26],
  301. ["2011-08-15", 623.86], ["2011-08-16", 1300.05], ["2011-08-17", 972.25], ["2011-08-18", 661.98],
  302. ["2011-08-20", 1546.23], ["2011-08-21", 593], ["2011-08-22", 560.25], ["2011-08-23", 857.8],
  303. ["2011-08-25", 1256.14], ["2011-08-26", 1033.01], ["2011-08-27", 811.63], ["2011-08-28", 735.01],
  304. ["2011-08-31", 1177], ["2011-09-01", 1023.66], ["2011-09-02", 1442.31], ["2011-09-03", 1299.24],
  305. ["2011-09-09", 4118.48], ["2011-09-10", 1988.11], ["2011-09-11", 1485.89], ["2011-09-12", 2681.97],
  306. ["2011-09-13", 1679.56], ["2011-09-14", 3538.43], ["2011-09-15", 3118.01], ["2011-09-16", 4198.97],
  307. ["2011-09-17", 3020.44], ["2011-09-18", 3383.45], ["2011-09-19", 2148.91], ["2011-09-20", 3058.82],
  308. ["2011-09-25", 2785.93], ["2011-09-26", 4329.7], ["2011-09-27", 3493.72], ["2011-09-28", 4440.55], ["2011-10-3", 6200.2]];
  309. var plot1 = $.jqplot("chart1", [currYear], {
  310. seriesColors: ["#0c5175"],
  311. highlighter: {
  312. show: true,
  313. sizeAdjust: 1,
  314. tooltipOffset: 9
  315. },
  316. grid: {
  317. background: 'rgba(57,57,57,0.0)',
  318. drawBorder: false,
  319. shadow: false,
  320. gridLineColor: '#eeeeee',
  321. gridLineWidth: 2
  322. },
  323. legend: {
  324. show: false,
  325. placement: 'inside'
  326. },
  327. seriesDefaults: {
  328. rendererOptions: {
  329. smooth: true,
  330. animation: {
  331. show: true
  332. }
  333. },
  334. showMarker: false
  335. },
  336. series: [
  337. {
  338. fill: false,
  339. label: '2012',
  340. shadow: false
  341. }
  342. ],
  343. axesDefaults: {
  344. rendererOptions: {
  345. baselineWidth: 1.5,
  346. baselineColor: '#444444',
  347. drawBaseline: false
  348. }
  349. },
  350. axes: {
  351. xaxis: {
  352. renderer: $.jqplot.DateAxisRenderer,
  353. tickRenderer: $.jqplot.CanvasAxisTickRenderer,
  354. tickOptions: {
  355. formatString: "%b %e",
  356. angle: -30,
  357. textColor: '#444444'
  358. },
  359. min: "2011-08-01",
  360. max: "2011-09-30",
  361. tickInterval: "7 days",
  362. drawMajorGridlines: false
  363. },
  364. yaxis: {
  365. renderer: $.jqplot.LogAxisRenderer,
  366. pad: 0,
  367. rendererOptions: {
  368. minorTicks: 1
  369. },
  370. tickOptions: {
  371. formatString: "%'d",
  372. showMark: false
  373. }
  374. }
  375. }
  376. });
  377. var s1 = [3200, 5633, 8921, 7842];
  378. var ticks = ['Jun', 'Jul', 'Aug', 'Sep'];
  379. var plot2 = $.jqplot('bar-chart1', [s1], {
  380. // Only animate if we're not using excanvas (not in IE 7 or IE 8)..
  381. animate: !$.jqplot.use_excanvas,
  382. grid: {
  383. background: 'rgba(57,57,57,0.0)',
  384. drawBorder: false,
  385. shadow: false,
  386. gridLineColor: '#ffffff',
  387. gridLineWidth: 2
  388. },
  389. seriesDefaults: {
  390. renderer: $.jqplot.BarRenderer,
  391. pointLabels: {show: true},
  392. shadow: false,
  393. color: "#52b9e9"
  394. },
  395. axes: {
  396. xaxis: {
  397. renderer: $.jqplot.CategoryAxisRenderer,
  398. ticks: ticks
  399. },
  400. yaxis: {
  401. show: false
  402. }
  403. },
  404. highlighter: {show: false}
  405. });
  406. var data = [
  407. ['Heavy Industry', 12], ['Retail', 9], ['Light Industry', 14],
  408. ['Out of home', 16], ['Commuting', 7], ['Orientation', 9]
  409. ];
  410. var plot3 = jQuery.jqplot('pie-chart1', [data],
  411. {
  412. grid: {
  413. background: 'rgba(57,57,57,0.0)',
  414. drawBorder: false,
  415. shadow: false,
  416. gridLineColor: '#eeeeee',
  417. gridLineWidth: 2
  418. },
  419. seriesDefaults: {
  420. // Make this a pie chart.
  421. renderer: jQuery.jqplot.PieRenderer,
  422. rendererOptions: {
  423. // Put data labels on the pie slices.
  424. // By default, labels show the percentage of the slice.
  425. showDataLabels: true
  426. }
  427. },
  428. legend: {show: true, location: 'e'}
  429. }
  430. );
  431. var data = [
  432. ['Heavy Industry', 12], ['Retail', 9], ['Light Industry', 14],
  433. ['Out of home', 16], ['Commuting', 7], ['Orientation', 9]
  434. ];
  435. var plot4 = jQuery.jqplot('pie-chart2', [data],
  436. {
  437. grid: {
  438. background: 'rgba(57,57,57,0.0)',
  439. drawBorder: false,
  440. shadow: false,
  441. gridLineColor: '#eeeeee',
  442. gridLineWidth: 2
  443. },
  444. seriesDefaults: {
  445. renderer: jQuery.jqplot.PieRenderer,
  446. rendererOptions: {
  447. // Turn off filling of slices.
  448. fill: false,
  449. showDataLabels: true,
  450. // Add a margin to seperate the slices.
  451. sliceMargin: 4,
  452. // stroke the slices with a little thicker line.
  453. lineWidth: 5
  454. }
  455. },
  456. legend: {show: true, location: 'e'}
  457. }
  458. );
  459. var current_nav_color = "bg-blue";
  460. $(".navbar-selector li").not(".noClick").click(function(e) {
  461. e.preventDefault();
  462. var bg = $(this).data("color");
  463. $(".navbar-theme").removeClass(current_nav_color).addClass(bg);
  464. current_nav_color = bg;
  465. });
  466. //Remove widget when clicking the times icon
  467. $(".box > .box-header > .box-tools > .off").click(function(e) {
  468. e.preventDefault();
  469. $(this).parents(".box").first().hide();
  470. });
  471. //LTE Tree
  472. $(".lte-tree").lteTree();
  473. var s1 = [['a', 6], ['b', 8], ['c', 14], ['d', 20]];
  474. var s2 = [['a', 8], ['b', 12], ['c', 6], ['d', 9]];
  475. var plot5 = $.jqplot('pie-chart3', [s1, s2], {
  476. grid: {
  477. background: 'rgba(57,57,57,0.0)',
  478. drawBorder: false,
  479. shadow: false,
  480. gridLineColor: '#eeeeee',
  481. gridLineWidth: 2
  482. },
  483. seriesDefaults: {
  484. // make this a donut chart.
  485. renderer: $.jqplot.DonutRenderer,
  486. rendererOptions: {
  487. // Donut's can be cut into slices like pies.
  488. sliceMargin: 3,
  489. // Pies and donuts can start at any arbitrary angle.
  490. startAngle: -90,
  491. showDataLabels: true,
  492. // By default, data labels show the percentage of the donut/pie.
  493. // You can show the data 'value' or data 'label' instead.
  494. dataLabels: 'value'
  495. }
  496. }
  497. });
  498. var s1 = [200, 600, 700, 1000];
  499. var s2 = [460, -210, 690, 820];
  500. var s3 = [-260, -440, 320, 200];
  501. // Can specify a custom tick Array.
  502. // Ticks should match up one for each y value (category) in the series.
  503. var ticks = ['May', 'June', 'July', 'August'];
  504. var plot6 = $.jqplot('bar-chart2', [s1, s2, s3], {
  505. grid: {
  506. background: 'rgba(57,57,57,0.0)',
  507. drawBorder: false,
  508. shadow: false,
  509. gridLineColor: '#ffffff',
  510. gridLineWidth: 2
  511. },
  512. // The "seriesDefaults" option is an options object that will
  513. // be applied to all series in the chart.
  514. seriesDefaults: {
  515. renderer: $.jqplot.BarRenderer,
  516. rendererOptions: {fillToZero: true}
  517. },
  518. // Custom labels for the series are specified with the "label"
  519. // option on the series option. Here a series option object
  520. // is specified for each series.
  521. series: [
  522. {label: 'Hotel'},
  523. {label: 'Event Regristration'},
  524. {label: 'Airfare'}
  525. ],
  526. // Show the legend and put it outside the grid, but inside the
  527. // plot container, shrinking the grid to accomodate the legend.
  528. // A value of "outside" would not shrink the grid and allow
  529. // the legend to overflow the container.
  530. legend: {
  531. show: false,
  532. placement: 'inside'
  533. },
  534. axes: {
  535. // Use a category axis on the x axis and use our custom ticks.
  536. xaxis: {
  537. renderer: $.jqplot.CategoryAxisRenderer,
  538. ticks: ticks
  539. },
  540. // Pad the y axis just a little so bars can get close to, but
  541. // not touch, the grid boundaries. 1.2 is the default padding.
  542. yaxis: {
  543. pad: 1.05,
  544. tickOptions: {formatString: '$%d'}
  545. }
  546. }
  547. });
  548. // For horizontal bar charts, x an y values must will be "flipped"
  549. // from their vertical bar counterpart.
  550. var plot7 = $.jqplot('bar-chart3', [
  551. [[2, 1], [4, 2], [6, 3], [3, 4]],
  552. [[5, 1], [1, 2], [3, 3], [4, 4]],
  553. [[4, 1], [7, 2], [1, 3], [2, 4]]], {
  554. grid: {
  555. background: 'rgba(57,57,57,0.0)',
  556. drawBorder: false,
  557. shadow: false,
  558. gridLineColor: '#ffffff',
  559. gridLineWidth: 2
  560. },
  561. seriesDefaults: {
  562. renderer: $.jqplot.BarRenderer,
  563. // Show point labels to the right ('e'ast) of each bar.
  564. // edgeTolerance of -15 allows labels flow outside the grid
  565. // up to 15 pixels. If they flow out more than that, they
  566. // will be hidden.
  567. pointLabels: {show: true, location: 'e', edgeTolerance: -15},
  568. // Rotate the bar shadow as if bar is lit from top right.
  569. shadowAngle: 135,
  570. // Here's where we tell the chart it is oriented horizontally.
  571. rendererOptions: {
  572. barDirection: 'horizontal'
  573. }
  574. },
  575. axes: {
  576. yaxis: {
  577. renderer: $.jqplot.CategoryAxisRenderer
  578. }
  579. }
  580. });
  581. // Some simple loops to build up data arrays.
  582. var cosPoints = [];
  583. for (var i = 0; i < 2 * Math.PI; i += 0.4) {
  584. cosPoints.push([i, Math.cos(i)]);
  585. }
  586. var sinPoints = [];
  587. for (var i = 0; i < 2 * Math.PI; i += 0.4) {
  588. sinPoints.push([i, 2 * Math.sin(i - .8)]);
  589. }
  590. var powPoints1 = [];
  591. for (var i = 0; i < 2 * Math.PI; i += 0.4) {
  592. powPoints1.push([i, 2.5 + Math.pow(i / 4, 2)]);
  593. }
  594. var powPoints2 = [];
  595. for (var i = 0; i < 2 * Math.PI; i += 0.4) {
  596. powPoints2.push([i, -2.5 - Math.pow(i / 4, 2)]);
  597. }
  598. var plot8 = $.jqplot('chart2', [cosPoints, sinPoints, powPoints1, powPoints2],
  599. {
  600. grid: {
  601. background: 'rgba(57,57,57,0.0)',
  602. drawBorder: false,
  603. shadow: false,
  604. gridLineColor: '#eeeeee',
  605. gridLineWidth: 2
  606. },
  607. title: 'Line Style Options',
  608. // Series options are specified as an array of objects, one object
  609. // for each series.
  610. series: [
  611. {
  612. // Change our line width and use a diamond shaped marker.
  613. lineWidth: 2,
  614. markerOptions: {style: 'dimaond'}
  615. },
  616. {
  617. // Don't show a line, just show markers.
  618. // Make the markers 7 pixels with an 'x' style
  619. showLine: false,
  620. markerOptions: {size: 7, style: "x"}
  621. },
  622. {
  623. // Use (open) circlular markers.
  624. markerOptions: {style: "circle"}
  625. },
  626. {
  627. // Use a thicker, 5 pixel line and 10 pixel
  628. // filled square markers.
  629. lineWidth: 5,
  630. markerOptions: {style: "filledSquare", size: 10}
  631. }
  632. ],
  633. axes: {
  634. xaxis: {
  635. drawMajorGridlines: false
  636. },
  637. yaxis: {
  638. rendererOptions: {
  639. minorTicks: 1
  640. }
  641. }
  642. }
  643. }
  644. );
  645. var plot9 = $.jqplot('chart3', [[3, 7, 9, 1, 4, 6, 8, 2, 5]], {
  646. grid: {
  647. background: 'rgba(57,57,57,0.0)',
  648. drawBorder: false,
  649. shadow: false,
  650. gridLineColor: '#eeeeee',
  651. gridLineWidth: 2
  652. },
  653. // Give the plot a title.
  654. title: 'Plot With Options',
  655. // You can specify options for all axes on the plot at once with
  656. // the axesDefaults object. Here, we're using a canvas renderer
  657. // to draw the axis label which allows rotated text.
  658. axesDefaults: {
  659. labelRenderer: $.jqplot.CanvasAxisLabelRenderer
  660. },
  661. // An axes object holds options for all axes.
  662. // Allowable axes are xaxis, x2axis, yaxis, y2axis, y3axis, ...
  663. // Up to 9 y axes are supported.
  664. axes: {
  665. // options for each axis are specified in seperate option objects.
  666. xaxis: {
  667. label: "X Axis",
  668. // Turn off "padding". This will allow data point to lie on the
  669. // edges of the grid. Default padding is 1.2 and will keep all
  670. // points inside the bounds of the grid.
  671. pad: 0,
  672. drawMajorGridlines: false
  673. },
  674. yaxis: {
  675. rendererOptions: {
  676. minorTicks: 1
  677. },
  678. label: "Y Axis"
  679. }
  680. }
  681. });
  682. $(window).resize(function() {
  683. plot1.replot({resetAxes: true});
  684. plot2.replot({resetAxes: true});
  685. plot3.replot({resetAxes: true});
  686. plot4.replot({resetAxes: true});
  687. plot5.replot({resetAxes: true});
  688. plot6.replot({resetAxes: true});
  689. plot7.replot({resetAxes: true});
  690. plot8.replot({resetAxes: true});
  691. plot9.replot({resetAxes: true});
  692. });
  693. });
  694. </script>
  695. </body>
  696. </html>