亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

go-go 圖表庫中的文本旋轉

go-go 圖表庫中的文本旋轉

Go
HUH函數 2023-05-08 14:38:37
我正在使用 go 圖表庫https://github.com/wcharczuk/go-chart制作條形圖。我面臨的問題是標簽值很長,我想將文本旋轉 45 度以顯示完整文本我喜歡顯示的日期格式是這樣的2018-05-12。var values []chart.Value        for k, v := range timeline {            // leng += 1            new_data := k[0:10]            println(new_data)            val := float64(v)            values = append(values, chart.Value{Label: new_data, Value: val, Style: chart.Style{FontColor: drawing.Color{R: 255, G: 0, B: 0, A: 255}, FontSize: 4.0}})        } pie := chart.BarChart{        Title:      "Timeline Chart",        Height:     350,        TitleStyle: chart.StyleShow(),        Background: chart.Style{            Padding: chart.Box{                Top: 40,            },        },        BarWidth: 60,        XAxis:    chart.StyleShow(),        YAxis: chart.YAxis{            Style: chart.StyleShow(),            // TickStyle: chart.Style{            //  TextRotationDegrees: 45.0,            // },            NameStyle: chart.Style{Show: true, TextRotationDegrees: 45.0},        },        Bars: values,}chart.Style屬性也不起作用,因為我想縮小字體大小并更改標簽文本的顏色
查看完整描述

1 回答

?
臨摹微笑

TA貢獻1982條經驗 獲得超2個贊

創建時chart.BarChart,只需添加TextRotationDegrees到您的樣式XAxis

XAxis: chart.Style{
    Show:                true,
    TextRotationDegrees: 45.0,
},


查看完整回答
反對 回復 2023-05-08
  • 1 回答
  • 0 關注
  • 152 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號