Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Charts] Support BarChart with scaleType: time #12537

Closed
Janpot opened this issue Mar 22, 2024 · 3 comments · Fixed by #13471
Closed

[Charts] Support BarChart with scaleType: time #12537

Janpot opened this issue Mar 22, 2024 · 3 comments · Fixed by #13471
Assignees
Labels
component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature

Comments

@Janpot
Copy link
Member

Janpot commented Mar 22, 2024

Summary

Trying out charts on a small weather dashboard. Would like to show precipitation over time in a bar chart. See bottom chart on https://dashboard-framework-prototype.vercel.app/forecast. Would like the X-axis to look like the other two charts.

Would it make sense to add a bars: true to the LineChart series, analog to the area: true?

Examples

No response

Motivation

No response

Search keywords: barchart time

@Janpot Janpot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 22, 2024
@alexfauquette
Copy link
Member

The mains reason why BarPlot needs a band scale is the notion of bandWidth which is unique to this scale.

From what I understand, the main benefit of your proposal would be to have a nice formatting out of the box, instead of having to define formater as follow

valueFormatter: (date, context) =>
	context.location === 'tick'
              ? date.toLocaleTimeString(/* option to only display hours */)
              : `date.toLocaleString(/* option for the entire timestamp */)`,

Do I miss other nice feature it would bring?

@alexfauquette alexfauquette added enhancement This is not a bug, nor a new feature component: charts This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 22, 2024
@Janpot
Copy link
Member Author

Janpot commented Mar 22, 2024

From what I understand, the main benefit of your proposal would be to have a nice formatting out of the box, instead of having to define formater as follow

Not quite exactly, it's not uncommon to represent time series with bars, or stacked bars. Especially when the data points are evenly spaced. Yet, the way I understand, the X-axis for a time series gets formatted differently than just formatting tick marks:

Screenshot 2024-03-22 at 18 34 49

Here there is for instance the "...11PM Sat 23 01AM..." and it looks like it also adapts the amount of ticks to the available space. Basically, I'd like a variant on line/area chart but where the line is represented by bars.

e.g. see also https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/time-series/#time-series

=> https://play.grafana.org/d/000000016/1-time-series-graphs?orgId=1&viewPanel=17

Copy link

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@Janpot: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
3 participants