0

我尝试像在文档中一样设置高度和宽度,但它占据了整个屏幕。我试过在 CSS 中给它一个大小;没用,我还在“maintainAspectRatio”设置之间切换,其中 true 和 false 对图表没有影响。

下面是条形图组件代码:

<Bar className="bar-chart"
                data={data}
                width={450}
                height={600}
                options={{
                    scales: {
                      yAxes: [
                        {
                          ticks: {
                            beginAtZero: true,
                          },
                        },
                      ],
                    },
                    maintainAspectRatio: false,
                    legend:{
                        display:true,
                        position:'bottom'
                    }
                  }}
                />

条形图位于类组件返回语句的最后一个 div 中,因此该 div 上没有样式或 CSS 显示设置。任何帮助,将不胜感激 这就是酒吧的外观和向下延伸的方式,远远超出我的图片所能容纳的范围

4

0 回答 0