0 votes

In bar charts, is it possible to set the color of one of the bars dynamically (from a variable) to emphasize that particular bar? When I tried to replace rgb(XXX, XXX, XXX) with variables (either the whole part or the individual components), I only got error messages. „If“ conditions (within the *data command) also did not work.

I do not want to put the whole diagram under an „if“ condition and create several versions of it (each with another bar emphasized), as this would certainly appear to work, but also stretch the code.

by (5.8k points)

1 Answer

0 votes

It is somewhat tricky to figure but it works if you put rgb(XXX, XXX, XXX) in quotes like that:

>> color = "rgb(64,224,208)"

*chart: Shoe sizes of famous celebrities
   *type: bar
    *data: [["Ellen Page", 6], ["Beyonce", 8], ["Kate Winslet", 11]]
    *color: {color}

Here is a sample program that has this and one more complex example.

by (5.8k points)
Welcome to Guidedtrack Q&A, where you can ask questions and receive answers from other members of the community.
134 questions
144 answers
55 comments
40 users