Skip to content

Datasets with one value break freedmanDiaconis and scott methods #42

Open
@hughess

Description

@hughess

Occasionally, I need to show a histogram that contains only one value (the dataset below is an example):

[
{a: 5},
{a: 5},
{a: 5},
{a: 5},
{a: 5},
{a: 5},
{a: 5}
]

This works with the default bin method (square root) and works with sturges, but does not work with freedmanDiaconis or scott. For the two methods where it does not work, I receive an "Invalid array length" error.

While the chart itself isn't meaningful when it only has 1 value, it is a use case that will come up occasionally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions