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

Chart with categories and rotated axis does not display correctly #129

Closed
webmaven opened this issue Apr 7, 2014 · 6 comments
Closed

Chart with categories and rotated axis does not display correctly #129

webmaven opened this issue Apr 7, 2014 · 6 comments
Labels
C-feature-request Category: A feature request or an enhancement resolved maybe

Comments

@webmaven
Copy link

webmaven commented Apr 7, 2014

Example:

chart = c3.generate({
    data: {
        columns: [
            ['data1', 30, 200, 100, 400, 150, 250, 50, 100, 250]
        ]
    },
    axis: {
        x: {
            type: 'categorized',
            categories: ['category 1', 'category 2', 'category 3', 'this is another category', 'cat5', 'cat6', 'cat7', 'cat8', 'cat9']
        },
        rotated: true
    }
});

In the following screnshot, see how the category 'ticks' are clipped on the left (not shown is how the tooltips are pushed to the right as well):
rotated_categories

@webmaven
Copy link
Author

webmaven commented Apr 7, 2014

I've discovered that if I set the left padding high enough the categories are revealed, but shouldn't this be calculated automatically?

@masayuki0812
Copy link
Member

Hi, I think this should be. I'll fix.

@masayuki0812
Copy link
Member

Hi @webmaven , I think this has been fixed in the latest version 0.1.38. Please try this version.

@matzke
Copy link

matzke commented May 10, 2014

works perfectly! just great!

@radiodario
Copy link

I have found an error with the calculation where if we have two labels and the longest one is second on the chart, the padding isn't calculated correctly:
screen shot 2015-10-08 at 11 27 41

However, when the longest label is first, it works just fine:
screen shot 2015-10-08 at 11 27 27

Note that this only happens when there are 2 categories, and if we add 3 or more it works fine.

Here's the c3 code to reproduce the issue:

var chart = c3.generate({
    data: {
        json: [
            {
                thing: 'Short',
                value: 1000
            }, 
            {
                thing: 'AlongerName',
                value: 2304
            }

        ],
        keys : {
            x: 'thing',
            value:  ['value']
        },
        type: 'bar'
    },
    axis: {
        rotated: true,
        x: {
            type: 'category',
            label: 'thingy'
        },
        y: {
            label: 'something'
        }
    }
});

I've created a jsfiddle to illustrate the point

@phandel
Copy link

phandel commented Mar 2, 2017

+1 ... only happens with 2 entries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request or an enhancement resolved maybe
Projects
None yet
Development

No branches or pull requests

5 participants