excelize icon indicating copy to clipboard operation
excelize copied to clipboard

How to set chart labels font color

Open vasiliyaltunin opened this issue 6 years ago • 7 comments

I creating horisontal bar chart, but font color for legends is light gray and hard to read, i use Excel 2016 shot1

vasiliyaltunin avatar Dec 27 '18 01:12 vasiliyaltunin

Any update on this issue? or is there any workaround to edit the axis font color?

devinyonas avatar Mar 06 '20 07:03 devinyonas

Hi @vasiliyaltunin, @davey06. Please adjust the value of lumOff temporary, I'll add support for specifying luminance shifted with custom lumOff later.

xuri avatar Mar 06 '20 08:03 xuri

@xuri thanks for the fast response!

Screen Shot 2020-03-06 at 15 43 33

devinyonas avatar Mar 06 '20 08:03 devinyonas

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.

jholder85638 avatar Sep 13 '21 21:09 jholder85638

@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.

tetsuyanh avatar Jul 12 '22 14:07 tetsuyanh

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 avatar Jul 13 '22 01:07 xuri

@xuri Thanks! It works! I use this adjustment by fork for a while.

tetsuyanh avatar Jul 13 '22 01:07 tetsuyanh

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 avatar Oct 14 '22 01:10 xuri

@xuri Thanks, so so much!

tetsuyanh avatar Oct 16 '22 04:10 tetsuyanh