How to have a unique color for every unique id in Timelion?

How can I have one color per unique machine_id? In the below graph I have two machine Ids listed on the top right hand side, but I would like to have different colors for each instead of them being all green.

Here is my code:

`.es(index=stage-athena-aux*, metric=avg:hours_per_device, timefield=capture_local_date, split=machine_id.keyword:2).color(green).title('Hours of operation').label(regex='.* machine_id.keyword:(.*) > .*', label='$1').bars(width=11).legend(ne)`

and here is my graph:

Bump

@EZprogramming If you remove the .color(green) from your Timelion query , Timelion will automatically assign a different color per ID.

You can also provide multiple colors in a list separated by :'s to the color function, like this: .color("red:green:blue:yellow:#4a790b") to provide the chart with a color palette, and Timelion will assign a different color to each series, assuming you provided enough colors.

1 Like

Thanks a lot, that is the solution :slight_smile:

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