c3 icon indicating copy to clipboard operation
c3 copied to clipboard

(timeseries) Invalid negative value for attribute width errors

Open annayo opened this issue 12 years ago • 3 comments

Originally opened as issue https://github.com/masayuki0812/c3/issues/299, happens with descending time values. Resulting in (up to) hundreds of errors (realtime data): Error: Invalid negative value for attribute width="-517" (each time new data is loaded, which is every 2 seconds)

The time array is sorted descending (10 minutes: start with the current minute and decrement for each of the last 9 minutes). The data is realtime, so incrementing from 10 minutes ago is a complicated and undesirable change.

The time and values generate properly, but do not load properly. But the graph looks vertically smashed (despite setting height and bar width), rollovers are broken, and the console is filled with errors.

This app has been working flawlessly until I updated the library yesterday. Using version pre-0.3.5 will work, but that introduces other bugs. Please let me know if there's a way to make descending sort work with the latest version (or if this is related to something else). Thanks for all your work. I love this library and hope to keep using it.

array example: ['time', 1401908040000, 1401907980000, 1401907920000, 1401907860000, 1401907800000, 1401907740000, 1401907680000, 1401907620000, 1401907560000, 1401907500000]

annayo avatar Jun 04 '14 22:06 annayo

Hi, Thank you for reporting. As you wrote, this is a bug that happens when x is not sorted ascendantly. I think this has been fixed and please try the code that includes the commit above. Thanks.

masayuki0812 avatar Jun 05 '14 02:06 masayuki0812

That fixed the errors! Thank you for your hard work and quick response.

However, still noticing a bug with the graph height gettting smashed (by about 50%). I set the height to 350px. If I increase to 500, it no longer looks smashed but is still only rendering at about 350px (the tooltip hover line does not extend the full height of the bar). I can open a new issue if that's appropriate.

screen shot 2014-06-04 at 8 09 36 pm

annayo avatar Jun 05 '14 03:06 annayo

Thank you for confirming. Yes, it would be appropriate to open as a new issue. Thanks. And if possible, could you show me the code? I tried, but I could not reproduce that issue.

masayuki0812 avatar Jun 05 '14 03:06 masayuki0812