Skip to content

Latest commit

 

History

History
47 lines (42 loc) · 1.13 KB

timing.md

File metadata and controls

47 lines (42 loc) · 1.13 KB

Timing for building PLUMED-NEST eggs

{% assign names = site.data.eggs | map: "id" %} {% assign times = site.data.eggs | map: "time" %}

The chart below shows the time needed to build each egg in PLUMED-NEST.

<script> var xValues = [ {{ names | join: '", "' | prepend: '"' | append: '"' }} ]; var yValues = [ {{ times | join: ', ' }} ]; // do sorting in descending order based on yValues //1) combine the arrays: var list = []; for (var j = 0; j < xValues.length; j++) list.push({'x': xValues[j], 'y': yValues[j]}); //2) sort: list.sort(function(a, b) { return ((a.y > b.y) ? -1 : ((a.y == b.y) ? 0 : 1)); }); //3) separate them back out: for (var k = 0; k < list.length; k++) { xValues[k] = list[k].x; yValues[k] = list[k].y; } var barColors = "green"; new Chart("myChart", { type: "horizontalBar", data: { labels: xValues, datasets: [{ backgroundColor: barColors, data: yValues }] }, options: { maintainAspectRatio: false, legend: {display: false}, title: { display: true, text: "Build time (s)" } } }); </script>