Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧐 How to create rectangle in heatmap instead of point or square as example #2847

Open
thoaihuynh2509 opened this issue Feb 5, 2025 · 0 comments

Comments

@thoaihuynh2509
Copy link

I try to update shape field but it is not work when working with rectangle

`import React, { useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
import { Heatmap } from '@ant-design/plots';

const DemoHeatmap = () => {
const [data, setData] = useState([]);

useEffect(() => {
asyncFetch();
}, []);

const asyncFetch = () => {
fetch('https://gw.alipayobjects.com/os/bmw-prod/68d3f380-089e-4683-ab9e-4493200198f9.json')
.then((response) => response.json())
.then((json) => setData(json))
.catch((error) => {
console.log('fetch data failed', error);
});
};
const config = {
data,
xField: 'name',
yField: 'country',
colorField: 'value',
sizeField: 'value',
shapeField: 'rect',
scale: {
size: { range: [12, 20] },
color: { range: ['#0d5fbb', '#7eadfc', '#fd8b6f', '#aa3523'] },
},
label: {
text: (d) => d.value,
position: 'inside',
style: {
fill: '#fff',
shadowBlur: 2,
shadowColor: 'rgba(0, 0, 0, .45)',
pointerEvents: 'none',
},
},
};

return <Heatmap {...config} />;
};

ReactDOM.render(, document.getElementById('container'));
`

Image

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant