Loading array from recordset causing error with line chrt

Posted by user1538696 
Loading array from recordset causing error with line chrt
April 17, 2013 07:56PM
I am trying to load the array for a simple line chart from a recordset using ASP:

This worked just fine:
    var myMoodData = new Array([1, 1], [2, 0], [3, 2], [4, 2], [5, 1], [6, 2], [7, 1], [8, 1], [9, 1], [10, 2]);


X = 1 to start

var myMoodData = new Array();
<% If Not rsMood.EOF Then %>
    <% While Not rsMood.EOF %>
        myMoodData[<%= x %>]="<%= CondInt(rsMood("MoodValue" )) %>";  //space inserted to keep a winkie face from showing up!
    <% x = x + 1 %>
    <% rsMood.MoveNext %>
    <% Wend %>
<% End If %>



I've also tried the following for the load line:
        myMoodData[<%= x %>]=<%= CondInt(rsMood("MoodValue" )) %>;
        myMoodData[<%= x %>,<%= CondInt(rsMood("MoodValue" )) %>];


And I get the same error:
Message: '0' is null or not an object
Line: 1770
Char: 5
Code: 0

The offending line:

var myMoodChart = new JSChart('graph', 'line');
    -->>    myMoodChart.setDataArray(myMoodData); <<--


Any help is greatly appreciated!
Re: Loading array from recordset causing error with line chrt
April 19, 2013 04:59PM
I got this resolved. I actually built the entire string : [1,0],[2,3],[3,7]... in ASP and then simply plug that string into the JS.
Sorry, you do not have permission to post/reply in this forum.