Sounds like what you want is to change color1
dynamically. You can do this by interpolating a value and concatenating to a string. Assuming input row 10, like in your question:
=SPARKLINE(NOW()-C10,
{
"charttype","bar";
"max",D10-C10;
"color1",IF(
K10="Delivered",
"gray",
"rgb("&INT(255*(NOW()-C10)/(D10-C10))&","&INT(255*(D10-NOW())/(D10-C10))&",0)"
)
})
- Here, your data input is
Now()-C10
, which gets passed to the sparkline.
- The
IF
Statement overrides the color to gray if K10="Delivered"
.
- The rgb string sets the color to more red as the date gets closer to the expiration date and more green as the date gets closer to the Issue Date.
If you want a full gray bar upon delivery, you can set the max
property to (K10<>"Delivered")*(D10-C10)
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…