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

Support custom values #50

Closed
justmiles opened this issue Sep 13, 2020 · 5 comments
Closed

Support custom values #50

justmiles opened this issue Sep 13, 2020 · 5 comments
Assignees
Labels
enhancement New feature

Comments

@justmiles
Copy link

I could be reading the setup wrong, but it appears the only way the Y axis value is determined is by the number of records returned in the results. It would be nice to set the value used for y axis in the query itself. For example, if we wanted to see number of users by role we would currently query like this:

SELECT role_name FROM users

It would be nice to offload this to the SQL like this:

SELECT role_name, count(*) as y_axis

This allows for more custom/advanced charts.

Is this already supported and I'm just missing it in the docs?

@razvanilin
Copy link
Member

razvanilin commented Sep 14, 2020

Your example is currently supported through the pattern charts that are available for all the charts except Line.

If you query your data with SELECT role_name FROM users you can select the role_name field and then you will be able to see how many roles of each type you have in your data.

I agree it's a bit confusing at the moment, but this part will be re-worked soon. Also, time filtering is not yet available for pattern charts, but it's the next big thing that's on my list of development 😁

Let me know if my quick guide above didn't make sense so I can offer a better explanation.

I'm assuming you want to create something like this, right? 👇

@justmiles
Copy link
Author

Using count(*) may have not been the best example because the count also returns the number of records. What I'm hoping for is to set the y-axis value in the SQL itself. A better example might be to use an AVG, SUM, or even an existing column.

SELECT role_name, avg(age) as y_axis FROM users

The "setup the fields" page is effectively selecting the column to use on the x-axis, with the y-axis being the count of instances for that column. The ability select a column that overrides the y-axis drastically increases what these charts can visualize.

@razvanilin
Copy link
Member

Gotcha! I'm planning to work on offering more customizability for Beta.13. The "Setup the fields" page will be revamped to offer the option to select custom fields on top of the date. I will also experiment with queries like the one you mentioned to see how I can design the UI for that kind of scenario.

The idea of selecting the axis from the SQL query is interesting and can definitely be placed in the ideas list. I'll add this issue there to keep track of it.

Thanks a lot for the suggestion and let me know if you come up with similar ideas or ways you'd like to use Chartbrew. It really helps! 😁

@razvanilin razvanilin added the enhancement New feature label Sep 16, 2020
@razvanilin razvanilin added this to 💡 Ideas & Requests in Chartbrew Devlog Sep 16, 2020
@razvanilin razvanilin moved this from 💡 Ideas & Requests to In progress in Chartbrew Devlog Sep 26, 2020
@razvanilin razvanilin self-assigned this Sep 26, 2020
@razvanilin
Copy link
Member

Just a quick update that this feature is being worked on in #57

Not planning to add field selection through the SQL query just yet. Will have to experiment with that after the new updates

@razvanilin
Copy link
Member

This is now implemented in Beta 13

@razvanilin razvanilin moved this from In progress to Done in Chartbrew Devlog Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature
Projects
Development

No branches or pull requests

2 participants