-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/4060 gantt working hours #5403
base: develop
Are you sure you want to change the base?
Feature/4060 gantt working hours #5403
Conversation
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@sidharthv96 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5403 +/- ##
==========================================
+ Coverage 5.73% 5.87% +0.13%
==========================================
Files 278 277 -1
Lines 41999 42060 +61
Branches 490 524 +34
==========================================
+ Hits 2409 2470 +61
Misses 39590 39590
Flags with carried forward coverage won't be shown. Click here to find out more.
|
docs/syntax/gantt.md
Outdated
You can assign core working hours within the Gantt by providing a time value to `wdStartTime` and `wdEndTime`. It expects a time in the 24hour format as shown below. | ||
|
||
```gantt | ||
title A Gantt Diagram | ||
accTitle: A simple sample gantt diagram | ||
accDescr: 2 sections with 2 tasks each, from 2014 | ||
dateFormat YYYY-MM-DD | ||
wdStartTime 08:00 | ||
wdEndTime 17:00 | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the YAML config for this, instead of adding more custom syntax?
You can assign core working hours within the Gantt by providing a time value to `wdStartTime` and `wdEndTime`. It expects a time in the 24hour format as shown below. | |
```gantt | |
title A Gantt Diagram | |
accTitle: A simple sample gantt diagram | |
accDescr: 2 sections with 2 tasks each, from 2014 | |
dateFormat YYYY-MM-DD | |
wdStartTime 08:00 | |
wdEndTime 17:00 | |
``` | |
You can assign core working hours within the Gantt by providing a time value to `wdStartTime` and `wdEndTime`. It expects a time in the 24hour format as shown below. | |
``` | |
--- | |
title: A Gantt Diagram | |
config: | |
gantt: | |
dateFormat: YYYY-MM-DD | |
workdayStartTime: 08:00 | |
workdayEndTime: 17:00 | |
--- | |
gantt | |
accTitle: A simple sample gantt diagram | |
accDescr: 2 sections with 2 tasks each, from 2014 | |
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry can you explain in a bit more detail what you mean? Does this relate to not using jison?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was to move new configurations into the yaml config section, and not to add more keywords in jison.
I only edited the documentation, to reflect how it'll look after the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nirname
The below is created within the config.type.ts automatically by the YAML config file (wdStartTime and wdEndTime are the two new pieces of code. However, I want to import this into the GanttDB.js file but as i understand it 'interface' is a typescript definition that cannot be imported in a plain JS file. What methods are there for getting around this? Or is it purely a need to re-write the GanttDB file?
export interface GanttDiagramConfig extends BaseDiagramConfig {
/**
* Margin top for the text over the diagram
*/
titleTopMargin?: number;
/**
* The height of the bars in the graph
*/
barHeight?: number;
/**
* The margin between the different activities in the gantt diagram
*/
barGap?: number;
/**
* Margin between title and gantt diagram and between axis and gantt diagram.
*
*/
topPadding?: number;
/**
* The space allocated for the section name to the right of the activities
*
*/
rightPadding?: number;
/**
* The space allocated for the section name to the left of the activities
*
*/
leftPadding?: number;
/**
* Vertical starting position of the grid lines
*/
gridLineStartPadding?: number;
/**
* Font size
*/
fontSize?: number;
/**
* Font size for sections
*/
sectionFontSize?: string | number;
/**
* The number of alternating section styles
*/
numberSectionStyles?: number;
/**
* Date/time format of the axis
*
* This might need adjustment to match your locale and preferences.
*
*/
axisFormat?: string;
/**
* axis ticks
*
* Pattern is:
*
* ```javascript
* /^([1-9][0-9]*)(millisecond|second|minute|hour|day|week|month)$/
* ```
*
*/
tickInterval?: string;
/**
* When this flag is set, date labels will be added to the top of the chart
*
*/
topAxis?: boolean;
/**
* Controls the display mode.
*
*/
displayMode?: '' | 'compact';
/**
* On which day a week-based interval should start
*
*/
weekday?: 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
/**
* Allows user to set the start time for the Workday. Used in calculating end times for tasks when set in hours
*
*/
wdStartTime?: string;
/**
* Allows user to set the end time for workday
*
*/
wdEndTime?: string;
Co-authored-by: Sidharth Vinod <github@sidharth.dev>
@robo1200 Any progress on this PR? I'm interested in seeing this completed and can also help in taking it to the finish line if required. |
@80avin happy for some support, the actual functionality works but it is currently parsed using Jison rather than Langium. I had a quick look and couldn’t work through how to get the langium parser to work so any support would be much appreciated. |
📑 Summary
First contribution to the community but a long time user and want to start providing some added benefit. Only a hobbyist developer so apologies in advance if some of this is not right first time.
Updated the Gantt chart to allow workday start and end times to be entered and for the gantt chart to then uses them for calculated task end dates assuming durations in hours and or minutes are provided.
Resolves #4060
📏 Design Decisions
Added options to the parser for a Working day start time and working day end time
Ammended the GetEndDate function to be able to calculate task end dates and times using working hours if provided by the user alongside a task duration. Ensured through testing that other elements of the gantt chart functionality such as inclusive / exclusive weekends can still be used in conjuction
Added applicable tests for both the parser and the ganttDB file.
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.develop
branch