chart does not render if data contains value of 0 when using logarithmic scale

Here we have one red vote, renders correctly:

data: {
        labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
        datasets: [{
            label: '# of Votes',
            data: [1, 2, 3, 5, 2, 3]
        }]
    }

image

Here we have zero red votes, does not render:

data: {
        labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
        datasets: [{
            label: '# of Votes',
            data: [0, 2, 3, 5, 2, 3]
        }]
    }

image

http://codepen.io/barsh/pen/GqOzKA

Author: Fantashit

1 thought on “chart does not render if data contains value of 0 when using logarithmic scale

  1. Wouldn’t it be better to allow user 0 values? I think we should consider this in calculations.
    There are also no checks for division by zero in the code. It should be improved and I try to suggest the code solution soon.

Comments are closed.