gpt4 book ai didi

reactjs - 如何使用 AG Grid 和 AdapTable 更改格式列中渐变的顺序

转载 作者:行者123 更新时间:2023-12-04 13:07:17 24 4
gpt4 key购买 nike

我在与 AdapTable 一起使用的 AG 网格中使用渐变列样式。
我的专栏有正数和负数。因此,我为负数创建了一个范围(红色),为正数创建了另一个范围(绿色)。
正范围工作正常,数字越大,绿色越暗。
但是在负值范围内,单元格越接近 0 越暗,这对我来说是错误的。我希望它更暗 (负)数。这可能吗?
我的格式列定义如下:

FormatColumn: {
FormatColumns: [
{
Scope: { ColumnIds: ['current_value']},
ColumnStyle: {
GradientStyle: {
CellRanges: [
{Min: -100, Max: 0, Color: 'Red'},
{Min: 0, Max: 100, Color: 'Green'}
],
},
},
DisplayFormat: { Formatter: 'NumberFormatter', Options: { Parentheses: true}},
CellAlignment: 'Center',
},
],
},

最佳答案

Range 有一个可选的 ReverseGradient bool 属性,默认值为 false。
您需要在负范围内提供此值并将其设置为 true

CellRanges: [
{Min: -100, Max: 0, Color: 'Red', ReverseGradient: true },
{Min: 0, Max: 100, Color: 'Green'}
],

关于reactjs - 如何使用 AG Grid 和 AdapTable 更改格式列中渐变的顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68798608/

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