chart_bar.js 529 B

123456789101112131415161718192021222324
  1. var chart = c3.generate({
  2. data: {
  3. columns: [
  4. ['data1', 30, 200, 100, 400, 150, 250],
  5. ['data2', 130, 100, 140, 200, 150, 50]
  6. ],
  7. type: 'bar'
  8. },
  9. bar: {
  10. width: {
  11. ratio: 0.5 // this makes bar width 50% of length between ticks
  12. }
  13. // or
  14. //width: 100 // this makes bar width 100px
  15. }
  16. });
  17. setTimeout(function () {
  18. chart.load({
  19. columns: [
  20. ['data3', 130, -150, 200, 300, -200, 100]
  21. ]
  22. });
  23. }, 1000);