billboard.js icon indicating copy to clipboard operation
billboard.js copied to clipboard

[Bug] load() with less category result in empty space

Open Glandos opened this issue 10 months ago • 2 comments

Description

After generating a category graph with A, B, C, D, load data with only A, B, D.

An empty column is generated, it should be filled with larger category.

Steps to check or reproduce

https://jsfiddle.net/wa2x07rp/1/

Glandos avatar Mar 14 '25 14:03 Glandos

Workaround in https://jsfiddle.net/jcn6w49g/

It is needed to provide categories when some of them are removed. Is it really the expected behavior?

Glandos avatar Mar 14 '25 14:03 Glandos

Hi @Glandos, thanks for the report.

If you load new dataseries, instead "download", you'll see datasets will be located to the specified categories' position.

chart.load({
    columns: [
      ["x", "www.site1.com", "www.site2.com", "www.site4.com"],
      ["download2", 130, 300, 470]
    ],
});

Image

This can explain current behavior which you're replacing the current with the new value. So, having this in mind, when you want "replace" the already loaded data specify new categories values as you did in your second example.

chart.load({
    columns: [
      ["download", 130, 300, 470]
    ],
    categories: ["www.site1.com", "www.site2.com", "www.site4.com"]
});

netil avatar Mar 17 '25 05:03 netil