timeseries.js 756 B

12345678910111213141516171819202122232425262728
  1. var chart = c3.generate({
  2. data: {
  3. x: 'x',
  4. // xFormat: '%Y%m%d', // 'xFormat' can be used as custom format of 'x'
  5. columns: [
  6. ['x', '2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05', '2013-01-06'],
  7. // ['x', '20130101', '20130102', '20130103', '20130104', '20130105', '20130106'],
  8. ['data1', 30, 200, 100, 400, 150, 250],
  9. ['data2', 130, 340, 200, 500, 250, 350]
  10. ]
  11. },
  12. axis: {
  13. x: {
  14. type: 'timeseries',
  15. tick: {
  16. format: '%Y-%m-%d'
  17. }
  18. }
  19. }
  20. });
  21. setTimeout(function () {
  22. chart.load({
  23. columns: [
  24. ['data3', 400, 500, 450, 700, 600, 500]
  25. ]
  26. });
  27. }, 1000);