Raphael Linechart. Overwrite X Axis. Uncaught TypeError: Object 0 has no method 'attr'

214 views Asked by At

I try to update the Unix timestamp of a Raphael LineChart in a beautiful formatted date, but I get the error Uncaught TypeError: Object 0 has no method 'attr'

The code I'm using is the following :

  var progression = r.linechart(30, 0, 350, 300, x, y, options);

  console.log("Progression is %O", progression.axis[0].text.items);

  /* Overwrites the Axis label for display a formatted date instead of the Unix timestamp */
  $(progression.axis[0].text.items).each( function ( label, index ) {
      originalText = label.attr('text');
      newText = 'up';
      label.attr({'text': newText});
    });

It seems I can't modify the label, BUT the attribute exists, as shown on this printscreen... The highlighted text is my Unix timestamp...

Printscreen Chrome console

I tried to modify directly the attribute but it it not possible... When I print label, it is only a string, not an object (?)

1

There are 1 answers

2
Sandra On

Object 0 has no method 'attr'

... because it is actually 'attrs'

enter image description here