Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing different symbols for plotting data not working
    text
    copied!<p>I am attempting to use a different symbol for one of my data series on my flot graph as it is at a much larger scale then the rest of the data. I am using this example as reference: <a href="http://www.flotcharts.org/flot/examples/symbols/index.html" rel="nofollow">http://www.flotcharts.org/flot/examples/symbols/index.html</a></p> <p>Here is what I have so far:</p> <p>My includes:</p> <pre><code>&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery.flot.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery.flot.symbol.js"&gt;&lt;/script&gt; </code></pre> <p>I then configure my flot options like so:</p> <pre><code>var options = { grid: {hoverable : true}, xaxis: { mode: "time", timeformat: "%H:%M", tickLength: 1}, series: { points : { show: true } } }; </code></pre> <p>I then actually plot the data:</p> <pre><code> $.plot('#placeholder', [{ data: my_data, lines: { show : true}, points: { symbol: "square"}, color: '#CB4B4B', label: 'My Data' }], options); } </code></pre> <p>However, <code>flot</code> is still graphing the points as the default circle. I get no error messages in firebug and I have even tried adding a logging message in the <code>jquery.flot.symbol.js</code> library itself to see if the "square" handler is even being called like so:</p> <pre><code>var handlers = { square: function (ctx, x, y, radius, shadow) { console.log("Square handler was called"); // pi * r^2 = (2s)^2 =&gt; s = r * sqrt(pi)/2 var size = radius * Math.sqrt(Math.PI) / 2; ctx.rect(x - size, y - size, size + size, size + size); }, </code></pre> <p>I am getting no console messages so I am assuming the handler is not getting called correctly. Am I missing something here?</p> <p><strong>EDIT:</strong></p> <p>Example of data I am trying to plot:</p> <pre><code>var d1 = [ [1364342400000, 208], [1364346000000, 107], [1364353200000, 42], [1364371200000, 1680], [1364360400000, 52], [1364349600000, 67], [1364385600000, 1118], [1364367600000, 163], [1364382000000, 1359], [1364378400000, 1468], [1364389200000, 1023], [1364356800000, 63], [1364374800000, 1601], [1364392800000, 556], [1364364000000, 84], ], d2 = [ [1364342400000, 86], [1364346000000, 42], [1364353200000, 13], [1364371200000, 458], [1364360400000, 10], [1364349600000, 22], [1364385600000, 453], [1364367600000, 45], [1364382000000, 369], [1364378400000, 379], [1364389200000, 358], [1364356800000, 17], [1364374800000, 471], [1364392800000, 147], [1364364000000, 16], ], d3 = [ [1364342400000, 7], [1364346000000, 5], [1364382000000, 11709], [1364371200000, 58336], [1364360400000, 1], [1364349600000, 1], [1364367600000, 2], [1364389200000, 1191], [1364378400000, 9085], [1364385600000, 4688], [1364374800000, 9386], [1364392800000, 1140], [1364364000000, 1], ]; </code></pre> <p>I have also edited my <code>options</code> parameter and how the plot function is called:</p> <pre><code>var options = { grid: {hoverable : true}, xaxis: { mode: "time", timeformat: "%H:%M", tickLength: 1} }; $.plot("#placeholder", [{ data: d1, lines: { show : true }, points: { show: true}, color: '#EDC240', label: "d1" }, { data: d2, lines: { show : true }, points: { show : true}, color: '#AFD8F8', label: "d2" }, { data: d3, yaxis: 2, lines: { show : true}, points: { show: true, symbol: "square"}, color: '#CB4B4B', label: "d3" }], options); </code></pre> <p>I am also sure that the <code>symbol</code> library is being included because I have added some logging itself to the library and that is showing up fine.</p>
 

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