board.create("line", ["jxgBoard1P6", "jxgBoard1P7"], {"strokecolor":"#666","strokeopacity":1,"highlightstrokeopacity":1,"fillopacity":1,"highlightfillopacity":1,"strokewidth":1,"highlightstrokewidth":2,"fixed":false,"withlabel":false,"visible":true,"priv":false,"dash":0,"trace":false,"highlight":true,"scalable":true,"draft":false,"islabel":false,"lastarrow":true,"straightfirst":false,"straightlast":false,"point1":{"visible":false,"withLabel":false,"fixed":false,"name":""},"point2":{"visible":false,"withLabel":false,"fixed":false,"name":""},"ticks":{"drawLabels":true,"label":{"offset":[4,-9]},"drawZero":false,"insertTicks":false,"minTicksDistance":50,"minorHeight":4,"majorHeight":-1,"minorTicks":4,"defaultDistance":1,"strokeOpacity":0.3},"label":{"strokeColor":"black","strokeOpacity":1,"highlightStrokeOpacity":0.666666,"highlightStrokeColor":"black","fixed":true,"position":"llft","offset":[10,10]},"name":"axis-h","objectformat":{},"id":"jxgBoard1L8"});
board.create("text", ["jxgBoard1L8"], {"fillcolor":"red","highlightfillcolor":"none","strokeopacity":1,"fillopacity":1,"highlightfillopacity":1,"strokewidth":2,"highlightstrokewidth":2,"fixed":false,"priv":false,"dash":0,"trace":false,"highlight":true,"snaptogrid":false,"scalable":true,"draft":false,"islabel":true,"anchor":"jxgBoard1L8","cssclass":"label-text","highlightcssclass":"label-text","position":"llft","id":"jxgBoard1L8Label","name":"custom-label","isdraggable":true,"objectformat":{"_text":"hdfghdf ghdf ghdfghdfh"},"label":{"strokeColor":"black","strokeOpacity":1,"highlightStrokeOpacity":0.666666,"highlightStrokeColor":"black","fixed":true,"position":"urt","offset":[10,10]}});
When i tried to restore this code in a new empty graph i got this javascript error:
Uncaught Error: JSXGraph: Can't create text with parent types 'object' and 'undefined'.
Possible parent types: [x,y], [z,x,y], [element,transformation]
It is like i cannot create a text object with a line as parent. Is this a bug? I want to clarify that i need to assign a text object as label to a line, and not use the label that the line have by default.
Regards and Thanks for the help
Victor
var p1 = board1.create('point', [-3, 5]);
var p2 = board1.create('point', [3, -1]);
var li = board1.create('line', [p1, p2]);
var txt = board1.create('text', [0, 0, 'Hello'], {anchor: li});
var txt = board1.create('text', [4, 1, 'Text']);