Bar Chart colors based on data source value

Hi All,

I (think) this is a pretty straightforward issue.  I have a report (Bar Chart and corresponding grid) that shows a count of open tasks by case (this is for an HR offboarding app).  I'd like to base the color of a given bar on some threshold of open task count e.g. 5 or less = Green, 5-10 = Amber, 10 or more = Red.  Any feedback would be much appreciated.  Thx!

Sean

  Discussion posts and replies are publicly visible

Parents
  • load(
      local!data: {
        {
          name: "XYZ",
          data: 5
        },
        {
          name: "ABC",
          data: 10
        },
        {
          name: "MNO",
          data: 15
        }
      },
      a!barChartField(
        categories: {
          " "
        },
        series: {
          a!forEach(
            items: local!data,
            expression: a!chartSeries(
              label: fv!item.name,
              data: fv!item.data,
              color: if(
                tointeger(
                  fv!item.data
                ) <= 5,
                "GREEN",
                if(
                  and(
                    tointeger(
                      fv!item.data
                    ) > 5,
                    tointeger(
                      fv!item.data
                    ) <= 10
                  ),
                  "ORANGE",
                  "RED"
                )
              )
            )
          )
        },
        yAxisTitle: "Count",
        showLegend: false,
        showDataLabels: true(),
        xAxisTitle: "Items"
      )
    )

Reply
  • load(
      local!data: {
        {
          name: "XYZ",
          data: 5
        },
        {
          name: "ABC",
          data: 10
        },
        {
          name: "MNO",
          data: 15
        }
      },
      a!barChartField(
        categories: {
          " "
        },
        series: {
          a!forEach(
            items: local!data,
            expression: a!chartSeries(
              label: fv!item.name,
              data: fv!item.data,
              color: if(
                tointeger(
                  fv!item.data
                ) <= 5,
                "GREEN",
                if(
                  and(
                    tointeger(
                      fv!item.data
                    ) > 5,
                    tointeger(
                      fv!item.data
                    ) <= 10
                  ),
                  "ORANGE",
                  "RED"
                )
              )
            )
          )
        },
        yAxisTitle: "Count",
        showLegend: false,
        showDataLabels: true(),
        xAxisTitle: "Items"
      )
    )

Children
No Data