简体   繁体   English

如何在 nivo 图表设置中添加自定义颜色主题

[英]How to add custom color theme in nivo chart settings

I am using Nivo charts in one of my projects and I have implemented nivo chart settings as they have implemented them in their website.我在我的一个项目中使用 Nivo 图表,并且我已经实施了 nivo 图表设置,因为他们已经在他们的网站中实施了这些设置。 However, I wanted to add a few of my own custom color theme options additional to what nivo provides.但是,除了 nivo 提供的内容之外,我还想添加一些我自己的自定义颜色主题选项。 For more clarity, I am attaching this screenshot enter image description here为了更清楚起见,我附上此屏幕截图在此处输入图像描述

Right now, we import colors from nivo package as现在,我们从 nivo package 导入 colors 为

import {
    categoricalColorSchemeIds,
    divergingColorSchemeIds,
    sequentialColorSchemeIds,
    colorSchemes,
} from '@nivo/colors'

now I read somewhere that we can inject our custom object as color theme, can anyone help me show as how it would be possible if for ex I want to add new theme with name CustomTheme with colors of "#000, #fff,#ff0000".现在我在某处读到我们可以将我们的自定义 object 作为颜色主题注入,任何人都可以帮助我展示如果我想添加名为 CustomTheme 的新主题与“#000, #fff,#ff0000 的 colors ”。 How would we do that, any help would be helpful.我们将如何做到这一点,任何帮助都会有所帮助。 Thanks in advance提前致谢

Do:做:

colors={['#111111', '#222222']}
colorBy="index"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM