apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.71k stars 13.85k forks source link

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

Open shreyansh1910 opened 1 month ago

shreyansh1910 commented 1 month ago

Bug description

Bar chart X axis Time format is stuck to adaptive no other format is working image

How to reproduce the bug

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

Screenshots/recordings

image

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

dosubot[bot] commented 1 month ago

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:

    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:

    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]](https://github.com/apache/superset/blob/master/superset/examples/configs/charts/Featured Charts/Mixed.yaml).

To continue talking to Dosu, mention @dosu.

shreyansh1910 commented 1 month ago

@dosu where is this yaml file

dosubot[bot] commented 1 month ago

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]](https://github.com/apache/superset/blob/master/superset/examples/configs/charts/Featured Charts/Mixed.yaml)

To continue talking to Dosu, mention @dosu.

evelyn369 commented 1 month ago

@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?