plotly / plotly/angular-plotly.js

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

未关闭
#193 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
242
派生
81
平均合并
8 小时 48 分钟
30 天内合并 PR
18

描述

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

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue 中所示的 Angular 模板和组件布局开始,然后将动态添加 y 轴的实现与链接的 CodePen 示例进行比较。使用添加的 yaxis2 重现图表,并确定相关的 legend 或 layout 配置;完成的标准是图例不再与新添加的 y 轴标题重叠。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。