index.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Vue.js SVG graph example</title>
  6. <link rel="stylesheet" href="style.css">
  7. <!-- Delete ".min" for console warnings in development -->
  8. <script src="../../dist/vue.min.js"></script>
  9. <script src="https://unpkg.com/marky/dist/marky.min.js"></script>
  10. </head>
  11. <body>
  12. <!-- template for the polygraph component. -->
  13. <script type="text/x-template" id="polygraph-template">
  14. <g>
  15. <polygon :points="points"></polygon>
  16. <circle cx="100" cy="100" r="80"></circle>
  17. <axis-label
  18. v-for="(stat, index) in stats"
  19. :stat="stat"
  20. :index="index"
  21. :total="stats.length">
  22. </axis-label>
  23. </g>
  24. </script>
  25. <!-- template for the axis label component. -->
  26. <script type="text/x-template" id="axis-label-template">
  27. <text :x="point.x" :y="point.y">{{stat.label}}</text>
  28. </script>
  29. <!-- demo root element -->
  30. <div id="demo">
  31. <!-- Use the component -->
  32. <svg width="200" height="200">
  33. <polygraph :stats="stats"></polygraph>
  34. </svg>
  35. <!-- controls -->
  36. <div v-for="stat in stats">
  37. <label>{{stat.label}}</label>
  38. <input type="range" v-model="stat.value" min="0" max="100">
  39. <span>{{stat.value}}</span>
  40. <button @click="remove(stat)" class="remove">X</button>
  41. </div>
  42. <form id="add">
  43. <input name="newlabel" v-model="newLabel">
  44. <button @click="add">Add a Stat</button>
  45. </form>
  46. <pre id="raw">{{ stats }}</pre>
  47. </div>
  48. <p style="font-size:12px">* input[type="range"] requires IE10 or above.</p>
  49. <script src="svg.js"></script>
  50. </body>
  51. </html>