apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.43k stars 19.61k forks source link

Issue when creating bar chart with 'time' X axis #13043

Closed alpesh0063 closed 2 years ago

alpesh0063 commented 4 years ago

Version

4.5.0

Steps to reproduce

option = {
    color: ['#62B5E5'],
    tooltip: {
        formatter: function(params) {
            params = params[0];
            //return moment(params.value[0],"x").format("ddd") + ' : ' + params.value[1];
            var date = new Date(params.value[0]);
            return date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear() + ' : ' + params.value[1];
        },
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    grid: {
        left: '10%',
        right: '2%',
        bottom: 0,
        top: '3%',
        containLabel: true
    },
    xAxis: [{
        interval: 3600*24*1000,
        type: 'time',
        axisLabel: {
            rotate: 45,
            formatter: (function(name) {
                var date = new Date(name);
                return date.getDay()
            }),
            show: true,
            color: '#838383',
            fontFamily: 'Open Sans',
            fontStyle: 'normal',
            fontWeight: 'normal',
            fontSize: 8,
            lineHeight: 11
        },
        axisTick: {
            show: false
        },
        axisLine: {
            lineStyle: {
                color: '#979797',
                width: 0.25
            },
        },
        splitLine: {
            show: false
        }
    }],
    yAxis: [{
        type: 'value',
        splitNumber: 2,
        name: 'Malware Families',
        nameLocation: 'middle',
        nameTextStyle: {
            color: '#838383',
            fontFamily: 'Open Sans',
            fontStyle: 'normal',
            fontWeight: 600,
            fontSize: 16,
            lineHeight: 12
        },
        nameGap: 30,
        axisTick: {
            show: false
        },
        axisLabel: {
            show: true,
            color: '#838383',
            fontFamily: 'Open Sans',
            fontStyle: 'normal',
            fontWeight: 'normal',
            fontSize: 8,
            lineHeight: 11
        },
        axisLine: {
            show: false
        },
        splitLine: {
            show: true,
            lineStyle: {
                color: '#979797',
                width: 0.25
            }
        }
    }],
    series: [{
        cursor: 'context-menu',
        name: 'No of Malware Families',
        type: 'bar',
        barWidth: '60%',
        data: [
            [1595356200000, 109],
            [1595442600000, 64],
            [1595529000000, 94],
            [1595615400000, 135],
            [1595701800000, 112],
            [1595788200000, 135],
            [1595874600000, 0]
        ],
    }]
}

What is expected?

The X axis label should be center align.. Also we have one ''Mon' label display at end

What is actually happening?

The axis label to align to right and we have two 'mon' label display at end

echarts-bot[bot] commented 4 years ago

Hi! We've received your issue and please be patient to get responded. 🎉 The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical questions.

If you are interested in the project, you may also subscribe our mail list.

Have a nice day! 🍵

alpesh0063 commented 4 years ago

image image

susiwen8 commented 4 years ago

5.0 which will be release alpha version in few days improve time axis @Ovilia

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] commented 2 years ago

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!