index.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. </head>
  10. <body>
  11. <!-- template for the polygraph component. -->
  12. <script type="text/x-template" id="polygraph-template">
  13. <g>
  14. <polygon :points="points"></polygon>
  15. <circle cx="100" cy="100" r="80"></circle>
  16. <axis-label
  17. v-for="(stat, index) in stats"
  18. :stat="stat"
  19. :index="index"
  20. :total="stats.length">
  21. </axis-label>
  22. </g>
  23. </script>
  24. <!-- template for the axis label component. -->
  25. <script type="text/x-template" id="axis-label-template">
  26. <text :x="point.x" :y="point.y">{{stat.label}}</text>
  27. </script>
  28. <!-- demo root element -->
  29. <div id="demo">
  30. <!-- Use the component -->
  31. <svg width="200" height="200">
  32. <polygraph :stats="stats"></polygraph>
  33. </svg>
  34. <!-- controls -->
  35. <div v-for="stat in stats">
  36. <label>{{stat.label}}</label>
  37. <input type="range" v-model="stat.value" min="0" max="100">
  38. <span>{{stat.value}}</span>
  39. <button @click="remove(stat)" class="remove">X</button>
  40. </div>
  41. <form id="add">
  42. <input name="newlabel" v-model="newLabel">
  43. <button @click="add">Add a Stat</button>
  44. </form>
  45. <pre id="raw">{{ stats }}</pre>
  46. </div>
  47. <p style="font-size:12px">* input[type="range"] requires IE10 or above.</p>
  48. <script src="svg.js"></script>
  49. </body>
  50. </html>