# Production rules in legend

**URL:** <https://discuss.elastic.co/t/production-rules-in-legend/243683>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [August 4, 2020, 9:48am UTC](https://discuss.elastic.co/t/production-rules-in-legend/243683 "2020-08-04T09:48:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michaela\_Krkosova](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michaela_krkosova/32/46926_2.png) [@Michaela\_Krkosova](https://discuss.elastic.co/u/Michaela_Krkosova)\
**Post date:** [August 4, 2020, 9:48am UTC](https://discuss.elastic.co/t/production-rules-in-legend/243683/1 "2020-08-04T09:48:56Z")

</div>

Hi  
I would like to use production rules in vega legend - simplified example - I want a circle near number 10 to be orange.

I assume my code should looks like this

```
{
  "$schema": "https://vega.github.io/schema/vega/v5.json",
  "padding": 5,
  "data": [{"name": "source", "url": "data/cars.json"}],
  "scales": [
    {
      "name": "size",
      "type": "linear",
      "round": true,
      "nice": false,
      "zero": true,
      "domain": {"data": "source", "field": "Acceleration"},
      "range": [4, 361]
    }
  ],
  "legends": [
    {
      "size": "size",
      "encode": {"symbols": {"update": 
      {"stroke": [{"test": "datum.key == 10", "value": "orange"}, {"value": "blue"}]}}},
      "symbolType": "circle"
    }
  ]
}

```

But I am struggeling with part {"test": "datum.key == 10", "value": "orange"}  
How to test data in legend?

Thank you  
Misa

---

<div class="post-metadata">

**Author:** ![Michaela\_Krkosova](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michaela_krkosova/32/46926_2.png) [@Michaela\_Krkosova](https://discuss.elastic.co/u/Michaela_Krkosova)\
**Post date:** [August 4, 2020, 11:11am UTC](https://discuss.elastic.co/t/production-rules-in-legend/243683/2 "2020-08-04T11:11:57Z")

</div>

Got it by myself 🙂

```
{
  "$schema": "https://vega.github.io/schema/vega/v5.json",
  "padding": 5,
  "data": [{"name": "source", "url": "data/cars.json"}],
  "scales": [
    {
      "name": "size",
      "type": "linear",
      "round": true,
      "nice": false,
      "zero": true,
      "domain": {"data": "source", "field": "Acceleration"},
      "range": [4, 361]
    }
  ],
  "legends": [
    {
      "size": "size",
      "encode": {"symbols": {"update": 
      {"stroke": [{"test": "datum.value == 10", "value": "orange"}, {"value": "blue"}]}}},
      "symbolType": "circle"
    }
  ]
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 1, 2020, 11:11am UTC](https://discuss.elastic.co/t/production-rules-in-legend/243683/3 "2020-09-01T11:11:59Z")

</div>

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