superset icon indicating copy to clipboard operation
superset copied to clipboard

Feature Request :- Line chart where X axis is not date but an integer/something else

Open dataneta opened this issue 9 years ago • 17 comments

I am looking for charting options where I can plot day (1-30 days) trend of current month and compare it with day trend of previous month. In this case X axis won't be date but integer (i.e. day) and currently SuperSet doesn't allow to do so. Can we have that feature.

dataneta avatar Nov 03 '17 11:11 dataneta

You can do something close to it with a distribution bar chart, though we should really add a non-timeseries line chart...

mistercrunch avatar Nov 04 '17 07:11 mistercrunch

Thanks !! However, I am looking to plot 3 day trends on same graph so that I can compare current month day trend with last month day trend and last year day trend.

dataneta avatar Nov 14 '17 07:11 dataneta

I'd also welcome such a functionality.

However, in the meantime, you can emulate it by simply projecting the dates of previous periods into the current one.

This is an example for comparing different years (in PostgreSQL syntax):

Let's assume that timecol is your temporal column. Then just create a calculated temporal column timecol_projected within superset's table definition that projects the dates of previous years into the current one:

timecol + (date_trunc('year',current_date) - date_trunc('year', timecol ))

Furthermore, you create a calculated column year which is groupable/filterable, e.g.:

to_char(auftrag_ende::date, 'IYYY')

Now you can create a Time Series Line Chart, using timecol_projected as Time Column and year as Group By and maybe Filter column. The start date can then be chosen to any value before the beginning of the current year and can stay like this forever. No need to adjust anything when the year changes.

In your case, you should be able to adapt this approach fairly easily by projecting everything to the current day and selecting the data of this month, the last month via a calculated month column. Include the last year's day trend, though, might be a bit more challenging, but I'm confident that with a bit more magic with calculated columns for year and/or year_month plus some custom WHERE condition, or with an entirely customized SQL query, it can be done in the fashion described above.

rumbin avatar Nov 14 '17 07:11 rumbin

Hey Thanks !! It is working. Month is also working as I created Year-Month as grouping value. But certainly a feature "line chart for non-time-series data" should be added.

dataneta avatar Nov 14 '17 08:11 dataneta

Heads up, my team is working on a generic x-y chart where you can pick your own x axis that does not have to be a time series and you can still plot multiple 'metrics' and perform 'group-bys'. It will not replace the current time series since that has more complex features like granularity and so forth.

fabianmenges avatar Dec 14 '17 23:12 fabianmenges

#3184 duplicate

fabianmenges avatar Dec 14 '17 23:12 fabianmenges

any update?

workoutbuddy avatar Mar 08 '18 02:03 workoutbuddy

@fabianmenges any update on the generic line chart?

vylc avatar Oct 30 '18 18:10 vylc

We implemented it in #4185 and are running it internally. Not sure if we are still tyring to get it upstream, adding @jeffreythewang

fabianmenges avatar Oct 30 '18 20:10 fabianmenges

I can rebase accordingly if we're committed to merging it in.

jeffreythewang avatar Oct 31 '18 14:10 jeffreythewang

@mistercrunch thoughts? customers are asking for this...

vylc avatar Oct 31 '18 18:10 vylc

Duplicate #6568

kristw avatar Mar 19 '19 21:03 kristw

I'd love to see a line chart with a non-timeseries x-axis.

bayesfactor avatar Jan 12 '22 21:01 bayesfactor

@bayesfactor please check out the PR that's currently open and does precisely this: #17917

villebro avatar Jan 13 '22 07:01 villebro

@villebro Is this feature available in 1.4.2? If so, which flag has to be set?

hartkena avatar Apr 05 '22 20:04 hartkena

According to the release notes, this feature is only available in version 1.5.

rumbin avatar Apr 05 '22 20:04 rumbin

Feature flag: GENERIC_CHART_AXES

rumbin avatar Apr 05 '22 20:04 rumbin