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.
 
 
 

34 lines
1.1 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(window.location.pathname.split("/").pop().includes('index')) {
  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. } else {
  21. sections = docSections;
  22. }
  23. sections.forEach(sectionConf => {
  24. let sectionEl = $.create('section', { className: sectionConf.name || sectionConf.title });
  25. insertAfter(sectionEl, currentElement);
  26. currentElement = sectionEl;
  27. dbd.makeSection(sectionEl, sectionConf);
  28. });