axes_x_localtime.js 686 B

1234567891011121314151617181920212223
  1. var chart = c3.generate({
  2. data: {
  3. x: 'x',
  4. xFormat: '%Y',
  5. columns: [
  6. // ['x', '2012-12-31', '2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05'],
  7. ['x', '2010', '2011', '2012', '2013', '2014', '2015'],
  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. // if true, treat x value as localtime (Default)
  16. // if false, convert to UTC internally
  17. localtime: false,
  18. tick: {
  19. format: '%Y-%m-%d %H:%M:%S'
  20. }
  21. }
  22. }
  23. });