javascript - 顶点图表拉伸(stretch)全尺寸

标签 javascript reactjs svg size apexcharts

顶点图表存在无法拉伸(stretch)完整尺寸的问题。如何使图形仅适合其父容器。

这是对间隙问题的检查,您可以看到内部图表元素与其相应父元素的间距不正确:

enter image description here

这是当前代码:

import Chart from "react-apexcharts";

const SimpleChart = () => {
    const data = {
        series: [{
          name: 'series1',
          data: [31, 40, 28, 51, 42, 109, 100]
        }],
        options: {
          chart: {
            type: 'area',
            toolbar: { show: false },
          },
          dataLabels: {
            enabled: false
          },
          legend: {
            show: false
          },
          stroke: {
            curve: 'smooth'
          },
          grid: { show: false },
          xaxis: {
            labels: { show: false },
            axisBorder: { show: false },
            axisTicks: { show: false },
            type: 'datetime',
            categories: ["2018-09-19T00:00:00.000Z", "2018-09-19T01:30:00.000Z", "2018-09-19T02:30:00.000Z", "2018-09-19T03:30:00.000Z", "2018-09-19T04:30:00.000Z", "2018-09-19T05:30:00.000Z", "2018-09-19T06:30:00.000Z"]
          },
          yaxis: { 
            labels: { show: false },
          },
          tooltip: {
            enabled: false
          },
        },
    };

    return (
        <Chart
            options={data.options}
            series={data.series}
            width="150"
            type="area"
        />
    )
}

export default SimpleChart```

最佳答案

启用迷你图选项

chart: {
  sparkline: {
    enabled: true
  }
},

关于javascript - 顶点图表拉伸(stretch)全尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69356013/

相关文章:

css - 如何设置旋转木马点的样式?

javascript - 不断出现 TypeError : Cannot read property 'map' of undefined when I click on checkbox, 不知道问题出在哪里

css - 捕捉 SVG 和 Material 阴影

javascript - 使用ajax javascript将一个int数组传递给MVC Controller

javascript - 如何在 JavaScript 中引用之前的prompt()?

javascript - bind() : You are binding a component method to the component. React 会自动为你做这个吗?

html - SVG - 剪辑路径仅在相同的 <svg> 标签中定义时才有效

javascript - 为什么我的按钮没有收到 js 循环创建的 onclick 命令?

javascript - GroupBy 使用 underscore.js 使用嵌套 JSON 对象

javascript - 调整 G 标签内的 SVG 矩形元素的大小