X轴能增加对时间的支持么
leslieDD opened this issue · comments
提供具体的示例代码以及数据,好确认如何调整
是指X轴直接传Time对象,再指定format的方式这样吗?
…Sent from my iPhone
On Feb 22, 2023, at 11:14, farmer luo ***@***.***> wrote:
+1,可以像grafana的图这样就好了:
[image]<https://user-images.githubusercontent.com/1650698/220511937-148e048f-8565-4a8a-b991-d5d433a79c37.png>
—
Reply to this email directly, view it on GitHub<#25 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AADKYZ53BCD3465OZWJYSKDWYWABXANCNFSM6AAAAAAQZLAE4Q>.
You are receiving this because you commented.Message ID: ***@***.***>
我误解你们的意思了,下个版本增加支持
@farmerluo @leslieDD
最新版本已经支持,具体设置如下:
- 设置x axis的boundaryGap为false: charts.XAxisDataOptionFunc(xAxisValue, charts.FalseFlag()),
- 根据x轴的value值计算第一个label展示的位置,例如判断value为xx:00
- 设置 opt.XAxis.FirstAxis = firstAxis
可参考示例:https://github.com/vicanso/go-charts/blob/main/examples/time_line_chart/main.go
@farmerluo @leslieDD 最新版本已经支持,具体设置如下:
- 设置x axis的boundaryGap为false: charts.XAxisDataOptionFunc(xAxisValue, charts.FalseFlag()),
- 根据x轴的value值计算第一个label展示的位置,例如判断value为xx:00
- 设置 opt.XAxis.FirstAxis = firstAxis
可参考示例:https://github.com/vicanso/go-charts/blob/main/examples/time_line_chart/main.go
这种方式虽然可以实现,但是还是有些不方便,X轴本质上还不是时间序列,是字符串。
是的,本质上X轴只是字符串