Incubator-echarts: Format time on x and y axis to day of the week or week number in a year, etc.

Created on 5 Sep 2018  ·  4Comments  ·  Source: apache/incubator-echarts

Is it possible to specify a way time format is displayed on x and y axis?
What I would like to achieve is to have for example 'Mon', 'Fr' or 'Week 23' instead of '03-05-2018'.
I tried to use 'minInterval' and 'maxInterval', but it does not produce outcomes that I am looking for.
Is it possible to do it in echarts or do I need to use separate library?

support

Most helpful comment

Where is this documented?

All 4 comments

echarts provides echarts.format.formatTime:

var option = {
    // ...
    xAxis: {
        type: 'time',
        axisLabel: {
            formatter: function (value) {
                return echarts.format.formatTime('yyyy-MM-dd', value);
                // And other formatter tool (e.g. moment) can be used here.
            }
        }
    }
}

Thank you! It solves my problem.

Where is this documented?

Where is this documented?

It seems there is no documentation for now but you can check the code

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akvaliya picture akvaliya  ·  3Comments

Thinkpad93 picture Thinkpad93  ·  3Comments

hanhui picture hanhui  ·  3Comments

antorman picture antorman  ·  3Comments

kirazxyun picture kirazxyun  ·  3Comments