Class: GitGraph

GitGraph

new GitGraph(optionsopt)

GitGraph

This:
Parameters:
Name Type Attributes Description
options object <optional>

GitGraph options

Properties
Name Type Attributes Default Description
elementId string <optional>
"gitGraph"

Id of the canvas container

template Template | string | object <optional>

Template of the graph

author string <optional>
"Sergio Flores <saxo-guy@epic.com>"

Default author for commits

mode string <optional>
(null|"compact")

Display mode

canvas HTMLElement <optional>

DOM canvas (ex: document.getElementById("id"))

orientation string <optional>
("vertical-reverse"|"horizontal"|"horizontal-reverse")

Graph orientation

reverseArrow boolean <optional>
false

Make arrows point to ancestors if true

initCommitOffsetX number <optional>
0

Add custom offsetX to initial commit.

initCommitOffsetY number <optional>
0

Add custom offsetY to initial commit.

tooltipContainer HTMLElement <optional>
document.body

HTML Element containing tooltips in compact mode.

Source:

Methods

applyCommits(event, callbackFn)

Hover event on commit dot

This:
Parameters:
Name Type Description
event MouseEvent

Mouse event

callbackFn CommitCallback

A callback function that will be called for each commit

Source:

branch(options) → {Branch}

Create new branch

This:
Parameters:
Name Type Description
options string | object

Branch name | Options of Branch

Source:
See:
Returns:

New branch

Type
Branch

click(event)

Click event on commit dot

This:
Parameters:
Name Type Description
event MouseEvent

Mouse event

Source:

commit(options) → {GitGraph}

Commit on HEAD

This:
Parameters:
Name Type Description
options string | BranchCommitOptions

Message | Options of commit

Source:
See:
Returns:

this - Return the main object so we can chain

Type
GitGraph

dispose()

Disposing canvas event handlers

This:
Source:

hover(event)

Hover event on commit dot

This:
Parameters:
Name Type Description
event MouseEvent

Mouse event

Source:

newTemplate(options) → {Template}

Create a new template

This:
Parameters:
Name Type Description
options string | object

The template name, or the template options

Source:
See:
Returns:
Type
Template

orphanBranch(options) → {Branch}

Create new orphan branch

This:
Parameters:
Name Type Description
options string | object

Branch name | Options of Branch

Source:
See:
Returns:

New branch

Type
Branch

render()

Render the canvas

This:
Source:

tag(options) → {GitGraph}

Tag the HEAD

This:
Parameters:
Name Type Description
options object

Options of tag

Source:
See:
Returns:

this - Return the main object so we can chain

Type
GitGraph