Adds < and > keyboard shortcuts for next/prev metric-on-canvas

This commit is contained in:
Simon Howe
2016-04-04 17:48:41 +02:00
parent a104962aa2
commit cc3d392010
6 changed files with 48 additions and 20 deletions
+6
View File
@@ -0,0 +1,6 @@
// http://stackoverflow.com/questions/4467539/javascript-modulo-not-behaving
export function modulo(i, n) {
return ((i % n) + n) % n;
}
+2 -3
View File
@@ -4,7 +4,7 @@ import d3 from 'd3';
const formatLargeValue = d3.format('s');
function toHtml(text, unit) {
function renderHtml(text, unit) {
return (
<span className="metric-formatted">
<span className="metric-value">{text}</span>
@@ -18,7 +18,6 @@ function makeFormatters(renderFn) {
const formatters = {
filesize(value) {
const obj = filesize(value, {output: 'object'});
console.log('rendering', value);
return renderFn(obj.value, obj.suffix);
},
@@ -45,7 +44,7 @@ function makeFormatters(renderFn) {
}
const formatters = makeFormatters(toHtml);
const formatters = makeFormatters(renderHtml);
const svgFormatters = makeFormatters((text, unit) => `${text}${unit}`);
export function formatMetric(value, opts, svg) {