首页 > 解决方案 > 如何在 chartist.js 中为图表背景着色

问题描述

我可能遗漏了一些简单的东西,但我无法使用 chartist.js 更改图表的背景颜色

.ct-grid {
background: black;
background-color: black;
stroke:black;
fill:black;
}

我正在尝试仅更改网格区域,而不是整个区域,因此我没有使用ct-chart ct-golden-section

有任何想法吗?

标签: csschartist.js

解决方案


下面可能会让您了解如何继续.. 可能使用一些 CSScalc()来找到合适的尺寸,这样您就不会静态设置它们

.ct-golden-section:before {
    display: block;
    float: left;
    content: "";
    width: 100%; 
    height: 413px; //set as the size of the container
    padding-bottom: 449px; //set as the size of the container
    background: yellow; // set the bg color wanted for the container
    border-style: solid;
    border-top-width: 15px;
    border-left-width: 49px;
    border-color: orange;  // choose the color of the page u have
    border-bottom-width: 25px;
    border-right-width: 39px;
}

检查屏幕截图以查看上述结果:

https://drive.google.com/file/d/15-vuRMXn2NspkNWfIuvcEZ8xxOEUeEgd/view?usp=sharing

请任何人随时编辑我的临时解决方案


推荐阅读