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.

66 lines
1.8 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <title>Examples of Fit (Tension vs. Monotonic) | CurvedLines</title>
  4. <style>
  5. .chart-style {
  6. width: 400px;
  7. height: 240px;
  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/MichaelZinsmaier/CurvedLines/master/curvedLines.js"></script>
  13. <script type="text/javascript">
  14. $(function() {
  15. //data
  16. var d1 = [[20, 20], [25, 50], [27.5, 35], [30, 20], [35, 20]];
  17. //flot options
  18. var options = {
  19. series: {
  20. curvedLines: {active: true}
  21. }
  22. };
  23. //plotting
  24. $.plot($("#flotContainer"),[
  25. {
  26. data: d1, color: '#2b8cbe',
  27. lines: {show: true, lineWidth: 3},
  28. //choose tension from [0,1] to see overshooting effects (0.5 is default)
  29. curvedLines: {apply: true, tension: 1}
  30. }, {
  31. data: d1, color: '#f03b20',
  32. points: {show: true}
  33. }
  34. ], options);
  35. $.plot($("#flotContainer2"),[
  36. {
  37. data: d1, color: '#2b8cbe',
  38. lines: {show: true, lineWidth: 3},
  39. //monotonicFit enforces monotonicity
  40. curvedLines: {apply: true, monotonicFit: true}
  41. }, {
  42. data: d1, color: '#f03b20',
  43. points: {show: true}
  44. }
  45. ], options);
  46. });
  47. </script>
  48. </head>
  49. <body>
  50. <h3>Examples of Fit (Tension vs. Monotonic)</h3>
  51. <h4>CurvedLines: with standard settings (shows effects of tension parameter)</h4>
  52. <div id="flotContainer" class="chart-style"></div>
  53. <h4>CurvedLines: with monotonicFit (no overshooting/wiggles) </h4>
  54. <div id="flotContainer2" class="chart-style"></div>
  55. <a href="index.html">Return to CurvedLines Examples list</a>
  56. </body>
  57. </html>