Adding additional properties to a Chart JS dataset
<p>I'm trying to add extra properties to a Chart JS dataset (for a Pie / Doughnut chart). I've got a piece of Ruby on the back-end that prints the following JSON to the view:</p>

<pre><code>[
{"segment": "undetermined",
"label": "Undetermined",
"value": 420193," 
color": "#DECF3F",
"highlight": "#e2d455"
},
{"segment":"peer_review",
"label":"Peer Review",
"value":415212,
"color":"#60BD68",
"highlight":"#72c479"
}
]
</code></pre>

<p>The "segment" property is an additional one (not provided for by the library) that I want to make available to my JS on the front-end. However when I wrap this JSON in a <code>canvas</code> tag I can't access it through JS.</p>

<p>The second line below outputs the above JSON:</p>

<pre><code>&lt;canvas id="review-type" height="235" data-facet="review_status_s"&gt;
  &lt;%= @by_review_type %&gt; 
&lt;/canvas&gt;
</code></pre>

<p>And I'm trying to access the "segment" property by using the <code>getSegmentsAtEvent()</code> API call (name collision accidental):</p>

<pre><code>   $("#review-type").click(
    function(evt) {
      var activePoints = reviewChart.getSegmentsAtEvent(evt);

      /* extract other properties, then build an URL from them: */

      var url = "/" +locale+ "/catalog?f[" +facet_frag+ "][]=" +segment+ "&amp;q=*:*";
      window.location = url;
    }
  );
</code></pre>

<p>However when I inspect <code>activePoints</code> in the JS console, "segment" isn't on the list of properties.</p>

<p>What should I do?</p>