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 摘要。