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

TimeSeries Chart is showing Year for the January month #29237

Closed
3 tasks done
vasu-ram opened this issue Jun 13, 2024 · 5 comments
Closed
3 tasks done

TimeSeries Chart is showing Year for the January month #29237

vasu-ram opened this issue Jun 13, 2024 · 5 comments
Labels
viz:charts:timeseries Related to Timeseries

Comments

@vasu-ram
Copy link
Contributor

Bug description

Time series Chart is showing Year instead January.
we know the month is continuous, seems it is confusing the users

How to reproduce the bug

  1. Create Timeseries chart any
  2. Use Timegrain month
  3. filter date Last Year

Screenshots/recordings

image

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@dosubot dosubot bot added the viz:charts:timeseries Related to Timeseries label Jun 13, 2024
Copy link

dosubot bot commented Jun 13, 2024

Hi @vasu-ram! I'm here to help you with any bugs, questions, or contributions you might have for the repository. Let's tackle this together!

To fix the issue where the TimeSeries Chart in Superset is displaying the year instead of the month for January, despite setting the Timegrain to "month", you need to ensure that the correct D3 time format is being used.

You can set the time format to display the month and year by using one of the D3 time format options. For example, you can use '%Y-%m' to display the year and month.

Here is how you can set it:

export const D3_TIME_FORMAT_OPTIONS: [string, string][] = [
  [SMART_DATE_ID, t('Adaptive formatting')],
  ['%d/%m/%Y', '%d/%m/%Y | 14/01/2019'],
  ['%m/%d/%Y', '%m/%d/%Y | 01/14/2019'],
  ['%Y-%m-%d', '%Y-%m-%d | 2019-01-14'],
  ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S | 2019-01-14 01:32:10'],
  ['%d-%m-%Y %H:%M:%S', '%d-%m-%Y %H:%M:%S | 14-01-2019 01:32:10'],
  ['%H:%M:%S', '%H:%M:%S | 01:32:10'],
  ['%Y-%m', '%Y-%m | 2019-01'],  // Add this line to include the year-month format
];

Make sure to select the '%Y-%m' format in your chart settings to display the month and year correctly [1].

To continue talking to Dosu, mention @dosu.

@rusackas
Copy link
Member

Have you tried adding a date formatter?

@vasu-ram
Copy link
Contributor Author

Tried above it is not working

@rusackas
Copy link
Member

I mean here in the "Customize" tab of the controls, adding an X Axis format. Here's an example:

BEFORE:
Screenshot_2024-06-14_at_9_47_43 AM

AFTER:
Screenshot_2024-06-14_at_9_48_20 AM

@vasu-ram
Copy link
Contributor Author

Thanks @rusackas, I don't know we can change the format on UI, That's fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
viz:charts:timeseries Related to Timeseries
Projects
None yet
Development

No branches or pull requests

2 participants