treant-js icon indicating copy to clipboard operation
treant-js copied to clipboard

Error: <path> attribute d: Expected number, "M,0,0" when collapsed=true

Open PegasoVT opened this issue 7 years ago • 12 comments

Hi, when my JSon configuration file contains nodes with the collapsed attibute set to true, I get a lot of errors in the raphael library (see attached image). I noted that the same error is present in some demo example (collapsed, timeline, ecc). Is there a way to resolve? Thank treant01 you in advance Maurizio

PegasoVT avatar Jun 29 '17 11:06 PegasoVT

Issue is not with Raphael JS.

It seems that function positionNodes is not able to connect the nodes

hence this.setConnectionToParent(node, hidePoint); // skip the root node is calling it with X and Y as 0,0

This only happens when the node db count is more than 167+

Thanks in Advance Team

rakesh-santra9 avatar Sep 12 '17 05:09 rakesh-santra9

Hi, i get the same issue, and only have 15 nodes that need to be rendered... Seems like the functionality is all in tact, its just that it generates a lot of console errors.

Edit: I had someone on my team have a look, and he found that the issue is caused by not resetting the x & y coordinates in the reset function of the TreeNode (added via the prototype).

reset: function(nodeStructure, id, parentId, tree, stackParentId) {
   this.id = id;
   this.parentId = parentId;

   .....

  this.X = 0;
  this.Y = 0;

  return this;
}

kairynners avatar Nov 10 '17 11:11 kairynners

@kairynners Were you able to solve it?

LorincJuraj avatar Nov 28 '17 16:11 LorincJuraj

@kairynners.... Later I found that it's not about the number of nodes... In my scenario it was giving about the dept of the child nodes... It was failing after depth level goes above 100 ..

Did you found any work around ?

rakesh-santra9 avatar Nov 28 '17 17:11 rakesh-santra9

More hack than work arond, but yes. It's actually @kairynners 's solution. Find following function: reset: function( nodeStructure, id, parentId, tree, stackParentId ) { And just before return this; add following code: this.X = 0; this.Y = 0;

Probably not the best solution, but it solved my problem FOR NOW.

LorincJuraj avatar Nov 28 '17 17:11 LorincJuraj

may i know where exactly should i add it to at my code please? at the config object as a property?

i had

new Treant( my_chart_config );

now , thanks

@LorincJuraj

Carson12345 avatar Apr 14 '18 13:04 Carson12345

@Carson12345 unfortunately you have to modify treant file Treant.js. You have to add this.X = 0; this.Y = 0; Here: https://github.com/fperucic/treant-js/blob/master/Treant.js#L1356 It worked for me with a bit older version of Treant , but it should work with current version too.

LorincJuraj avatar Apr 14 '18 13:04 LorincJuraj

@LorincJuraj it works thanks so much for explaining!

Carson12345 avatar Apr 14 '18 14:04 Carson12345

@Carson12345 unfortunately you have to modify treant file Treant.js. You have to add this.X = 0; this.Y = 0; Here: https://github.com/fperucic/treant-js/blob/master/Treant.js#L1356 It worked for me with a bit older version of Treant , but it should work with current version too.

It worked thx

SabriCihan avatar Dec 13 '18 09:12 SabriCihan

Thank you @LorincJuraj ! :)

wbotelhos avatar Oct 08 '19 22:10 wbotelhos

@Carson12345 please advise if I have to create treant script file and reference it in my _layout file? I am new to JS and I am getting this error when my object results suppose to populate morris graphs. here is my code snippet :

image

image

manamelatumelo avatar Oct 14 '19 06:10 manamelatumelo

@manamelatumelo I don't know about MOrris Graphs, but console says M or m, but received Z. Maybe you can search for this Z value and try to use M or m.

The other error was solved on previous comment.

wbotelhos avatar Oct 14 '19 16:10 wbotelhos