在 Apexcharts.js 中限制 x 轴 [英] Limit x-axis in Apexcharts.js

查看:44
本文介绍了在 Apexcharts.js 中限制 x 轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想限制我正在使用的条形图中的 x 轴,我有多个值但我只想显示 7,然后用户可以滚动查看剩余的值.这个选项存在吗?

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?

推荐答案

设置 xaxis.range 属性的值应该会有所帮助.

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();

这篇关于在 Apexcharts.js 中限制 x 轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆