Skip to content

Commit

Permalink
LG-4634: Ensure canvas is sized to container with correct pixel ratio (
Browse files Browse the repository at this point in the history
…#2633)

* More explicit dimensions

* Changeset

* Fix changeset
  • Loading branch information
tsck authored Jan 16, 2025
1 parent 99484f7 commit 8d924f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/sour-tables-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lg-charts/core': patch
---

Ensure canvas is sized to container with correct pixel ratio
8 changes: 6 additions & 2 deletions charts/core/src/Echart/useEchart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,12 @@ export function useEchart({

if (container) {
// Init an echart instance
const newChart = echartsCoreRef.current.init(container);

const newChart = echartsCoreRef.current.init(container, null, {
devicePixelRatio: window.devicePixelRatio || 1,
renderer: 'canvas',
width: container.clientWidth,
height: container.clientHeight,
});
// Set the initial options on the instance
newChart.setOption(options);

Expand Down

0 comments on commit 8d924f6

Please sign in to comment.