0

I'm new to d3 charts, i want to use x-axis as string and my app throws Error: Invalid value for <text> attribute x="NaN" error.

This is my sample JSON

[
{"key" : "test1", "values" : [["test1", 3]},
{"key" : "test2", "values" : [["test2", 5]},
{"key" : "test3", "values" : [["test3", 9]}
];

So , How to pass x-axis value as string

Aravinth
  • 397
  • 1
  • 4
  • 19

1 Answers1

0

Are you sure this should work? Coordinates are usually numbers and not some sort of text. Plus I don't see a single example of this directive where it uses a String for X- or Y-Axis values.

You could check out this though: http://jtblin.github.io/angular-chart.js/

It uses Labels as X-Coordinate, but you have to set every single X-Coordinate on this one and can't skip any points which is annoying in some cases. But if that's fine for you, I'd suggest you to try it.

Mayobirne
  • 51
  • 5