Note that there are some explanatory texts on larger screens.

plurals
  1. POString value sent to series.data, expected Number
    primarykey
    data
    text
    <p>I'm having an error when publishing my rails app to Heroku with Highcharts (<a href="http://highcharts.com/errors/14" rel="nofollow">error 14</a>). In development it all works fine, and the values aren't transformed into strings.</p> <p>Basically, when my view is loaded on Heroku, i get the following code : </p> <pre><code> &lt;script type="text/javascript" charset="UTF-8"&gt; $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'visualization', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'Receipts by Gender' }, tooltip: { formatter: function() { return '&lt;b&gt;'+ this.point.name +'&lt;/b&gt;: '+ this.percentage +' %'; } }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: false }, showInLegend: true } }, series: [{ type: 'pie', name: 'Receipts by gender', data: [["M", "432854518.0"]] }] }); }); }); &lt;/script&gt; </code></pre> <p>If we look at series.data, we will see [["M", "432854518.0"]], and here we have the problem. The value on the right should be a float or at least an integer.</p> <p>My controller :</p> <pre><code> @pie_gender_total = Receipt.group_by_gender_pie(current_user, :total) @pie_gender = @pie_gender_total </code></pre> <p>My view :</p> <pre><code>&lt;script type="text/javascript" charset="UTF-8"&gt; $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ ... series: [{ ... data: &lt;%=raw @pie_gender %&gt; }] }); }); }); &lt;/script&gt; </code></pre> <p>And my model method :</p> <pre><code>def self.group_by_gender_pie(user, dim, begin_date=nil, end_date=nil) arr=[] self.group_by_gender(user).each do |item| arr.push([item.gender, dim == :count ? item.number_of_receipts : item.total]) end arr end </code></pre> <p>Any ideas on why the same solution works in development, but not so for my heroku environment ? And workarounds ?</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