Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
@td-design/charts
Advanced tools
@td-design/charts
基于 G2 和 G2Plot 的雷数图表组件库
需要在项目根目录下babel.config.js
文件中加入以下配置:
plugins: [
[
'import',
{
libraryName: '@td-design/charts',
customName: (name) => {
if (name.indexOf('create') > -1) {
return `@td-design/charts/es/utils/${name}`;
}
return `@td-design/charts/es/components/${name}`;
},
style: true,
},
],
],
从 @td-design/charts
下导出两种 API:
全部 API 结构如下:
@td-design/charts
|-- components (DOM 组件类)
|-- ChartDom (图表组合组件)
|-- ComBlock (组件显示的载体,包含 border )
|-- ComCard (大屏卡片组件)
|-- ChartPlot (图表组件)
|-- utils (图表生成方法)
|-- createLinePlot (普通折线图)
|-- createColumnPlot (普通柱状图)
|-- createGroupColumnPlot (分组柱状图)
|-- createDonutPlot (基础环图)
|-- createStackColumnPlot (堆叠柱状图)
|-- createRangeColumnPlot (区间柱状图)
|-- createWaterfallPlot (瀑布图)
|-- createLiquidPlot (水波图)
|-- createDonutRosePlot (玫瑰图)
|-- createCustomBarPlot (基础条形图)
|-- createStackRosePlot (堆叠玫瑰图)
|-- createRadarPlot (雷达图)
|-- createStackAreaPlot (堆叠面积图)
|-- createScatterPlot (单象限散点图)
|-- createCustomRangeBarPlot (区间条形图)
|-- createRadialStackPlot (径向堆叠柱形图)
|-- createCustomGroupedBarPlot (分组条形图)
|-- createColumnLinePlot (柱线混合图)
|-- createGroupedColumnLinePlot (分组柱线混合图)
|-- createDualLinePlot (双折线图)
具体导出的组件和方法详见 在线文档 。
如果需要使用图表主题功能以实现主题配置或主题切换。
global.ts 中配置初始 theme ,这里配置了 dark
为初始主题:
((global as unknown) as CustomWindow).chartConfig = {
theme: 'dark',
};
interfaces/common.ts 下需要新增 chartConfig 属性:
// interfaces/common.ts
export interface CustomWindow extends Window {
// 其他配置
chartConfig: {
theme: string;
themeConfig?: {
// 对应主题色
[name: string]: {
[name: string]: string | string[] | number | number[];;
};
};
};
}
1.如果需要切换主题的功能,则需要配置chartConfig
中的themeConfig
属性,在themeConfig
下需要配置对应主题的属性,在 g2plot 主题链接 中有所有的主题属性可配置项(colors20 暂不支持),单线图不会被应用 colors10 颜色。
比如:需要dark
和light
的主题切换,则可以配置chartConfig
如下:
((global as unknown) as CustomWindow).chartConfig = {
theme: 'dark',
themeConfig: {
// 暗黑主题
dark: {
colors10: ['red','yellow'],
// 其他的主题属性
},
// 白色主题
light: {
colors10: ['green','blue']
},
},
};
目前主题库有dark
和light
,上面的属性(如legendColor
)是全部目前图表库暴露的可配置属性,都是可选可不选的,如果不传会用默认的主题设置。如果是自定义的其他主题,图表库则会默认使用dark
主题颜色作为模板。
2.修改全局 theme 主题名称即可。如:
// 切换为 light 主题
((global as unknown) as CustomWindow).chartConfig.theme = 'light';
FAQs
The npm package @td-design/charts receives a total of 7 weekly downloads. As such, @td-design/charts popularity was classified as not popular.
We found that @td-design/charts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.