# Scatter plot by VEGA

**URL:** <https://discuss.elastic.co/t/scatter-plot-by-vega/318701>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [November 11, 2022, 2:24am UTC](https://discuss.elastic.co/t/scatter-plot-by-vega/318701 "2022-11-11T02:24:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sshota](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@sshota](https://discuss.elastic.co/u/sshota)\
**Post date:** [November 11, 2022, 2:24am UTC](https://discuss.elastic.co/t/scatter-plot-by-vega/318701/1 "2022-11-11T02:24:59Z")

</div>

We have created attached scatter plot by VEGA.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/c/fc28f7bbe9b85105a69620e80889ed6d756a2a78.jpeg)  
The code what we use is as below (We concealed critical information):

```auto
{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "mark": { type:"point", filled: true },
  data: {
    url: {
      %context%: true
      %timefield%: ****
      index: **** -demo
      body: {
        size: 10000
        _source: ["Revolution.","Speed","name","date"]
      }
    }
    format: { 
      property: "hits.hits" 
    }
  }
  transform: [{
    calculate: "toDate(datum._source['date'])"
    as: "time"    
  }]
 
  encoding: {
    x:{
      field: _source['Speed']
      type: quantitative
      axis: { title: "Speed[kn]" }
     }
    y: {
      field: _source['Revolution.']
      type: quantitative
      axis: { title: "Revolution. [rpm]"}
     }
     
    size: {value: 300}
    tooltip: [{
      field: "_source['date']",title:"date "
      },{
      field: "_source['Revolution.']",title:"Revolution. [rpm] "
      },{
      field: "_source['Speed']",title:"Speed [kn] "
      }
    ] 
    color: {
      field: _source.name
      type: nominal
      legend: {
        title:"name",
        }
    }
    shape: {
      field: _source.name
      type: nominal
    }
  }

}

```

At this moment we would like to put some function on it.  
What we would like to add is  
・Absolutely standard line of the data. It must be fixed permanently. It must not e effected by any changes such as data range or time stamp. Nothing can effect to the line.  
・Fix range of X-axis and Y-axis. Keep the range as we set up no matter what happens.  
Our ideal image is as below

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/c/ecdc4dc52bdba6bad1588b87de24d11dad9c2db6.jpeg)

Please advise how we can realize our requirements.

Thank you.

---

<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:** [December 8, 2022, 11:22pm UTC](https://discuss.elastic.co/t/scatter-plot-by-vega/318701/2 "2022-12-08T23:22:06Z")

</div>



---

<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:** [January 5, 2023, 11:22pm UTC](https://discuss.elastic.co/t/scatter-plot-by-vega/318701/3 "2023-01-05T23:22:15Z")

</div>

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