Column chart categories only showing first one.

Certified Associate Developer

Hello,

The categories of column char showing one 1st at its index. The column chart is as follows:

series:


  local!columnSeries:a!forEach(
    items:local!months,
    expression: a!localVariables(
      a!chartSeries(
        label: fv!item,
        data: a!localVariables(
          local!count_usage:where(local!months=cast(typeof(local!months), fv!item), 0),
          if(
            length(local!count_usage)=0,
            0,
            index(index(local!localCbProcessess.data, "id_count", {}), local!count_usage, 0)
          )
        )
      )
    )
  )

Column Chart field:

 a!columnChartField(
                          categories: local!months,
                          series: local!columnSeries,
                          xAxisTitle: "Months",
                          yAxisTitle: "Usage",
                          stacking: "NONE",                         
                          colorScheme: "CLASSIC"
                        )

categories data sanp:

the chart is not showing all the categories

Can anyone help me out.

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    I've made some test. Try this. Only with one chartSeries, tell me if this is valid

    a!localVariables(
    local!months: {"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"},
    local!localCbProcessess: {23, 32, 12, 5, 9, 14, 7, 12, 21, 43, 21, 10},

    {
    a!sectionLayout(
    label: "Section",
    contents: {
    a!columnChartField(
    categories: local!months,
    series: a!chartSeries(
    label: local!months,
    data: local!localCbProcessess
    ),

    yAxisTitle: "Usage",
    showLegend: false,
    showTooltips: true
    )
    }
    )
    }
    )

  • 0
    Certified Lead Developer

    do not use foreach to create chartSeries, use that to create data,

    Ex.

    local!columnSeries: a!chartSeries(
    label: "Count",
    data: a!forEach(
    local!months,
    a!localVariables(
    local!count_usage: wherecontains(
    fv!item,
    touniformstring(local!data.month)
    ),
    if(
    length(local!count_usage) = 0, 0, sum( index( local!data.id_count, local!count_usage, { 0 }) )
    )
    )
    )
    )