Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. let objName = ["object1", "object2", "object3"];
  2. let xyzArr = ["xyz1", "xyz2","xyz3"];
  3. let theArr = [[], [], []];
  4.  
  5. objName.forEach((name, index) => {
  6. window[name] = {
  7. xyz: xyzArr[index],
  8. arr: theArr[index]
  9. };
  10. });
  11.  
  12. $.getJSON(json, result =>
  13. {result.forEach((elem, i, array) =>
  14. {object1.data.push({x:elem.val1, y:elem.val2});
  15. {object2.data.push({x:elem.val1, y:elem.val2});
  16. {object3.data.push({x:elem.val1, y:elem.val2});
  17. })
  18. });
  19.  
  20. $.getJSON(json, result =>
  21. {result.forEach((elem, i, array) =>
  22. (for let j=0; j<=5; j++) {
  23. {object[i].data.push({x:elem.val1, y:elem.val2});
  24. )
  25. })
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement