gpt4 book ai didi

css - 如何调整胜率?

转载 作者:行者123 更新时间:2023-11-28 08:54:50 24 4
gpt4 key购买 nike

下面是一个通用的胜利代码。

 <svg viewBox={viewBox}>
<VictoryPie
standalone={false}
width={width} height={height}
data={data}
innerRadius={innerRadius}
colorScale={colorScale}

/>
<VictoryLegend x={width - 50} y={30}
title="Totals"
centerTitle
orientation="vertical"
gutter={20}
style={{
title: { fontSize: 15 }
}}
data={legendDataWithStyle}
standalone={false}
/>
</svg>

这是对应的Jsfiddle

我正在使用 VictoryLegend x={width - 50} y={30} 来调节饼图和图例的距离。但是我发现很难精确地调整它。如何增加饼图和图例的距离?

最佳答案

我可以建议您使用 g具有适当的 transform 属性值的元素

The g SVG element is a container used to group other SVG elements. Transformations applied to the element are performed on all of its child elements, and any of its attributes are inherited by its child elements.

widthheight 属性用于 svg 元素而不是 viewBox。我 fork 了你的 fiddle ,请检查 - https://jsfiddle.net/levsha/5tx2s8jj/这里the diff between your and my code .

<svg width={width + 100} height={height}> // we add 100 here to legend fits in svg

...

<g transform="translate(40,0)"> // we move legend on 40px here
<VictoryLegend x={width} y={30}
title="Totals"
centerTitle
orientation="vertical"
gutter={20}
style={{
title: { fontSize: 15 }
}}
data={legendDataWithStyle}
standalone={false}
/>
</g>

关于css - 如何调整胜率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47346561/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com