Search Support
-
Alan DickmanApril 18, 2016 at 12:10 pm #1621
I’m interested in suggestions/recommendations for how to best graph return data from the Bluemix Tone Analyzer service. The service returns 3 tone categories and each category has 3-5 tone names and scores. The values are in the leaves so how best to represent the 2 levels of categories in a single chart if possible?
{ “document_tone”: {
‘ “tone_categories”: [
{ “tones”: [
{ “score”: 0.081787,
“tone_id”: “anger”,
“tone_name”: “Anger”
},
{ “score”: 0.096338,
“tone_id”: “disgust”,
“tone_name”: “Disgust”
},
{ “score”: 0.116451,
“tone_id”: “fear”,
“tone_name”: “Fear”
},
{ “score”: 0.218889,
“tone_id”: “joy”,
“tone_name”: “Joy”
},
{ “score”: 0.649926,
“tone_id”: “sadness”,
“tone_name”: “Sadness”
}
],
“category_id”: “emotion_tone”,
“category_name”: “Emotion Tone”
},
{ “tones”: [
{ “score”: 0,
“tone_id”: “analytical”,
“tone_name”: “Analytical”
},
{ “score”: 0,
“tone_id”: “confident”,
“tone_name”: “Confident”
},
{ “score”: 0,
“tone_id”: “tentative”,
“tone_name”: “Tentative”
}
],
“category_id”: “writing_tone”,
“category_name”: “Writing Tone”
},
{ “tones”: [
{ “score”: 0.014,
“tone_id”: “openness_big5”,
“tone_name”: “Openness”
},
{ “score”: 0.148,
“tone_id”: “conscientiousness_big5”,
“tone_name”: “Conscientiousness”
},
{ “score”: 0.532,
“tone_id”: “extraversion_big5”,
“tone_name”: “Extraversion”
},
{ “score”: 0.782,
“tone_id”: “agreeableness_big5”,
“tone_name”: “Agreeableness”
},
{ “score”: 0.988,
“tone_id”: “neuroticism_big5”,
“tone_name”: “Emotional Range”
}
],
“category_id”: “social_tone”,
“category_name”: “Social Tone”
}
]
}
};SPARK SupportApril 18, 2016 at 1:08 pm #1623Hey Alan,
Thanks for your question. You could leverage the drill-down capabilities of the chart. In your example you could have a pie chart that has the 3 different Tone Categories, and then you can drill into each one that will show the nested tones and their scores. Let me know if you need help with the JSON code for it.
Elliot P.
Alan DickmanApril 20, 2016 at 10:41 am #1626Thanks Elliot. I’ll proceed based on your recommendation.
Alan DickmanApril 22, 2016 at 6:55 am #1652Elliot or someone else – I started out by following the instructions in the How to Create a Drilldown article (https://salientprocess.zendesk.com/hc/en-us/articles/206499817-How-To-Create-a-Drilldown-Tree-for-Charts) just to get a based example working but it isn’t painting the Pie Chart.
- Is there some common mistake someone makes when trying out that solution?
- It wasn’t obvious to me how to pass data into the Ajax via the ANY parameter.
- Is there some way to populate the Pie Chart without using an Ajax service?
SPARK SupportApril 22, 2016 at 8:21 am #1653Alan, the article’s example should be working if you followed it. There possibly is a small syntax error that is causing the rendering to fail. Would you be able to share your drill-down code?
Thanks,
Elliot P.
Alan DickmanApril 22, 2016 at 8:36 am #1654Elliot – I’m attaching the toolkit. The code I was playing with is in the “Test Chart” human service and the Ajax service is “s”. Ultimately, I will want to place data from the Tone Analyzer json into the Pie Chart. I’ve parsed the json into an object. I would be interested to understand how the object gets passed into “s”. That wasn’t obvious to me.
BTW, Thanks! Ultimately, we plan to use this in a demo day held in SLC and hopefully in Denver.
SPARK SupportApril 22, 2016 at 8:51 am #1655Due to security reasons the .TWX file doesn’t work on here. Here is a link to a dropbox you can put it in: https://www.dropbox.com/request/KP4PmmMuKGfQDbSgdVAE
Thanks,
Elliot P.
SPARK SupportApril 22, 2016 at 10:04 am #1656Hey Alan,
You’re going to laugh when you hear why it wasn’t showing. The comments at the bottom of the code in the ‘s’ AJAX service use the // syntax, and this is incorrect for an XML format. If you remove the comments, it should work.
Hope This Helps,
Elliot P.
Alan DickmanApril 22, 2016 at 11:05 am #1657Bizarre! I don’t remember editing those comments…
If you look in my twx file, there’s a GSS named Invoke Tone Analyzer parse Json. It returns a list of 3 ToneCategory BOs, each containing 3 or 5 Tone BOs. If I have a human service, for example Test Chart, that calls the Invoke Tone Analyzer parse Json GSS and gets the list of ToneCategory BOs, how do I pass that into the Ajax service? This wasn’t obvious to me from the Drill Down article.
BTW, thanks again. You’ve been very helpful.
SPARK SupportApril 22, 2016 at 12:01 pm #1658To pass data into the AJAX Service on the Chart, you would make use of the .setQueryData() method. Here are the steps:
- In your TestChart HS, drag a Data control onto the coach and bind TCS[] list to it.
- In the On Load event of the Data control type this : ${Pie_Chart_SDS1}.setQueryData(me.getData()); ${Pie_Chart_SDS1}.refresh()
- Within the ‘s’ Ajax Service, change the input data type to a list of ToneCategory
- You need to reference the input data within the xml to do this change the following:
<drilldown-spec>
<drilldown name=”Type”>
<js-query description=”Qty sold by Product Type (Clothing/Appliance/Garden)”>
<script>
<![CDATA[var data = [[ “<#=tw.local.input[0].category_name#>”, 1093], [“APPLIANCES”, 174]];
populateDataSeries(data);
]]>
</script>
</js-query>….
***Make sure that you have the ” ” around the JS input and you use the <#= #> JS tag.
LeeMarch 5, 2017 at 6:12 am #3935A Slider chart may be more effective for Watson TA output, and showing only the top ranked of the 3 categories, depending on your use case.
~Lee
SPARK SupportMarch 6, 2017 at 10:11 am #3944Hi Lee,
Thank you fro the feedback.
Regards,
Stephen P.
-
|
You must be logged in to reply to this topic.