Class: GitGraph

GitGraph

new GitGraph(options)

GitGraph

This:
Parameters:
Name Type Description
options Object

GitGraph options

Properties
Name Type Argument 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.

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 Object

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

Parameters:
Name Type Description
options String | Object

The template name, or the template options

Source:
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