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

label y-position for all-zero-valued graph #1747

Open
nzjay opened this issue Jul 1, 2016 · 0 comments
Open

label y-position for all-zero-valued graph #1747

nzjay opened this issue Jul 1, 2016 · 0 comments

Comments

@nzjay
Copy link

nzjay commented Jul 1, 2016

https://github.com/c3js/c3/blob/98769492d07b6103bfc30a0254ccb1e1ec1cca50/src/text.js

getYForText function looks to make a decision for dropping the labels below bars for negative graphs, and treats the all-zero-values case as a negative bar graph

If you are graphing data that is always non-zero positive this can cause the labels to disappear behind the x-axis, I have looked around a bit and I can't see a way to override this decision through configuration

Reproduction code

http://jsfiddle.net/jaa7e1h4/

// label for zero values visible above x-axis
var chart = c3.generate({
    data: {
        columns: [
            ['data1', 1, 0, 0, 0, 0, 0]
        ],
        labels: true,
        type: 'bar'
    }
});

http://jsfiddle.net/jaa7e1h4/1/

// change to all zeroes, no labels visible
var chart = c3.generate({
    data: {
        columns: [
            ['data1', 0, 0, 0, 0, 0, 0]
        ],
        labels: true,
        type: 'bar'
    }
});

C3js version c3@0.4.11
Confirmed in Chrome, Firefox

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

1 participant