excelize
excelize copied to clipboard
How to set chart labels font color
I creating horisontal bar chart, but font color for legends is light gray and hard to read, i use Excel 2016
Any update on this issue? or is there any workaround to edit the axis font color?
Hi @vasiliyaltunin, @davey06. Please adjust the value of lumOff temporary, I'll add support for specifying luminance shifted with custom lumOff later.
@xuri thanks for the fast response!
Hi @davey06 could you share how you got the text to be black? I've tried setting the values but the text is always grey. I also checked out the revision with the above commit, same problem.
@xuri Thanks for your great work. I use this library. I cannot fix this issue by https://github.com/IsotronicGmbH/excelize/commit/00509e578b4daaf5fcdba84b62c6008c1aa3530d. I'm looking forward to solve this.
Hi @tetsuyanh, thanks for your feedback, which version of Excelize you're using? If you're using the v2.6.0 and later, please adjust the value of lumOff
to 0
like this:
LumOff: &attrValInt{Val: intPtr(0)},
@xuri Thanks! It works! I use this adjustment by fork for a while.
Hi @tetsuyanh, I have added support for set chart labels font style, please upgrade to the master branch code if you need it, and this feature will be released in the next version. Now you can set font RGB color in font
field like this:
&excelize.Chart{
Type: excelize.Col3DClustered,
Series: []excelize.ChartSeries{
{
Name: "Sheet1!$A$2",
Categories: "Sheet1!$B$1:$D$1",
Values: "Sheet1!$B$2:$D$2",
}, {
Name: "Sheet1!$A$3",
Categories: "Sheet1!$B$1:$D$1",
Values: "Sheet1!$B$3:$D$3",
}, {
Name: "Sheet1!$A$4",
Categories: "Sheet1!$B$1:$D$1",
Values: "Sheet1!$B$4:$D$4",
},
},
Title: excelize.ChartTitle{
Name: "Fruit 3D Clustered Column Chart",
},
XAxis: excelize.ChartAxis{
+ Font: excelize.Font{
+ Bold: true,
+ Italic: true,
+ Underline: "dbl",
+ Color: "#000000",
+ },
},
YAxis: excelize.ChartAxis{
+ Font: excelize.Font{
+ Bold: false,
+ Italic: false,
+ Underline: "sng",
+ Color: "#777777",
+ },
},
}
@xuri Thanks, so so much!