on 05-02-2016 9:29 PM
Experts,
I am working on a very basic viz chart SAPUI5 example. My preferred JSON that I want to use to populate the chart looks like this:
"data": [
{"object": {
"ave":".173",
"name":"Fergie Jenkins",
"team":"Chicago Cubs",
"OnBasePercentage":".250"
}}
,
{"object": {
"ave":".300",
"name":"Alfonso Soriano",
"team":"Chicago Cubs",
"OnBasePercentage":".375"
}}
,
{"object": {
"ave":".130",
"name":"Gaylord Perry",
"team":"San Francisco Giants",
"OnBasePercentage":".205"
}}
]
The above JSON doesn't work with these dimensions:
var dataSet = new sap.viz.ui5.data.FlattenedDataset({
dimensions: [
{ axis: 1, name: 'Player', value: "{name}" },
{ axis: 2, name: 'Team', value: "{team}" }
],
measures: [
{ name: 'Average', value: '{ave}' }
],
data: { path: "/data" }
});
Is there a way to tell this dimensions construct that I have a parent node in my JSON for each record of "object"? I tried {object.name}, but that did not work. Is there a syntax change I can make to reference the field values that would include the "object" reference somehow?
My chart works fine when I use the following JSON without the "object" wrapper, but this is not my preferred format:
"data": [
{
"AgentryObjectName": "",
"ave":".173",
"name":"Fergie Jenkins",
"team":"Chicago Cubs",
"OnBasePercentage":".250"
}
,
{
"AgentryObjectName": "",
"ave":".300",
"name":"Alfonso Soriano",
"team":"Chicago Cubs",
"OnBasePercentage":".375"
}
,
{
"AgentryObjectName": "",
"ave":".130",
"name":"Gaylord Perry",
"team":"San Francisco Giants",
"OnBasePercentage":".205"
}
]
Any help would be greatly appreciated. Thanks!
Jason Latko - Senior Product Developer at SAP
Have you tried below?
dimensions: [
{ axis: 1, name: 'Player', value: "{object/name}" },
{ axis: 2, name: 'Team', value: "{object/team}" }
],
measures: [
{ name: 'Average', value: '{object/ave}' }
],
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Chapman is correct see sample
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
10 | |
9 | |
8 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.