Unable to Display Categories for column chart field

Certified Lead Developer

 Currently I am generating a report which has multiple groups and issues resolved, The categories in the report are not Displaying correctly, Only the first category is displaying. 

This is how the categories are displayed.

a!columnChartField(
        categories: a!forEach(
          items: local!datasubset.data,
          expression: group(
            tointeger(
              index(
                fv!item,
                "someGroup",
                null
              )
            ),
            "groupName"
          )
        ),
        series: {
          a!forEach(
            items: local!datasubset.data,
            expression: a!chartSeries(
              label: group(
                tointeger(
                  index(
                    fv!item,
                    "someGroup",
                    null
                  )
                ),
                "groupName"
              ),
              data: index(
                fv!item,
                "number",
                null
              ),
              links: a!dynamicLink(
                value: index(
                  fv!item,
                  "someGroup",
                  null
                ),
                saveInto: {
                  local!selectedGroup,
                  a!save(
                    local!gridPagingInfo.startIndex,
                    1
                  )
                }
              )
            )
          )
        },
        showDataLabels: true,
        showLegend: true
      )

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Hi Santosh ,

    Number of Data in Chart Series Should be equal to the number of Categories.

    Example as below

     

    =a!columnChartField(
      categories: {"Red", "Green", "Blue"},
      series: {
        a!chartSeries(label: "Points", data: {20.3, 12.5, 18.2})
      },
      yAxisTitle: "Average Point Velocity",
      showLegend: false,
      showDataLabels: true
    )

     

    But as per your code, the columnchart is generated something similar to below

     

    =a!columnChartField(
    categories: {"Group 1", "Group 2", "Group 3"},
    series: {
        a!chartSeries(label: "Points", data: {20.3}),
        a!chartSeries(label: "Points", data: {12.5}),
        a!chartSeries(label: "Points", data: {18.2})
    },
    yAxisTitle: "Average Point Velocity",
    showLegend: false,
    showDataLabels: true
    )
     

     

    Can you try the below code and see if it works, if you want the all the group name to be listed in Category:

    with(
      local!chartData: a!forEach(
        items: local!datasubset.data,
        expression: {
          groupName: group(
            tointeger(
              index(
                fv!item,
                "someGroup",
                null
              )
            ),
            "groupName"
          ),
          count: index(
            fv!item,
            "number",
            null
          )
        }
      ),
      a!columnChartField(
        categories: index(
          local!chartData,
          "groupName",
          null
        ),
        series: {
          a!chartSeries(
            label: "Count",
            data: index(
              local!chartData,
              "count",
              null
            ),
            links: a!forEach(
              items: local!datasubset.data,
              expression: a!dynamicLink(
                value: index(
                  fv!item,
                  "someGroup",
                  null
                ),
                saveInto: {
                  local!selectedGroup,
                  a!save(
                    local!gridPagingInfo.startIndex,
                    1
                  )
                }
              )
            )
          )
        },
        showDataLabels: true,
        showLegend: true
      )
    )