Browse Source

fixed dataAxis not showing large numbers correctly #313

v3_develop
Alex de Mulder 10 years ago
parent
commit
fe9383bb3d
4 changed files with 2380 additions and 2289 deletions
  1. +7
    -0
      HISTORY.md
  2. +2281
    -2279
      dist/vis.js
  3. +80
    -0
      examples/network/ex.html
  4. +12
    -10
      lib/timeline/DataStep.js

+ 7
- 0
HISTORY.md View File

@ -4,6 +4,13 @@ http://visjs.org
## not yet released, version 3.4.3-SNAPSHOT
### Network
- Fixed nodes not always being unfixed when using allowedToMove.
### Graph2d
- Fixed dataAxis not showing large numbers correctly.
## 2014-10-12, version 3.4.2

+ 2281
- 2279
dist/vis.js
File diff suppressed because it is too large
View File


+ 80
- 0
examples/network/ex.html View File

@ -0,0 +1,80 @@
<!doctype html>
<html>
<head>
<title>Network | Random nodes</title>
<style type="text/css">
body {
font: 10pt sans;
}
#mynetwork {
width: 600px;
height: 600px;
border: 1px solid lightgray;
}
</style>
<script type="text/javascript" src="../../dist/vis.js"></script>
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var nodes = null;
var edges = null;
var network = null;
function draw() {
nodes = new vis.DataSet([
{id: '1001', value: '1'},
{id: '1009', value: '2'},
{id: '1061', value: '3'},
{id: '1226', value: '4'}
]);
edges = new vis.DataSet([
{id: '1001_1061', from: '1001', to: '1061'},
{id: '1001_1226', from: '1001', to: '1226'},
{id: '1009_1061', from: '1009', to: '1061'},
{id: '1009_1226', from: '1009', to: '1226'},
{id: '1061_1226', from: '1061', to: '1226'}
]);
var container = document.getElementById('mynetwork');
var data = {
nodes: nodes,
edges: edges
};
var options = {
nodes: {
shape: 'dot'
},
edges: {
inheritColor: false
},
physics: {
'barnesHut': {
centralGravity: 0.5,
springLength: 150,
springConstant: 0.03,
damping: 0.2
}
}
};
network = new vis.Network(container, data, options);
// add event listeners
network.on('select', function(params) {
document.getElementById('selection').innerHTML = 'Selection: ' + params.nodes;
console.log(params.edges)
console.log(network.getSelection())
});
}
</script>
</head>
<body onload="draw();">
<br>
<div id="mynetwork"></div>
<p id="selection"></p>
</body>
</html>

+ 12
- 10
lib/timeline/DataStep.js View File

@ -180,16 +180,18 @@ DataStep.prototype.previous = function() {
*/
DataStep.prototype.getCurrent = function() {
var toPrecision = '' + Number(this.current).toPrecision(5);
for (var i = toPrecision.length-1; i > 0; i--) {
if (toPrecision[i] == "0") {
toPrecision = toPrecision.slice(0,i);
}
else if (toPrecision[i] == "." || toPrecision[i] == ",") {
toPrecision = toPrecision.slice(0,i);
break;
}
else{
break;
if (toPrecision.indexOf(",") != -1 || toPrecision.indexOf(".") != -1) {
for (var i = toPrecision.length-1; i > 0; i--) {
if (toPrecision[i] == "0") {
toPrecision = toPrecision.slice(0,i);
}
else if (toPrecision[i] == "." || toPrecision[i] == ",") {
toPrecision = toPrecision.slice(0,i);
break;
}
else{
break;
}
}
}

Loading…
Cancel
Save