wcharczuk / go-chart

go chart is a basic charting library in go.
MIT License
3.99k stars 326 forks source link

Grid Lines for BarChart #139

Closed delogix-daniel closed 1 year ago

delogix-daniel commented 4 years ago

I'm trying to setup grid lines in a BarChart, any ideas how to make this work will be appreciated.

graph := chart.BarChart{
        Title: "Population - grid lines",
        Background: chart.Style{
            Padding: chart.Box{
                Top: 40,
            },
        },
        Height:   300,
        Width:    400,
        BarWidth: 40,
        Bars: []chart.Value{
            {Value: 100, Label: "2015"},
            {Value: 130, Label: "2020"},
            {Value: 120, Label: "2025"},
            {Value: 150, Label: "2030"},
            {Value: 160, Label: "2035"},
        },
        YAxis: chart.YAxis{
            GridMajorStyle: chart.Style{
                Hidden:      false,
                StrokeColor: drawing.ColorBlack,
                StrokeWidth: 1.0,
            },
            GridMinorStyle: chart.Style{
                Hidden:      false,
                StrokeColor: drawing.ColorBlue,
                StrokeWidth: 1.0,
            },
        },
    }
warmans commented 4 years ago

I don't think grids are implemented for bar charts. At least I can't see any reference to the grid options in the bar chart code.

siriele commented 3 years ago

This doesn't make sense, and kind of makes bar charts useless. Is there any plan to have this fixed?