Skip to content

Commit 8d924f6

Browse files
authored
LG-4634: Ensure canvas is sized to container with correct pixel ratio (#2633)
* More explicit dimensions * Changeset * Fix changeset
1 parent 99484f7 commit 8d924f6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Diff for: .changeset/sour-tables-wonder.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@lg-charts/core': patch
3+
---
4+
5+
Ensure canvas is sized to container with correct pixel ratio

Diff for: charts/core/src/Echart/useEchart.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,12 @@ export function useEchart({
271271

272272
if (container) {
273273
// Init an echart instance
274-
const newChart = echartsCoreRef.current.init(container);
275-
274+
const newChart = echartsCoreRef.current.init(container, null, {
275+
devicePixelRatio: window.devicePixelRatio || 1,
276+
renderer: 'canvas',
277+
width: container.clientWidth,
278+
height: container.clientHeight,
279+
});
276280
// Set the initial options on the instance
277281
newChart.setOption(options);
278282

0 commit comments

Comments
 (0)