# Create a dynamic chart to plot multiple axes and traces

**URL:** <https://community.plotly.com/t/create-a-dynamic-chart-to-plot-multiple-axes-and-traces/1964>\
**Category:** plotly.js\
**Created:** [August 24, 2016, 6:02pm UTC](https://community.plotly.com/t/create-a-dynamic-chart-to-plot-multiple-axes-and-traces/1964 "2016-08-24T18:02:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jahn](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jahn](https://community.plotly.com/u/jahn)\
**Post date:** [August 24, 2016, 6:02pm UTC](https://community.plotly.com/t/create-a-dynamic-chart-to-plot-multiple-axes-and-traces/1964/1 "2016-08-24T18:02:55Z")

</div>

Hallo ,

iam trying to create a webapplication where i can add and delete multiple y axes and traces.  
I need 3 yaxis on each side maximum. But they should only appear when a button is pressed which adds a new trace that need  
a new axis. How should i do this?

Adding new Trace is with `Plotly.addTraces(div,data);` no problem. But adding a new layout? i cannot find a way to create a new trace , specify the ‘Y’ axis and then create a new layout. The new layout with yaxis binded to the trace always need to get a new position when there is already one axis.

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [August 24, 2016, 8:44pm UTC](https://community.plotly.com/t/create-a-dynamic-chart-to-plot-multiple-axes-and-traces/1964/2 "2016-08-24T20:44:46Z")

</div>

> [@jahn](#):
>
> But adding a new layout?

Hmm. There’s only one layout per plot, so you can’t really add a new layout.

You can using `Plotly.relayout` to reposition the new x/y axes. For example:

```js
Plotly.addTraces(gd, [{ y: [2, 1, 2], yaxis: 'y2', }]);
Plotly.relayout(gd, 'yaxis2.domain': [0.5, 1]);

```
