Colour changing in bar chart

Hi All,
Can please someone guide me ,in changing the colours of the bar chart , that is I need to know how can I customize the colour …
In other BI tools we do have the options to choose the colour , but I don’t see that in metabase …
Will be of great help if expertise can please guide me to achieve this
Thanks

THi @zarrar,

See under Display options here: https://metabase.com/docs/latest/users-guide/05-visualizing-results.html#options-for-line-bar-and-area-charts

You get to settings by clicking the gear icon next to the graph type picker

Hi jornh
Thanks for the reply …when I build the bar chart , by defuakt it is taking single colour …how can I change multiple colour …

Hi, this is not possible right now (at least not until v0.28.1). You might want to add your request to this github issue: https://github.com/metabase/metabase/issues/4267

Hi, Does anyone know whether this feature is implemented in latest release? If so, can someone guide me? (This is about changing colors in bar graph based on values)

@renjithpaul Yes, this has been possible for a long time - have a look in the documentation:
https://www.metabase.com/docs/latest/users-guide/05-visualizing-results.html#line--bar-charts-

Hi, @flamber.

I'm still having trouble with this issue. When selecting a bar chart, under the display menu, I only get the chance to pick the color for all the bars.

In the example above, I'd like to select one color for each of the bars. Is there a way to do this?

Also, you mentioned this has already been implemented. Since which version has metabase implemented this function then? I'm currently on 0.36.5.1 !

Thanks in advance.

@celioxf You need to return multiple series to be able to give different colors. Latest release is 0.36.6

Sorry for the noob question, @flamber, but what do you mean by return multiple series? Doesn’t group by different categories suffice?

Should I open a request for a feature that allows for picking colors individually for bars (and rows) out of a chart that contains group by ?

@celioxf I cannot see how you're building you're question or your visualization settings, but you need to add multiple columns to the X-axis:

But you're essentially asking for the same as this, if you want conditional colors on the same series:
Conditional formatting on bar charts · Issue #11461 · metabase/metabase · GitHub - upvote by clicking :+1: on the first post

Hi,
I found a way to have something like that:


I think this is what you want, you want to have one of several bars in different colours, right?

I use mySQL so I don´t know how it would work if you use another language but with mysql you need to write a select statement for every single column and join them with union.

something like:

select x, y
from table a
group by x

union

select x, y
from table b
group by x

...

Disadvantage is that it will become quite inflexible as you can´t for example change the number of columns with a filter anymore (in my example the columns are the last 24 months and I can´t use a filter to change the timeframe. And I had to add 24 unions ... :exploding_head:)
but it worked :slight_smile:

1 Like

Hey, @EvaS. You figured out what I wanted.

I'm building a query lon MariaDB ike this:

SELECT bearbeitungsschema, COUNT(*)
FROM akten
GROUP BY bearbeitungsschema
HAVING bearbeitungsschema = "vw"

UNION

SELECT bearbeitungsschema, COUNT(*)
FROM akten
GROUP BY bearbeitungsschema
HAVING bearbeitungsschema = "daimler"

UNION 

SELECT bearbeitungsschema, COUNT(*)
FROM akten
GROUP BY bearbeitungsschema
HAVING bearbeitungsschema = "audi"

UNION 

SELECT bearbeitungsschema, COUNT(*)
FROM akten
GROUP BY bearbeitungsschema
HAVING bearbeitungsschema = "bmw"

However, when I try to select a different color for the bars, I only get this option:

So, I'm still not sure how to figure it out. @flamber, does this give you anymore information on how I'm writing my query?

@celioxf So that’s basically a Simple question summarized Count grouped by bearbeitungsschema - not sure why you’re trying to make such query in SQL manually.
Please post “Diagnostic Info” from Admin > Troubleshooting.

Hey, @flamber .

To answer your question. I normally find it quickier to write native queries. On top of this, at this exact moment Metabase is showing the odd message that no tables were found in the Databank - it’s a peculiar message though, because I can obviously see all the tables in the native query mode.

The first query I posted however was made exactly like you suggested, however the option to pick different colors for bars is not available.

I supposed this is the Diagnostic-Info you wanted to see:

{
  "browser-info": {
    "language": "de-DE",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.8+10",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "https://adoptopenjdk.net/",
    "java.version": "11.0.8",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.8+10",
    "os.name": "Linux",
    "os.version": "4.15.0-117-generic",
    "user.language": "en",
    "user.timezone": "Europe/Berlin"
  },
  "metabase-info": {
    "databases": [
      "mysql"
    ],
    "hosting-env": "unknown",
    "application-database": "mysql",
    "application-database-details": {
      "database": {
        "name": "MariaDB",
        "version": "10.5.5-MariaDB-1:10.5.5+maria~focal"
      },
      "jdbc-driver": {
        "name": "MariaDB Connector/J",
        "version": "2.6.2"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2020-09-11",
      "tag": "v0.36.5.1",
      "branch": "release-0.36.x",
      "hash": "a3459e8"
    },
    "settings": {
      "report-timezone": "Europe/Berlin"
    }
  }
}

I hope this helps. Thanks again in advance!

@celioxf
Look at my example in my previous comment. I group by two columns, and both of those columns are added to the X-axis.

So you would do something like this and remember to add both columns to the X-axis:

SELECT 1 AS X, bearbeitungsschema, COUNT(*) AS Anzahl
FROM akten
WHERE bearbeitungsschema = 'bmw'
GROUP BY X, bearbeitungsschema
UNION ALL
SELECT 1 AS X, bearbeitungsschema, COUNT(*) AS Anzahl
FROM akten
WHERE bearbeitungsschema = 'audi'
GROUP BY X, bearbeitungsschema
...

I don’t know which problems you’re having with tables not showing up, but open a new topic about that and check your log for errors during sync+scan process.
Latest release is 0.36.6 - not that it will make any difference in regards to this.

1 Like

Thanks a lot! This is already great help. I have to say that when I try to do this with a horizontal bar chart, it does not work (by not working I really mean the visualisation goes away). So I’d take this solution as something provisory.

I’ve also already upvoted the feature you mentioned and I hope it gets implemented soon.

Thanks again for the great help!

@celioxf I don’t understand. Are you talking about the Row visualization? That doesn’t support multi-series:
https://github.com/metabase/metabase/issues/5855 - upvote by clicking :+1: on the first post

Hi @celioxf!
In order to do this, you will need to

  1. Have another column for your color purpose. You can set other rows as null or something else.
  2. Put both variables on the axis.variables
  3. Remember to set stacking status as "Stack".
    Hope you find it helpful.

Hello i want to do with
“combo vis”. which has not have stack choise in the display option .
we really need conditional formatting in every visualization.

@omerfaruk It’s currently not possible to do stacked with combo:
https://github.com/metabase/metabase/issues/12008 - upvote by clicking :+1: on the first post