金融 · katucharts.js/finance
样条区间面积图
type: 'areasplinerange'带平滑 Catmull-Rom 曲线边缘的区间面积图 — 区间面积图的样条版本。
编辑右侧的JSON并按Run(或⌘/Ctrl + Enter)——数据、标题、类别和颜色全部实时更新。
实时
样条区间面积图
编辑 · JSON
数据格式
{ x, low, high } · [[x, low, high]]
数据结构
传入图表的 JSON——可直接放进你的 series。
data: [
{ x: 0, low: 8, high: 14 },
{ x: 1, low: 9, high: 16 },
{ x: 2, low: 7, high: 15 }
]示例
import KatuCharts from 'katucharts.js';
KatuCharts.chart('container', {
chart: { type: 'areasplinerange' },
series: [{
name: 'Range',
data: [
{ x: 0, low: 8, high: 14 },
{ x: 1, low: 9, high: 16 },
{ x: 2, low: 7, high: 15 }
]
}]
});类型特定选项
| 选项 | 描述 |
|---|---|
(继承区间面积图选项) | fillOpacity、lineWidth。 |
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/finance';`, then call KatuCharts.chart(container, { chart: { type: 'areasplinerange' }, series: [...] }).
- 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.