Data I got from CDTdata=[date_month:1,templateId_count:3,templateName:Accident / Near Miss]; [date_month:1,templateId_count:22,templateName:DFTC Lousado]; [date_month:1,templateId_count:12,templateName:Duplicated items process]; [date_month:1,templateId_count:3,templateName:ESP Summary Report]; [date_month:1,templateId_count:2,templateName:Every Month]; \
Need to be transformed like
data= [date_month:1,"Accident / Near Miss":3,]; [date_month:1,"DFTC Lousado":22]; [date_month:1,"Duplicated items process":12]; [date_month:1,"ESP Summary Report":3]; [date_month:1,"Every Month":2]; or
data= [date_month:1,"Accident / Near Miss":3,"DFTC Lousado":22,"Duplicated items process":12, "ESP Summary Report":3, ,"Every Month":2]
To use it in a stack chart plot date_month on the 'x' axis. How to achieve this?
Discussion posts and replies are publicly visible
What chart are you using? You can directly use grouping on the chart level.
"Column Chart"
And do you also have a record for this table with the sync enabled?
If yes, you can pass that record type directly in the chart and set the primary grouping on your 'date_month' field
If not, then you can achieve it by this block of code.
a!localVariables( local!data: { { date_month: 1, templateId_count: 3, templateName: "Accident / Near Miss" }, { date_month: 1, templateId_count: 22, templateName: "DFTCLousado" }, { date_month: 1, templateId_count: 12, templateName: "Duplicated items process" }, { date_month: 1, templateId_count: 3, templateName: "ESP Summary Report" }, { date_month: 1, templateId_count: 2, templateName: "Every Month" } }, local!uniqueDateMonths: union( local!data.date_month, local!data.date_month ), { a!columnChartField( label: "Column Chart", categories: local!data.templateName, series: a!forEach( items: local!uniqueDateMonths, expression: a!chartSeries( label: fv!item, data: index( local!data.templateId_count, wherecontains( fv!item, tointeger(local!data.date_month) ), {} ) ) ), stacking: "NONE", showLegend: true, showTooltips: true, labelPosition: "ABOVE", allowImageDownload: true, colorScheme: "RAINFOREST", height: "MEDIUM", xAxisStyle: "STANDARD", yAxisStyle: "STANDARD" ) } )