Legend Color

Hello, I'm new with Kibana and Vega
I want to customize the legend color in kibana: i need to make the color Green for the "Up" and Red for the "Down"
Is this possible?

Could you please share your Vega Spec so someone can take a look?

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "description": "A simple bar chart with embedded data.",
  "data": {
    "values": [
      {
        "a": "Java",
        "b": "working"
      },
      {
        "a": "Java",
        "b": "sleeping"
      },
      {
        "a": "Java",
        "b": "unknown"
      }
    ]
  },
  "mark": "circle",
  "encoding": {
    "x": {
      "field": "a",
      "type": "nominal"
    },
    "y": {
      "field": "b",
      "type": "nominal"
    },
    "color": {
      "field": "b",
      "type": "nominal"
    }
  },
  "config": {
    "range": {
      "category": {
        "scheme": "elastic"
      }
    },
    "mark": {
      "color": "#54B399"
    },
    "title": {
      "color": "#343741"
    },
    "style": {
      "guide-label": {
        "fill": "#69707d"
      },
      "guide-title": {
        "fill": "#343741"
      },
      "group-title": {
        "fill": "#343741"
      },
      "group-subtitle": {
        "fill": "#343741"
      }
    },
    "axis": {
      "tickColor": "#eef0f3",
      "domainColor": "#eef0f3",
      "gridColor": "#eef0f3"
    },
    "background": "transparent"
  },
  "width": "container",
  "height": "container",
  "autosize": {
    "type": "fit",
    "contains": "padding"
  }
}

I don't see anything with up or down here.

I changed them later to "sleeping" and "working" and "unknown" (according to data from metricbeat)

You can add a scale and manually set the range and corresponding color like this.

    "color": {
      "field": "b",
      "type": "nominal",
      "scale": {
        "domain": ["working", "sleeping", "unknown"],
        "range": ["green", "orange", "red"]
      }
    }
1 Like

that worked for me ! thank you

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