Skip to content
New issue

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

Custom format for the chart title 支持修改图表title的字体吗? #1588

Closed
lifenglsf opened this issue Jul 27, 2023 · 1 comment
Closed
Labels
enhancement New feature or request

Comments

@lifenglsf
Copy link

目前发现创建的图表的title都是灰色的,想把图表title更改字体颜色,不知道是否支持。
通过ChartTitle设置的图表title,看到charttitle只有name这一个属性

@xuri xuri changed the title 支持修改图表title的字体吗? Custom format for the chart title 支持修改图表title的字体吗? Jul 27, 2023
@xuri xuri added the enhancement New feature or request label Jul 27, 2023
@xuri xuri closed this as completed in a07c8cd Jul 27, 2023
@xuri
Copy link
Member

xuri commented Jul 27, 2023

Thanks for your issue, I have made a breaking changes for the AddChart function, now it supports formatting and setting rich text titles for the chart. Please try to upgrade the master branch code, and this feature will be released in the next version. For example, you can set title for chart with blue color and custom formats like this:

err := f.AddChart("Sheet1", "E1", &excelize.Chart{
    // ...
    Title: []excelize.RichTextRun{
        {
            Text: "Chart Title",
            Font: &excelize.Font{
                Bold:   true,
                Italic: true,
                Family: "Times New Roman",
                Size:   16,
                Color:  "2354e8",
            },
        },
    },
});

jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
… `AddChart` function

- Removed exported `ChartTitle` data type
- The `AddChart` function now supports formatting and setting rich text titles for the chart
- New exported function `GetFormControl` for getting form control
- Made case in-sensitive for internal worksheet XML path to improve compatibility
- Update the unit tests
- Update the documentation and internal comments on the codes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants