-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Clickable gantt tasks #804
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…unction by splitting the functionargs by commas
…ws css styling for clickable elements
…at it returns the id that is specified after the keyword
…to undesired whitespace in function names
…ailable in a separate function. Also, setLink no longer using the .link attribute and instead calls links directly via window.open
…tespace in links and resolves the issue with href ending with EOF
…ommitted to github
…brackets in task text
Pull Request Test Coverage Report for Build 743
💛 - Coveralls |
knsv
pushed a commit
that referenced
this pull request
Jun 9, 2019
Merged
Thanks! Merging! |
Thank you so much for merging! I guess that merge was not the easiest one, with the code coming from an absolute JS, and JISON beginner. Love to see this project still being actively developed! |
@knsv Does this merge request allow for section names to be clickable? If not that would be a great addition. I could open an issue if appropriate. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding click capabilities to gantt diagrams
The problem of lack of interaction in gantt diagrams has been previously mentioned in several issues:
issue #715, issue #540.
I recently came across the same problem when I wanted to add interactive gantt diagrams to a web-based project of mine. Therefore, I propose this solution to be added to the project.
Syntax
The syntax is inspired by the flowchart syntax for click events. Yet, it is not the same and, in my view, has some properties that exceed the capabilities of flowchart interactions.
So how does it work?
Have a look at this example:
The processed gantt diagram looks like this:
By specifying
ganttTestClick
like so:clicking on the second task would result in this console output:
And clicking on the first task would open the mermaid documentation (
https://mermaidjs.github.io/
).Details
Click
click
is a keyword that introduces interaction commands. Just as in flowcharts, it must be followed by a valid task-id.By appending a
href
orcall
command toclick
, the corresponding action is attached to the task-id that is specified byclick
.Href
This is different to the flowchart syntax but I think that
href
actually improves readability.href
is to be appended by a double quoted link.By clicking on the task with id
id1
, the browser would scroll to the element with idexample
:Call
With this pull request, executing javascript functions by clicking on a task becomes possible.
The above call command binds the function
callback
to the task with idid1
. When clicked on the specified task, the functioncallback
is executed with all arguments specified inside the parentheses.By leaving the parentheses empty, no arguments are passed to
callback
.Function arguments
The following points must be considered when working with function arguments
passed to the specified callback
.trim()
is called. This removes allwhitespace before and after the string. Strings with starting or trailing whitespace should be
surrounded by double quotes when the whitespace should be preserved.
Combinations
click
allows any desired combination ofhref
andclick
.are both valid commands.