jeudi 9 février 2017

is there anything wrong with this If Condition in Javascript code?

I have "if condition" in javascript code like this

for(var i in data)
            {
                //Gender.push("Gender " + data[i].JenisKelaminID);
                if(data[i].JenisKelaminID == 1)
                {
                    Gender.push("Men");
                } 
                if(data[i].JenisKelaminID == 2)
                {
                    Gender.push("Women");
                }


                else
                {
                    Gender.push("Other");
                } 

                jumlah.push(data[i].jumlah);

                if(data[i].Fakultas == "A")
                {
                    Fakultas.push("FAPERTA");
                }

                if(data[i].Fakultas == "B")
                {
                    Fakultas.push("FKH");
                }

                if(data[i].Fakultas == "C")
                {
                    Fakultas.push("FPIK");
                }

                if(data[i].Fakultas == "D")
                {
                    Fakultas.push("FAPET");
                }

                if(data[i].Fakultas == "E")
                {
                    Fakultas.push("FAHUTAN");
                }

                if(data[i].Fakultas == "F")
                {
                    Fakultas.push("FATETA");
                }

                if(data[i].Fakultas == "G")
                {
                    Fakultas.push("FMIPA");
                }

                if(data[i].Fakultas == "H")
                {
                    Fakultas.push("FEM");
                }

                if(data[i].Fakultas == "I")
                {
                    Fakultas.push("FEMA");
                }

                else
                {
                    Fakultas.push("Other");
                }

                jumlah_orang.push(data[i].jumlah_orang);
            }

I took the data from the database with query. Here is the table of db enter image description here enter image description here

but the result came like this enter image description here

how can I make the chart to be correct? Because I just want 1 "other" in every chart. Please help me to solve that problem thankyou. GBU




Aucun commentaire:

Enregistrer un commentaire