Canvas Area Chart: applying a gradient to a series

I'm trying to create a Canvas dashboard plotting metricbeat CPU stats, and I'm using an area chart for this:

I'd like the colour of the series to change as it goes up the Y axis from green at the bottom to red at the top (or eventually some other weighted palette).

However although I have set gradient=true it doesn't seem to affect the plot. Here's the code:

| essql 
  query="SELECT \"\" * 100 AS cpu, \"@timestamp\", \"service_name\" FROM \"metricbeat-6.4.3-2019.01.09*\" WHERE \"\"='cpu' ORDER BY \"@timestamp\" DESC"
| pointseries x="@timestamp" y="mean(cpu)"
| plot defaultStyle={seriesStyle bars=0 lines=1 points=0 fill=1} palette={palette "#D3FB71" "#7ECAE3" "#f03b20" gradient=true}
| render

and the SQL query for the data source:
SELECT "" * 100 AS cpu, "@timestamp", "service_name" FROM "metricbeat-6.4.3-2019.01.09*" WHERE ""='cpu' ORDER BY "@timestamp" DESC

edit: applied the correct gradient


I've checked with the canvas team on this. Referencing the y values directly for gradient change is not currently supported and there are no plans to support it in the near-term. A team member had the following to say:

...each line plot only supports one color for that line and the gradient would only apply if you had multiple lines in your plot

Having said that, you could definitely file an enhancement request in our github repo.


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