admin管理员组

文章数量:1389768

I want to limit the x-axis in the bar graph I'm using, I have multiple values but I want to show only 7 and then the user can scroll to see the remaining. Does this option exist?

I want to limit the x-axis in the bar graph I'm using, I have multiple values but I want to show only 7 and then the user can scroll to see the remaining. Does this option exist?

Share Improve this question asked Mar 10, 2021 at 7:43 SamSam 3615 silver badges22 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

Setting the value of the xaxis.range property should help.

var options = {
    series: [
        {
            name: 'PRODUCT A',
            data: [44, 55, 41, 67, 22, 43, 13, 23, 20, 8, 13, 27]
        }, {
            name: 'PRODUCT B',
            data: [13, 23, 20, 8, 13, 27, 11, 17, 15, 15, 21, 14]
        }, {
            name: 'PRODUCT C',
            data: [11, 17, 15, 15, 21, 14, 44, 55, 41, 67, 22, 43]
        }
    ],
    chart: {
        type: 'bar',
        height: 350,
        stacked: true,
        toolbar: {
          show: true
        }
    },
    xaxis: {
        range: 7
    }
};
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();

本文标签: javascriptLimit xaxis in ApexchartsjsStack Overflow