graph.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { tabulate } from './d3table.js';
  2. import { drawGraph } from './d3graph.js';
  3. import { drawTree } from './d3tree.js';
  4. import { treeTable } from './d3treetable.js';
  5. import { data } from './results.js';
  6. import * as d3 from "https://cdn.jsdelivr.net/npm/d3@7/+esm";
  7. const div = d3.selectAll("div");
  8. tabulate(data, "#figure1");
  9. drawGraph(data, "#figure2", 1280, 650);
  10. drawTree(data, "#figure3", "root", false, 1280, 650, 150);
  11. // treeTable(data, "#figure4");
  12. Yasqe.defaults.value = ""
  13. const queries_obj = ""
  14. const url = window.location.href.endsWith('/') ? window.location.href.slice(0, -1) : window.location.href;
  15. const endpointsList = [...new Set([url, ...Object.keys(queries_obj).map((label) => {
  16. if (queries_obj[label]["endpoint"]) return queries_obj[label]["endpoint"]
  17. })])]
  18. const yasguiEndpoints = endpointsList.map((endpoint) => {
  19. return {endpoint: endpoint}
  20. })
  21. const yasgui = new Yasgui(document.getElementById("yasgui"), {
  22. requestConfig: {endpoint: url, copyEndpointOnNewTab: true,},
  23. endpointCatalogueOptions: {
  24. getData: function () {
  25. return yasguiEndpoints
  26. },
  27. keys: [],
  28. },
  29. });
  30. Object.keys(queries_obj).map((label) => {
  31. const tabsLabel = Object.keys(yasgui._tabs).map(tab => yasgui._tabs[tab].persistentJson.name)
  32. if (!tabsLabel.includes(label)) {
  33. yasgui.addTab(
  34. false,
  35. {
  36. ...Yasgui.Tab.getDefaults(),
  37. name: label,
  38. requestConfig: {endpoint: queries_obj[label]['endpoint']},
  39. yasqe: {value: queries_obj[label]['query']}
  40. }
  41. );
  42. }
  43. })