wcharczuk / go-chart

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

Question / Feature Request #170

Closed stevef1uk closed 3 years ago

stevef1uk commented 3 years ago

Hi,

Nice library.

I am trying to display a time series but want to show hours (within a day) for the X-Axis labels rather than days. Any pointers?

I used the Stock Analysis demo code as my starter for 10. output

Regards

Steve

stevef1uk commented 3 years ago

Ok. Looking at other examples I have solved this. Not elegant but ...

        ValueFormatter: func(v interface{}) string {
                if vf, isTime := v.(float64); isTime {
                    v1 := int64(vf)
                    v1 = v1 / 1000000000
                    parsed := time.Unix(v1, 0)
                    unitTimeInRFC3339 :=parsed.Format(time.RFC3339)
                    return unitTimeInRFC3339[11:16]
                }

output