# Kibana: add object to existing dashboard

**URL:** <https://discuss.elastic.co/t/kibana-add-object-to-existing-dashboard/256321>\
**Category:** Kibana\
**Created:** [November 23, 2020, 8:10am UTC](https://discuss.elastic.co/t/kibana-add-object-to-existing-dashboard/256321 "2020-11-23T08:10:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Dobrovolskyi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_dobrovolskyi/32/75364_2.png) [@Eugene\_Dobrovolskyi](https://discuss.elastic.co/u/Eugene_Dobrovolskyi)\
**Post date:** [November 23, 2020, 8:10am UTC](https://discuss.elastic.co/t/kibana-add-object-to-existing-dashboard/256321/1 "2020-11-23T08:10:47Z")

</div>

I am developing a set of scripts to manage Kibana objects, I have created an object and created a dashboard ( with some initial list of objects in it) and now I would like to place/add my new object in this existing dashboard.

I have extracted dashboard JSON and extracted the id of my visualization object. Then I update "references" in dashboard\_json with a dictionary: {'name': 'panel\_new', 'type': 'visualization', 'id': 'd4ef9b30-2ab2-11eb-b19d-9b0fdf84f862'}

and then I add into dashboard\_json['attributes']['panelsJSON'] next dictionary {"panelRefName": "panel\_new"}

but it makes my dashboard is broken ( Kibana shows empty white page instead of the dashboard) As I see all existing objects in my dashboard in dashboard\_json['attributes']['panelsJSON'] has coordinates of object position in the dashboard. Should I add it also? how can I calculate it? What should I do more to correct add the object into my dashboard? How it can be done at all?

---

<div class="post-metadata">

**Author:** ![afharo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/afharo/32/75202_2.png) [@afharo](https://discuss.elastic.co/u/afharo)\
**Post date:** [November 23, 2020, 1:34pm UTC](https://discuss.elastic.co/t/kibana-add-object-to-existing-dashboard/256321/2 "2020-11-23T13:34:03Z")

</div>

Hi @Eugene_Dobrovolskyi

If you open your browser's Developer Tools, you'll notice the console shows an error `panelNew.gridData is undefined`. This means `gridData` is required in the `panelsJSON` documents.  
The `gridData` has:

- the `x` and `y` values: if not provided it will be appended in a new row at the end of the dashboard.
- the `w` and `h` values: the `width` and `height` of the panel containing your visualization
- `i`: it should match `panelIndex` and it's a unique identifier of this entry.

In order to calculate the positioning, you can look for the document with the max values of `x` and `y` (let's call them `x0` and `y0`). Your new `x` will be `x0 + w0` (from the previous doc) and `y` will match the `y0` from that doc as well.  
If your new `x` plus the `w` of your viz will be higher than the max-width of your dashboard (typically `48`), you should use `x = 0` and `y = y0 + h0`.

```auto
  {
    "version": "7.10.0",
    "gridData": {
      "x": 24,
      "y": 100,
      "w": 24,
      "h": 15,
      "i": "any-random-value"
    },
    "panelIndex": "any-random-value",
    "panelRefName": "panel_new"
  }

```

Please, bear in mind this might change in future versions and overwriting saved objects should be done with caution.

---

<div class="post-metadata">

**Author:** ![Eugene\_Dobrovolskyi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_dobrovolskyi/32/75364_2.png) [@Eugene\_Dobrovolskyi](https://discuss.elastic.co/u/Eugene_Dobrovolskyi)\
**Post date:** [November 27, 2020, 1:33pm UTC](https://discuss.elastic.co/t/kibana-add-object-to-existing-dashboard/256321/3 "2020-11-27T13:33:25Z")

</div>

Hi @afharo  
many thanks for your answer!  
it helped me!

---

<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 25, 2020, 1:33pm UTC](https://discuss.elastic.co/t/kibana-add-object-to-existing-dashboard/256321/4 "2020-12-25T13:33:57Z")

</div>

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