生物信息学 · katucharts.js/bio
火山图
type: 'volcano'火山图——折叠变化(x)与统计显著性(−log10 p值,y)。点按显著性阈值着色:上调、下调、无显著性。
编辑右侧的JSON并按Run(或⌘/Ctrl + Enter)——数据、标题、类别和颜色全部实时更新。
实时
火山图
编辑 · JSON
数据格式
{ x: log2FC, y: -log10pval, name?: geneName }
数据结构
传入图表的 JSON——可直接放进你的 series。
data: [
{ x: 2.5, y: 10.3, name: 'BRCA1' },
{ x: -1.8, y: 4.2, name: 'TP53' },
{ x: 0.8, y: 8.1, name: 'PTEN' }
]示例
import KatuCharts from 'katucharts.js';
import 'katucharts.js/bio';
KatuCharts.chart('container', {
series: [{
type: 'volcano',
data: [{ x: 2.5, y: 10.3, name: 'BRCA1' }, { x: -1.8, y: 4.2, name: 'TP53' }],
foldChangeThreshold: 1,
pValueThreshold: 0.01
}]
});类型特定选项
| 选项 | 描述 |
|---|---|
thresholds | { foldChange、pValue }分类截点。 |
colors | { upregulated、downregulated、nonsignificant }。 |
labelTopN | 标记最显著的前N个基因。 |
变体
标注显著基因
用 labelTopN 标注最显著的数据点。
KatuCharts.chart('container', {
series: [{
type: 'volcano',
data: genes,
foldChangeThreshold: 1,
pValueThreshold: 0.01,
labelTopN: 8
}]
});Common errors
- Why does my 火山图 chart render as a line chart?
- The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
- Why do I get "Cannot read properties of null (reading 'appendChild')"?
- The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
- Why is the chart rendering with zero height?
- The container has no height. A div with no content collapses to zero. Give it a height in CSS, or pass `chart: { height: 400 }` in the options.
FAQ
- How do I create a 火山图 chart in JavaScript?
- Install with `npm install katucharts.js`, import the module with `import 'katucharts.js/bio';`, then call KatuCharts.chart(container, { chart: { type: 'volcano' }, series: [...] }).
- What data does the volcano plot expect?
- Points that are already transformed: { x: log2 fold change, y: −log10(p), name }. Compute −log10 of your p-values (or adjusted p-values) before passing them in; the series does not read DESeq2, edgeR or limma result tables directly.
- How are points classified as up-regulated, down-regulated or not significant?
- With foldChangeThreshold (default 1) and pValueThreshold (default 0.05) on the series. Dashed threshold lines are drawn at ±foldChangeThreshold and at −log10(pValueThreshold), and the three groups are coloured with upColor, downColor and nsColor.
- How do I label the most significant genes?
- Set labelTopN on the series, for example labelTopN: 8. Labels use each point's name.
- Why does my 火山图 chart render as a line chart?
- The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
- Why do I get "Cannot read properties of null (reading 'appendChild')"?
- The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.