Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c3.js X-Axis String Value Javascript error #1739

Open
tunesum opened this issue Jun 26, 2016 · 1 comment
Open

c3.js X-Axis String Value Javascript error #1739

tunesum opened this issue Jun 26, 2016 · 1 comment

Comments

@tunesum
Copy link

tunesum commented Jun 26, 2016

I am setting values to a simple c3.js bar chart by javascript. Here is how I am setting the values

var values={  x : 'x', 
type: "bar", 
columns: [['x', data_0x,data_1x,data_2x,data_3x,data_4x] ,
["% of Employees",data_0y,data_1y,data_2y,data_3y,data_4y]]}

While generating the chart, the following is my code


var chart = new c3.generate({
        bindto: '#chartContainer',
        data: values,
        axis: {x: {type: 'category'}}
});

When data_0x, data_1x etc are numerical values, the chart comes out perfect.

However when these are string values like 'a', 'b' etc, I am getting the following javascript errors

d3.v3.min.js:670 Error: attribute transform: Expected number, "translate(NaN, 0)".attrFunction @ d3.v3.min.js:670
d3.v3.min.js:670 Error: attribute x: Expected length, "NaN".attrFunction @ d3.v3.min.js:670
d3.v3.min.js:670 Error: attribute width: Expected length, "NaN".

@ezr-ondrej
Copy link

If you want a category labels, here is the examle:
http://c3js.org/samples/categorized.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants