ecomfe / echarts-stat

Statistics tool for Apache ECharts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Datasets with one value break freedmanDiaconis and scott methods

hughess opened this issue · comments

commented

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.