chinmaymk / angular-charts

angular directives for creating common charts using d3
MIT License
1.03k stars 270 forks source link

Error: Invalid value for <text> attribute transform="translate(NaN,NaN)" #142

Open fizerkhan opened 9 years ago

fizerkhan commented 9 years ago

I tried to draw pie chart with following data

[
    {
        "x": "Chrome",
        "y": [
            0
        ],
        "tooltip": "Chrome"
    },
    {
        "x": "Firefox",
        "y": [
            0
        ],
        "tooltip": "Firefox"
    },
    {
        "x": "Safari",
        "y": [
            0
        ],
        "tooltip": "Safari"
    },
    {
        "x": "IE",
        "y": [
            0
        ],
        "tooltip": "IE"
    },
    {
        "x": "Opera",
        "y": [
            0
        ],
        "tooltip": "Opera"
    },
    {
        "x": "Others",
        "y": [
            0
        ],
        "tooltip": "Others"
    }
]

Since all the values are 0, it throws error: Invalid value for attribute transform="translate(NaN,NaN)"

chaosfinity commented 9 years ago

With this error you have labels on correct?

fizerkhan commented 9 years ago

Yes, i labelled them correct. If i change any one of the value other than zero(0), it works fine. No error in the console. it only happens if everything is 0 value.

chaosfinity commented 9 years ago

Since the arcs have not startAngle and endAngle it cannot calculate a point to place the labels. This error should be suppressed in the next release

fizerkhan commented 9 years ago

@chaosfinity Thanks for the fix.