apexcharts - ApexChart - 数字非常小的轴
问题描述
我正在尝试生成一个处理非常小的数字的图表。但是 ApexCharts 上的 x 轴(实际上是 y 轴,因为它是一个水平堆叠条形图)仅显示零,这具有隐藏一些数据条的效果。
我试过了
yaxis: {
type: 'numeric',
tickAmount: 50
},
...和...
yaxis: {
type: 'numeric',
tickAmount: 'dataPoints'
},
...但两者都不起作用(第二个选项会使浏览器崩溃!)
一个非常基本的示例,根本没有太多数据:
https://codepen.io/anon/pen/JxojwZ
如果您在日期之间切换(使用底部的日期选项,您将看到默认情况下不(但应该)显示的额外数据。
还有什么我可以尝试的吗?
解决方案
您使用的是旧版本的 ApexCharts (2.2.4)。我建议您使用此 CDN 链接将其替换为最新版本 - https://cdn.jsdelivr.net/npm/apexcharts
这是图表的更新配置
var options = {
chart: {
type: "bar",
stacked: true,
height: 300
},
plotOptions: {
bar: {
barHeight: "90%",
distributed: true,
horizontal: true
}
},
stroke: {
width: 1,
colors: ["#fff"]
},
series: [
{
name: "Monday 7th January 2019",
data: [0.02, 0.01, 0.01]
},
{
name: "Tuesday 8th January 2019",
data: [0.02, 0.01, 0.01]
},
{
name: "Wednesday 9th January 2019",
data: [0.01, 0.02, 0.0]
}
],
xaxis: {
categories: ["England", "Scotland", "Wales"],
title: {
text: "Average"
},
labels: {
formatter: function(val) {
return val;
}
}
},
dataLabels: {
enabled: false
},
yaxis: {},
tooltip: {
theme: "light",
x: {
show: true
}
}
};
var chart = new ApexCharts(document.querySelector("#statChart"), options);
chart.render();
推荐阅读
- reactjs - Reactstrap 中的 CardImgOverlay
- music21 - 使用music21的音阶类继承“deriveAll”功能的自定义音阶
- graphql - 如何使用 GraphQL 界面从 GitLab 部署中检索所有用户?
- javascript - 使用 bootstrap vue 未显示表
- sql-server - 无法使用 invoke-sqlcmd 执行 SQL 脚本
- r - 计算向量中每个值的阶乘
- sublimetext3 - 在 SublimeText3 中运行(构建)代码到当前行的快捷键?
- python - 当前日期作为使用 celerybeatC 计划的任务中的参数
- docker - 如何从 docker compose 容器将 mocha 日志作为 gitlab 工件输出?
- android - Google Pay - Android 11 上的请求失败