You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.0 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <title>Stacked Data Example | CurvedLines</title>
  4. <style>
  5. .chart-style {
  6. width: 600px;
  7. height: 260px;
  8. }
  9. </style>
  10. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
  11. <script type="text/javascript" src="https://cdn.rawgit.com/flot/flot/v0.8.3/jquery.flot.js"></script>
  12. <script type="text/javascript" src="https://rawgit.com/flot/flot/v0.8.3/jquery.flot.stack.js"></script>
  13. <script type="text/javascript" src="https://rawgit.com/MichaelZinsmaier/CurvedLines/master/curvedLines.js"></script>
  14. <script type="text/javascript">
  15. $(function() {
  16. //random data
  17. var d1 = [];
  18. for (var i = 0; i <= 10; i += 1) {
  19. d1.push([i, parseInt(Math.random() * 30)]);
  20. }
  21. var d2 = [];
  22. for (var i = 0; i <= 10; i += 1) {
  23. d2.push([i, parseInt(Math.random() * 30)]);
  24. }
  25. var d3 = [];
  26. for (var i = 0; i <= 10; i += 1) {
  27. d3.push([i, parseInt(Math.random() * 30)]);
  28. }
  29. //flot options
  30. var options = {
  31. series: {
  32. curvedLines: {
  33. apply: true,
  34. active: true,
  35. monotonicFit: true
  36. }
  37. }
  38. };
  39. //plotting
  40. $.plot($("#flotContainer"), [
  41. {data: d1, lines: { show: true, fill: true }, stack: true },
  42. {data: d2, lines: { show: true, fill: true }, stack: true },
  43. {data: d3, lines: { show: true, fill: true }, stack: true }
  44. ], {});
  45. $.plot($("#flotContainer2"), [
  46. {data: d1, lines: { show: true, fill: true }, stack: true },
  47. {data: d2, lines: { show: true, fill: true }, stack: true },
  48. {data: d3, lines: { show: true, fill: true }, stack: true }
  49. ], options);
  50. });
  51. </script>
  52. <h4>CurvedLines: random stacked data</h4>
  53. <div id="flotContainer" class="chart-style"></div>
  54. <h4>CurvedLines: same data connected with curved lines</h4>
  55. <div id="flotContainer2" class="chart-style"></div>
  56. <a href="index.html">Return to CurvedLines Examples list</a>
  57. </body>
  58. </html>