Skip to main content
venkateshg4665
Known Participant
May 31, 2025 6:28 PM UTC
Question

Colours In Column Chart

Hi Team, I'm currently stuck at a point and would appreciate your input. I need to display different colors for different countries in a column chart. Below is the database structure I'm working with

country ListId(pK),

.countryId(int),

isAllowed(boolean)

Note: I want to show only allowed countries data in column chart.

I grouped the data by countryId, and I want to display different colors for different ranges of country IDs in a column chart. For example: Country IDs 1, 2, 3, and 4 should be shown in blue Country IDs 5, 6, 7, and 8 in yellow Country IDs 9 and 10 in another color These colors are just examples. If this approach is feasible, I will apply it to the actual requirement.

7 replies

Inspiring
Jun 2, 2025 1:49 PM UTC

You can manage the colors by using multiple a!chartSeries() like below...

{
  a!columnChartField(
    label: "Column Chart",
    categories: {"Category 1", "Category 2", "Category 3"},
    series: {
      a!chartSeries(color: "#f0f0f0", label: "Country One", data: {1, 2, 3}),
      a!chartSeries(color: "ACCENT", label: "Country Two", data: {2, 3, 4}),
    },
    stacking: "NONE",
    showLegend: true,
    showTooltips: true,
    labelPosition: "ABOVE",
    allowImageDownload: true,
    colorScheme: "RAINFOREST",
    height: "MEDIUM",
    xAxisStyle: "STANDARD",
    yAxisStyle: "STANDARD"
  )
}

Known Participant
Jun 4, 2025 9:38 AM UTC

[mention:abe7c4dc1a704835a31a221efc203f54:e9ed411860ed4f2ba0265705b8793d05]  Thanks for reply, but link parameter is not working  for above code in all bars in chart.

stefanhelzle0001
Brainy
Jun 4, 2025 10:54 AM UTC

What exactly do you mean with "not working", and how does you code look like?