timeseries_raw.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <html>
  2. <head>
  3. <link rel="stylesheet" type="text/css" href="/css/c3.css">
  4. </head>
  5. <body>
  6. <div id="chart"></div>
  7. <script src="http://d3js.org/d3.v4.min.js" charset="utf-8"></script>
  8. <script src="/js/c3.js"></script>
  9. <script>
  10. var rows = [["x","Views","GMV"]];
  11. rows = rows.concat([[1398709800000,780,136],
  12. [1398450600000,812,134],
  13. [1399401000000,784,154],
  14. [1399228200000,786,135],
  15. [1399573800000,802,131],
  16. [1399487400000,773,166],
  17. [1399314600000,787,146],
  18. [1399919400000,1496,309],
  19. [1399833000000,767,138],
  20. [1399746600000,797,141],
  21. [1399660200000,796,146],
  22. [1398623400000,779,143],
  23. [1399055400000,794,140],
  24. [1398969000000,791,140],
  25. [1398882600000,825,107],
  26. [1399141800000,786,136],
  27. [1398537000000,773,143],
  28. [1398796200000,783,154],
  29. [1400005800000,1754,284]].sort(function (a, b) {
  30. return a[0] - b[0];
  31. }));
  32. var chart = c3.generate({
  33. bindto: '#chart',
  34. data: {
  35. x : 'x',
  36. rows: rows
  37. },
  38. axis : {
  39. x : {
  40. type : 'timeseries',
  41. tick : {
  42. format : "%Y-%m-%d" // https://github.com/mbostock/d3/wiki/Time-Formatting#wiki-format
  43. }
  44. }
  45. }
  46. });
  47. </script>
  48. </body>
  49. </html>