Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Legend Not Adjusting when dynamically adding a new y-axis. #193

Open
hadysysdev opened this issue Apr 27, 2022 · 0 comments
Open

Comments

@hadysysdev
Copy link

Hi, I am currently facing issues adjusting the legend of a plot when a new trace with a new y-axis is added to the plot.
Somehow the legend seems to be overlayed on the newly added y-axis title.

This is my current code set-up:

Angular Template:
<plotly-plot #plotlygraph [style]="{position: 'relative', width: '100%', height: '100%'}" [useResizeHandler]="true"></plotly-plot>
Angular Component:

    // Initial Layout
    layout = {
      title: 'Anomaly Plot',
      autosize: true,
      xaxis: {
        autorange: true,
        type: 'date',
        title: { text: 'DateTime' },
      },
      yaxis: {
        autorange: true,
        type: 'linear',
        title: { text: '°C' },
      },
    };
    // Add new trace with a new y-axis
    layout[yaxis2] = {
      autorange: true,
      type: 'linear',
      side: 'right',
      title: { text: 'mA' },
    };

According to this example here the legend seems to have been adjusted automatically without any further configuration.

Is there a configuration am missing? if not, how can I achieve adjusting the label not to overlay the newly added y-axis?

image

@hadysysdev hadysysdev changed the title Issue with Legend Not shifting when dynamically adding a new y-axis. Issue with Legend Not Adjusting when dynamically adding a new y-axis. Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant