diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2016-10-28 13:31:36 -0700 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2016-10-28 13:31:36 -0700 |
| commit | 05e761abca3ff42dbba371af0560b82707dfe7c0 (patch) | |
| tree | 268cc06b931357a0ffad684961ff6d24eeec3b4b /www/lib/vis/examples/graph2d/06_interpolation.html | |
| parent | 55a9e628760dc31400457099e4aaabc767beed70 (diff) | |
updated vis
Diffstat (limited to 'www/lib/vis/examples/graph2d/06_interpolation.html')
| -rw-r--r-- | www/lib/vis/examples/graph2d/06_interpolation.html | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/www/lib/vis/examples/graph2d/06_interpolation.html b/www/lib/vis/examples/graph2d/06_interpolation.html new file mode 100644 index 00000000..a6ddc53b --- /dev/null +++ b/www/lib/vis/examples/graph2d/06_interpolation.html @@ -0,0 +1,101 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Graph2d | Interpolation</title> + <link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> + <style type="text/css"> + body, html { + font-family: sans-serif; + } + </style> + + <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> +<body> +<h2>Graph2d | Interpolation</h2> +<div style="width:700px; font-size:14px; text-align: justify;"> + The Graph2d makes use of <a href="http://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline" target="_blank">Catmull-Rom spline interpolation</a>. + The user can configure these per group, or globally. In this example we show all 4 possiblities. The differences are in the parametrization of + the curves. The options are <code>uniform</code>, <code>chordal</code> and <code>centripetal</code>. Alternatively you can disable the Catmull-Rom interpolation and + a linear interpolation will be used. The <code>centripetal</code> parametrization produces the best result (no self intersection, yet follows the line closely) and is therefore the default setting. + <br /><br /> + For both the <code>centripetal</code> and <code>chordal</code> parametrization, the distances between the points have to be calculated and this makes these methods computationally intensive + if there are very many points. The <code>uniform</code> parametrization still has to do transformations, though it does not have to calculate the distance between point. Finally, the + linear interpolation is the fastest method. For more on the Catmull-Rom method, <a href="http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf" target="_blank">C. Yuksel et al. have an interesting paper titled ″On the parametrization of Catmull-Rom Curves″</a>. +</div> +<br /> +<div id="visualization"></div> + +<script type="text/javascript"> + // create a dataSet with groups + var names = ['centripetal', 'chordal', 'uniform', 'disabled']; + var groups = new vis.DataSet(); + groups.add({ + id: 0, + content: names[0], + options: { + drawPoints: false, + interpolation: { + parametrization: 'centripetal' + } + }}); + + groups.add({ + id: 1, + content: names[1], + options: { + drawPoints: false, + interpolation: { + parametrization: 'chordal' + } + }}); + + groups.add({ + id: 2, + content: names[2], + options: { + drawPoints: false, + interpolation: { + parametrization: 'uniform' + } + } + }); + + groups.add({ + id: 3, + content: names[3], + options: { + drawPoints: { style: 'circle' }, + interpolation: false + }}); + + var container = document.getElementById('visualization'); + var dataset = new vis.DataSet(); + for (var i = 0; i < names.length; i++) { + dataset.add( [ + {x: '2014-06-12', y: 0 , group: i}, + {x: '2014-06-13', y: 40, group: i}, + {x: '2014-06-14', y: 10, group: i}, + {x: '2014-06-15', y: 15, group: i}, + {x: '2014-06-15', y: 30, group: i}, + {x: '2014-06-17', y: 10, group: i}, + {x: '2014-06-18', y: 15, group: i}, + {x: '2014-06-19', y: 52, group: i}, + {x: '2014-06-20', y: 10, group: i}, + {x: '2014-06-21', y: 20, group: i} + ]); + } + + var options = { + drawPoints: false, + dataAxis: {visible: false}, + legend: true, + start: '2014-06-11', + end: '2014-06-22' + }; + var graph2d = new vis.Graph2d(container, dataset, groups, options); + +</script> +</body> +</html>
\ No newline at end of file |
