I have a problem displaying data on a ShieldUI JavaScript Chart. The values I want to show are entered by the user in some text fields. I made sure that the function is actually being called. Here is my code:

 var Participants = new Array();
    Participants [0]=document.getElementById("ParticipantA").value;
    Participants [1]=document.getElementById("ParticipantB").value;
    Participants [2]=document.getElementById("ParticipantC").value;

and that I do put the data on the chart:
dataSeries: [
                {
                    seriesType: 'line',
                    collectionAlias: 'chart',
                    data: [Participants [0], Participants [1], Participants [2]]
                }

So what is the problem?

The one error I can see, is that the values of the text fields are not in the correct format. Although you might be entering numerical values, you need to convert them explicitly, in order to be used with your Shield UI Chart:

var Participants = new Array();
Participants [0]=parseFloat(document.getElementById("ParticipantA").value);
Participants [1]=parseFloat(document.getElementById("ParticipantB").value);
Participants [2]=parseFloat(document.getElementById("ParticipantC").value);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.