mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
Bonsai: add Hour zoom level to the interactive Gantt chart
The jsGantt-improved library that renders Bonsai's Gantt chart already ships full support for an "Hour" granularity (column width, header labels in every bundled language, hour-aware rendering math). Bonsai's config only exposed Day/Week/Month/Quarter, with a comment claiming Hour caused browser issues even with vUseSingleCell enabled. Headless Chrome testing against the same library version shows that claim no longer holds once vUseSingleCell is active (as Bonsai already configures it at 10000): Hour-format charts render without errors from typical schedules up through fairly extreme ones (5000 tasks across a 3 year span rendered in about 2.4s). The failure mode the old comment described only reproduces with vUseSingleCell disabled, which is not how Bonsai runs it. Task start/finish times already flow through to the chart unmodified as raw ISO datetimes (tool/sequence.py create_new_task_json), so any schedule authored with real hour-level timestamps, for example an imported MS Project/P6/Excel schedule or one written directly through ifcopenshell-python, can now be viewed at hour granularity. Verified live with a night shift schedule crossing midnight, rendered correctly with no console errors. Note: Bonsai's own "Edit Task Time" UI currently always snaps ScheduleStart/ScheduleFinish to 09:00/17:00 regardless of the hour entered (ifcopenshell/api/sequence/edit_task_time.py), and work calendars only encode working days, not working hours. So authoring a genuine hour-precision schedule through that UI is still not possible; this change only unlocks viewing hour-level data that already exists in the model. Fixing the editor and calendar model is a separate, larger design decision for a maintainer. Addresses #2772. Generated with the assistance of an AI coding tool.
This commit is contained in:
committed by
Dion Moult
parent
a45f2fae61
commit
727b5f3475
@@ -244,7 +244,7 @@ function addGanttElement(blenderId, tasks, workSched, filename) {
|
||||
vShowTaskInfoLink: 1, // Show link in tool tip (0/1)
|
||||
vShowEndWeekDate: 0, // Show/Hide the date for the last day of the week in header for daily
|
||||
vUseSingleCell: 10000, // Set the threshold cell per table row (Helps performance for large data.
|
||||
vFormatArr: ["Day", "Week", "Month", "Quarter"], // Even with setUseSingleCell using Hour format on such a large chart can cause issues in some browsers,
|
||||
vFormatArr: ["Hour", "Day", "Week", "Month", "Quarter"], // vUseSingleCell keeps Hour usable on large charts.
|
||||
vShowRes: true, // Disable the resource column.
|
||||
vShowComp: false, // Disable the completion column.
|
||||
vShowDur: false, // Disable the duration column, because jsgantt doesn't calculate durations the way we want.
|
||||
|
||||
@@ -12,7 +12,7 @@ function create_gantt_chart(json_data) {
|
||||
vShowTaskInfoLink: 1, // Show link in tool tip (0/1)
|
||||
vShowEndWeekDate: 0, // Show/Hide the date for the last day of the week in header for daily
|
||||
vUseSingleCell: 10000, // Set the threshold cell per table row (Helps performance for large data.
|
||||
vFormatArr: ['Day', 'Week', 'Month', 'Quarter'], // Even with setUseSingleCell using Hour format on such a large chart can cause issues in some browsers,
|
||||
vFormatArr: ['Hour', 'Day', 'Week', 'Month', 'Quarter'], // vUseSingleCell keeps Hour usable on large charts.
|
||||
vShowRes: true, // Disable the resource column.
|
||||
vShowComp: false, // Disable the completion column.
|
||||
vShowDur: false, // Disable the duration column, because jsgantt doesn't calculate durations the way we want.
|
||||
|
||||
Reference in New Issue
Block a user