Note that there are some explanatory texts on larger screens.

plurals
  1. POflot dynamically defining multiple data with labels
    primarykey
    data
    text
    <p>I've read at least half a dozen other questions about doing this, and I can't figure out how mine is different: <a href="http://jsfiddle.net/jshado1/Z5UFg/1/" rel="nofollow noreferrer"><a href="http://jsfiddle.net/jshado1/Z5UFg/1/" rel="nofollow noreferrer">http://jsfiddle.net/jshado1/Z5UFg/1/</a></a></p> <p>I added a function <code>LoadGraph.check_data</code> which I run from the console. The data that it output after running <code>load_data(1,"199 Water St",7);</code> is:</p> <pre><code>#mine [ { label:"coffee", data:[ [1659] ] }, { label:"cocoa", data:[ [717] ] }, { label:"tea", data:[ [206] ] } ] </code></pre> <p>That looks exactly the same to me as <a href="https://github.com/flot/flot/blob/master/API.md" rel="nofollow noreferrer">the example in the doc</a> (just above <em>Plot Options</em>):</p> <pre><code>#doc example [ { label: "Foo", data: [ [10, 1], [17, -14], [30, 5] ] }, { label: "Bar", data: [ [11, 13], [19, 11], [30, -7] ] } ] </code></pre> <p>I also tried modelling my structure after <a href="https://stackoverflow.com/a/5661134">SO answer 5661134</a>, but that didn't fly either (exact same outcome as seen in the fiddle).</p> <p>The 2nd graph in the fiddle should either have 3 bars next to each other or (better yet) have the 3 bars stacked on top of each other.</p> <p><strong>UPDATE</strong>: I added an x-value to get the following (but it still doesn't work, fiddle):</p> <pre><code>#http://jsfiddle.net/jshado1/Z5UFg/3/ [ { label:"coffee", data:[ [7, 1659] ] }, { label:"cocoa", data:[ [7, 717] ] }, { label:"tea", data:[ [7, 206] ] } ] #http://jsfiddle.net/jshado1/Z5UFg/2/ [ { label:"coffee", data:[ [0, 1659] ] }, { label:"cocoa", data:[ [1, 717] ] }, { label:"tea", data:[ [2, 206] ] } ] </code></pre> <p>If I take out the object-ness (eg, the labelling), it works (but I'll need to figure out why <code>f_opts.series.stack=true</code> doesn't work—I think, since all 3 bars are blue, it's treating all three as the same series): <a href="http://jsfiddle.net/jshado1/Z5UFg/4/" rel="nofollow noreferrer">v4</a></p> <p><strong>UPDATE 2</strong> Are these supposed to be in 2 different places? By that I mean should that label+data array-object be in the options object and the data also be in the data array? The documentation is kind of difficult to figure out because it never says what the parent object is.</p>
    singulars
    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