diff --git a/__tests__/unit/plots/heatmap/pattern-spec.ts b/__tests__/unit/plots/heatmap/pattern-spec.ts
new file mode 100644
index 0000000000..482feb0f40
--- /dev/null
+++ b/__tests__/unit/plots/heatmap/pattern-spec.ts
@@ -0,0 +1,67 @@
+import { Heatmap } from '../../../../src';
+import { semanticBasicHeatmapData } from '../../../data/basic-heatmap';
+import { createDiv } from '../../../utils/dom';
+
+describe('heatmap: pattern', () => {
+ it('pattern: obj', () => {
+ const heatmap = new Heatmap(createDiv('style'), {
+ width: 400,
+ height: 300,
+ data: semanticBasicHeatmapData,
+ xField: 'name',
+ yField: 'day',
+ colorField: 'sales',
+ pattern: {
+ type: 'line',
+ },
+ });
+
+ heatmap.render();
+
+ const geometry = heatmap.chart.geometries[0];
+ const elements = geometry.elements;
+ expect(elements[0].shape.attr('fill') instanceof CanvasPattern).toEqual(true);
+
+ heatmap.update({
+ pattern: false,
+ });
+
+ expect(heatmap.chart.geometries[0].elements[0].shape.attr('fill') instanceof CanvasPattern).toEqual(false);
+
+ heatmap.destroy();
+ });
+
+ it('pattern: callback', () => {
+ const heatmap = new Heatmap(createDiv('style'), {
+ width: 400,
+ height: 300,
+ data: semanticBasicHeatmapData,
+ xField: 'name',
+ yField: 'day',
+ colorField: 'sales',
+ pattern: ({ sales }) => {
+ if (sales === 10) {
+ return { type: 'dot' };
+ }
+ },
+ });
+
+ heatmap.render();
+
+ const geometry = heatmap.chart.geometries[0];
+ const elements = geometry.elements;
+ expect(elements[0].shape.attr('fill') instanceof CanvasPattern).toEqual(true);
+
+ heatmap.update({
+ pattern: ({ sales }) => {
+ if (sales === 19) {
+ return { type: 'dot' };
+ }
+ },
+ });
+
+ expect(heatmap.chart.geometries[0].elements[1].shape.attr('fill') instanceof CanvasPattern).toEqual(true);
+
+ heatmap.destroy();
+ });
+});
diff --git a/docs/api/plots/heatmap.en.md b/docs/api/plots/heatmap.en.md
index ef64424c24..fb1ca4bad7 100644
--- a/docs/api/plots/heatmap.en.md
+++ b/docs/api/plots/heatmap.en.md
@@ -49,6 +49,8 @@ Axis mapping.
`markdown:docs/common/color.en.md`
+`markdown:docs/common/pattern.en.md`
+
#### shape
**optional** _rect | square | circle_
diff --git a/docs/api/plots/heatmap.zh.md b/docs/api/plots/heatmap.zh.md
index eda4569f65..d861650fc6 100644
--- a/docs/api/plots/heatmap.zh.md
+++ b/docs/api/plots/heatmap.zh.md
@@ -49,6 +49,8 @@ order: 23
`markdown:docs/common/color.zh.md`
+`markdown:docs/common/pattern.zh.md`
+
#### shape
**可选** _rect | square | circle_
diff --git a/src/types/attr.ts b/src/types/attr.ts
index ec98bb4be3..77976a9233 100644
--- a/src/types/attr.ts
+++ b/src/types/attr.ts
@@ -9,6 +9,7 @@ export type ShapeStyle = ShapeAttrs;
export type ColorAttr = string | string[] | ((datum: Datum) => string) | object;
/** pattern 映射*/
export type PatternAttr =
+ | boolean
| CanvasPattern
| PatternOption
| ((datum: Datum, color: string /** inherit color */) => PatternOption | CanvasPattern);