question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enforce branch column order and colors

See original GitHub issue

First of all, thank you for the great project!

Currently the order of branch columns is determined by which branch comes first in commit list:

export class GraphColumns<TNode> {
  private branches: Set<Branch["name"]> = new Set();

  public constructor(commits: Array<Commit<TNode>>) {
    commits.forEach((commit) => this.branches.add(commit.branchToDisplay));
  }
// ...
}

My app has an UI which hides/shows branches based on user requests by filtering commits which get imported to gitgraph, and arbitrarily changing branch order and colors become confusing for users. I’d like to have master branch always having column index 0, first selected branch having column index 1, second branch having column index 2, … regardless of which commit comes first in the log.

What would be the easiest way to accomplish this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
nicoespeoncommented, Mar 29, 2019

Thanks for your contribution @haizz 👋

As mentioned in the PR: I simply refactor the name to be more explicit. I went for the semantics of Array.prototype.sort(), thus I called it CompareBranchesOrder instead of BranchesOrderFunction.

I published v1.1.0-2 of @gitgraph/react & @gitgraph/core that contains the change. Let’s know if you find some issues with different ordering of branches.

0reactions
haizzcommented, Apr 1, 2019

@nicoespeon Thank you so much! Working great so far.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Color branches of a dendrogram based on column in dataframe
It appears that it is ordering the colors from the bottom to the top of the dendrogram based on the order of the...
Read more >
Adding a column to the branch listing - Atlassian Developer
Bitbucket Server provides a listing of all the branches within a repository. It is a useful view for providing relevant information associated ...
Read more >
Columns: Change row colours #1813 - ocornut/imgui - GitHub
Version/Branch of Dear ImGui: 1.61 My Issue/Question: When dealing with ... Is there a way to get an x/y position of the current...
Read more >
TTree Class Reference - ROOT
A TTree, often called in jargon tree, consists of a list of independent columns or branches, represented by the TBranch class. Behind each...
Read more >
Learning to cook — ObjectListView 2.9.1 documentation
How do I make the sorted column have that slightly different colour? 23. How do I make a column that shows just an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found