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
我安装了中文字体,但是标题部分没有生效,如图
测试代码如下:
x := "18:44:10 18:44:15 18:44:20 18:44:25 18:44:30 18:44:35 18:44:40 18:44:45 18:44:50 18:44:55 18:45:00 18:45:05 18:45:10 18:45:15 18:45:20 18:45:25 18:45:30 18:45:35 18:45:40 18:45:45 18:45:50 18:45:55 18:46:00 18:46:05 18:46:10 18:46:15 18:46:20 18:46:25 18:46:30 18:46:35 18:46:40 18:46:45 18:46:50 18:46:55 18:47:00 18:47:05 18:47:10 18:47:15 18:47:20 18:47:25 18:47:30 18:47:35 18:47:40 18:47:45 18:47:50 18:47:55 18:48:00 18:48:05 18:48:10 18:48:15 18:48:20 18:48:25 18:48:30 18:48:35 18:48:40 18:48:45 18:48:50 18:48:55 18:49:00 18:49:05 18:49:10 18:49:15 18:49:20" valueX := strings.Split(x, " ") valueY := [][]float64{} valueY = append(valueY, [][]float64{ { 0, 0, 12046.8, 50940.4, 64277.6, 69571.2, 72629.4, 66802, 75399.8, 65165, 70525, 73513.4, 68959.8, 68037, 70576.6, 65701.2, 71732.2, 68568.4, 69133, 67981.8, 62586.8, 70843.8, 63619.4, 64814.2, 70443, 70087.4, 70710.4, 73406, 68357.2, 71322.4, 64685.8, 65596, 75884.6, 71428.4, 60309, 69036, 73502.4, 68335.2, 65319.2, 66490.2, 67470.4, 69440.6, 64983.2, 69458.2, 69676.8, 61542.4, 64884, 75708.6, 65860.2, 67289.6, 71214, 71063.2, 71760, 65326.8, 74354.2, 58777.4, 73552.6, 67964, 66412.6, 73250.6, 69759.2, 67226, 16999.4, }, { 61542.4, 64884, 75708.6, 65860.2, 67289.6, 71214, 71063.2, 71760, 65326.8, 74354.2, 58777.4, 73552.6, 67964, 66412.6, 73250.6, 69759.2, 67226, 16999.4, 0, 0, 12046.8, 50940.4, 64277.6, 69571.2, 72629.4, 66802, 75399.8, 65165, 70525, 73513.4, 68959.8, 68037, 70576.6, 65701.2, 71732.2, 68568.4, 69133, 67981.8, 62586.8, 70843.8, 63619.4, 64814.2, 70443, 70087.4, 70710.4, 73406, 68357.2, 71322.4, 64685.8, 65596, 75884.6, 71428.4, 60309, 69036, 73502.4, 68335.2, 65319.2, 66490.2, 67470.4, 69440.6, 64983.2, 69458.2, 69676.8, }, }...) f := false label := []string{ "成功", "失败", } // 字体文件需要自行下载 buff, err := ioutil.ReadFile("./NotoSansSC-VF.ttf") if err != nil { panic(err) } err = charts.InstallFont("noto", buff) if err != nil { panic(err) } p, err := charts.LineRender( valueY, charts.FontFamilyOptionFunc("noto"), charts.TitleTextOptionFunc("全部请求"), charts.XAxisDataOptionFunc(valueX), func(opt *charts.ChartOption) { opt.XAxis.BoundaryGap = &f opt.Padding = charts.Box{Left: 20, Right: 50, Top: 20, Bottom: 20} }, charts.ThemeOptionFunc("grafana"), charts.WidthOptionFunc(1000), charts.LegendOptionFunc(charts.LegendOption{ Data: label, Left: "100", }), )
The text was updated successfully, but these errors were encountered:
fix: fix font setting for title, #15
e095223
试试v2.1.0版本
Sorry, something went wrong.
可以了,感恩
No branches or pull requests
我安装了中文字体,但是标题部分没有生效,如图
测试代码如下:
The text was updated successfully, but these errors were encountered: