Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is the solution <a href="http://jsfiddle.net/Zx3ew/1/" rel="nofollow">jsfiddle</a>, I would suggest using some thing like JQuery to add event listeners, otherwise you need to handle IE separately in your JS code. I have used underscore for data manipulations.</p> <pre><code> // note, each data item has "bullet" field. var chartData = [{ "name": "John", "points": 35654, "color": "#7F8DA9", "bullet": "0.gif" }, { "name": "John", "points": 35654, "color": "#7F8DA9", "bullet": "0.gif" },{ "name": "John", "points": 35654, "color": "#7F8DA9", "bullet": "0.gif" },{ "name": "Damon", "points": 65456, "color": "#FEC514", "bullet": "1.gif" }, { "name": "Patrick", "points": 45724, "color": "#DB4C3C", "bullet": "2.gif" },{ "name": "Patrick", "points": 45724, "color": "#DB4C3C", "bullet": "2.gif" },{ "name": "Patrick", "points": 45724, "color": "#DB4C3C", "bullet": "2.gif" },{ "name": "Patrick", "points": 45724, "color": "#DB4C3C", "bullet": "2.gif" }, { "name": "Mark", "points": 13654, "color": "#DAF0FD", "bullet": "3.gif" }]; var select = document.getElementById("selector"); var lookup = {}; var uniqNames = _.unique(_.pluck(chartData, 'name')); var len = uniqNames.length; //alert(items) for (var i = 0; i &lt; len; i++) { var name = uniqNames[i]; var option = document.createElement("option"); option.value = name; option.textContent = name; select.appendChild(option); }; select.addEventListener('change', function () { var selValue = select.options[select.selectedIndex].value; if (selValue === 'None') { return; } var selectedOptions = _.where(chartData, {name:selValue}) alert(JSON.stringify(selectedOptions)) }) </code></pre>
    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.
    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