plotly / plotly/angular-plotly.js

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

Open
#193 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
242
Forks
81
Avg merge
8h 48m
Merged PRs (30d)
18

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Angular template and component layout shown in the issue, then compare the dynamic y-axis addition with the linked CodePen example. Reproduce the plot with the added yaxis2 and determine the relevant legend or layout configuration; done means the legend no longer overlaps the newly added y-axis title.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.