Bug description

Bar chart X axis Time format is stuck to adaptive no other format is working Apache Superset Superset Bar Chart X axis time formatting not working only Adaptive filter is being applied

How to reproduce the bug

Create a bar chart with Time as x axis Try to change to other Time format

Screenshots/recordings

Apache Superset Superset Bar Chart X axis time formatting not working only Adaptive filter is being applied

Superset version

master / latest-dev

Python version

3.9

Node version

16

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.
  • [ ] 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]

Hey @shreyansh1910! I'm here to help you with any bugs, questions, or contributions you have for Superset. Let's squash those bugs together!

A similar issue was reported and closed in this GitHub issue [1]. The problem is that the default time format is set to adaptive formatting (SMART_DATE_ID), which means that unless explicitly changed, the adaptive formatting will be applied.

To resolve this, you need to change the time format setting in your chart configuration. Here is how you can do it:

  1. In the chart configuration: Modify the xAxisFormat property in the formData object to your desired format. For example: tsx formData={{ ... xAxisFormat: '%d/%m/%Y', // or any other desired format ... }}

  2. In the YAML configuration: Change the x_axis_time_format property to your desired format. For example: yaml x_axis_time_format: '%d/%m/%Y' # or any other desired format

This should allow you to apply a different time format to the X-axis of your bar chart [2][3][4].

To continue talking to Dosu, mention @dosu.

Comment From: shreyansh1910

@dosu where is this yaml file

Comment From: dosubot[bot]

The YAML file for changing the x_axis_time_format property in Superset is located at superset/examples/configs/charts/Featured Charts/Mixed.yaml.

In this file, the property is specified as:

x_axis_time_format: smart_date

[1]

To continue talking to Dosu, mention @dosu.

Comment From: evelyn369

@dosu I have same problem, so I'm going to do same thing. Do I have to change Both "1.chart configuration" and "2.YAML configuration"? Or Can I change just YAML file? And the example above is "Mixed File", But I have a problem with "Bar chart (viz_type: echarts_timeseries_bar)". So would it be correct to change the Bar.yaml file instead of Mixed.yaml?

Comment From: rusackas

I make charts like this all the time, and haven't had any trouble applying date formatters. Are you still facing this in 4.1.2 or newer, and if so could you give us reproduction steps using an example chart and/or example datasets?

Comment From: dosubot[bot]

You can change the "Bar chart (viz_type: echarts_timeseries_bar)" by modifying the Bar.yaml file. There is no need to change the Mixed.yaml file for this specific chart configuration. The Bar.yaml file contains all the necessary configurations for the "Bar chart" with viz_type: echarts_timeseries_bar [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

Comment From: rusackas

Opened a PR!