vis.js is a dynamic, browser-based visualization library
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.

64 lines
1.6 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  5. <meta content="utf-8" http-equiv="encoding">
  6. <title>Graph2d | Localization</title>
  7. <style type="text/css">
  8. body, html, select {
  9. font-family: sans-serif;
  10. font-size: 11pt;
  11. }
  12. </style>
  13. <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.1/moment-with-locales.min.js"></script>
  14. <script src="../../dist/vis.js"></script>
  15. <link href="../../dist/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <h2>Graph2d | Localization</h2>
  19. <p>
  20. To localize Graph2d, one has to load a version of moment.js including locales. To set a locale, specify option <code>{locale: STRING}</code>.
  21. </p>
  22. <p>
  23. <label for="locale">Select a locale:</label>
  24. <select id="locale">
  25. <option value="en" selected>en</option>
  26. <option value="nl">nl</option>
  27. </select>
  28. </p>
  29. <div id="visualization"></div>
  30. <script type="text/javascript">
  31. var container = document.getElementById('visualization');
  32. var items = [
  33. {x: '2014-06-11', y: 10},
  34. {x: '2014-06-12', y: 25},
  35. {x: '2014-06-13', y: 30},
  36. {x: '2014-06-14', y: 10},
  37. {x: '2014-06-15', y: 15},
  38. {x: '2014-06-16', y: 30}
  39. ];
  40. var dataset = new vis.DataSet(items);
  41. var options = {
  42. start: '2014-06-10',
  43. end: '2014-06-18'
  44. };
  45. var graph2d = new vis.Graph2d(container, dataset, options);
  46. // update the locale when changing the select box value
  47. var select = document.getElementById('locale');
  48. select.onchange = function () {
  49. graph2d.setOptions({
  50. locale: this.value
  51. });
  52. };
  53. select.onchange();
  54. </script>
  55. </body>
  56. </html>