maximum call stack size exceeded jquery cytoscape











up vote
0
down vote

favorite












I am working with cytoscape and jquery with large data. My html code is



<script src="jquery.js"></script>
<script src="jquery.qtip.js"></script>
<script src="cytoscape.js"></script>
<script src="cytoscape-qtip.js"></script>
<script src="my_java_script.js"></script>`


My java script code is



$(function(){ // 
var cy = cytoscape({
container: document.getElementById('cy'),
boxSelectionEnabled: false,
autounselectify: true,
style: cytoscape.stylesheet()
.selector('node')
.css({'label': 'data(label)',
'width': '60px','height': '60px', })
.selector('edge')
.css({'width': '10px','line-color':'#000000'})

.selector("#22").css({"line-color":"red"})
.selector("#44").css({"line-color":"red"})
.selector("#55").css({"line-color":"red"})


I have almost 20000 selectors. Because of such large data I am getting following error in Chrome 70 browser:



Uncaught RangeError: Maximum call stack size exceeded
at k (jquery.js:2)
at Object.fireWith [as resolveWith] (jquery.js:2)
at Function.ready (jquery.js:2)
at HTMLDocument.D (jquery.js:2)


How can I get rid of this ?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I am working with cytoscape and jquery with large data. My html code is



    <script src="jquery.js"></script>
    <script src="jquery.qtip.js"></script>
    <script src="cytoscape.js"></script>
    <script src="cytoscape-qtip.js"></script>
    <script src="my_java_script.js"></script>`


    My java script code is



    $(function(){ // 
    var cy = cytoscape({
    container: document.getElementById('cy'),
    boxSelectionEnabled: false,
    autounselectify: true,
    style: cytoscape.stylesheet()
    .selector('node')
    .css({'label': 'data(label)',
    'width': '60px','height': '60px', })
    .selector('edge')
    .css({'width': '10px','line-color':'#000000'})

    .selector("#22").css({"line-color":"red"})
    .selector("#44").css({"line-color":"red"})
    .selector("#55").css({"line-color":"red"})


    I have almost 20000 selectors. Because of such large data I am getting following error in Chrome 70 browser:



    Uncaught RangeError: Maximum call stack size exceeded
    at k (jquery.js:2)
    at Object.fireWith [as resolveWith] (jquery.js:2)
    at Function.ready (jquery.js:2)
    at HTMLDocument.D (jquery.js:2)


    How can I get rid of this ?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am working with cytoscape and jquery with large data. My html code is



      <script src="jquery.js"></script>
      <script src="jquery.qtip.js"></script>
      <script src="cytoscape.js"></script>
      <script src="cytoscape-qtip.js"></script>
      <script src="my_java_script.js"></script>`


      My java script code is



      $(function(){ // 
      var cy = cytoscape({
      container: document.getElementById('cy'),
      boxSelectionEnabled: false,
      autounselectify: true,
      style: cytoscape.stylesheet()
      .selector('node')
      .css({'label': 'data(label)',
      'width': '60px','height': '60px', })
      .selector('edge')
      .css({'width': '10px','line-color':'#000000'})

      .selector("#22").css({"line-color":"red"})
      .selector("#44").css({"line-color":"red"})
      .selector("#55").css({"line-color":"red"})


      I have almost 20000 selectors. Because of such large data I am getting following error in Chrome 70 browser:



      Uncaught RangeError: Maximum call stack size exceeded
      at k (jquery.js:2)
      at Object.fireWith [as resolveWith] (jquery.js:2)
      at Function.ready (jquery.js:2)
      at HTMLDocument.D (jquery.js:2)


      How can I get rid of this ?










      share|improve this question













      I am working with cytoscape and jquery with large data. My html code is



      <script src="jquery.js"></script>
      <script src="jquery.qtip.js"></script>
      <script src="cytoscape.js"></script>
      <script src="cytoscape-qtip.js"></script>
      <script src="my_java_script.js"></script>`


      My java script code is



      $(function(){ // 
      var cy = cytoscape({
      container: document.getElementById('cy'),
      boxSelectionEnabled: false,
      autounselectify: true,
      style: cytoscape.stylesheet()
      .selector('node')
      .css({'label': 'data(label)',
      'width': '60px','height': '60px', })
      .selector('edge')
      .css({'width': '10px','line-color':'#000000'})

      .selector("#22").css({"line-color":"red"})
      .selector("#44").css({"line-color":"red"})
      .selector("#55").css({"line-color":"red"})


      I have almost 20000 selectors. Because of such large data I am getting following error in Chrome 70 browser:



      Uncaught RangeError: Maximum call stack size exceeded
      at k (jquery.js:2)
      at Object.fireWith [as resolveWith] (jquery.js:2)
      at Function.ready (jquery.js:2)
      at HTMLDocument.D (jquery.js:2)


      How can I get rid of this ?







      jquery cytoscape.js






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 at 7:33









      user10340258

      168




      168
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          Consider using classes for your selectors and not unique id's, the way you use them is not the way you are supposed to do that. Especially if the selectors are just a line color, you can always define the selector with a more dynamic option:



          style: [
          {
          selector: 'node',
          style: {
          'shape': 'data(faveShape)',
          'content': 'data(DisplayName)',
          'height': 'data(faveHeight)',
          'width': 'data(faveWidth)',
          'background-color': 'data(faveColor)',
          'line-color': 'data(faveLineColor)',
          'font-family': 'data(faceFontFam)',
          'font-size': 'data(faveFontSize)'
          }
          },
          ...


          ]



          And when you add nodes/edges, use the logic from your python code and get the color of the element, after that, just put that variable in the cy.add() and you are good to go:



          cy.add({
          data: {
          id: 'yourId',
          ...
          faveLineColor: 'yourLineColor',
          ...

          },
          ...
          });





          share|improve this answer























          • Thanks @Stephan T. for your reply. I have different types of nodes and edges to be highlighted in different color. Can you please help me how to group them ?
            – user10340258
            Nov 15 at 5:03










          • If you do it like in my answer, there will be no need of grouping them, you just have to add a color field in the data part of your nodes/edges. I don't know what your data looks like (the data used for adding the nodes and edges to cy), if you can provide some sort of example that would be great :)#
            – Stephan T.
            Nov 15 at 5:12










          • I am adding data like this ,elements:{nodes:[{ data: { id:"n0",label:"A2" } },.....and for edges edges:[{"data": {"id": "e0","source": "n2","target": "n0"}},
            – user10340258
            Nov 15 at 5:29










          • And how do you know which color each element has? Which criteria is responsible for that?
            – Stephan T.
            Nov 15 at 5:33










          • I am defining color by .selector. I have a python code which prints .selector commands in .js file. At present I am using .selector("#e19,#e2,#e5,#e4,#e9,#e15").css({"line-color":"blue"}) which is also not working for large data.
            – user10340258
            Nov 15 at 5:36













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295111%2fmaximum-call-stack-size-exceeded-jquery-cytoscape%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted










          Consider using classes for your selectors and not unique id's, the way you use them is not the way you are supposed to do that. Especially if the selectors are just a line color, you can always define the selector with a more dynamic option:



          style: [
          {
          selector: 'node',
          style: {
          'shape': 'data(faveShape)',
          'content': 'data(DisplayName)',
          'height': 'data(faveHeight)',
          'width': 'data(faveWidth)',
          'background-color': 'data(faveColor)',
          'line-color': 'data(faveLineColor)',
          'font-family': 'data(faceFontFam)',
          'font-size': 'data(faveFontSize)'
          }
          },
          ...


          ]



          And when you add nodes/edges, use the logic from your python code and get the color of the element, after that, just put that variable in the cy.add() and you are good to go:



          cy.add({
          data: {
          id: 'yourId',
          ...
          faveLineColor: 'yourLineColor',
          ...

          },
          ...
          });





          share|improve this answer























          • Thanks @Stephan T. for your reply. I have different types of nodes and edges to be highlighted in different color. Can you please help me how to group them ?
            – user10340258
            Nov 15 at 5:03










          • If you do it like in my answer, there will be no need of grouping them, you just have to add a color field in the data part of your nodes/edges. I don't know what your data looks like (the data used for adding the nodes and edges to cy), if you can provide some sort of example that would be great :)#
            – Stephan T.
            Nov 15 at 5:12










          • I am adding data like this ,elements:{nodes:[{ data: { id:"n0",label:"A2" } },.....and for edges edges:[{"data": {"id": "e0","source": "n2","target": "n0"}},
            – user10340258
            Nov 15 at 5:29










          • And how do you know which color each element has? Which criteria is responsible for that?
            – Stephan T.
            Nov 15 at 5:33










          • I am defining color by .selector. I have a python code which prints .selector commands in .js file. At present I am using .selector("#e19,#e2,#e5,#e4,#e9,#e15").css({"line-color":"blue"}) which is also not working for large data.
            – user10340258
            Nov 15 at 5:36

















          up vote
          0
          down vote



          accepted










          Consider using classes for your selectors and not unique id's, the way you use them is not the way you are supposed to do that. Especially if the selectors are just a line color, you can always define the selector with a more dynamic option:



          style: [
          {
          selector: 'node',
          style: {
          'shape': 'data(faveShape)',
          'content': 'data(DisplayName)',
          'height': 'data(faveHeight)',
          'width': 'data(faveWidth)',
          'background-color': 'data(faveColor)',
          'line-color': 'data(faveLineColor)',
          'font-family': 'data(faceFontFam)',
          'font-size': 'data(faveFontSize)'
          }
          },
          ...


          ]



          And when you add nodes/edges, use the logic from your python code and get the color of the element, after that, just put that variable in the cy.add() and you are good to go:



          cy.add({
          data: {
          id: 'yourId',
          ...
          faveLineColor: 'yourLineColor',
          ...

          },
          ...
          });





          share|improve this answer























          • Thanks @Stephan T. for your reply. I have different types of nodes and edges to be highlighted in different color. Can you please help me how to group them ?
            – user10340258
            Nov 15 at 5:03










          • If you do it like in my answer, there will be no need of grouping them, you just have to add a color field in the data part of your nodes/edges. I don't know what your data looks like (the data used for adding the nodes and edges to cy), if you can provide some sort of example that would be great :)#
            – Stephan T.
            Nov 15 at 5:12










          • I am adding data like this ,elements:{nodes:[{ data: { id:"n0",label:"A2" } },.....and for edges edges:[{"data": {"id": "e0","source": "n2","target": "n0"}},
            – user10340258
            Nov 15 at 5:29










          • And how do you know which color each element has? Which criteria is responsible for that?
            – Stephan T.
            Nov 15 at 5:33










          • I am defining color by .selector. I have a python code which prints .selector commands in .js file. At present I am using .selector("#e19,#e2,#e5,#e4,#e9,#e15").css({"line-color":"blue"}) which is also not working for large data.
            – user10340258
            Nov 15 at 5:36















          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          Consider using classes for your selectors and not unique id's, the way you use them is not the way you are supposed to do that. Especially if the selectors are just a line color, you can always define the selector with a more dynamic option:



          style: [
          {
          selector: 'node',
          style: {
          'shape': 'data(faveShape)',
          'content': 'data(DisplayName)',
          'height': 'data(faveHeight)',
          'width': 'data(faveWidth)',
          'background-color': 'data(faveColor)',
          'line-color': 'data(faveLineColor)',
          'font-family': 'data(faceFontFam)',
          'font-size': 'data(faveFontSize)'
          }
          },
          ...


          ]



          And when you add nodes/edges, use the logic from your python code and get the color of the element, after that, just put that variable in the cy.add() and you are good to go:



          cy.add({
          data: {
          id: 'yourId',
          ...
          faveLineColor: 'yourLineColor',
          ...

          },
          ...
          });





          share|improve this answer














          Consider using classes for your selectors and not unique id's, the way you use them is not the way you are supposed to do that. Especially if the selectors are just a line color, you can always define the selector with a more dynamic option:



          style: [
          {
          selector: 'node',
          style: {
          'shape': 'data(faveShape)',
          'content': 'data(DisplayName)',
          'height': 'data(faveHeight)',
          'width': 'data(faveWidth)',
          'background-color': 'data(faveColor)',
          'line-color': 'data(faveLineColor)',
          'font-family': 'data(faceFontFam)',
          'font-size': 'data(faveFontSize)'
          }
          },
          ...


          ]



          And when you add nodes/edges, use the logic from your python code and get the color of the element, after that, just put that variable in the cy.add() and you are good to go:



          cy.add({
          data: {
          id: 'yourId',
          ...
          faveLineColor: 'yourLineColor',
          ...

          },
          ...
          });






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 15 at 5:56

























          answered Nov 14 at 8:11









          Stephan T.

          535420




          535420












          • Thanks @Stephan T. for your reply. I have different types of nodes and edges to be highlighted in different color. Can you please help me how to group them ?
            – user10340258
            Nov 15 at 5:03










          • If you do it like in my answer, there will be no need of grouping them, you just have to add a color field in the data part of your nodes/edges. I don't know what your data looks like (the data used for adding the nodes and edges to cy), if you can provide some sort of example that would be great :)#
            – Stephan T.
            Nov 15 at 5:12










          • I am adding data like this ,elements:{nodes:[{ data: { id:"n0",label:"A2" } },.....and for edges edges:[{"data": {"id": "e0","source": "n2","target": "n0"}},
            – user10340258
            Nov 15 at 5:29










          • And how do you know which color each element has? Which criteria is responsible for that?
            – Stephan T.
            Nov 15 at 5:33










          • I am defining color by .selector. I have a python code which prints .selector commands in .js file. At present I am using .selector("#e19,#e2,#e5,#e4,#e9,#e15").css({"line-color":"blue"}) which is also not working for large data.
            – user10340258
            Nov 15 at 5:36




















          • Thanks @Stephan T. for your reply. I have different types of nodes and edges to be highlighted in different color. Can you please help me how to group them ?
            – user10340258
            Nov 15 at 5:03










          • If you do it like in my answer, there will be no need of grouping them, you just have to add a color field in the data part of your nodes/edges. I don't know what your data looks like (the data used for adding the nodes and edges to cy), if you can provide some sort of example that would be great :)#
            – Stephan T.
            Nov 15 at 5:12










          • I am adding data like this ,elements:{nodes:[{ data: { id:"n0",label:"A2" } },.....and for edges edges:[{"data": {"id": "e0","source": "n2","target": "n0"}},
            – user10340258
            Nov 15 at 5:29










          • And how do you know which color each element has? Which criteria is responsible for that?
            – Stephan T.
            Nov 15 at 5:33










          • I am defining color by .selector. I have a python code which prints .selector commands in .js file. At present I am using .selector("#e19,#e2,#e5,#e4,#e9,#e15").css({"line-color":"blue"}) which is also not working for large data.
            – user10340258
            Nov 15 at 5:36


















          Thanks @Stephan T. for your reply. I have different types of nodes and edges to be highlighted in different color. Can you please help me how to group them ?
          – user10340258
          Nov 15 at 5:03




          Thanks @Stephan T. for your reply. I have different types of nodes and edges to be highlighted in different color. Can you please help me how to group them ?
          – user10340258
          Nov 15 at 5:03












          If you do it like in my answer, there will be no need of grouping them, you just have to add a color field in the data part of your nodes/edges. I don't know what your data looks like (the data used for adding the nodes and edges to cy), if you can provide some sort of example that would be great :)#
          – Stephan T.
          Nov 15 at 5:12




          If you do it like in my answer, there will be no need of grouping them, you just have to add a color field in the data part of your nodes/edges. I don't know what your data looks like (the data used for adding the nodes and edges to cy), if you can provide some sort of example that would be great :)#
          – Stephan T.
          Nov 15 at 5:12












          I am adding data like this ,elements:{nodes:[{ data: { id:"n0",label:"A2" } },.....and for edges edges:[{"data": {"id": "e0","source": "n2","target": "n0"}},
          – user10340258
          Nov 15 at 5:29




          I am adding data like this ,elements:{nodes:[{ data: { id:"n0",label:"A2" } },.....and for edges edges:[{"data": {"id": "e0","source": "n2","target": "n0"}},
          – user10340258
          Nov 15 at 5:29












          And how do you know which color each element has? Which criteria is responsible for that?
          – Stephan T.
          Nov 15 at 5:33




          And how do you know which color each element has? Which criteria is responsible for that?
          – Stephan T.
          Nov 15 at 5:33












          I am defining color by .selector. I have a python code which prints .selector commands in .js file. At present I am using .selector("#e19,#e2,#e5,#e4,#e9,#e15").css({"line-color":"blue"}) which is also not working for large data.
          – user10340258
          Nov 15 at 5:36






          I am defining color by .selector. I have a python code which prints .selector commands in .js file. At present I am using .selector("#e19,#e2,#e5,#e4,#e9,#e15").css({"line-color":"blue"}) which is also not working for large data.
          – user10340258
          Nov 15 at 5:36




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295111%2fmaximum-call-stack-size-exceeded-jquery-cytoscape%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?