Browse Source

Merge remote-tracking branch 'origin/v4' into v4

flowchartTest
jos 9 years ago
parent
commit
491e40c958
25 changed files with 13122 additions and 12605 deletions
  1. +13
    -5
      dist/vis.css
  2. +12521
    -12274
      dist/vis.js
  3. +1
    -1
      dist/vis.min.css
  4. +8
    -8
      docs/network/edges.html
  5. +8
    -8
      docs/network/groups.html
  6. +13
    -10
      docs/network/interaction.html
  7. +13
    -10
      docs/network/layout.html
  8. +13
    -10
      docs/network/manipulation.html
  9. +7
    -8
      docs/network/new_network.html
  10. +7
    -8
      docs/network/nodes.html
  11. +13
    -10
      docs/network/physics.html
  12. +13
    -10
      docs/network/rendering.html
  13. +13
    -10
      docs/network/selection.html
  14. +13
    -10
      docs/network/view.html
  15. +2
    -2
      examples/graph2d/05_bothAxis.html
  16. +1
    -1
      examples/graph2d/10_barsSideBySide.html
  17. +18
    -17
      lib/DOMutil.js
  18. +214
    -0
      lib/module/uuid.js
  19. +29
    -17
      lib/timeline/DataStep.js
  20. +122
    -113
      lib/timeline/component/DataAxis.js
  21. +23
    -16
      lib/timeline/component/Legend.js
  22. +12
    -19
      lib/timeline/component/LineGraph.js
  23. +40
    -25
      lib/timeline/component/graph2d_types/bar.js
  24. +4
    -13
      lib/util.js
  25. +1
    -0
      package.json

+ 13
- 5
dist/vis.css View File

@ -179,7 +179,7 @@
border-width: 1px;
background-color: #D5DDF6;
display: inline-block;
overflow: hidden;
/*overflow: hidden;*/
}
.vis-item.vis-selected {
@ -230,17 +230,23 @@
margin: 0;
}
.vis-item .vis-item-frame {
position: relative;
width: 100%;
height: 100%;
padding: 0;
margin: 0;
overflow: hidden;
}
.vis-item.vis-range .vis-item-content {
position: relative;
display: inline-block;
max-width: 100%;
}
.vis-item.background .vis-item-content {
position: absolute;
display: inline-block;
max-width: 100%;
margin: 5px;
}
.vis-item.vis-line {
@ -254,7 +260,7 @@
.vis-item .vis-item-content {
white-space: nowrap;
box-sizing: border-box;
padding: 5px;
margin: 5px;
}
.vis-item .vis-delete {
@ -271,6 +277,7 @@
position: absolute;
width: 24px;
max-width: 20%;
min-width: 2px;
height: 100%;
top: 0;
left: -4px;
@ -282,6 +289,7 @@
position: absolute;
width: 24px;
max-width: 20%;
min-width: 2px;
height: 100%;
top: 0;
right: -4px;

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


+ 1
- 1
dist/vis.min.css
File diff suppressed because it is too large
View File


+ 8
- 8
docs/network/edges.html View File

@ -40,6 +40,7 @@
================================================== -->
<body onload="prettyPrint();">
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
@ -56,21 +57,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 8
- 8
docs/network/groups.html View File

@ -38,6 +38,7 @@
================================================== -->
<body onload="prettyPrint();">
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
@ -54,21 +55,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 13
- 10
docs/network/interaction.html View File

@ -32,12 +32,14 @@
</head>
<body onload="prettyPrint();">
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -47,19 +49,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon" src="../img/external-link-icons/external-link-icon-white.png"></a></li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 13
- 10
docs/network/layout.html View File

@ -33,12 +33,14 @@
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -48,19 +50,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon" src="../img/external-link-icons/external-link-icon-white.png"></a></li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 13
- 10
docs/network/manipulation.html View File

@ -32,12 +32,14 @@
</head>
<body onload="prettyPrint();">
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -47,19 +49,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon" src="../img/external-link-icons/external-link-icon-white.png"></a></li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 7
- 8
docs/network/new_network.html View File

@ -50,21 +50,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 7
- 8
docs/network/nodes.html View File

@ -49,21 +49,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 13
- 10
docs/network/physics.html View File

@ -33,12 +33,14 @@
</head>
<body onload="prettyPrint();">
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -48,19 +50,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon" src="../img/external-link-icons/external-link-icon-white.png"></a></li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 13
- 10
docs/network/rendering.html View File

@ -32,12 +32,14 @@
</head>
<body onload="prettyPrint();">
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -47,19 +49,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon" src="../img/external-link-icons/external-link-icon-white.png"></a></li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 13
- 10
docs/network/selection.html View File

@ -33,12 +33,14 @@
</head>
<body onload="prettyPrint();">
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -48,19 +50,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon" src="../img/external-link-icons/external-link-icon-white.png"></a></li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 13
- 10
docs/network/view.html View File

@ -32,12 +32,14 @@
</head>
<body onload="prettyPrint();">
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -47,19 +49,20 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon" src="../img/external-link-icons/external-link-icon-white.png"></a></li>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
src="../img/external-link-icons/external-link-icon-white.png"></a>
</li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>

+ 2
- 2
examples/graph2d/05_bothAxis.html View File

@ -2,7 +2,6 @@
<html>
<head>
<title>Graph2d | Both Axis Example</title>
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body, html {
font-family: sans-serif;
@ -32,7 +31,8 @@
stroke: none;
}
</style>
<!--IMPORTANT: import the vis css after the custom styles to avoid overriding styles-->
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
<script src="../../dist/vis.js"></script>
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script></head>

+ 1
- 1
examples/graph2d/10_barsSideBySide.html View File

@ -40,7 +40,7 @@
{x: '2014-06-14', y: 10},
{x: '2014-06-15', y: 15},
{x: '2014-06-16', y: 30},
{x: '2014-06-11', y: 12},
{x: '2014-06-11', y: -12},
{x: '2014-06-14', y: 24},
{x: '2014-06-15', y: 5},
{x: '2014-06-16', y: 12}

+ 18
- 17
lib/DOMutil.js View File

@ -153,28 +153,29 @@ exports.drawPoint = function(x, y, group, JSONcontainer, svgContainer, labelObj)
point.setAttributeNS(null, "style", 'vis-' + group.group.options.drawPoints.styles);
}
point.setAttributeNS(null, "class", group.className + " vis-point");
//handle label
var label = exports.getSVGElement('text',JSONcontainer,svgContainer);
if (labelObj){
if (labelObj.xOffset) {
x = x + labelObj.xOffset;
}
//handle label
if (labelObj.yOffset) {
y = y + labelObj.yOffset;
}
if (labelObj.content) {
label.textContent = labelObj.content;
}
if (labelObj.className) {
label.setAttributeNS(null, "class", labelObj.className + " vis-label");
}
if (labelObj) {
var label = exports.getSVGElement('text',JSONcontainer,svgContainer);
if (labelObj.xOffset) {
x = x + labelObj.xOffset;
}
if (labelObj.yOffset) {
y = y + labelObj.yOffset;
}
if (labelObj.content) {
label.textContent = labelObj.content;
}
if (labelObj.className) {
label.setAttributeNS(null, "class", labelObj.className + " vis-label");
}
label.setAttributeNS(null, "x", x);
label.setAttributeNS(null, "y", y);
}
label.setAttributeNS(null, "x", x);
label.setAttributeNS(null, "y", y);
return point;
};

+ 214
- 0
lib/module/uuid.js View File

@ -0,0 +1,214 @@
var _rng;
var globalVar = window !== undefined ? window : global;
if (globalVar.crypto && crypto.getRandomValues) {
// WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
// Moderately fast, high quality
var _rnds8 = new Uint8Array(16);
_rng = function whatwgRNG() {
crypto.getRandomValues(_rnds8);
return _rnds8;
};
}
if (!_rng) {
// Math.random()-based (RNG)
//
// If all else fails, use Math.random(). It's fast, but is of unspecified
// quality.
var _rnds = new Array(16);
_rng = function() {
for (var i = 0, r; i < 16; i++) {
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
_rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
}
return _rnds;
};
}
// uuid.js
//
// Copyright (c) 2010-2012 Robert Kieffer
// MIT License - http://opensource.org/licenses/mit-license.php
// Unique ID creation requires a high quality random # generator. We feature
// detect to determine the best RNG source, normalizing to a function that
// returns 128-bits of randomness, since that's what's usually required
//var _rng = require('./rng');
// Maps for number <-> hex string conversion
var _byteToHex = [];
var _hexToByte = {};
for (var i = 0; i < 256; i++) {
_byteToHex[i] = (i + 0x100).toString(16).substr(1);
_hexToByte[_byteToHex[i]] = i;
}
// **`parse()` - Parse a UUID into it's component bytes**
function parse(s, buf, offset) {
var i = (buf && offset) || 0, ii = 0;
buf = buf || [];
s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {
if (ii < 16) { // Don't overflow!
buf[i + ii++] = _hexToByte[oct];
}
});
// Zero out remaining bytes if string was short
while (ii < 16) {
buf[i + ii++] = 0;
}
return buf;
}
// **`unparse()` - Convert UUID byte array (ala parse()) into a string**
function unparse(buf, offset) {
var i = offset || 0, bth = _byteToHex;
return bth[buf[i++]] + bth[buf[i++]] +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] +
bth[buf[i++]] + bth[buf[i++]] +
bth[buf[i++]] + bth[buf[i++]];
}
// **`v1()` - Generate time-based UUID**
//
// Inspired by https://github.com/LiosK/UUID.js
// and http://docs.python.org/library/uuid.html
// random #'s we need to init node and clockseq
var _seedBytes = _rng();
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
var _nodeId = [
_seedBytes[0] | 0x01,
_seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
];
// Per 4.2.2, randomize (14 bit) clockseq
var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
// Previous uuid creation time
var _lastMSecs = 0, _lastNSecs = 0;
// See https://github.com/broofa/node-uuid for API details
function v1(options, buf, offset) {
var i = buf && offset || 0;
var b = buf || [];
options = options || {};
var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
// Per 4.2.1.2, use count of uuid's generated during the current clock
// cycle to simulate higher resolution clock
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
// Time since last uuid creation (in msecs)
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
// Per 4.2.1.2, Bump clockseq on clock regression
if (dt < 0 && options.clockseq === undefined) {
clockseq = clockseq + 1 & 0x3fff;
}
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
// time interval
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
nsecs = 0;
}
// Per 4.2.1.2 Throw error if too many uuids are requested
if (nsecs >= 10000) {
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
}
_lastMSecs = msecs;
_lastNSecs = nsecs;
_clockseq = clockseq;
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
msecs += 12219292800000;
// `time_low`
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
b[i++] = tl >>> 24 & 0xff;
b[i++] = tl >>> 16 & 0xff;
b[i++] = tl >>> 8 & 0xff;
b[i++] = tl & 0xff;
// `time_mid`
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
b[i++] = tmh >>> 8 & 0xff;
b[i++] = tmh & 0xff;
// `time_high_and_version`
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
b[i++] = tmh >>> 16 & 0xff;
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
b[i++] = clockseq >>> 8 | 0x80;
// `clock_seq_low`
b[i++] = clockseq & 0xff;
// `node`
var node = options.node || _nodeId;
for (var n = 0; n < 6; n++) {
b[i + n] = node[n];
}
return buf ? buf : unparse(b);
}
// **`v4()` - Generate random UUID**
// See https://github.com/broofa/node-uuid for API details
function v4(options, buf, offset) {
// Deprecated - 'format' argument, as supported in v1.2
var i = buf && offset || 0;
if (typeof(options) == 'string') {
buf = options == 'binary' ? new Array(16) : null;
options = null;
}
options = options || {};
var rnds = options.random || (options.rng || _rng)();
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = (rnds[6] & 0x0f) | 0x40;
rnds[8] = (rnds[8] & 0x3f) | 0x80;
// Copy bytes to buffer, if provided
if (buf) {
for (var ii = 0; ii < 16; ii++) {
buf[i + ii] = rnds[ii];
}
}
return buf || unparse(rnds);
}
// Export public API
var uuid = v4;
uuid.v1 = v1;
uuid.v4 = v4;
uuid.parse = parse;
uuid.unparse = unparse;
module.exports = uuid;

+ 29
- 17
lib/timeline/DataStep.js View File

@ -60,13 +60,12 @@ function DataStep(start, end, minimumStep, containerHeight, customRange, alignZe
DataStep.prototype.setRange = function(start, end, minimumStep, containerHeight, customRange) {
this._start = customRange.min === undefined ? start : customRange.min;
this._end = customRange.max === undefined ? end : customRange.max;
if (this._start == this._end) {
this._start -= 0.75;
this._end += 1;
if (this._start === this._end) {
this._start = customRange.min === undefined ? this._start - 0.75 : this._start;
this._end = customRange.max === undefined ? this._end + 1 : this._end;;
}
if (this.autoScale == true) {
if (this.autoScale === true) {
this.setMinimumStep(minimumStep, containerHeight);
}
@ -75,14 +74,14 @@ DataStep.prototype.setRange = function(start, end, minimumStep, containerHeight,
/**
* Automatically determine the scale that bests fits the provided minimum step
* @param {Number} [minimumStep] The minimum step size in milliseconds
* @param {Number} [minimumStep] The minimum step size in pixels
*/
DataStep.prototype.setMinimumStep = function(minimumStep, containerHeight) {
// round to floor
var size = this._end - this._start;
var safeSize = size * 1.2;
var minimumStepValue = minimumStep * (safeSize / containerHeight);
var orderOfMagnitude = Math.round(Math.log(safeSize)/Math.LN10);
var range = this._end - this._start;
var safeRange = range * 1.2;
var minimumStepValue = minimumStep * (safeRange / containerHeight);
var orderOfMagnitude = Math.round(Math.log(safeRange)/Math.LN10);
var minorStepIdx = -1;
var magnitudefactor = Math.pow(10,orderOfMagnitude);
@ -103,7 +102,7 @@ DataStep.prototype.setMinimumStep = function(minimumStep, containerHeight) {
break;
}
}
if (solutionFound == true) {
if (solutionFound === true) {
break;
}
}
@ -130,14 +129,13 @@ DataStep.prototype.setFirst = function(customRange) {
this.marginStart = customRange.min === undefined ? this.roundToMinor(niceStart) : customRange.min;
// if we need to align the zero's we need to make sure that there is a zero to use.
if (this.alignZeros == true && (this.marginEnd - this.marginStart) % this.step != 0) {
if (this.alignZeros === true && (this.marginEnd - this.marginStart) % this.step != 0) {
this.marginEnd += this.marginEnd % this.step;
}
this.deadSpace = this.roundToMinor(niceEnd) - niceEnd + this.roundToMinor(niceStart) - niceStart;
this.marginRange = this.marginEnd - this.marginStart;
this.current = this.marginEnd;
};
@ -168,7 +166,7 @@ DataStep.prototype.next = function() {
this.current -= this.step;
// safety mechanism: if current time is still unchanged, move to the end
if (this.current == prev) {
if (this.current === prev) {
this.current = this._end;
}
};
@ -234,10 +232,10 @@ DataStep.prototype.getCurrent = function(decimals) {
if (toPrecision.indexOf(",") != -1 || toPrecision.indexOf(".") != -1) {
// If no decimal is specified, and there are decimal places, remove trailing zeros
for (var i = toPrecision.length - 1; i > 0; i--) {
if (toPrecision[i] == "0") {
if (toPrecision[i] === "0") {
toPrecision = toPrecision.slice(0, i);
}
else if (toPrecision[i] == "." || toPrecision[i] == ",") {
else if (toPrecision[i] === "." || toPrecision[i] === ",") {
toPrecision = toPrecision.slice(0, i);
break;
}
@ -257,7 +255,21 @@ DataStep.prototype.getCurrent = function(decimals) {
* @return {boolean} true if current date is major, else false.
*/
DataStep.prototype.isMajor = function() {
return (this.current % (this.scale * this.majorSteps[this.stepIndex]) == 0);
return (this.current % (this.scale * this.majorSteps[this.stepIndex]) === 0);
};
DataStep.prototype.shift = function(steps) {
if (steps < 0) {
for (let i = 0; i < -steps; i++) {
this.previous();
}
}
else if (steps > 0) {
for (let i = 0; i < steps; i++) {
this.next();
}
}
}
module.exports = DataStep;

+ 122
- 113
lib/timeline/component/DataAxis.js View File

@ -28,17 +28,15 @@ function DataAxis (body, options, svg, linegraphOptions) {
width: '40px',
visible: true,
alignZeros: true,
customRange: {
left: {min:undefined, max:undefined},
right: {min:undefined, max:undefined}
left:{
range: {min:undefined,max:undefined},
format: {decimals:undefined},
title: {text:undefined,style:undefined}
},
title: {
left: {text:undefined},
right: {text:undefined}
},
format: {
left: {decimals: undefined},
right: {decimals: undefined}
right:{
range: {min:undefined,max:undefined},
format: {decimals:undefined},
title: {text:undefined,style:undefined}
}
};
@ -65,8 +63,8 @@ function DataAxis (body, options, svg, linegraphOptions) {
this.hidden = false;
this.stepPixels = 25;
this.stepPixelsForced = 25;
this.zeroCrossing = -1;
this.amountOfSteps = -1;
this.lineOffset = 0;
this.master = true;
@ -126,16 +124,15 @@ DataAxis.prototype.setOptions = function (options) {
'iconWidth',
'width',
'visible',
'customRange',
'title',
'format',
'left',
'right',
'alignZeros'
];
util.selectiveExtend(fields, this.options, options);
this.minWidth = Number(('' + this.options.width).replace("px",""));
if (redraw == true && this.dom.frame) {
if (redraw === true && this.dom.frame) {
this.hide();
this.show();
}
@ -175,19 +172,23 @@ DataAxis.prototype._redrawGroupIcons = function () {
var iconOffset = 4;
var y = iconOffset + 0.5 * iconHeight;
if (this.options.orientation == 'left') {
if (this.options.orientation === 'left') {
x = iconOffset;
}
else {
x = this.width - iconWidth - iconOffset;
}
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight);
y += iconHeight + iconOffset;
}
var groupArray = Object.keys(this.groups);
groupArray.sort(function (a,b) {
return (a < b ? -1 : 1);
})
for (var i = 0; i < groupArray.length; i++) {
var groupId = groupArray[i];
if (this.groups[groupId].visible === true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] === true)) {
this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight);
y += iconHeight + iconOffset;
}
}
@ -196,7 +197,7 @@ DataAxis.prototype._redrawGroupIcons = function () {
};
DataAxis.prototype._cleanupIcons = function() {
if (this.iconsRemoved == false) {
if (this.iconsRemoved === false) {
DOMutil.prepareElements(this.svgElements);
DOMutil.cleanupElements(this.svgElements);
this.iconsRemoved = true;
@ -209,7 +210,7 @@ DataAxis.prototype._cleanupIcons = function() {
DataAxis.prototype.show = function() {
this.hidden = false;
if (!this.dom.frame.parentNode) {
if (this.options.orientation == 'left') {
if (this.options.orientation === 'left') {
this.body.dom.left.appendChild(this.dom.frame);
}
else {
@ -243,7 +244,7 @@ DataAxis.prototype.hide = function() {
* @param end
*/
DataAxis.prototype.setRange = function (start, end) {
if (this.master == false && this.options.alignZeros == true && this.zeroCrossing != -1) {
if (this.master === false && this.options.alignZeros === true && this.zeroCrossing != -1) {
if (start > 0) {
start = 0;
}
@ -265,12 +266,12 @@ DataAxis.prototype.redraw = function () {
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
if (this.groups[groupId].visible === true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] === true)) {
activeGroups++;
}
}
}
if (this.amountOfGroups == 0 || activeGroups == 0) {
if (this.amountOfGroups === 0 || activeGroups === 0) {
this.hide();
}
else {
@ -279,7 +280,7 @@ DataAxis.prototype.redraw = function () {
// svg offsetheight did not work in firefox and explorer...
this.dom.lineContainer.style.height = this.height + 'px';
this.width = this.options.visible == true ? Number(('' + this.options.width).replace("px","")) : 0;
this.width = this.options.visible === true ? Number(('' + this.options.width).replace("px","")) : 0;
var props = this.props;
var frame = this.dom.frame;
@ -304,7 +305,7 @@ DataAxis.prototype.redraw = function () {
props.majorLineHeight = 1;
// take frame offline while updating (is almost twice as fast)
if (orientation == 'left') {
if (orientation === 'left') {
frame.style.top = '0';
frame.style.left = '0';
frame.style.bottom = '';
@ -326,7 +327,7 @@ DataAxis.prototype.redraw = function () {
resized = this._redrawLabels();
resized = this._isResized() || resized;
if (this.options.icons == true) {
if (this.options.icons === true) {
this._redrawGroupIcons();
}
else {
@ -346,113 +347,121 @@ DataAxis.prototype._redrawLabels = function () {
var resized = false;
DOMutil.prepareElements(this.DOMelements.lines);
DOMutil.prepareElements(this.DOMelements.labels);
var orientation = this.options['orientation'];
// calculate range and step (step such that we have space for 7 characters per label)
var minimumStep = this.master ? this.props.majorCharHeight || 10 : this.stepPixelsForced;
// get the range for the slaved axis
var step;
if (this.master === false) {
var stepSize, rangeStart, rangeEnd, minimumStep;
if (this.zeroCrossing !== -1 && this.options.alignZeros === true) {
if (this.range.end > 0) {
stepSize = this.range.end / this.zeroCrossing; // size of one step
rangeStart = this.range.end - this.amountOfSteps * stepSize;
rangeEnd = this.range.end;
}
else {
// all of the range (including start) has to be done before the zero crossing.
stepSize = -1 * this.range.start / (this.amountOfSteps - this.zeroCrossing); // absolute size of a step
rangeStart = this.range.start;
rangeEnd = this.range.start + stepSize * this.amountOfSteps;
}
}
else {
rangeStart = this.range.start;
rangeEnd = this.range.end;
}
minimumStep = this.stepPixels;
}
else {
// calculate range and step (step such that we have space for 7 characters per label)
minimumStep = this.props.majorCharHeight;
rangeStart = this.range.start;
rangeEnd = this.range.end;
}
var step = new DataStep(
this.range.start,
this.range.end,
this.step = step = new DataStep(
rangeStart,
rangeEnd,
minimumStep,
this.dom.frame.offsetHeight,
this.options.customRange[this.options.orientation],
this.master == false && this.options.alignZeros // doess the step have to align zeros? only if not master and the options is on
this.options[this.options.orientation].range,
this.master === false && this.options.alignZeros // does the step have to align zeros? only if not master and the options is on
);
this.step = step;
// get the distance in pixels for a step
// dead space is space that is "left over" after a step
var stepPixels = (this.dom.frame.offsetHeight - (step.deadSpace * (this.dom.frame.offsetHeight / step.marginRange))) / (((step.marginRange - step.deadSpace) / step.step));
this.stepPixels = stepPixels;
var amountOfSteps = this.height / stepPixels;
var stepDifference = 0;
// the slave axis needs to use the same horizontal lines as the master axis.
if (this.master == false) {
stepPixels = this.stepPixelsForced;
stepDifference = Math.round((this.dom.frame.offsetHeight / stepPixels) - amountOfSteps);
for (var i = 0; i < 0.5 * stepDifference; i++) {
step.previous();
}
amountOfSteps = this.height / stepPixels;
if (this.zeroCrossing != -1 && this.options.alignZeros == true) {
var zeroStepDifference = (step.marginEnd / step.step) - this.zeroCrossing;
if (zeroStepDifference > 0) {
for (var i = 0; i < zeroStepDifference; i++) {step.next();}
}
else if (zeroStepDifference < 0) {
for (var i = 0; i < -zeroStepDifference; i++) {step.previous();}
}
}
if (this.master === true) {
this.stepPixels = ((this.dom.frame.offsetHeight) / step.marginRange) * step.step;
this.amountOfSteps = Math.ceil(this.dom.frame.offsetHeight / this.stepPixels);
}
else {
amountOfSteps += 0.25;
// align with zero
if (this.options.alignZeros === true && this.zeroCrossing !== -1) {
// distance is the amount of steps away from the zero crossing we are.
let distance = (step.current - this.zeroCrossing * step.step) / step.step;
this.step.shift(distance);
}
}
this.valueAtZero = step.marginEnd;
var marginStartPos = 0;
// do not draw the first label
var max = 1;
// value at the bottom of the SVG
this.valueAtBottom = step.marginEnd;
// Get the number of decimal places
var decimals;
if(this.options.format[orientation] !== undefined) {
decimals = this.options.format[orientation].decimals;
if(this.options[orientation].format !== undefined) {
decimals = this.options[orientation].format.decimals;
}
this.maxLabelSize = 0;
var y = 0;
while (max < Math.round(amountOfSteps)) {
step.next();
y = Math.round(max * stepPixels);
marginStartPos = max * stepPixels;
var isMajor = step.isMajor();
if (this.options['showMinorLabels'] && isMajor == false || this.master == false && this.options['showMinorLabels'] == true) {
this._redrawLabel(y - 2, step.getCurrent(decimals), orientation, 'vis-y-axis vis-minor', this.props.minorCharHeight);
}
var y = 0; // init value
var stepIndex = 0; // init value
var isMajor = false; // init value
while (stepIndex < this.amountOfSteps) {
y = Math.round(stepIndex * this.stepPixels);
isMajor = step.isMajor();
if (stepIndex > 0 && stepIndex !== this.amountOfSteps) {
if (this.options['showMinorLabels'] && isMajor === false || this.master === false && this.options['showMinorLabels'] === true) {
this._redrawLabel(y - 2, step.getCurrent(decimals), orientation, 'vis-y-axis vis-minor', this.props.minorCharHeight);
}
if (isMajor && this.options['showMajorLabels'] && this.master == true ||
this.options['showMinorLabels'] == false && this.master == false && isMajor == true) {
if (y >= 0) {
this._redrawLabel(y - 2, step.getCurrent(decimals), orientation, 'vis-y-axis vis-major', this.props.majorCharHeight);
if (isMajor && this.options['showMajorLabels'] && this.master === true ||
this.options['showMinorLabels'] === false && this.master === false && isMajor === true) {
if (y >= 0) {
this._redrawLabel(y - 2, step.getCurrent(decimals), orientation, 'vis-y-axis vis-major', this.props.majorCharHeight);
}
this._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-major', this.options.majorLinesOffset, this.props.majorLineWidth);
}
else {
this._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-minor', this.options.minorLinesOffset, this.props.minorLineWidth);
}
this._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-major', this.options.majorLinesOffset, this.props.majorLineWidth);
}
else {
this._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-minor', this.options.minorLinesOffset, this.props.minorLineWidth);
}
if (this.master == true && step.current == 0) {
this.zeroCrossing = max;
// get zero crossing
if (this.master === true && step.current === 0) {
this.zeroCrossing = stepIndex;
}
max++;
step.next();
stepIndex += 1;
}
if (this.master == false) {
this.conversionFactor = y / (this.valueAtZero - step.current);
}
else {
this.conversionFactor = this.dom.frame.offsetHeight / step.marginRange;
// get zero crossing if it's the last step
if (this.master === true && step.current === 0) {
this.zeroCrossing = stepIndex;
}
this.conversionFactor = this.stepPixels / step.step;
// Note that title is rotated, so we're using the height, not width!
var titleWidth = 0;
if (this.options.title[orientation] !== undefined && this.options.title[orientation].text !== undefined) {
if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) {
titleWidth = this.props.titleCharHeight;
}
var offset = this.options.icons == true ? Math.max(this.options.iconWidth, titleWidth) + this.options.labelOffsetX + 15 : titleWidth + this.options.labelOffsetX + 15;
var offset = this.options.icons === true ? Math.max(this.options.iconWidth, titleWidth) + this.options.labelOffsetX + 15 : titleWidth + this.options.labelOffsetX + 15;
// this will resize the yAxis to accommodate the labels.
if (this.maxLabelSize > (this.width - offset) && this.options.visible == true) {
if (this.maxLabelSize > (this.width - offset) && this.options.visible === true) {
this.width = this.maxLabelSize + offset;
this.options.width = this.width + "px";
DOMutil.cleanupElements(this.DOMelements.lines);
@ -461,7 +470,7 @@ DataAxis.prototype._redrawLabels = function () {
resized = true;
}
// this will resize the yAxis if it is too big for the labels.
else if (this.maxLabelSize < (this.width - offset) && this.options.visible == true && this.width > this.minWidth) {
else if (this.maxLabelSize < (this.width - offset) && this.options.visible === true && this.width > this.minWidth) {
this.width = Math.max(this.minWidth,this.maxLabelSize + offset);
this.options.width = this.width + "px";
DOMutil.cleanupElements(this.DOMelements.lines);
@ -479,13 +488,13 @@ DataAxis.prototype._redrawLabels = function () {
};
DataAxis.prototype.convertValue = function (value) {
var invertedValue = this.valueAtZero - value;
var invertedValue = this.valueAtBottom - value;
var convertedValue = invertedValue * this.conversionFactor;
return convertedValue;
};
DataAxis.prototype.screenToValue = function (x) {
return this.valueAtZero - (x / this.conversionFactor);
return this.valueAtBottom - (x / this.conversionFactor);
};
/**
@ -502,7 +511,7 @@ DataAxis.prototype._redrawLabel = function (y, text, orientation, className, cha
var label = DOMutil.getDOMElement('div',this.DOMelements.labels, this.dom.frame); //this.dom.redundant.labels.shift();
label.className = className;
label.innerHTML = text;
if (orientation == 'left') {
if (orientation === 'left') {
label.style.left = '-' + this.options.labelOffsetX + 'px';
label.style.textAlign = "right";
}
@ -530,12 +539,12 @@ DataAxis.prototype._redrawLabel = function (y, text, orientation, className, cha
* @param width
*/
DataAxis.prototype._redrawLine = function (y, orientation, className, offset, width) {
if (this.master == true) {
if (this.master === true) {
var line = DOMutil.getDOMElement('div',this.DOMelements.lines, this.dom.lineContainer);//this.dom.redundant.lines.shift();
line.className = className;
line.innerHTML = '';
if (orientation == 'left') {
if (orientation === 'left') {
line.style.left = (this.width - offset) + 'px';
}
else {
@ -556,17 +565,17 @@ DataAxis.prototype._redrawTitle = function (orientation) {
DOMutil.prepareElements(this.DOMelements.title);
// Check if the title is defined for this axes
if (this.options.title[orientation] !== undefined && this.options.title[orientation].text !== undefined) {
if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) {
var title = DOMutil.getDOMElement('div', this.DOMelements.title, this.dom.frame);
title.className = 'vis-y-axis vis-title vis-' + orientation;
title.innerHTML = this.options.title[orientation].text;
title.innerHTML = this.options[orientation].title.text;
// Add style - if provided
if (this.options.title[orientation].style !== undefined) {
util.addCssText(title, this.options.title[orientation].style);
if (this.options[orientation].title.style !== undefined) {
util.addCssText(title, this.options[orientation].title.style);
}
if (orientation == 'left') {
if (orientation === 'left') {
title.style.left = this.props.titleCharHeight + 'px';
}
else {

+ 23
- 16
lib/timeline/component/Legend.js View File

@ -110,11 +110,15 @@ Legend.prototype.setOptions = function(options) {
Legend.prototype.redraw = function() {
var activeGroups = 0;
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
activeGroups++;
}
var groupArray = Object.keys(this.groups);
groupArray.sort(function (a,b) {
return (a < b ? -1 : 1);
})
for (var i = 0; i < groupArray.length; i++) {
var groupId = groupArray[i];
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
activeGroups++;
}
}
@ -164,11 +168,10 @@ Legend.prototype.redraw = function() {
}
var content = '';
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
content += this.groups[groupId].content + '<br />';
}
for (var i = 0; i < groupArray.length; i++) {
var groupId = groupArray[i];
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
content += this.groups[groupId].content + '<br />';
}
}
this.dom.textArea.innerHTML = content;
@ -178,6 +181,11 @@ Legend.prototype.redraw = function() {
Legend.prototype.drawLegendIcons = function() {
if (this.dom.frame.parentNode) {
var groupArray = Object.keys(this.groups);
groupArray.sort(function (a,b) {
return (a < b ? -1 : 1);
})
DOMutil.prepareElements(this.svgElements);
var padding = window.getComputedStyle(this.dom.frame).paddingTop;
var iconOffset = Number(padding.replace('px',''));
@ -188,12 +196,11 @@ Legend.prototype.drawLegendIcons = function() {
this.svg.style.width = iconWidth + 5 + iconOffset + 'px';
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight);
y += iconHeight + this.options.iconSpacing;
}
for (var i = 0; i < groupArray.length; i++) {
var groupId = groupArray[i];
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight);
y += iconHeight + this.options.iconSpacing;
}
}

+ 12
- 19
lib/timeline/component/LineGraph.js View File

@ -54,25 +54,16 @@ function LineGraph(body, options) {
width: '40px',
visible: true,
alignZeros: true,
customRange: {
left: {min:undefined, max:undefined},
right: {min:undefined, max:undefined}
left:{
range: {min:undefined,max:undefined},
format: {decimals:undefined},
title: {text:undefined,style:undefined}
},
right:{
range: {min:undefined,max:undefined},
format: {decimals:undefined},
title: {text:undefined,style:undefined}
}
//, these options are not set by default, but this shows the format they will be in
//format: {
// left: {decimals: 2},
// right: {decimals: 2}
//},
//title: {
// left: {
// text: 'left',
// style: 'color:black;'
// },
// right: {
// text: 'right',
// style: 'color:black;'
// }
//}
},
legend: {
enabled: false,
@ -575,6 +566,7 @@ LineGraph.prototype.redraw = function(forceGraphUpdate) {
// update the height of the graph on each redraw of the graph.
if (this.updateSVGheight == true) {
console.log(this.options.graphHeight, this.body.domProps.centerContainer.height)
if (this.options.graphHeight != this.body.domProps.centerContainer.height + 'px') {
this.options.graphHeight = this.body.domProps.centerContainer.height + 'px';
this.svg.style.height = this.body.domProps.centerContainer.height + 'px';
@ -890,8 +882,9 @@ LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) {
else {this.yAxisLeft.lineOffset = 0;}
resized = this.yAxisLeft.redraw() || resized;
this.yAxisRight.stepPixelsForced = this.yAxisLeft.stepPixels;
this.yAxisRight.stepPixels = this.yAxisLeft.stepPixels;
this.yAxisRight.zeroCrossing = this.yAxisLeft.zeroCrossing;
this.yAxisRight.amountOfSteps = this.yAxisLeft.amountOfSteps;
resized = this.yAxisRight.redraw() || resized;
}
else {

+ 40
- 25
lib/timeline/component/graph2d_types/bar.js View File

@ -49,8 +49,8 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) {
// combine all barchart data
for (i = 0; i < groupIds.length; i++) {
group = framework.groups[groupIds[i]];
if (group.options.style == 'bar') {
if (group.visible == true && (framework.options.groups.visibility[groupIds[i]] === undefined || framework.options.groups.visibility[groupIds[i]] == true)) {
if (group.options.style === 'bar') {
if (group.visible === true && (framework.options.groups.visibility[groupIds[i]] === undefined || framework.options.groups.visibility[groupIds[i]] === true)) {
for (j = 0; j < processedGroupData[groupIds[i]].length; j++) {
combinedData.push({
x: processedGroupData[groupIds[i]][j].x,
@ -64,13 +64,14 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) {
}
}
if (barPoints == 0) {return;}
if (barPoints === 0) {return;}
// sort by time and by group
combinedData.sort(function (a, b) {
if (a.x == b.x) {
return a.groupId - b.groupId;
} else {
if (a.x === b.x) {
return a.groupId < b.groupId ? -1 : 1;
}
else {
return a.x - b.x;
}
});
@ -98,20 +99,26 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) {
drawData = Bargraph._getSafeDrawData(coreDistance, group, minWidth);
intersections[key].resolved += 1;
if (group.options.barChart.handleOverlap == 'stack') {
heightOffset = intersections[key].accumulated;
intersections[key].accumulated += group.zeroPosition - combinedData[i].y;
if (group.options.barChart.handleOverlap === 'stack') {
if (combinedData[i].y < group.zeroPosition) {
heightOffset = intersections[key].accumulatedNegative;
intersections[key].accumulatedNegative += group.zeroPosition - combinedData[i].y;
}
else {
heightOffset = intersections[key].accumulatedPositive;
intersections[key].accumulatedPositive += group.zeroPosition - combinedData[i].y;
}
}
else if (group.options.barChart.handleOverlap == 'sideBySide') {
else if (group.options.barChart.handleOverlap === 'sideBySide') {
drawData.width = drawData.width / intersections[key].amount;
drawData.offset += (intersections[key].resolved) * drawData.width - (0.5*drawData.width * (intersections[key].amount+1));
if (group.options.barChart.align == 'left') {drawData.offset -= 0.5*drawData.width;}
else if (group.options.barChart.align == 'right') {drawData.offset += 0.5*drawData.width;}
if (group.options.barChart.align === 'left') {drawData.offset -= 0.5*drawData.width;}
else if (group.options.barChart.align === 'right') {drawData.offset += 0.5*drawData.width;}
}
}
DOMutil.drawBar(combinedData[i].x + drawData.offset, combinedData[i].y - heightOffset, drawData.width, group.zeroPosition - combinedData[i].y, group.className + ' vis-bar', framework.svgElements, framework.svg);
// draw points
if (group.options.drawPoints.enabled == true) {
if (group.options.drawPoints.enabled === true) {
Points.draw([combinedData[i]], group, framework, drawData.offset);
//DOMutil.drawPoint(combinedData[i].x + drawData.offset, combinedData[i].y, group, framework.svgElements, framework.svg);
}
@ -135,9 +142,9 @@ Bargraph._getDataIntersections = function (intersections, combinedData) {
if (i > 0) {
coreDistance = Math.min(coreDistance, Math.abs(combinedData[i - 1].x - combinedData[i].x));
}
if (coreDistance == 0) {
if (coreDistance === 0) {
if (intersections[combinedData[i].x] === undefined) {
intersections[combinedData[i].x] = {amount: 0, resolved: 0, accumulated: 0};
intersections[combinedData[i].x] = {amount: 0, resolved: 0, accumulatedPositive: 0, accumulatedNegative: 0};
}
intersections[combinedData[i].x].amount += 1;
}
@ -160,10 +167,10 @@ Bargraph._getSafeDrawData = function (coreDistance, group, minWidth) {
width = coreDistance < minWidth ? minWidth : coreDistance;
offset = 0; // recalculate offset with the new width;
if (group.options.barChart.align == 'left') {
if (group.options.barChart.align === 'left') {
offset -= 0.5 * coreDistance;
}
else if (group.options.barChart.align == 'right') {
else if (group.options.barChart.align === 'right') {
offset += 0.5 * coreDistance;
}
}
@ -171,10 +178,10 @@ Bargraph._getSafeDrawData = function (coreDistance, group, minWidth) {
// default settings
width = group.options.barChart.width;
offset = 0;
if (group.options.barChart.align == 'left') {
if (group.options.barChart.align === 'left') {
offset -= 0.5 * group.options.barChart.width;
}
else if (group.options.barChart.align == 'right') {
else if (group.options.barChart.align === 'right') {
offset += 0.5 * group.options.barChart.width;
}
}
@ -186,9 +193,10 @@ Bargraph.getStackedBarYRange = function(barCombinedData, groupRanges, groupIds,
if (barCombinedData.length > 0) {
// sort by time and by group
barCombinedData.sort(function (a, b) {
if (a.x == b.x) {
return a.groupId - b.groupId;
} else {
if (a.x === b.x) {
return a.groupId < b.groupId ? -1 : 1;
}
else {
return a.x - b.x;
}
});
@ -212,13 +220,20 @@ Bargraph._getStackedBarYRange = function (intersections, combinedData) {
yMax = yMax < combinedData[i].y ? combinedData[i].y : yMax;
}
else {
intersections[key].accumulated += combinedData[i].y;
if (combinedData[i].y < 0) {
intersections[key].accumulatedNegative += combinedData[i].y;
}
else {
intersections[key].accumulatedPositive += combinedData[i].y;
}
}
}
for (var xpos in intersections) {
if (intersections.hasOwnProperty(xpos)) {
yMin = yMin > intersections[xpos].accumulated ? intersections[xpos].accumulated : yMin;
yMax = yMax < intersections[xpos].accumulated ? intersections[xpos].accumulated : yMax;
yMin = yMin > intersections[xpos].accumulatedNegative ? intersections[xpos].accumulatedNegative : yMin;
yMin = yMin > intersections[xpos].accumulatedPositive ? intersections[xpos].accumulatedPositive : yMin;
yMax = yMax < intersections[xpos].accumulatedNegative ? intersections[xpos].accumulatedNegative : yMax;
yMax = yMax < intersections[xpos].accumulatedPositive ? intersections[xpos].accumulatedPositive : yMax;
}
}

+ 4
- 13
lib/util.js View File

@ -2,7 +2,10 @@
// first check if moment.js is already loaded in the browser window, if so,
// use this instance. Else, load via commonjs.
var moment = require('./module/moment');
var uuid = require('./module/uuid');
/**
* Test whether given object is a number
@ -90,19 +93,7 @@ exports.isDataTable = function(object) {
* @return {String} uuid
*/
exports.randomUUID = function() {
var S4 = function () {
return Math.floor(
Math.random() * 0x10000 /* 65536 */
).toString(16);
};
return (
S4() + S4() + '-' +
S4() + '-' +
S4() + '-' +
S4() + '-' +
S4() + S4() + S4()
);
return uuid.v4();
};

+ 1
- 0
package.json View File

@ -31,6 +31,7 @@
"emitter-component": "^1.1.1",
"hammerjs": "^2.0.4",
"keycharm": "^0.2.0",
"uuid": "^2.0.1",
"moment": "^2.10.2",
"propagating-hammerjs": "^1.4.1"
},

Loading…
Cancel
Save