in this notebook I want to change the font weight in a text mark in dependency of the data, but it does not work: Einkommensmobilität / RND | Observable
fontWeight: (d) => (d.layer == layer_input ? 600 : 400)
in this notebook I want to change the font weight in a text mark in dependency of the data, but it does not work: Einkommensmobilität / RND | Observable
fontWeight: (d) => (d.layer == layer_input ? 600 : 400)
The fontWeight option is a constant option rather than a channel, so this is not supported. Instead you can create two text marks with different font weights, and then assign them different data as desired, say by using the filter option.
I also run into this, and like to have text-specific constant options (as well as possibly some other constant options) to also support functions.
For example, I like to use an array of objects, each containing the text, its position, and its style and mark them on the plot with a single plot call.
Then again, you must have given it some good thought on why they are text-specific constant options. Can you please share your considerations so I may also understand?