We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Description
I am trying to generate a combo chart with a secondary Y axis, however, the secondary Y axis is missing the title.
Steps to reproduce the issue:
Run the following code
package main import ( "fmt" "github.com/xuri/excelize/v2" ) func main() { f := excelize.NewFile() defer func() { if err := f.Close(); err != nil { fmt.Println(err) } }() data := [][]interface{}{ {"MonYear", "Aug-23", "Sep-23", "Oct-23", "Nov-23", "Dec-23", "Jan-24", "Feb-24", "Mar-24", "Apr-24", "May-24", "Jun-24"}, {"a", 14, 14, 14, 12, 14, 14, 13, 13, 12, 13, 4}, {"b", 3, 2, 4, 3, 2, 3, 2, 3, 2, 1, 0}, {"c", 44198, 44366, 44683, 44857, 44762, 44949, 45005, 45157, 45483, 45574, 45435}, } for idx, col := range data { cell, err := excelize.CoordinatesToCellName(idx+1, 1) if err != nil { fmt.Println(err) return } f.SetSheetCol("Sheet1", cell, &col) } disable := false if err := f.AddChart("Sheet1", "F1", &excelize.Chart{ Type: excelize.Col, Dimension: excelize.ChartDimension{Width: 1080, Height: 576}, XAxis: excelize.ChartAxis{Font: excelize.Font{Color: "000000"}}, YAxis: excelize.ChartAxis{Font: excelize.Font{Color: "000000"}, MajorGridLines: true, Title: []excelize.RichTextRun{{Text: "Primary Axis"}}}, VaryColors: &disable, PlotArea: excelize.ChartPlotArea{ShowVal: true, NumFmt: excelize.ChartNumFmt{CustomNumFmt: "#\"\""}}, Series: []excelize.ChartSeries{ { Name: "Sheet1!$B$1", Categories: "Sheet1!$A$2:$A$12", Values: "Sheet1!$B$2:$B$12", Fill: excelize.Fill{Type: "pattern", Color: []string{"1F77B4"}, Pattern: 1}, DataLabelPosition: excelize.ChartDataLabelsPositionInsideEnd, }, { Name: "Sheet1!$C$1", Categories: "Sheet1!$A$2:$A$12", Values: "Sheet1!$C$2:$C$12", Fill: excelize.Fill{Type: "pattern", Color: []string{"FF7F0E"}, Pattern: 1}, DataLabelPosition: excelize.ChartDataLabelsPositionInsideEnd, }, }, Title: []excelize.RichTextRun{ { Text: "Combo column and line chart", }, }, }, &excelize.Chart{ Type: excelize.Line, Dimension: excelize.ChartDimension{Width: 1080, Height: 576}, YAxis: excelize.ChartAxis{Secondary: true, Font: excelize.Font{Color: "000000"}, Title: []excelize.RichTextRun{{Font: &excelize.Font{Color: "000000"}, Text: "Secondary Axis"}}}, VaryColors: &disable, PlotArea: excelize.ChartPlotArea{ShowVal: true, NumFmt: excelize.ChartNumFmt{CustomNumFmt: "#\"\""}}, Series: []excelize.ChartSeries{ { Name: "Sheet1!$D$1", Categories: "Sheet1!$A$2:$A$12", Values: "Sheet1!$D$2:$D$12", Fill: excelize.Fill{Type: "pattern", Color: []string{"2CA02C"}, Pattern: 1}, DataLabelPosition: excelize.ChartDataLabelsPositionAbove, Marker: excelize.ChartMarker{Symbol: "none"}, }, }, }); err != nil { fmt.Println(err) return } // Save spreadsheet by the given path. if err := f.SaveAs("Book1.xlsx"); err != nil { fmt.Println(err) } }
Describe the results you received:
Combo bar + line chart. Primary Y-axis has the title, but the secondary Y-axis does not.
Describe the results you expected:
I expect the secondary Y-axis to have a title that I provided.
Output of go version:
go version
go version go1.22.4 darwin/arm64
Excelize version or commit ID:
v2.8.2-0.20240617135415-1a99dd4a233c
Environment details (OS, Microsoft Excel™ version, physical, etc.):
MacOS Sonoma 14.5, Microsoft Excel for Mac Version 16.86 (24060916)
The text was updated successfully, but these errors were encountered:
Thanks for your issue. It seems we need remove this line of code in the drawing.go, would you like to create a pull request for help us fix that?
Sorry, something went wrong.
fixes issue qax-os#1926
f14902b
Hi @xuri, per your instruction I have just submitted a new pull request. Thank you for a quick response!
4e6457a
Successfully merging a pull request may close this issue.
Description
I am trying to generate a combo chart with a secondary Y axis, however, the secondary Y axis is missing the title.
Steps to reproduce the issue:
Run the following code
Describe the results you received:
Combo bar + line chart. Primary Y-axis has the title, but the secondary Y-axis does not.
Describe the results you expected:
I expect the secondary Y-axis to have a title that I provided.
Output of
go version
:Excelize version or commit ID:
Environment details (OS, Microsoft Excel™ version, physical, etc.):
MacOS Sonoma 14.5, Microsoft Excel for Mac Version 16.86 (24060916)
The text was updated successfully, but these errors were encountered: