Change color for single bars?

Hey, I currently have a bar chart representing some data.
Name on x axis and amount on Y Axis.
So a pretty basic bar chart.

But I want to have some of the bars be the same color as others. So I tried using the query for a category:

[
  {
    $addFields: {
      category: {
        $cond: {
          if: {
            $in: [
              "$name",
              [
                "Name8",
                "Name7"
              ]
            ]
          },
          then: "category1",
          else: {
            $cond: {
              if: {
                $in: [
                  "$name",
                  [
                    "name3",
                    "name 4"

                  ]
                ]
              },
              then: "category2",
              else: {
                $cond: {
                  if: {
                    $in: [
                      "name",
                      [
                        "Name1",
                        "Name2"
                      ]
                    ]
                  },
                  then: "category3",
                  else: "other"
                }
              }
            }
          }
        }
      }
    }
  }
]

But the problem here is that its not really made (I guess?) for this kind of query there because my bars become very thin and missplaced (too much right/left)

I added the new field category in Series.

Greetings

Change your chart from a Grouped Bar to a Stacked Bar. That way the bars will retain their maximum width.

Tom

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.