作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图让 VictoryChart 填满整个容器,但它在右侧留下了大量空白。这就是我想要做的:
<VictoryChart domainPadding={{ x: 25 }}>
<VictoryAxis
tickValues={categories ? categories.x : undefined}
/>
<VictoryAxis
tickValues={categories ? categories.y : undefined}
domain={yAxisDomain}
dependentAxis
crossAxis
/>
<VictoryBar
cornerRadius={{ topLeft: 5, topRight: 5 }}
data={data}
labels={labels}
/>
</VictoryChart>
这是正在呈现的内容:
<div class="VictoryContainer" style="height: 100%; width: 100%; user-select: none; pointer-events: none; touch-action: none; position: relative;">
<svg width="450" height="300" role="img" aria-labelledby="victory-container-2-title victory-container-2-desc" viewBox="0 0 450 300" style="pointer-events: all; width: 100%; height: auto;">
...
</svg>
<div style="z-index: 99; position: absolute; top: 0px; left: 0px; width: 100%; height: auto;">
<svg width="450" height="300" viewBox="0 0 450 300" style="overflow: visible; width: 100%; height: auto;"></svg>
</div>
</div>
最佳答案
通过在 VictoryChart
组件上设置填充解决了这个问题:
<VictoryChart
domainPadding={{ x: 25 }}
padding={{ top: 50, bottom: 50, right: 0, left: 50 }}
>
关于reactjs - VictoryChart 没有填满整个 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57854945/
我试图让 VictoryChart 填满整个容器,但它在右侧留下了大量空白。这就是我想要做的: 这是正在呈现的内容: ...
我有以下渲染函数: render() { return ( Header
我是一名优秀的程序员,十分优秀!