-
Notifications
You must be signed in to change notification settings - Fork 370
Render graph from JSON #38
Comments
Hi @TesloCosmin =) For sure that would be a cool feature to add. That would be a nice step to do to enable integration with GitHub / Bitbucket / etc. APIs. Long time we didn't update the lib but I'll find some time to give it a look. Thanks! |
👍 for this feature request! Do you know guys is there any standard of JSON format, which could be used for that? |
Looks like there isn't really a git-graph specific format. There's the format used in the Github API and the Bitbucket API, which are both different. There's also the more generic JSON Graph Format and the Netflix JSON Graph Specification. I think it would be more sensible to have intermediary converters for each source than try to find a common denominator. |
Wondering if there has been any additional work on this feature? |
Hi @strich =) There has been no concrete progression from my side, but it's still something I wish to do. There has been discussions around that feature, as you can see with related issues above. |
Worth a check: https://github.com/fabien0102/git2json |
Here is a method I have made to render a gitgraph in Aras PLM, from a GitLab commits exports I still need to work on it to make sure it ends on the main (gitlab commits are pulled on a branch basis and the branch of each commit is not referenced) It assumes the input json is sorted chronologically. |
@YMA-MDL I would like first of all to thank you for your solution. It helped me so much. Have you found solution to how merge branches to master and not vice versa? I have multiple "master into" merge commits. |
Hi, |
@j-barata Very interesting, I wasn't aware about this BTW, this feature is a part of our plan for the v2 (#188 #187). The actual idea is to take this kind of json (https://github.com/fabien0102/git2json/blob/master/test/gitlog.expected) and use it in react with something like this: <Gitgraph data={myJSON} /> or <Gitgraph>
{(gitgraph) => {
gitgraph.import(myJSON)
}}
</Gitgraph> You have all examples of the new gitgraph-react usage here -> https://github.com/nicoespeon/gitgraph.js/tree/2.0.0/packages/gitgraph-react/src/stories Any feedback are appreciate 😉 |
This will be fixed with v2 with an |
So, this is technically not resolved for the We even have stories to document usage: <Gitgraph>
{(gitgraph) => {
gitgraph.import(simpleGraph);
}}
</Gitgraph> // simpleGraph JS object, could be a JSON
export default [
{
refs: ["HEAD", "feat1"],
hash: "5d8e7d7f6b4cf520b4ec55a0face7c07b4d642c1",
hashAbbrev: "5d8e7d7",
tree: "4b825dc642cb6eb9a060e54bf8d69288fbee4904",
treeAbbrev: "4b825dc",
parents: ["0df8d7cce68908571cd7cd9178e498f1519de77e"],
parentsAbbrev: ["0df8d7c"],
author: {
name: "Nicolas Carlo",
email: "[email protected]",
timestamp: 1532021290000,
},
committer: {
name: "Nicolas Carlo",
email: "[email protected]",
timestamp: 1532021290000,
},
subject: "third",
body: "",
notes: "",
stats: [],
},
{
refs: ["master"],
hash: "5e5b104afddb719d02b6d685463dd38b4dd82493",
hashAbbrev: "5e5b104",
tree: "4b825dc642cb6eb9a060e54bf8d69288fbee4904",
treeAbbrev: "4b825dc",
parents: ["0df8d7cce68908571cd7cd9178e498f1519de77e"],
parentsAbbrev: ["0df8d7c"],
author: {
name: "Nicolas Carlo",
email: "[email protected]",
timestamp: 1532021274000,
},
committer: {
name: "Nicolas Carlo",
email: "[email protected]",
timestamp: 1532021274000,
},
subject: "second",
body: "",
notes: "",
stats: [],
},
{
refs: [],
hash: "0df8d7cce68908571cd7cd9178e498f1519de77e",
hashAbbrev: "0df8d7c",
tree: "4b825dc642cb6eb9a060e54bf8d69288fbee4904",
treeAbbrev: "4b825dc",
parents: [],
parentsAbbrev: [],
author: {
name: "Nicolas Carlo",
email: "[email protected]",
timestamp: 1532021230000,
},
committer: {
name: "Nicolas Carlo",
email: "[email protected]",
timestamp: 1532021230000,
},
subject: "first",
body: "",
notes: "",
stats: [],
},
]; We didn't test a lot of use-cases though, so we flagged the feature as "experimental" for now. But it exists. I suggest you report any scenario where it fails rendering the graph as you would expect—or might even failed rendering at all. Thus, I'm closing this issue as we won't maintain the We still accept PRs if someone really needs it, but I'd suggest moving to the aforementioned packages. Thanks 🙏 |
It would be nice to have the possibility to render the graph automatically from JSON data (coming from an Ajax call for example), including the options for customizing dots, arrow, branches, message and so on.
The text was updated successfully, but these errors were encountered: