ANovokmet / svelte-gantt

:calendar: Interactive JavaScript Gantt chart/resource booking component

Home Page:https://anovokmet.github.io/svelte-gantt/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

column count is not finite number

monsteradurm opened this issue · comments

Hello,
Receiving this error when initializing a new gantt container. Havent been able to find any other issues posted that seem related.

bundle.js:190209 Uncaught Error: column count is not a finite number at getColumns (bundle.js:190209:33) at instance$8 (bundle.js:190206:17) at init (bundle.js:185246:23) at new Gantt (bundle.js:190934:5) at bundle.js:13517:28 at commitHookEffectListMount (bundle.js:157860:30) at commitPassiveMountOnFiber (bundle.js:159612:17) at commitPassiveMountEffects_complete (bundle.js:159577:13) at commitPassiveMountEffects_begin (bundle.js:159564:11) at commitPassiveMountEffects (bundle.js:159552:7)

If it helps here are the properties being passed (JSON.stringify.
the from/to values ive tried passing as moments directly and as below as integers

{ "tasks": [ { "from": 1660744800, "to": 1661004000, "label": "mickey, Model Character", "resourceId": "mickey", "id": "2871802768", "isDisabled": false, "classes": "tl-task" }, { "from": 1659535200, "to": 1660485600, "label": "mickey, Rig Body", "resourceId": "mickey", "id": "2883658459", "isDisabled": false, "classes": "tl-task" }, { "from": 1659535200, "to": 1660572000, "label": "mickey, Rig Face", "resourceId": "mickey", "id": "2883659377", "isDisabled": false, "classes": "tl-task" }, { "from": 1659535200, "to": 1662904800, "label": "pluto, Model Character", "resourceId": "pluto", "id": "2883661677", "isDisabled": false, "classes": "tl-task" }, { "from": 1659535200, "to": 1661868000, "label": "pluto, Rig Character", "resourceId": "pluto", "id": "2883661827", "isDisabled": false, "classes": "tl-task" } ], "rows": [ { "id": "mickey", "label": "mickey", "children": [], "expanded": false, "classes": "tl-row" }, { "id": "pluto", "label": "pluto", "children": [], "expanded": false, "classes": "tl-row" } ], "from": { "from": 1659535200, "to": 1660485600, "label": "mickey, Rig Body", "resourceId": "mickey", "id": "2883658459", "isDisabled": false, "classes": "tl-task" }, "to": { "from": 1659535200, "to": 1662904800, "label": "pluto, Model Character", "resourceId": "pluto", "id": "2883661677", "isDisabled": false, "classes": "tl-task" }, "dateAdapter": {}, "columnOffset": 15, "magnetOffset": 15, "rowHeight": 52, "timeRanges": [], "rowPadding": 6, "headers": [ { "unit": "day", "format": "MMM Do" } ], "fitWidth": true, "minWidth": 800, "tableHeaders": [ { "title": "Label", "property": "label", "width": 140, "type": "tree" } ], "tableWidth": 240, "ganttTableModules": [ null ] }

commented

Usually this error happens when the column count is infinite. For example if you want to show days as columns, with a very large timespan (ie 2 years for example), on a small window.
If the width of column < 1px it will be approximated to zero which lead to a division by zero, then leading to a column count = infinite.

I gave a quick look to your props and it seems your from and to properties are structured as slot object and not as dates :
image

Correct these properties with dates and it should be better

Thanks for the prompt feedback.

I did have as dates before with the same issue, but the time scale seems to correctly pointed out as the issue.