Bug description

  1. Go to a time series line chart with monthly data from the example datasets
  2. Chose month time grain

Expected

Last month's label should show on X axis

Actual

Last month's label doesn’t show

Screenshots/recordings

Image

Superset version

master / latest-dev

Python version

3.11

Node version

18 or greater

Browser

Chrome

Additional context

No response

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] 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.

Comment From: dosubot[bot]

This issue is likely related to how Superset handles time ranges and time grain in the backend query. The X axis only shows periods present in the query result, so if the last month is missing from your chart, it's probably not included in the query output. This can happen if the time range end boundary is exclusive or if the SQL time grain logic doesn't generate a row for the last month.

There have been recent fixes that may help: one ensures all x-axis date labels for the selected time grain are displayed (PR 33191), and another adds an option to show all X axis ticks on timeseries charts (PR 33729). Make sure your deployment includes these changes and try enabling the new X axis tick display option if it's available.

If the issue persists, check the SQL generated for your chart to confirm the last month is included in the result set. Adjusting the time range or time grain settings may help. If you need the last month to appear even when there is no data, you would need to pad missing periods in your dataset or adjust the backend query to generate all expected periods, as the frontend does not do this automatically.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: geido


🎉 Preset Bounty Available: $100 USD 🎉

To claim this bounty, please carefully follow the steps below.


📋 Steps to Participate

  1. Review Guidelines:
    Read through the Preset Bounty Program Contribution Guide for complete details on bounty requirements.

  2. Show Your Interest:
    Complete the Preset Bounty Program Survey and comment this issue to express your interest.

  3. Join the Slack Channel:
    After completing the survey, you’ll receive an invitation to the dedicated Apache Superset Slack channel.

  4. Get Assigned:
    To officially start, ensure a Bounty Program Manager has assigned you to this issue.

  5. Submit Your Solution:
    When ready, submit your solution with the Fixes #{issue_number} notation in your Pull Request description.

  6. Claim Your Bounty:
    Sign up at GitPay.me and submit your solution via: https://gitpay.me/#/task/1214


💡 Additional Notes

  • Only developers assigned by a Bounty Program Manager should start working on this issue to win the bounty.
  • Be sure to follow the guide closely to avoid any delays in payment. Please, allow a few days after your PR has been merged for the bounty to be released.

Good luck, and happy coding! 🎉

Comment From: abhishek818

@geido can I take this up?

Comment From: Sameerali0

@dosu where is the code for the line chart and can you provide some suggestions on how to solve this issue.

Comment From: dosubot[bot]

The main code for the ECharts Time Series Line Chart is in superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/index.ts—this registers the plugin and sets up the chart rendering logic, which is loaded from ../../EchartsTimeseries and uses utility functions like extractSeries from superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts to process the data for the X axis and series display [source].

The issue with the last month's label not appearing is almost always due to the backend query not returning a row for that month—Superset's frontend does not pad missing time intervals, so if the data for the last month is missing, the label won't show up [source]. The backend time grain logic (including "month") is handled in superset/db_engine_specs/base.py [source].

To fix this, check the SQL generated for your chart and make sure the last month is included in the result set. If your time range is exclusive at the end, try making it inclusive. If you want the last month to appear even when there is no data, you’ll need to pad missing periods in the backend query (e.g., generate a series of all expected months and left join your data onto it). There isn’t a built-in frontend option to do this automatically.

If you want to explore a frontend solution, you’d need to modify the logic in extractSeries to inject missing periods, but this is usually best handled on the backend for consistency across all visualizations.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X