Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have json data format given below. From this data I need to display group11 emotions only in 3D charts.So i need x ,y and z value.how to get these values please give me some logic.we can use anything from this given json.

What I have tried
x-Emotion name(Supremacy, Arrogance)
y-Emotion count(how many times repeated)
z-Emotion duration(in minutes)


What I have tried:

JSON
{
"status":"success",
"result":{
"duration":"15034.88",
"sessionStatus":"Done",
"analysisSegments":[{
"offset":0,
"duration":10000,
"end":10000,
"analysis":{
"Temper":{
"Value":"62.00",
"Group":"medium",
"Score":"59.00"
},
"Valence":{
"Value":"96.00",
"Group":"positive",
"Score":"94.00"
},
"Arousal":{
"Value":"98.00",
"Group":"high",
"Score":"97.00"
},
"Vad":{
"Voiced":"70.00"
},
"Mood":{
"Group7":{
"Primary":{
"Id":1,
"Phrase":"Angry"
},
"Secondary":{
"Id":3,
"Phrase":"Enthusiastic"
}
},
"Group11":{
"Primary":{
"Id":11,
"Phrase":"Supremacy, Arrogance"
},
"Secondary":{
"Id":1,
"Phrase":"Creative, Passionate"
}
},
"Group21":{
"Primary":{
"Id":9,
"Phrase":"egoism"
},
"Secondary":{
"Id":18,
"Phrase":"motivation"
}
},
"Composite":{
"Primary":{
"Id":143,
"Phrase":"Insistence and stubbornness. Possibly childishness."
},
"Secondary":{
"Id":5,
"Phrase":"Ambitious. Assertiveness to achieve goals."
}
}
}
}
},
{
"offset":5000,
"duration":10000,
"end":15000,
"analysis":{
"Temper":{
"Value":"63.00",
"Group":"medium",
"Score":"57.00"
},
"Valence":{
"Value":"89.00",
"Group":"positive",
"Score":"84.00"
},
"Arousal":{
"Value":"94.00",
"Group":"high",
"Score":"91.00"
},
"Vad":{
"Voiced":"62.00"
},
"Mood":{
"Group7":{
"Primary":{
"Id":1,
"Phrase":"Angry"
},
"Secondary":{
"Id":3,
"Phrase":"Enthusiastic"
}
},
"Group11":{
"Primary":{
"Id":11,
"Phrase":"Supremacy, Arrogance"
},
"Secondary":{
"Id":6,
"Phrase":"Leadership, Charisma"
}
},
"Group21":{
"Primary":{
"Id":8,
"Phrase":"dominance"
},
"Secondary":{
"Id":18,
"Phrase":"motivation"
}
},
"Composite":{
"Primary":{
"Id":107,
"Phrase":"Possessiveness. Ownership. Authoritative."
},
"Secondary":{
"Id":41,
"Phrase":"Strong drive."
}
}
}
}
}
],"analysisSummary":{
"AnalysisResult":{
"Temper":{
"Mode":"medium",
"ModePct":"100.00"
},
"Valence":{
"Mode":"positive",
"ModePct":"100.00"
},
"Arousal":{
"Mode":"high",
"ModePct":"100.00"
}
}
}
}
}

json parse
var counter4=0;
var val4 =0;
var val4minute =0;
   var phrase = rawdata[i]["analysis"]["Mood"]["Group11"]["Primary"]["Phrase"];
      if (phrase == "Supremacy, Arrogance") {
  counter4++;
 val4 = counter4 * 10000;
 val4minute = Math.floor(val4 / 60000);
}

Here x is "Supremacy, Arrogance" counter4 is y axis and val4minute is z axis

but this logic is wrong can any one give me a better logic.
Posted
Updated 24-Jan-18 0:10am
Comments
Sinisa Hajnal 24-Jan-18 6:09am    
In what way is it wrong? Do you get an error? Or just wrong count?
GrpSMK 24-Jan-18 6:33am    
i need to get z axis value related to that phrase "Supremacy, Arrogance" from that json
GrpSMK 24-Jan-18 6:17am    
that z axis value is wrong

1 solution

I would create the object
{ phrase: "", count: 0, duration: t }


, go through JSON and count the phrases (you can use filter for supremacy arrogance if that is the only one you're interested in). If you need each time separately, instead of duration: t use array into which you add each time instance duration: []
In this case your object would look like
{phrase: "Supremacy, Arrogance", count: 3, duration: [t1, t2, t3] }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900