美文网首页
解决go-echarts X轴显示不全问题

解决go-echarts X轴显示不全问题

作者: EasyNetCN | 来源:发表于2023-01-02 11:40 被阅读0次

go-ehcharts(https://github.com/go-echarts/go-echarts)是golang的图表库,api兼容echarts(https://github.com/apache/echarts),在使用中,发现X轴显示不全,可以通过以下方式解决:

    bar := charts.NewBar()
    // set some global options like Title/Legend/ToolTip or anything else
    bar.SetGlobalOptions(
        charts.WithTitleOpts(opts.Title{
            Title:    "代码统计",
            Subtitle: "柱形图",
        }),
        charts.WithTooltipOpts(opts.Tooltip{Show: true}),
        charts.WithInitializationOpts(opts.Initialization{
            Width:  width,
            Height: height,
        }),
        charts.WithXAxisOpts(opts.XAxis{
            AxisLabel: &opts.AxisLabel{Rotate: 45, ShowMinLabel: true, ShowMaxLabel: true, Interval: "0"},
        }),
    )

相关文章

网友评论

      本文标题:解决go-echarts X轴显示不全问题

      本文链接:https://www.haomeiwen.com/subject/jsihcdtx.html