How to use utils.drawRect() to draw Rectangle with opaque color #566
Unanswered
abdullahamin231
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to draw an opaque rectangle much like what you can draw on the preview website, but with each second the color increases in opacity.
https://preview.klinecharts.com/#en-US
Here's the code if it helps:
useEffect(() => {
const chart = init(chartID);
thisChartRef.current = chart;
const drawRectangles = () => {
const canvas = thisChartRef.current.getDom().querySelector("canvas");
const ctx = canvas.getContext("2d");
rectangles.forEach((rectangle) => {
utils.drawRect(ctx, rectangle.rect, rectangle.styles);
});
};
}, []);
return (
<>
</>
);
}
Beta Was this translation helpful? Give feedback.
All reactions