index.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Flot Examples: Pie Charts</title>
  6. <link href="../examples.css" rel="stylesheet" type="text/css">
  7. <style type="text/css">
  8. .demo-container {
  9. position: relative;
  10. height: 400px;
  11. }
  12. #placeholder {
  13. width: 550px;
  14. }
  15. #menu {
  16. position: absolute;
  17. top: 20px;
  18. left: 625px;
  19. bottom: 20px;
  20. right: 20px;
  21. width: 200px;
  22. }
  23. #menu button {
  24. display: inline-block;
  25. width: 200px;
  26. padding: 3px 0 2px 0;
  27. margin-bottom: 4px;
  28. background: #eee;
  29. border: 1px solid #999;
  30. border-radius: 2px;
  31. font-size: 16px;
  32. -o-box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  33. -ms-box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  34. -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  35. -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  36. box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  37. cursor: pointer;
  38. }
  39. #description {
  40. margin: 15px 10px 20px 10px;
  41. }
  42. #code {
  43. display: block;
  44. width: 870px;
  45. padding: 15px;
  46. margin: 10px auto;
  47. border: 1px dashed #999;
  48. background-color: #f8f8f8;
  49. font-size: 16px;
  50. line-height: 20px;
  51. color: #666;
  52. }
  53. ul {
  54. font-size: 10pt;
  55. }
  56. ul li {
  57. margin-bottom: 0.5em;
  58. }
  59. ul.options li {
  60. list-style: none;
  61. margin-bottom: 1em;
  62. }
  63. ul li i {
  64. color: #999;
  65. }
  66. </style>
  67. <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
  68. <script language="javascript" type="text/javascript" src="../../jquery.js"></script>
  69. <script language="javascript" type="text/javascript" src="../../jquery.flot.js"></script>
  70. <script language="javascript" type="text/javascript" src="../../jquery.flot.pie.js"></script>
  71. <script type="text/javascript">
  72. $(function() {
  73. // Example Data
  74. //var data = [
  75. // { label: "Series1", data: 10},
  76. // { label: "Series2", data: 30},
  77. // { label: "Series3", data: 90},
  78. // { label: "Series4", data: 70},
  79. // { label: "Series5", data: 80},
  80. // { label: "Series6", data: 110}
  81. //];
  82. //var data = [
  83. // { label: "Series1", data: [[1,10]]},
  84. // { label: "Series2", data: [[1,30]]},
  85. // { label: "Series3", data: [[1,90]]},
  86. // { label: "Series4", data: [[1,70]]},
  87. // { label: "Series5", data: [[1,80]]},
  88. // { label: "Series6", data: [[1,0]]}
  89. //];
  90. //var data = [
  91. // { label: "Series A", data: 0.2063},
  92. // { label: "Series B", data: 38888}
  93. //];
  94. // Randomly Generated Data
  95. var data = [],
  96. series = Math.floor(Math.random() * 6) + 3;
  97. for (var i = 0; i < series; i++) {
  98. data[i] = {
  99. label: "Series" + (i + 1),
  100. data: Math.floor(Math.random() * 100) + 1
  101. }
  102. }
  103. var placeholder = $("#placeholder");
  104. $("#example-1").click(function() {
  105. placeholder.unbind();
  106. $("#title").text("Default pie chart");
  107. $("#description").text("The default pie chart with no options set.");
  108. $.plot(placeholder, data, {
  109. series: {
  110. pie: {
  111. show: true
  112. }
  113. }
  114. });
  115. setCode([
  116. "$.plot('#placeholder', data, {",
  117. " series: {",
  118. " pie: {",
  119. " show: true",
  120. " }",
  121. " }",
  122. "});"
  123. ]);
  124. });
  125. $("#example-2").click(function() {
  126. placeholder.unbind();
  127. $("#title").text("Default without legend");
  128. $("#description").text("The default pie chart when the legend is disabled. Since the labels would normally be outside the container, the chart is resized to fit.");
  129. $.plot(placeholder, data, {
  130. series: {
  131. pie: {
  132. show: true
  133. }
  134. },
  135. legend: {
  136. show: false
  137. }
  138. });
  139. setCode([
  140. "$.plot('#placeholder', data, {",
  141. " series: {",
  142. " pie: {",
  143. " show: true",
  144. " }",
  145. " },",
  146. " legend: {",
  147. " show: false",
  148. " }",
  149. "});"
  150. ]);
  151. });
  152. $("#example-3").click(function() {
  153. placeholder.unbind();
  154. $("#title").text("Custom Label Formatter");
  155. $("#description").text("Added a semi-transparent background to the labels and a custom labelFormatter function.");
  156. $.plot(placeholder, data, {
  157. series: {
  158. pie: {
  159. show: true,
  160. radius: 1,
  161. label: {
  162. show: true,
  163. radius: 1,
  164. formatter: labelFormatter,
  165. background: {
  166. opacity: 0.8
  167. }
  168. }
  169. }
  170. },
  171. legend: {
  172. show: false
  173. }
  174. });
  175. setCode([
  176. "$.plot('#placeholder', data, {",
  177. " series: {",
  178. " pie: {",
  179. " show: true,",
  180. " radius: 1,",
  181. " label: {",
  182. " show: true,",
  183. " radius: 1,",
  184. " formatter: labelFormatter,",
  185. " background: {",
  186. " opacity: 0.8",
  187. " }",
  188. " }",
  189. " }",
  190. " },",
  191. " legend: {",
  192. " show: false",
  193. " }",
  194. "});"
  195. ]);
  196. });
  197. $("#example-4").click(function() {
  198. placeholder.unbind();
  199. $("#title").text("Label Radius");
  200. $("#description").text("Slightly more transparent label backgrounds and adjusted the radius values to place them within the pie.");
  201. $.plot(placeholder, data, {
  202. series: {
  203. pie: {
  204. show: true,
  205. radius: 1,
  206. label: {
  207. show: true,
  208. radius: 3/4,
  209. formatter: labelFormatter,
  210. background: {
  211. opacity: 0.5
  212. }
  213. }
  214. }
  215. },
  216. legend: {
  217. show: false
  218. }
  219. });
  220. setCode([
  221. "$.plot('#placeholder', data, {",
  222. " series: {",
  223. " pie: {",
  224. " show: true,",
  225. " radius: 1,",
  226. " label: {",
  227. " show: true,",
  228. " radius: 3/4,",
  229. " formatter: labelFormatter,",
  230. " background: {",
  231. " opacity: 0.5",
  232. " }",
  233. " }",
  234. " }",
  235. " },",
  236. " legend: {",
  237. " show: false",
  238. " }",
  239. "});"
  240. ]);
  241. });
  242. $("#example-5").click(function() {
  243. placeholder.unbind();
  244. $("#title").text("Label Styles #1");
  245. $("#description").text("Semi-transparent, black-colored label background.");
  246. $.plot(placeholder, data, {
  247. series: {
  248. pie: {
  249. show: true,
  250. radius: 1,
  251. label: {
  252. show: true,
  253. radius: 3/4,
  254. formatter: labelFormatter,
  255. background: {
  256. opacity: 0.5,
  257. color: "#000"
  258. }
  259. }
  260. }
  261. },
  262. legend: {
  263. show: false
  264. }
  265. });
  266. setCode([
  267. "$.plot('#placeholder', data, {",
  268. " series: {",
  269. " pie: { ",
  270. " show: true,",
  271. " radius: 1,",
  272. " label: {",
  273. " show: true,",
  274. " radius: 3/4,",
  275. " formatter: labelFormatter,",
  276. " background: { ",
  277. " opacity: 0.5,",
  278. " color: '#000'",
  279. " }",
  280. " }",
  281. " }",
  282. " },",
  283. " legend: {",
  284. " show: false",
  285. " }",
  286. "});"
  287. ]);
  288. });
  289. $("#example-6").click(function() {
  290. placeholder.unbind();
  291. $("#title").text("Label Styles #2");
  292. $("#description").text("Semi-transparent, black-colored label background placed at pie edge.");
  293. $.plot(placeholder, data, {
  294. series: {
  295. pie: {
  296. show: true,
  297. radius: 3/4,
  298. label: {
  299. show: true,
  300. radius: 3/4,
  301. formatter: labelFormatter,
  302. background: {
  303. opacity: 0.5,
  304. color: "#000"
  305. }
  306. }
  307. }
  308. },
  309. legend: {
  310. show: false
  311. }
  312. });
  313. setCode([
  314. "$.plot('#placeholder', data, {",
  315. " series: {",
  316. " pie: {",
  317. " show: true,",
  318. " radius: 3/4,",
  319. " label: {",
  320. " show: true,",
  321. " radius: 3/4,",
  322. " formatter: labelFormatter,",
  323. " background: {",
  324. " opacity: 0.5,",
  325. " color: '#000'",
  326. " }",
  327. " }",
  328. " }",
  329. " },",
  330. " legend: {",
  331. " show: false",
  332. " }",
  333. "});"
  334. ]);
  335. });
  336. $("#example-7").click(function() {
  337. placeholder.unbind();
  338. $("#title").text("Hidden Labels");
  339. $("#description").text("Labels can be hidden if the slice is less than a given percentage of the pie (10% in this case).");
  340. $.plot(placeholder, data, {
  341. series: {
  342. pie: {
  343. show: true,
  344. radius: 1,
  345. label: {
  346. show: true,
  347. radius: 2/3,
  348. formatter: labelFormatter,
  349. threshold: 0.1
  350. }
  351. }
  352. },
  353. legend: {
  354. show: false
  355. }
  356. });
  357. setCode([
  358. "$.plot('#placeholder', data, {",
  359. " series: {",
  360. " pie: {",
  361. " show: true,",
  362. " radius: 1,",
  363. " label: {",
  364. " show: true,",
  365. " radius: 2/3,",
  366. " formatter: labelFormatter,",
  367. " threshold: 0.1",
  368. " }",
  369. " }",
  370. " },",
  371. " legend: {",
  372. " show: false",
  373. " }",
  374. "});"
  375. ]);
  376. });
  377. $("#example-8").click(function() {
  378. placeholder.unbind();
  379. $("#title").text("Combined Slice");
  380. $("#description").text("Multiple slices less than a given percentage (5% in this case) of the pie can be combined into a single, larger slice.");
  381. $.plot(placeholder, data, {
  382. series: {
  383. pie: {
  384. show: true,
  385. combine: {
  386. color: "#999",
  387. threshold: 0.05
  388. }
  389. }
  390. },
  391. legend: {
  392. show: false
  393. }
  394. });
  395. setCode([
  396. "$.plot('#placeholder', data, {",
  397. " series: {",
  398. " pie: {",
  399. " show: true,",
  400. " combine: {",
  401. " color: '#999',",
  402. " threshold: 0.1",
  403. " }",
  404. " }",
  405. " },",
  406. " legend: {",
  407. " show: false",
  408. " }",
  409. "});"
  410. ]);
  411. });
  412. $("#example-9").click(function() {
  413. placeholder.unbind();
  414. $("#title").text("Rectangular Pie");
  415. $("#description").text("The radius can also be set to a specific size (even larger than the container itself).");
  416. $.plot(placeholder, data, {
  417. series: {
  418. pie: {
  419. show: true,
  420. radius: 500,
  421. label: {
  422. show: true,
  423. formatter: labelFormatter,
  424. threshold: 0.1
  425. }
  426. }
  427. },
  428. legend: {
  429. show: false
  430. }
  431. });
  432. setCode([
  433. "$.plot('#placeholder', data, {",
  434. " series: {",
  435. " pie: {",
  436. " show: true,",
  437. " radius: 500,",
  438. " label: {",
  439. " show: true,",
  440. " formatter: labelFormatter,",
  441. " threshold: 0.1",
  442. " }",
  443. " }",
  444. " },",
  445. " legend: {",
  446. " show: false",
  447. " }",
  448. "});"
  449. ]);
  450. });
  451. $("#example-10").click(function() {
  452. placeholder.unbind();
  453. $("#title").text("Tilted Pie");
  454. $("#description").text("The pie can be tilted at an angle.");
  455. $.plot(placeholder, data, {
  456. series: {
  457. pie: {
  458. show: true,
  459. radius: 1,
  460. tilt: 0.5,
  461. label: {
  462. show: true,
  463. radius: 1,
  464. formatter: labelFormatter,
  465. background: {
  466. opacity: 0.8
  467. }
  468. },
  469. combine: {
  470. color: "#999",
  471. threshold: 0.1
  472. }
  473. }
  474. },
  475. legend: {
  476. show: false
  477. }
  478. });
  479. setCode([
  480. "$.plot('#placeholder', data, {",
  481. " series: {",
  482. " pie: {",
  483. " show: true,",
  484. " radius: 1,",
  485. " tilt: 0.5,",
  486. " label: {",
  487. " show: true,",
  488. " radius: 1,",
  489. " formatter: labelFormatter,",
  490. " background: {",
  491. " opacity: 0.8",
  492. " }",
  493. " },",
  494. " combine: {",
  495. " color: '#999',",
  496. " threshold: 0.1",
  497. " }",
  498. " }",
  499. " },",
  500. " legend: {",
  501. " show: false",
  502. " }",
  503. "});",
  504. ]);
  505. });
  506. $("#example-11").click(function() {
  507. placeholder.unbind();
  508. $("#title").text("Donut Hole");
  509. $("#description").text("A donut hole can be added.");
  510. $.plot(placeholder, data, {
  511. series: {
  512. pie: {
  513. innerRadius: 0.5,
  514. show: true
  515. }
  516. }
  517. });
  518. setCode([
  519. "$.plot('#placeholder', data, {",
  520. " series: {",
  521. " pie: {",
  522. " innerRadius: 0.5,",
  523. " show: true",
  524. " }",
  525. " }",
  526. "});"
  527. ]);
  528. });
  529. $("#example-12").click(function() {
  530. placeholder.unbind();
  531. $("#title").text("Interactivity");
  532. $("#description").text("The pie can be made interactive with hover and click events.");
  533. $.plot(placeholder, data, {
  534. series: {
  535. pie: {
  536. show: true
  537. }
  538. },
  539. grid: {
  540. hoverable: true,
  541. clickable: true
  542. }
  543. });
  544. setCode([
  545. "$.plot('#placeholder', data, {",
  546. " series: {",
  547. " pie: {",
  548. " show: true",
  549. " }",
  550. " },",
  551. " grid: {",
  552. " hoverable: true,",
  553. " clickable: true",
  554. " }",
  555. "});"
  556. ]);
  557. placeholder.bind("plothover", function(event, pos, obj) {
  558. if (!obj) {
  559. return;
  560. }
  561. var percent = parseFloat(obj.series.percent).toFixed(2);
  562. $("#hover").html("<span style='font-weight:bold; color:" + obj.series.color + "'>" + obj.series.label + " (" + percent + "%)</span>");
  563. });
  564. placeholder.bind("plotclick", function(event, pos, obj) {
  565. if (!obj) {
  566. return;
  567. }
  568. percent = parseFloat(obj.series.percent).toFixed(2);
  569. alert("" + obj.series.label + ": " + percent + "%");
  570. });
  571. });
  572. // Show the initial default chart
  573. $("#example-1").click();
  574. // Add the Flot version string to the footer
  575. $("#footer").prepend("Flot " + $.plot.version + " &ndash; ");
  576. });
  577. // A custom label formatter used by several of the plots
  578. function labelFormatter(label, series) {
  579. return "<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>" + label + "<br/>" + Math.round(series.percent) + "%</div>";
  580. }
  581. //
  582. function setCode(lines) {
  583. $("#code").text(lines.join("\n"));
  584. }
  585. </script>
  586. </head>
  587. <body>
  588. <div id="header">
  589. <h2>Pie Charts</h2>
  590. </div>
  591. <div id="content">
  592. <h3 id="title"></h3>
  593. <div class="demo-container">
  594. <div id="placeholder" class="demo-placeholder"></div>
  595. <div id="menu">
  596. <button id="example-1">Default Options</button>
  597. <button id="example-2">Without Legend</button>
  598. <button id="example-3">Label Formatter</button>
  599. <button id="example-4">Label Radius</button>
  600. <button id="example-5">Label Styles #1</button>
  601. <button id="example-6">Label Styles #2</button>
  602. <button id="example-7">Hidden Labels</button>
  603. <button id="example-8">Combined Slice</button>
  604. <button id="example-9">Rectangular Pie</button>
  605. <button id="example-10">Tilted Pie</button>
  606. <button id="example-11">Donut Hole</button>
  607. <button id="example-12">Interactivity</button>
  608. </div>
  609. </div>
  610. <p id="description"></p>
  611. <h3>Source Code</h3>
  612. <pre><code id="code"></code></pre>
  613. <br/>
  614. <h2>Pie Options</h2>
  615. <ul class="options">
  616. <li style="border-bottom: 1px dotted #ccc;"><b>option:</b> <i>default value</i> - Description of option</li>
  617. <li><b>show:</b> <i>false</i> - Enable the plugin and draw as a pie.</li>
  618. <li><b>radius:</b> <i>'auto'</i> - Sets the radius of the pie. If value is between 0 and 1 (inclusive) then it will use that as a percentage of the available space (size of the container), otherwise it will use the value as a direct pixel length. If set to 'auto', it will be set to 1 if the legend is enabled and 3/4 if not.</li>
  619. <li><b>innerRadius:</b> <i>0</i> - Sets the radius of the donut hole. If value is between 0 and 1 (inclusive) then it will use that as a percentage of the radius, otherwise it will use the value as a direct pixel length.</li>
  620. <li><b>startAngle:</b> <i>3/2</i> - Factor of PI used for the starting angle (in radians) It can range between 0 and 2 (where 0 and 2 have the same result).</li>
  621. <li><b>tilt:</b> <i>1</i> - Percentage of tilt ranging from 0 and 1, where 1 has no change (fully vertical) and 0 is completely flat (fully horizontal -- in which case nothing actually gets drawn).</li>
  622. <li><b>shadow:</b> <ul>
  623. <li><b>top:</b> <i>5</i> - Vertical distance in pixel of the tilted pie shadow.</li>
  624. <li><b>left:</b> <i>15</i> - Horizontal distance in pixel of the tilted pie shadow.</li>
  625. <li><b>alpha:</b> <i>0.02</i> - Alpha value of the tilted pie shadow.</li>
  626. </ul>
  627. <li><b>offset:</b> <ul>
  628. <li><b>top:</b> <i>0</i> - Pixel distance to move the pie up and down (relative to the center).</li>
  629. <li><b>left:</b> <i>'auto'</i> - Pixel distance to move the pie left and right (relative to the center).</li>
  630. </ul>
  631. <li><b>stroke:</b> <ul>
  632. <li><b>color:</b> <i>'#FFF'</i> - Color of the border of each slice. Hexadecimal color definitions are prefered (other formats may or may not work).</li>
  633. <li><b>width:</b> <i>1</i> - Pixel width of the border of each slice.</li>
  634. </ul>
  635. <li><b>label:</b> <ul>
  636. <li><b>show:</b> <i>'auto'</i> - Enable/Disable the labels. This can be set to true, false, or 'auto'. When set to 'auto', it will be set to false if the legend is enabled and true if not.</li>
  637. <li><b>radius:</b> <i>1</i> - Sets the radius at which to place the labels. If value is between 0 and 1 (inclusive) then it will use that as a percentage of the available space (size of the container), otherwise it will use the value as a direct pixel length.</li>
  638. <li><b>threshold:</b> <i>0</i> - Hides the labels of any pie slice that is smaller than the specified percentage (ranging from 0 to 1) i.e. a value of '0.03' will hide all slices 3% or less of the total.</li>
  639. <li><b>formatter:</b> <i>[function]</i> - This function specifies how the positioned labels should be formatted, and is applied after the legend's labelFormatter function. The labels can also still be styled using the class "pieLabel" (i.e. ".pieLabel" or "#graph1 .pieLabel").</li>
  640. <li><b>radius:</b> <i>1</i> - Sets the radius at which to place the labels. If value is between 0 and 1 (inclusive) then it will use that as a percentage of the available space (size of the container), otherwise it will use the value as a direct pixel length.</li>
  641. <li><b>background:</b> <ul>
  642. <li><b>color:</b> <i>null</i> - Backgound color of the positioned labels. If null, the plugin will automatically use the color of the slice.</li>
  643. <li><b>opacity:</b> <i>0</i> - Opacity of the background for the positioned labels. Acceptable values range from 0 to 1, where 0 is completely transparent and 1 is completely opaque.</li>
  644. </ul>
  645. </ul>
  646. <li><b>combine:</b> <ul>
  647. <li><b>threshold:</b> <i>0</i> - Combines all slices that are smaller than the specified percentage (ranging from 0 to 1) i.e. a value of '0.03' will combine all slices 3% or less into one slice).</li>
  648. <li><b>color:</b> <i>null</i> - Backgound color of the positioned labels. If null, the plugin will automatically use the color of the first slice to be combined.</li>
  649. <li><b>label:</b> <i>'Other'</i> - Label text for the combined slice.</li>
  650. </ul>
  651. <li><b>highlight:</b> <ul>
  652. <li><b>opacity:</b> <i>0.5</i> - Opacity of the highlight overlay on top of the current pie slice. Currently this just uses a white overlay, but support for changing the color of the overlay will also be added at a later date.
  653. </ul>
  654. </ul>
  655. <h2>Changes/Features</h2>
  656. <ul>
  657. <li style="list-style: none;"><i>v1.0 - November 20th, 2009 - Brian Medendorp</i></li>
  658. <li>The pie plug-in is now part of the Flot repository! This should make it a lot easier to deal with.</li>
  659. <li>Added a new option (innerRadius) to add a "donut hole" to the center of the pie, based on comtributions from Anthony Aragues. I was a little reluctant to add this feature because it doesn't work very well with the shadow created for the tilted pie, but figured it was worthwhile for non-tilted pies. Also, excanvas apparently doesn't support compositing, so it will fall back to using the stroke color to fill in the center (but I recommend setting the stroke color to the background color anyway).</li>
  660. <li>Changed the lineJoin for the border of the pie slices to use the 'round' option. This should make the center of the pie look better, particularly when there are numerous thin slices.</li>
  661. <li>Included a bug fix submitted by btburnett3 to display a slightly smaller slice in the event that the slice is 100% and being rendered with Internet Explorer. I haven't experienced this bug myself, but it doesn't seem to hurt anything so I've included it.</li>
  662. <li>The tilt value is now used when calculating the maximum radius of the pie in relation to the height of the container. This should prevent the pie from being smaller than it needed to in some cases, as well as reducing the amount of extra white space generated above and below the pie.</li>
  663. <li><b>Hover and Click functionality are now availabe!</b><ul>
  664. <li>Thanks to btburnett3 for the original hover functionality and Anthony Aragues for the modification that makes it compatable with excanvas, this was a huge help!</li>
  665. <li>Added a new option (highlight opacity) to modify the highlight created when mousing over a slice. Currently this just uses a white overlay, but an option to change the hightlight color will be added when the appropriate functionality becomes available.
  666. <li>I had a major setback that required me to practically rebuild the hover/click events from scratch one piece at a time (I discovered that it only worked with a single pie on a page at a time), but the end result ended up being virtually identical to the original, so I'm not quite sure what exactly made it work.</li>
  667. <li><span style="color: red;">Warning:</span> There are some minor issues with using this functionality in conjuction with some of the other more advanced features (tilt and donut). When using a donut hole, the inner portion still triggers the events even though that portion of the pie is no longer visible. When tilted, the interactive portions still use the original, untilted version of the pie when determining mouse position (this is because the isPointInPath function apparently doesn't work with transformations), however hover and click both work this way, so the appropriate slice is still highlighted when clicking, and it isn't as noticable of a problem.</li>
  668. </ul></li>
  669. <li>Included a bug fix submitted by Xavi Ivars to fix array issues when other javascript libraries are included in addition to jQuery</li>
  670. <br/>
  671. <li style="list-style: none;"><i>v0.4 - July 1st, 2009 - Brian Medendorp</i></li>
  672. <li>Each series will now be shown in the legend, even if it's value is zero. The series will not get a positioned label because it will overlap with the other labels present and often makes them unreadable.</li>
  673. <li>Data can now be passed in using the standard Flot method using an array of datapoints, the pie plugin will simply use the first y-value that it finds for each series in this case. The plugin uses this datastructure internally, but you can still use the old method of passing in a single numerical value for each series (the plugin will convert it as necessary). This should make it easier to transition from other types of graphs (such as a stacked bar graph) to a pie.</li>
  674. <li>The pie can now be tilted at an angle with a new "tilt" option. Acceptable values range from 0-1, where 1 has no change (fully vertical) and 0 is completely flat (fully horizontal -- in which case nothing actually gets drawn). If the plugin determines that it will fit within the canvas, a drop shadow will be drawn under the tilted pie (this also requires a tilt value of 0.8 or less).</li>
  675. <br/>
  676. <li style="list-style: none;"><i>v0.3.2 - June 25th, 2009 - Brian Medendorp</i></li>
  677. <li>Fixed a bug that was causing the pie to be shifted too far left or right when the legend is showing in some cases.</li>
  678. <br/>
  679. <li style="list-style: none;"><i>v0.3.1 - June 24th, 2009 - Brian Medendorp</i></li>
  680. <li>Fixed a bug that was causing nothing to be drawn and generating a javascript error if any of the data values were set to zero.</li>
  681. <br/>
  682. <li style="list-style: none;"><i>v0.3 - June 23rd, 2009 - Brian Medendorp</i></li>
  683. <li>The legend now works without any modifications! Because of changes made to flot and the plugin system (thanks Ole Laursen!) I was able to simplify a number of things and am now able to use the legend without the direct access hack that was required in the previous version.</li>
  684. <br/>
  685. <li style="list-style: none;"><i>v0.2 - June 22nd, 2009 - Brian Medendorp</i></li>
  686. <li>The legend now works but only if you make the necessary changes to jquery.flot.js. Because of this, I changed the default values for pie.radius and pie.label.show to new 'auto' settings that change the default behavior of the size and labels depending on whether the legend functionality is available or not.</li>
  687. <br/>
  688. <li style="list-style: none;"><i>v0.1 - June 18th, 2009 - Brian Medendorp</i></li>
  689. <li>Rewrote the entire pie code into a flot plugin (since that is now an option), so it should be much easier to use and the code is cleaned up a bit. However, the (standard flot) legend is no longer available because the only way to prevent the grid lines from being displayed also prevents the legend from being displayed. Hopefully this can be fixed at a later date.</li>
  690. <li>Restructured and combined some of the options. It should be much easier to deal with now.</li>
  691. <li>Added the ability to change the starting point of the pie (still defaults to the top).</li>
  692. <li>Modified the default options to show the labels to compensate for the lack of a legend.</li>
  693. <li>Modified this page to use a random dataset. <span style="color: red">Note: you may need to refresh the page to see the effects of some of the examples.</span></li>
  694. <br/>
  695. <li style="list-style: none;"><i>May 21st, 2009 - Brian Medendorp</i></li>
  696. <li>Merged original pie modifications by Sergey Nosenko into the latest SVN version <i>(as of May 15th, 2009)</i> so that it will work with ie8.</li>
  697. <li>Pie graph will now be centered in the canvas unless moved because of the legend or manually via the options. Additionally it prevents the pie from being moved beyond the edge of the canvas.</li>
  698. <li>Modified the code related to the labelFormatter option to apply flot's legend labelFormatter first. This is so that the labels will be consistent, but still provide extra formatting for the positioned labels (such as adding the percentage value).</li>
  699. <li>Positioned labels now have their backgrounds applied as a seperate element (much like the legend background) so that the opacity value can be set independently from the label itself (foreground). Additionally, the background color defaults to that of the matching slice.</li>
  700. <li>As long as the labelOffset and radiusLimit are not set to hard values, the pie will be shrunk if the labels will extend outside the edge of the canvas</li>
  701. <li>Added new options "radiusLimitFactor" and "radiusLimit" which limits how large the (visual) radius of the pie is in relation to the full radius (as calculated from the canvas dimensions) or a hard-pixel value (respectively). This allows for pushing the labels "outside" the pie.</li>
  702. <li>Added a new option "labelHidePercent" that does not show the positioned labels of slices smaller than the specified percentage. This is to help prevent a bunch of overlapping labels from small slices.</li>
  703. <li>Added a new option "sliceCombinePercent" that combines all slices smaller than the specified percentage into one larger slice. This is to help make the pie more attractive when there are a number of tiny slices. The options "sliceCombineColor" and "sliceCombineLabel" have also been added to change the color and name of the new slice if desired.</li>
  704. <li>Tested in Firefox (3.0.10, 3.5b4), Internet Explorer (6.0.2900, 7.0.5730, 8.0.6001), Chrome (1.0.154), Opera (9.64), and Safari (3.1.1, 4 beta 5528.16).
  705. </ul>
  706. </div>
  707. <div id="footer">
  708. Copyright &copy; 2007 - 2013 IOLA and Ole Laursen
  709. </div>
  710. </body>
  711. </html>