wcharczuk / go-chart

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

undefined: chart.StyleShow #143

Open OscarYuen opened 4 years ago

OscarYuen commented 4 years ago
XAxis: chart.XAxis{
                Name:      "Week",
                NameStyle: chart.StyleShow(),
                Style:     chart.StyleShow(),
                Ticks: []chart.Tick{
                    {1.0, "1"},
                    {2.0, "2"},
                    {3.0, "3"},
                    {4.0, "4"},
                    {5.0, "5"},
                    {6.0, "6"},
                    {7.0, "7"},
                },
            },

chart.StyleShow() is undefined in latest package. What API I can call? thanks

bealbrown commented 4 years ago

seconded

svitiashchuk commented 3 years ago

Seems like forgotten pieces of code, which needs refactoring.

As I can see from the history that was a function defined in go-chart/style.go [commit]

// StyleShow is a prebuilt style with the `Show` property set to true.
func StyleShow() Style {
    return Style{
        Show: true,
    }
} 

But later it's signature was changed to func Shown() Style [commit]

func Shown() Style {
    return Style{
        Hidden: false,
    }
}

So, @OscarYuen, correct usage in your example looks like below:

XAxis: chart.XAxis{
    Name:      "Week",
    NameStyle: chart.Shown(),
    Style:     chart.Shown(),
    Ticks: []chart.Tick{
        {1.0, "1"},
        {2.0, "2"},
        {3.0, "3"},
        {4.0, "4"},
        {5.0, "5"},
        {6.0, "6"},
        {7.0, "7"},
    },
},