api_grid_x.js 775 B

123456789101112131415161718192021222324252627282930313233343536
  1. var chart = c3.generate({
  2. bindto: '#chart',
  3. data: {
  4. columns: [
  5. ['sample', 30, 200, 100, 400, 150, 250]
  6. ]
  7. }
  8. });
  9. setTimeout(function () {
  10. chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]);
  11. }, 1000);
  12. setTimeout(function () {
  13. chart.xgrids([{value: 2, text:'Label 2'}]);
  14. }, 2000);
  15. setTimeout(function () {
  16. chart.xgrids.add([{value: 3, text:'Label 3', class:'hoge'}]);
  17. }, 3000);
  18. setTimeout(function () {
  19. chart.xgrids.remove({value:2});
  20. }, 4000);
  21. setTimeout(function () {
  22. chart.xgrids.remove({class:'hoge'});
  23. }, 5000);
  24. setTimeout(function () {
  25. chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]);
  26. }, 6000);
  27. setTimeout(function () {
  28. chart.xgrids.remove();
  29. }, 7000);