You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
1.2 KiB

  1. import { $, insertAfter } from '../../../src/js/utils/dom';
  2. import { fireballOver25, fireball_2_5, fireball_5_25 } from './data';
  3. import { lineComposite, barComposite, demoSections} from './demoConfig';
  4. import { docSections } from './docsConfig';
  5. import { docsBuilder } from './docsBuilder';
  6. let Chart = frappe.Chart; // eslint-disable-line no-undef
  7. let dbd = new docsBuilder(Chart);
  8. let currentElement = document.querySelector('header');
  9. let sections = [];
  10. if(document.querySelectorAll('#line-composite-1').length) {
  11. let lineCompositeChart = new Chart("#line-composite-1", lineComposite.config);
  12. let barCompositeChart = new Chart("#bar-composite-1", barComposite.config);
  13. lineCompositeChart.parent.addEventListener('data-select', (e) => {
  14. let i = e.index;
  15. barCompositeChart.updateDatasets([
  16. fireballOver25[i], fireball_5_25[i], fireball_2_5[i]
  17. ]);
  18. });
  19. sections = demoSections;
  20. }
  21. // else {
  22. // sections = docSections;
  23. // }
  24. sections.forEach(sectionConf => {
  25. let sectionEl = $.create('section', { className: sectionConf.name || sectionConf.title });
  26. insertAfter(sectionEl, currentElement);
  27. currentElement = sectionEl;
  28. dbd.makeSection(sectionEl, sectionConf);
  29. });