PHP/JavaScript webapp to analyse spending habits
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

thresholding.html 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Flot Examples</title>
  6. <link href="layout.css" rel="stylesheet" type="text/css"></link>
  7. <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
  8. <script language="javascript" type="text/javascript" src="../jquery.js"></script>
  9. <script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
  10. <script language="javascript" type="text/javascript" src="../jquery.flot.threshold.js"></script>
  11. </head>
  12. <body>
  13. <h1>Flot Examples</h1>
  14. <div id="placeholder" style="width:600px;height:300px;"></div>
  15. <p>With the threshold plugin, you can apply a specific color to
  16. the part of a data series below a threshold. This is can be useful
  17. for highlighting negative values, e.g. when displaying net results
  18. or what's in stock.</p>
  19. <p class="controls">
  20. <input type="button" value="Threshold at 5">
  21. <input type="button" value="Threshold at 0">
  22. <input type="button" value="Threshold at -2.5">
  23. </p>
  24. <script id="source" language="javascript" type="text/javascript">
  25. $(function () {
  26. var d1 = [];
  27. for (var i = 0; i <= 60; i += 1)
  28. d1.push([i, parseInt(Math.random() * 30 - 10)]);
  29. function plotWithOptions(t) {
  30. $.plot($("#placeholder"), [ {
  31. data: d1,
  32. color: "rgb(30, 180, 20)",
  33. threshold: { below: t, color: "rgb(200, 20, 30)" },
  34. lines: { steps: true }
  35. } ]);
  36. }
  37. plotWithOptions(0);
  38. $(".controls input").click(function (e) {
  39. e.preventDefault();
  40. var t = parseFloat($(this).val().replace('Threshold at ', ''));
  41. plotWithOptions(t);
  42. });
  43. });
  44. </script>
  45. </body>
  46. </html>