plotly / plotly/react-plotly.js
Horizontal legend entrywidth does not adjust to font size on initial render
未关闭
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 1.1k
- 派生
- 138
- 平均合并
- 3 天 2 小时
- 30 天内合并 PR
- 4
描述
When initially rendering the component, when set to orientation "h", the legend entries do not adjust their size correctly based on the font size set in the layout.
Example:
`
export const Test = (): ReactElement => {
const data : Data[] =[
{
x: [1, 2, 3],
y: [2, 6, 3],
name: "my example scatter chart",
type: 'scatter',
mode: 'lines+markers',
marker: {color: 'red'},
},
{type: 'bar', name:"my example bar chart", x: [1, 2, 3], y: [2, 5, 3]},
]
const layout = {
width: 1350,
height: 950,
hoverlabel: {
bgcolor: "#555555",
font: {
family: "Open Sans",
size: 14
}
},
legend: {
x: 0.25,
y: -0.35,
orientation: "h" as any,
font: {
family: 'Open Sans',
size: 24,
color: '#555555'
},
entrywidth:0,
},
xaxis: {
showline: false,
zeroline: false,
title: {
text: 'x',
font: {
family: 'Open Sans',
size: 14,
color: '#555555'
}
},
},
yaxis: {
showline: false,
zeroline: false,
title: {
text: 'y',
font: {
family: 'Open Sans',
size: 14,
color: '#555555'
}
}
}
}
return (<Plot
layout={layout}
data={data}
/>)
}
`

If I adjust the font size property of the layout object after the initial render, it corrects itself.

Any guidance or help would be greatly appreciated.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 组件的初始渲染路径以及示例中描述的图例水平尺寸调整行为开始。使用 orientation "h" 和 24px 的图例字体重现图表,然后将其与更改字体大小后的结果进行比较;当初始渲染时条目宽度与配置的字体匹配时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- data-visualization, frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100