Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I change the step for Cube metrics?
    primarykey
    data
    text
    <p>I am just starting out with cubism.js</p> <p>Stripping down the example code I am able to show two metrics .. one calculated (kpi1) -- random function , one from Cube (kpi2). It works perfect at a context step of 1e4 as soon as I change it to 1e3 the calculated one - random - shows fine at a resolution of 1s while the one from Cube does not show at all.</p> <p>this works:</p> <pre><code>var context = cubism.context() .serverDelay(0) .clientDelay(0) .step(1e4) .size(960); </code></pre> <p>this does not:</p> <pre><code>var context = cubism.context() .serverDelay(0) .clientDelay(0) .step(1e3) .size(960); </code></pre> <p>What am I doing wrong?</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt;&lt;head&gt;&lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;&lt;meta charset="utf-8"&gt; &lt;title&gt;Dashboard&lt;/title&gt; &lt;/head&gt;&lt;body&gt;&lt;div id="body"&gt; &lt;div id="kpi1"&gt;&lt;/div&gt; &lt;div id="kpi2"&gt;&lt;/div&gt; &lt;script src="../d3.v2.js"&gt;&lt;/script&gt; &lt;script src="../cubism.v1.js"&gt;&lt;/script&gt; &lt;script&gt;function random(name) { var value = 0, values = [], i = 0, last; return context.metric(function(start, stop, step, callback) { start = +start, stop = +stop; if (isNaN(last)) last = start; while (last &lt; stop) { last += step; value = Math.max(-10, Math.min(10, value + .8 * Math.random() - .4 + .2 * Math.cos(i += .2))); values.push(value); } callback(null, values = values.slice((start - stop) / step)); }, name); }&lt;/script&gt; &lt;script&gt; var context = cubism.context() .serverDelay(0) .clientDelay(0) .step(1e4) .size(960); var foo = random("foo"); var cube = context.cube(); d3.select("#kpi1").call(function(div) { div.selectAll(".horizon") .data([foo]) .enter().append("div") .attr("class", "horizon") .call(context.horizon()); }); d3.select("#kpi2").call(function(div) { div.selectAll(".horizon") .data([cube.metric("median(cube_compute(ms))")]) .enter().append("div") .attr("class", "horizon") .call(context.horizon()); }); &lt;/script&gt; &lt;/body&gt;&lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload