Skip to content

Commit

Permalink
JOSS release :thumb:
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCoene committed Aug 10, 2018
1 parent 8091629 commit 5a93109
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 156 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,7 +1,7 @@
# sigmajs

[![Travis-CI Build Status](https://travis-ci.org/JohnCoene/sigmajs.svg?branch=master)](https://travis-ci.org/JohnCoene/sigmajs) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/JohnCoene/sigmajs?branch=master&svg=true)](https://ci.appveyor.com/project/JohnCoene/sigmajs) [![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable) [![bitbucket](https://img.shields.io/bitbucket/pipelines/JohnCoene/sigmajs.svg)](https://bitbucket.org/JohnCoene/sigmajs) [![CRAN status](https://www.r-pkg.org/badges/version/sigmajs)](https://cran.r-project.org/package=sigmajs)
[![CircleCI](https://img.shields.io/circleci/project/github/JohnCoene/sigmajs.svg)](https://github.com/JohnCoene/sigmajs) [![Coverage status](https://coveralls.io/repos/github/JohnCoene/sigmajs/badge.svg)](https://coveralls.io/r/JohnCoene/sigmajs?branch=master) [![Coverage status](https://codecov.io/gh/JohnCoene/sigmajs/branch/master/graph/badge.svg)](https://codecov.io/github/JohnCoene/sigmajs?branch=master) [![twinetverse](https://img.shields.io/badge/twinetverse-0.0.2-yellow.svg)](http://twinetverse.john-coene.com/)
[![CircleCI](https://img.shields.io/circleci/project/github/JohnCoene/sigmajs.svg)](https://github.com/JohnCoene/sigmajs) [![Coverage status](https://coveralls.io/repos/github/JohnCoene/sigmajs/badge.svg)](https://coveralls.io/r/JohnCoene/sigmajs?branch=master) [![Coverage status](https://codecov.io/gh/JohnCoene/sigmajs/branch/master/graph/badge.svg)](https://codecov.io/github/JohnCoene/sigmajs?branch=master) [![DOI](http://joss.theoj.org/papers/10.21105/joss.00814/status.svg)](https://doi.org/10.21105/joss.00814) [![twinetverse](https://img.shields.io/badge/twinetverse-0.0.2-yellow.svg)](http://twinetverse.john-coene.com/)

<img src="/man/figures/logo.png" height="150" align="right" />

Expand Down
85 changes: 43 additions & 42 deletions docs/index.html

Large diffs are not rendered by default.

227 changes: 115 additions & 112 deletions docs/index_files/sigmajs-binding-0.1.1/sigmajs.js
Expand Up @@ -22,42 +22,6 @@ HTMLWidgets.widget({

var sel_handle = new crosstalk.SelectionHandle();

sel_handle.on("change", function(ev) {

if (ev.sender !== sel_handle) {
s.graph.nodes().forEach(function(n) {
n.color = n.originalColor;
});
s.graph.edges().forEach(function(e) {
e.color = e.originalColor;
});
s.refresh();
}

if (typeof ev.value[0] != 'undefined') {

var nodeId = ev.value[0];
toKeep = s.graph.neighbors(nodeId);
toKeep[nodeId] = s.graph.nodes(String(nodeId));
sel_handle.set(nodeId);
s.graph.nodes().forEach(function(n) {
if (toKeep[n.id])
n.color = n.originalColor;
else
n.color = '#eee';
});
s.graph.edges().forEach(function(e) {
if (toKeep[e.source] && toKeep[e.target])
e.color = e.originalColor;
else
e.color = '#eee';
});
s.refresh();

}

});

return {

renderValue: function (x) {
Expand Down Expand Up @@ -124,8 +88,10 @@ HTMLWidgets.widget({
}

// force neighbours true if crosstalk enabled
if(x.crosstalk.crosstalk_key !== null){
x.neighbours = true;
if(x.crosstalk.crosstalk_key !== null && !x.hasOwnProperty('neighbours')){
x.neighbours = [];
x.neighbours.edges = "#eee";
x.neighbours.nodes = "#eee";
}

// highlight neighbours
Expand All @@ -147,13 +113,13 @@ HTMLWidgets.widget({
if (toKeep[n.id])
n.color = n.originalColor;
else
n.color = '#eee';
n.color = x.neighbours.nodes;
});
s.graph.edges().forEach(function(e) {
if (toKeep[e.source] && toKeep[e.target])
e.color = e.originalColor;
else
e.color = '#eee';
e.color = x.neighbours.edges;
});
s.refresh();
});
Expand All @@ -168,6 +134,43 @@ HTMLWidgets.widget({
sel_handle.clear();
});
}


sel_handle.on("change", function(ev) {

if (ev.sender !== sel_handle) {
s.graph.nodes().forEach(function(n) {
n.color = n.originalColor;
});
s.graph.edges().forEach(function(e) {
e.color = e.originalColor;
});
s.refresh();
}

if (typeof ev.value[0] != 'undefined') {

var nodeId = ev.value[0];
toKeep = s.graph.neighbors(nodeId);
toKeep[nodeId] = s.graph.nodes(String(nodeId));
sel_handle.set(nodeId);
s.graph.nodes().forEach(function(n) {
if (toKeep[n.id])
n.color = n.originalColor;
else
n.color = x.neighbours.nodes;
});
s.graph.edges().forEach(function(e) {
if (toKeep[e.source] && toKeep[e.target])
e.color = e.originalColor;
else
e.color = x.neighbours.edges;
});
s.refresh();

}

});

// start forceAtlas
if (x.hasOwnProperty('force')) {
Expand Down Expand Up @@ -370,172 +373,172 @@ HTMLWidgets.widget({
}
}

// stop force
if(x.hasOwnProperty('forceStopDelay')){
if(x.button.event === 'force_stop'){
button.addEventListener("click", function(event) {
setTimeout(function () {
s.stopForceAtlas2();
}, x.forceStopDelay);
});
} else {
setTimeout(function () {
s.stopForceAtlas2();
}, x.forceStopDelay);
}
}

if(x.hasOwnProperty('forceRestartDelay')){

var is_it_running = s.isForceAtlas2Running();

if(is_it_running === false){
s.startForceAtlas2();
}

x.forceRestartDelay.forEach((force) => {
setTimeout(function () {
s.killForceAtlas2();
s.startForceAtlas2();
}, force.sigmajsdelay);
});

}

if(x.hasOwnProperty('exportSVG')){
button.addEventListener("click", function(event) {
var output = s.toSVG(x.exportSVG);
});
}

if(x.hasOwnProperty('exportIMG')){
button.addEventListener("click", function(event) {
var output = renderer.snapshot(x.exportIMG);
});
}

sel_handle.setGroup(x.crosstalk.crosstalk_group);
//filter_handle.setGroup(x.crosstalk.crosstalk_group);
s.refresh(); // refresh

// events
if (HTMLWidgets.shinyMode) {

// click node
s.bind('clickNode', function (e) {
Shiny.onInputChange(el.id + '_click_node' + ":sigmajsParse", e.data.node);
Shiny.setInputValue(el.id + '_click_node' + ":sigmajsParseJS", e.data.node);
});

// click nodeS
s.bind('clickNodes', function (e) {
Shiny.onInputChange(el.id + '_click_nodes' + ":sigmajsParse", e.data.nodes);
Shiny.setInputValue(el.id + '_click_nodes' + ":sigmajsParseJS", e.data.nodes);
});

// click edge
s.bind('clickEdge', function (e) {
Shiny.onInputChange(el.id + '_click_edge' + ":sigmajsParse", e.data.edge);
Shiny.setInputValue(el.id + '_click_edge' + ":sigmajsParseJS", e.data.edge);
});

// click edgeS
s.bind('clickEdges', function (e) {
Shiny.onInputChange(el.id + '_click_edges' + ":sigmajsParse", e.data.edges);
Shiny.setInputValue(el.id + '_click_edges' + ":sigmajsParseJS", e.data.edges);
});

// click stage
s.bind('clickStage', function (e) {
Shiny.onInputChange(el.id + '_click_stage' + ":sigmajsParse", true);
Shiny.setInputValue(el.id + '_click_stage' + ":sigmajsParseJS", true);
});

// double click stage
s.bind('doubleClickStage', function (e) {
Shiny.onInputChange(el.id + '_double_click_stage' + ":sigmajsParse", true);
Shiny.setInputValue(el.id + '_double_click_stage' + ":sigmajsParseJS", true);
});

// right click stage
s.bind('rightClickStage', function (e) {
Shiny.onInputChange(el.id + '_right_click_stage' + ":sigmajsParse", true);
Shiny.setInputValue(el.id + '_right_click_stage' + ":sigmajsParseJS", true);
});

// double click node
s.bind('doubleClickNode', function (e) {
Shiny.onInputChange(el.id + '_double_click_node' + ":sigmajsParse", e.data.node);
Shiny.setInputValue(el.id + '_double_click_node' + ":sigmajsParseJS", e.data.node);
});

// double click nodeS
s.bind('doubleClickNodes', function (e) {
Shiny.onInputChange(el.id + '_double_click_nodes' + ":sigmajsParse", e.data.nodes);
Shiny.setInputValue(el.id + '_double_click_nodes' + ":sigmajsParseJS", e.data.nodes);
});

// double click edge
s.bind('doubleClickEdge', function (e) {
Shiny.onInputChange(el.id + '_double_click_edge' + ":sigmajsParse", e.data.edge);
Shiny.setInputValue(el.id + '_double_click_edge' + ":sigmajsParseJS", e.data.edge);
});

// double click edgeS
s.bind('doubleClickEdges', function (e) {
Shiny.onInputChange(el.id + '_double_click_edges' + ":sigmajsParse", e.data.edges);
Shiny.setInputValue(el.id + '_double_click_edges' + ":sigmajsParseJS", e.data.edges);
});

// right click node
s.bind('rightClickNode', function (e) {
Shiny.onInputChange(el.id + '_right_click_node' + ":sigmajsParse", e.data.node);
Shiny.setInputValue(el.id + '_right_click_node' + ":sigmajsParseJS", e.data.node);
});

// right click nodeS
s.bind('rightClickNodes', function (e) {
Shiny.onInputChange(el.id + '_right_click_nodes' + ":sigmajsParse", e.data.nodes);
Shiny.setInputValue(el.id + '_right_click_nodes' + ":sigmajsParseJS", e.data.nodes);
});

// right click edge
s.bind('rightClickEdge', function (e) {
Shiny.onInputChange(el.id + '_right_click_edge' + ":sigmajsParse", e.data.edge);
Shiny.setInputValue(el.id + '_right_click_edge' + ":sigmajsParseJS", e.data.edge);
});

// right click edgeS
s.bind('rightClickEdges', function (e) {
Shiny.onInputChange(el.id + '_right_click_edges' + ":sigmajsParse", e.data.edges);
Shiny.setInputValue(el.id + '_right_click_edges' + ":sigmajsParseJS", e.data.edges);
});

// over node
s.bind('overNode', function (e) {
Shiny.onInputChange(el.id + '_over_node' + ":sigmajsParse", e.data.node);
Shiny.setInputValue(el.id + '_over_node' + ":sigmajsParseJS", e.data.node);
});

// over nodeS
s.bind('overNodes', function (e) {
Shiny.onInputChange(el.id + '_over_nodes' + ":sigmajsParse", e.data.nodes);
Shiny.setInputValue(el.id + '_over_nodes' + ":sigmajsParseJS", e.data.nodes);
});

// over edge
s.bind('overEdge', function (e) {
Shiny.onInputChange(el.id + '_over_edge' + ":sigmajsParse", e.data.edge);
Shiny.setInputValue(el.id + '_over_edge' + ":sigmajsParse", e.data.edge);
});

// over edgeS
s.bind('overEdges', function (e) {
Shiny.onInputChange(el.id + '_over_edges' + ":sigmajsParse", e.data.edges);
Shiny.setInputValue(el.id + '_over_edges' + ":sigmajsParse", e.data.edges);
});

// out node
s.bind('outNode', function (e) {
Shiny.onInputChange(el.id + '_out_node' + ":sigmajsParse", e.data.node);
Shiny.setInputValue(el.id + '_out_node' + ":sigmajsParse", e.data.node);
});

// out nodeS
s.bind('outNodes', function (e) {
Shiny.onInputChange(el.id + '_out_nodes' + ":sigmajsParse", e.data.nodes);
Shiny.setInputValue(el.id + '_out_nodes' + ":sigmajsParse", e.data.nodes);
});

// out edge
s.bind('outEdge', function (e) {
Shiny.onInputChange(el.id + '_out_edge' + ":sigmajsParse", e.data.edge);
Shiny.setInputValue(el.id + '_out_edge' + ":sigmajsParse", e.data.edge);
});

// out edgeS
s.bind('outEdges', function (e) {
Shiny.onInputChange(el.id + '_out_edges' + ":sigmajsParse", e.data.edges);
Shiny.setInputValue(el.id + '_out_edges' + ":sigmajsParse", e.data.edges);
});
}

s.refresh(); // refresh

// stop force
if(x.hasOwnProperty('forceStopDelay')){
if(x.button.event === 'force_stop'){
button.addEventListener("click", function(event) {
setTimeout(function () {
s.stopForceAtlas2();
}, x.forceStopDelay);
});
} else {
setTimeout(function () {
s.stopForceAtlas2();
}, x.forceStopDelay);
}
}

if(x.hasOwnProperty('forceRestartDelay')){

var is_it_running = s.isForceAtlas2Running();

if(is_it_running === false){
s.startForceAtlas2();
}

x.forceRestartDelay.forEach((force) => {
setTimeout(function () {
s.killForceAtlas2();
s.startForceAtlas2();
}, force.sigmajsdelay);
});

}

if(x.hasOwnProperty('exportSVG')){
button.addEventListener("click", function(event) {
var output = s.toSVG(x.exportSVG);
});
}

if(x.hasOwnProperty('exportIMG')){
button.addEventListener("click", function(event) {
var output = renderer.snapshot(x.exportIMG);
});
}

sel_handle.setGroup(x.crosstalk.crosstalk_group);
//filter_handle.setGroup(x.crosstalk.crosstalk_group);

},

Expand Down
2 changes: 1 addition & 1 deletion index.Rmd
@@ -1,4 +1,4 @@
[![Travis-CI Build Status](https://travis-ci.org/JohnCoene/sigmajs.svg?branch=master)](https://travis-ci.org/JohnCoene/sigmajs) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/JohnCoene/sigmajs?branch=master&svg=true)](https://ci.appveyor.com/project/JohnCoene/sigmajs) [![bitbucket](https://img.shields.io/bitbucket/pipelines/JohnCoene/sigmajs.svg)](https://bitbucket.org/JohnCoene/sigmajs) [![CircleCI](https://img.shields.io/circleci/project/github/JohnCoene/sigmajs.svg)](https://github.com/JohnCoene/sigmajs) [![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable) [![CRAN status](https://www.r-pkg.org/badges/version/sigmajs)](https://cran.r-project.org/package=sigmajs) [![Coverage status](https://codecov.io/gh/JohnCoene/sigmajs/branch/master/graph/badge.svg)](https://codecov.io/github/JohnCoene/sigmajs?branch=master) [![Coverage status](https://coveralls.io/repos/github/JohnCoene/sigmajs/badge.svg)](https://coveralls.io/r/JohnCoene/sigmajs?branch=master) [![twinetverse](https://img.shields.io/badge/twinetverse-0.0.2-yellow.svg)](http://twinetverse.john-coene.com/)
[![Travis-CI Build Status](https://travis-ci.org/JohnCoene/sigmajs.svg?branch=master)](https://travis-ci.org/JohnCoene/sigmajs) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/JohnCoene/sigmajs?branch=master&svg=true)](https://ci.appveyor.com/project/JohnCoene/sigmajs) [![bitbucket](https://img.shields.io/bitbucket/pipelines/JohnCoene/sigmajs.svg)](https://bitbucket.org/JohnCoene/sigmajs) [![CircleCI](https://img.shields.io/circleci/project/github/JohnCoene/sigmajs.svg)](https://github.com/JohnCoene/sigmajs) [![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable) [![CRAN status](https://www.r-pkg.org/badges/version/sigmajs)](https://cran.r-project.org/package=sigmajs) [![Coverage status](https://codecov.io/gh/JohnCoene/sigmajs/branch/master/graph/badge.svg)](https://codecov.io/github/JohnCoene/sigmajs?branch=master) [![Coverage status](https://coveralls.io/repos/github/JohnCoene/sigmajs/badge.svg)](https://coveralls.io/r/JohnCoene/sigmajs?branch=master) [![DOI](http://joss.theoj.org/papers/10.21105/joss.00814/status.svg)](https://doi.org/10.21105/joss.00814) [![twinetverse](https://img.shields.io/badge/twinetverse-0.0.2-yellow.svg)](http://twinetverse.john-coene.com/)

```{r, include=FALSE}
library(htmltools)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 5a93109

Please sign in to comment.