Browse Source

Merged all css files in vis.css, restructured image locations

css_transitions
josdejong 10 years ago
parent
commit
7a5fb1492d
15 changed files with 409 additions and 219 deletions
  1. +8
    -7
      Jakefile.js
  2. BIN
      dist/img/acceptDeleteIcon.png
  3. BIN
      dist/img/addNodeIcon.png
  4. BIN
      dist/img/backIcon.png
  5. BIN
      dist/img/connectIcon.png
  6. BIN
      dist/img/deleteIcon.png
  7. BIN
      dist/img/editIcon.png
  8. BIN
      dist/img/minus.png
  9. BIN
      dist/img/plus.png
  10. BIN
      dist/img/zoomExtends.png
  11. +190
    -0
      dist/vis.css
  12. +8
    -8
      examples/graph/20_navigation.html
  13. +190
    -191
      examples/graph/21_data_manipulation.html
  14. +6
    -6
      src/graph/css/graph-manipulation.css
  15. +7
    -7
      src/graph/css/graph-navigation.css

+ 8
- 7
Jakefile.js View File

@ -29,6 +29,8 @@ task('default', ['build', 'minify'], function () {
desc('Build the visualization library vis.js');
task('build', {async: true}, function () {
jake.mkdirP(DIST);
jake.mkdirP(DIST + '/img');
// concatenate and stringify the css files
concat({
src: [
@ -39,7 +41,10 @@ task('build', {async: true}, function () {
'./src/timeline/component/css/item.css',
'./src/timeline/component/css/timeaxis.css',
'./src/timeline/component/css/currenttime.css',
'./src/timeline/component/css/customtime.css'
'./src/timeline/component/css/customtime.css',
'./src/graph/css/graph-manipulation.css',
'./src/graph/css/graph-navigation.css'
],
dest: VIS_CSS,
separator: '\n'
@ -100,14 +105,10 @@ task('build', {async: true}, function () {
});
// copy images
wrench.copyDirSyncRecursive('./src/graph/img', DIST+ '/img', {
forceDelete: true
});
wrench.copyDirSyncRecursive('./src/timeline/img', DIST+ '/img/timeline', {
wrench.copyDirSyncRecursive('./src/graph/img', DIST + '/img/graph', {
forceDelete: true
});
// copy css
wrench.copyDirSyncRecursive('./src/graph/css', DIST+ '/css', {
wrench.copyDirSyncRecursive('./src/timeline/img', DIST + '/img/timeline', {
forceDelete: true
});

BIN
dist/img/acceptDeleteIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
dist/img/addNodeIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
dist/img/backIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
dist/img/connectIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
dist/img/deleteIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
dist/img/editIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
dist/img/minus.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.0 KiB

BIN
dist/img/plus.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.2 KiB

BIN
dist/img/zoomExtends.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

+ 190
- 0
dist/vis.css View File

@ -271,3 +271,193 @@
cursor: move;
z-index: 9;
}
div.graph-manipulationDiv {
border-width:0px;
border-bottom: 1px;
border-style:solid;
border-color: #d6d9d8;
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #fcfcfc 48%, #fafafa 50%, #fcfcfc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(48%,#fcfcfc), color-stop(50%,#fafafa), color-stop(100%,#fcfcfc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fcfcfc',GradientType=0 ); /* IE6-9 */
width: 600px;
height:30px;
z-index:10;
position:absolute;
}
div.graph-manipulation-editMode {
height:30px;
z-index:10;
position:absolute;
margin-top:20px;
}
div.graph-manipulation-closeDiv {
height:30px;
width:30px;
z-index:11;
position:absolute;
margin-top:3px;
margin-left:590px;
background-position: 0px 0px;
background-repeat:no-repeat;
background-image: url("img/graph/cross.png");
cursor: pointer;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
span.graph-manipulationUI {
font-family: verdana;
font-size: 12px;
-moz-border-radius: 15px;
border-radius: 15px;
display:inline-block;
background-position: 0px 0px;
background-repeat:no-repeat;
height:24px;
margin: -14px 0px 0px 10px;
vertical-align:middle;
cursor: pointer;
padding: 0px 8px 0px 8px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
span.graph-manipulationUI:hover {
box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.20);
}
span.graph-manipulationUI:active {
box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.50);
}
span.graph-manipulationUI.back {
background-image: url("img/graph/backIcon.png");
}
span.graph-manipulationUI.none:hover {
box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.0);
cursor: default;
}
span.graph-manipulationUI.none:active {
box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.0);
}
span.graph-manipulationUI.none {
padding: 0px 0px 0px 0px;
}
span.graph-manipulationUI.notification{
margin: 2px;
font-weight: bold;
}
span.graph-manipulationUI.add {
background-image: url("img/graph/addNodeIcon.png");
}
span.graph-manipulationUI.edit {
background-image: url("img/graph/editIcon.png");
}
span.graph-manipulationUI.edit.editmode {
background-color: #fcfcfc;
border-style:solid;
border-width:1px;
border-color: #cccccc;
}
span.graph-manipulationUI.connect {
background-image: url("img/graph/connectIcon.png");
}
span.graph-manipulationUI.delete {
background-image: url("img/graph/deleteIcon.png");
}
/* top right bottom left */
span.graph-manipulationLabel {
margin: 0px 0px 0px 23px;
line-height: 25px;
}
div.graph-seperatorLine {
display:inline-block;
width:1px;
height:20px;
background-color: #bdbdbd;
margin: 5px 7px 0px 15px;
}
div.graph-navigation {
width:34px;
height:34px;
z-index:10;
-moz-border-radius: 17px;
border-radius: 17px;
position:absolute;
display:inline-block;
background-position: 2px 2px;
background-repeat:no-repeat;
cursor: pointer;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
div.graph-navigation:hover {
box-shadow: 0px 0px 3px 3px rgba(56, 207, 21, 0.30);
}
div.graph-navigation:active {
box-shadow: 0px 0px 1px 3px rgba(56, 207, 21, 0.95);
}
div.graph-navigation.up {
background-image: url("img/graph/upArrow.png");
margin-top:520px;
margin-left:55px;
}
div.graph-navigation.down {
background-image: url("img/graph/downArrow.png");
margin-top:560px;
margin-left:55px;
}
div.graph-navigation.left {
background-image: url("img/graph/leftArrow.png");
margin-top:560px;
margin-left:15px;
}
div.graph-navigation.right {
background-image: url("img/graph/rightArrow.png");
margin-top:560px;
margin-left:95px;
}
div.graph-navigation.zoomIn {
background-image: url("img/graph/plus.png");
margin-top:560px;
margin-left:555px;
}
div.graph-navigation.zoomOut {
background-image: url("img/graph/minus.png");
margin-top:560px;
margin-left:515px;
}
div.graph-navigation.zoomExtends {
background-image: url("img/graph/zoomExtends.png");
margin-top:520px;
margin-left:555px;
}

+ 8
- 8
examples/graph/20_navigation.html View File

@ -34,7 +34,7 @@
</style>
<script type="text/javascript" src="../../dist/vis.js"></script>
<link type="text/css" rel="stylesheet" charset="UTF-8" href="../../dist/css/graph-navigation.css">
<link type="text/css" rel="stylesheet" href="../../dist/vis.css">
<script type="text/javascript">
var nodes = null;
@ -130,13 +130,13 @@
<table class="legend_table">
<tr>
<td>Icons: </td>
<td><div class="table_content"><img src="../../dist/img/upArrow.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/downArrow.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/leftArrow.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/rightArrow.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/plus.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/minus.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/zoomExtends.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/graph/upArrow.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/graph/downArrow.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/graph/leftArrow.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/graph/rightArrow.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/graph/plus.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/graph/minus.png" /> </div></td>
<td><div class="table_content"><img src="../../dist/img/graph/zoomExtends.png" /> </div></td>
</tr>
<tr>
<td><div class="table_description">Keyboard shortcuts:</div></td>

+ 190
- 191
examples/graph/21_data_manipulation.html View File

@ -1,209 +1,208 @@
<!doctype html>
<html>
<head>
<title>Graph | Navigation</title>
<style type="text/css">
body {
font: 10pt sans;
}
#mygraph {
position:relative;
width: 600px;
height: 600px;
border: 1px solid lightgray;
}
table.legend_table {
font-size: 11px;
border-width:1px;
border-color:#d3d3d3;
border-style:solid;
}
table.legend_table,td {
border-width:1px;
border-color:#d3d3d3;
border-style:solid;
padding: 2px;
}
div.table_content {
width:80px;
text-align:center;
}
div.table_description {
width:100px;
}
#operation {
font-size:28px;
<title>Graph | Navigation</title>
<style type="text/css">
body {
font: 10pt sans;
}
#mygraph {
position:relative;
width: 600px;
height: 600px;
border: 1px solid lightgray;
}
table.legend_table {
font-size: 11px;
border-width:1px;
border-color:#d3d3d3;
border-style:solid;
}
table.legend_table,td {
border-width:1px;
border-color:#d3d3d3;
border-style:solid;
padding: 2px;
}
div.table_content {
width:80px;
text-align:center;
}
div.table_description {
width:100px;
}
#operation {
font-size:28px;
}
#graph-popUp {
display:none;
position:absolute;
top:350px;
left:170px;
z-index:299;
width:250px;
height:120px;
background-color: #f9f9f9;
border-style:solid;
border-width:3px;
border-color: #5394ed;
padding:10px;
text-align: center;
}
</style>
<script type="text/javascript" src="../../dist/vis.js"></script>
<link type="text/css" rel="stylesheet" href="../../dist/vis.css">
<script type="text/javascript">
var nodes = null;
var edges = null;
var graph = null;
function draw() {
nodes = [];
edges = [];
var connectionCount = [];
// randomly create some nodes and edges
var nodeCount = 25;
for (var i = 0; i < nodeCount; i++) {
nodes.push({
id: i,
label: String(i)
});
connectionCount[i] = 0;
// create edges in a scale-free-graph way
if (i == 1) {
var from = i;
var to = 0;
edges.push({
from: from,
to: to
});
connectionCount[from]++;
connectionCount[to]++;
}
#graph-popUp {
display:none;
position:absolute;
top:350px;
left:170px;
z-index:299;
width:250px;
height:120px;
background-color: #f9f9f9;
border-style:solid;
border-width:3px;
border-color: #5394ed;
padding:10px;
text-align: center;
else if (i > 1) {
var conn = edges.length * 2;
var rand = Math.floor(Math.random() * conn);
var cum = 0;
var j = 0;
while (j < connectionCount.length && cum < rand) {
cum += connectionCount[j];
j++;
}
var from = i;
var to = j;
edges.push({
from: from,
to: to
});
connectionCount[from]++;
connectionCount[to]++;
}
</style>
<link type="text/css" rel="stylesheet" charset="UTF-8" href="../../dist/css/graph-manipulation.css">
<link type="text/css" rel="stylesheet" charset="UTF-8" href="../../dist/css/graph-navigation.css">
<script type="text/javascript" src="../../dist/vis.js"></script>
<script type="text/javascript">
var nodes = null;
var edges = null;
var graph = null;
function draw() {
nodes = [];
edges = [];
var connectionCount = [];
// randomly create some nodes and edges
var nodeCount = 25;
for (var i = 0; i < nodeCount; i++) {
nodes.push({
id: i,
label: String(i)
});
connectionCount[i] = 0;
// create edges in a scale-free-graph way
if (i == 1) {
var from = i;
var to = 0;
edges.push({
from: from,
to: to
});
connectionCount[from]++;
connectionCount[to]++;
}
else if (i > 1) {
var conn = edges.length * 2;
var rand = Math.floor(Math.random() * conn);
var cum = 0;
var j = 0;
while (j < connectionCount.length && cum < rand) {
cum += connectionCount[j];
j++;
}
var from = i;
var to = j;
edges.push({
from: from,
to: to
});
connectionCount[from]++;
connectionCount[to]++;
}
}
// create a graph
var container = document.getElementById('mygraph');
var data = {
nodes: nodes,
edges: edges
};
var options = {
edges: {
length: 50
},
stabilize: false,
dataManipulation: true,
onAdd: function(data,callback) {
var span = document.getElementById('operation');
var idInput = document.getElementById('node-id');
var labelInput = document.getElementById('node-label');
var saveButton = document.getElementById('saveButton');
var cancelButton = document.getElementById('cancelButton');
var div = document.getElementById('graph-popUp');
span.innerHTML = "Add Node";
idInput.value = data.id;
labelInput.value = data.label;
saveButton.onclick = saveData.bind(this,data,callback);
cancelButton.onclick = clearPopUp.bind();
div.style.display = 'block';
},
onEdit: function(data,callback) {
var span = document.getElementById('operation');
var idInput = document.getElementById('node-id');
var labelInput = document.getElementById('node-label');
var saveButton = document.getElementById('saveButton');
var cancelButton = document.getElementById('cancelButton');
var div = document.getElementById('graph-popUp');
span.innerHTML = "Edit Node";
idInput.value = data.id;
labelInput.value = data.label;
saveButton.onclick = saveData.bind(this,data,callback);
cancelButton.onclick = clearPopUp.bind();
div.style.display = 'block';
}
};
graph = new vis.Graph(container, data, options);
// add event listeners
graph.on('select', function(params) {
document.getElementById('selection').innerHTML = 'Selection: ' + params.nodes;
});
graph.on("frameResize", function(params) {console.log(params.width,params.height)});
function clearPopUp() {
var saveButton = document.getElementById('saveButton');
var cancelButton = document.getElementById('cancelButton');
saveButton.onclick = null;
cancelButton.onclick = null;
var div = document.getElementById('graph-popUp');
div.style.display = 'none';
}
function saveData(data,callback) {
var idInput = document.getElementById('node-id');
var labelInput = document.getElementById('node-label');
var div = document.getElementById('graph-popUp');
data.id = idInput.value;
data.label = labelInput.value;
clearPopUp();
callback(data);
}
}
// create a graph
var container = document.getElementById('mygraph');
var data = {
nodes: nodes,
edges: edges
};
var options = {
edges: {
length: 50
},
stabilize: false,
dataManipulation: true,
onAdd: function(data,callback) {
var span = document.getElementById('operation');
var idInput = document.getElementById('node-id');
var labelInput = document.getElementById('node-label');
var saveButton = document.getElementById('saveButton');
var cancelButton = document.getElementById('cancelButton');
var div = document.getElementById('graph-popUp');
span.innerHTML = "Add Node";
idInput.value = data.id;
labelInput.value = data.label;
saveButton.onclick = saveData.bind(this,data,callback);
cancelButton.onclick = clearPopUp.bind();
div.style.display = 'block';
},
onEdit: function(data,callback) {
var span = document.getElementById('operation');
var idInput = document.getElementById('node-id');
var labelInput = document.getElementById('node-label');
var saveButton = document.getElementById('saveButton');
var cancelButton = document.getElementById('cancelButton');
var div = document.getElementById('graph-popUp');
span.innerHTML = "Edit Node";
idInput.value = data.id;
labelInput.value = data.label;
saveButton.onclick = saveData.bind(this,data,callback);
cancelButton.onclick = clearPopUp.bind();
div.style.display = 'block';
}
</script>
};
graph = new vis.Graph(container, data, options);
// add event listeners
graph.on('select', function(params) {
document.getElementById('selection').innerHTML = 'Selection: ' + params.nodes;
});
graph.on("frameResize", function(params) {console.log(params.width,params.height)});
function clearPopUp() {
var saveButton = document.getElementById('saveButton');
var cancelButton = document.getElementById('cancelButton');
saveButton.onclick = null;
cancelButton.onclick = null;
var div = document.getElementById('graph-popUp');
div.style.display = 'none';
}
function saveData(data,callback) {
var idInput = document.getElementById('node-id');
var labelInput = document.getElementById('node-label');
var div = document.getElementById('graph-popUp');
data.id = idInput.value;
data.label = labelInput.value;
clearPopUp();
callback(data);
}
}
</script>
</head>
<body onload="draw();">
<h2>Editing the dataset</h2>
<div style="width: 700px; font-size:14px;">
In this example we have enabled the data manipulation setting. If the dataManipulation option is set to true, the edit button will appear.
If you prefer to have the toolbar visible initially, you can set the initiallyVisible option to true. The exact method is described in the docs.
<br /><br />
The data manipulation allows the user to add nodes, connect them, edit them and delete any selected items. In this example we have created trigger functions
for the add and edit operations. By settings these trigger functions the user can direct the way the data is manipulated. In this example we have created a simple
pop-up that allows us to edit some of the properties.
In this example we have enabled the data manipulation setting. If the dataManipulation option is set to true, the edit button will appear.
If you prefer to have the toolbar visible initially, you can set the initiallyVisible option to true. The exact method is described in the docs.
<br /><br />
The data manipulation allows the user to add nodes, connect them, edit them and delete any selected items. In this example we have created trigger functions
for the add and edit operations. By settings these trigger functions the user can direct the way the data is manipulated. In this example we have created a simple
pop-up that allows us to edit some of the properties.
</div>
<br />
<div id="graph-popUp">
<span id="operation">node</span> <br>
<table style="margin:auto;"><tr>
<td>id</td><td><input id="node-id" value="new value"></td>
</tr>
<tr>
<td>label</td><td><input id="node-label" value="new value"> </td>
</tr></table>
<input type="button" value="save" id="saveButton"></button>
<input type="button" value="cancel" id="cancelButton"></button>
<span id="operation">node</span> <br>
<table style="margin:auto;"><tr>
<td>id</td><td><input id="node-id" value="new value"></td>
</tr>
<tr>
<td>label</td><td><input id="node-label" value="new value"> </td>
</tr></table>
<input type="button" value="save" id="saveButton"></button>
<input type="button" value="cancel" id="cancelButton"></button>
</div>
<br />
<div id="mygraph"></div>

+ 6
- 6
src/graph/css/graph-manipulation.css View File

@ -34,7 +34,7 @@ div.graph-manipulation-closeDiv {
margin-left:590px;
background-position: 0px 0px;
background-repeat:no-repeat;
background-image: url("../../dist/img/cross.png");
background-image: url("img/graph/cross.png");
cursor: pointer;
-webkit-touch-callout: none;
-webkit-user-select: none;
@ -74,7 +74,7 @@ span.graph-manipulationUI:active {
}
span.graph-manipulationUI.back {
background-image: url("../../dist/img/backIcon.png");
background-image: url("img/graph/backIcon.png");
}
span.graph-manipulationUI.none:hover {
@ -93,11 +93,11 @@ span.graph-manipulationUI.notification{
}
span.graph-manipulationUI.add {
background-image: url("../../dist/img/addNodeIcon.png");
background-image: url("img/graph/addNodeIcon.png");
}
span.graph-manipulationUI.edit {
background-image: url("../../dist/img/editIcon.png");
background-image: url("img/graph/editIcon.png");
}
span.graph-manipulationUI.edit.editmode {
@ -108,11 +108,11 @@ span.graph-manipulationUI.edit.editmode {
}
span.graph-manipulationUI.connect {
background-image: url("../../dist/img/connectIcon.png");
background-image: url("img/graph/connectIcon.png");
}
span.graph-manipulationUI.delete {
background-image: url("../../dist/img/deleteIcon.png");
background-image: url("img/graph/deleteIcon.png");
}
/* top right bottom left */
span.graph-manipulationLabel {

+ 7
- 7
src/graph/css/graph-navigation.css View File

@ -26,37 +26,37 @@ div.graph-navigation:active {
}
div.graph-navigation.up {
background-image: url("../../dist/img/upArrow.png");
background-image: url("img/graph/upArrow.png");
margin-top:520px;
margin-left:55px;
}
div.graph-navigation.down {
background-image: url("../../dist/img/downArrow.png");
background-image: url("img/graph/downArrow.png");
margin-top:560px;
margin-left:55px;
}
div.graph-navigation.left {
background-image: url("../../dist/img/leftArrow.png");
background-image: url("img/graph/leftArrow.png");
margin-top:560px;
margin-left:15px;
}
div.graph-navigation.right {
background-image: url("../../dist/img/rightArrow.png");
background-image: url("img/graph/rightArrow.png");
margin-top:560px;
margin-left:95px;
}
div.graph-navigation.zoomIn {
background-image: url("../../dist/img/plus.png");
background-image: url("img/graph/plus.png");
margin-top:560px;
margin-left:555px;
}
div.graph-navigation.zoomOut {
background-image: url("../../dist/img/minus.png");
background-image: url("img/graph/minus.png");
margin-top:560px;
margin-left:515px;
}
div.graph-navigation.zoomExtends {
background-image: url("../../dist/img/zoomExtends.png");
background-image: url("img/graph/zoomExtends.png");
margin-top:520px;
margin-left:555px;
}

Loading…
Cancel
Save