Redash: Wrong column value in bar chart

Created on 28 Apr 2017  路  8Comments  路  Source: getredash/redash

I think this chart will show the error: http://demo.redash.io/queries/4439/source#6248

I can't see real column values when using stacking: it's ok with bar's height but popup with value is wrong.

2017-04-28 10 38 30

Most helpful comment

It would be great to add checkbox after stacking options to turn-on summing for same values. What do you think?

^ this would also solve a problem we have here with our visualizations!
Has there been any updates /developments regarding implementation?

All 8 comments

Maybe it just a bad example, but in the example you sent you have multiple values for the same X value and hence the bad tooltip.

@arikfr I think that it should be summed in graph.

For example, I want to make some charts in one query: daily, weekly and monthly and it will be good to sum them in graph because it's better than create 3 different queries.

You can't always sum the values. The query in the demo is:

select created_at::date as day, date_trunc('week', created_at) as week, count(*)
from dashboards
where created_at >= current_date - interval '1 month'
group by day, week

But what if we wanted to know how many unique users we had each day? Then the query will be:

select created_at::date as day, date_trunc('week', created_at) as week, count(distinct user_id)
from dashboards
where created_at >= current_date - interval '1 month'
group by day, week

But you can't get the weekly unique number of users by just adding up the daily numbers, because if the same users visited each day, then the weekly number is the same as the daily one.

@arikfr
It was summed in a bar in master version but only the value was wrong.

The issue you provided is not visualization problem. If I want to count unique values I'll make a join with values dau, wau, for example, and create visualization without stacking.

But if I want to stack all values in a chart I understand that stacking is mostly summing.

It was summed in a bar in master version but only the value was wrong.

Seems like it wasn't, see this: http://demo.redash.io/queries/4617/source#6595 or did I misunderstand you?

But if I want to stack all values in a chart I understand that stacking is mostly summing.

I agree. But there is a difference between stacking values where for each series there is a single value vs. stacking where for each series there are multiple values. The way I see it: visualizations need to visualize the data, not to change it. Summing the values inside a series (not across multiple series) is changing the data it represents.

Also note that Plotly maintains the same behavior: it expects a single value for each series.

Having said all that, I think that we should either show an error message to the user in such case or implement something along the lines what you suggest.

@arikfr Yes, you're right.

Summing isn't default use case but sometimes it is helpful.

It would be great to add checkbox after stacking options to turn-on summing for same values. What do you think?

I can try to do this changing this pull request: https://github.com/getredash/redash/pull/1785/commits/d5e1442436747e42f81c013aefa98c6ff2d2ad8c

Also look here: http://demo.redash.io/queries/4868#7059

There is summing in chart.

It would be great to add checkbox after stacking options to turn-on summing for same values. What do you think?

^ this would also solve a problem we have here with our visualizations!
Has there been any updates /developments regarding implementation?

Was this page helpful?
0 / 5 - 0 ratings