apache / apache/echarts

[Feature] Set Dimensions for Downloaded Images in saveAsImage

Open
#20,981 4 comments 1 reaction 0 assignees View on GitHub
en new-feature pending
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### What problem does this feature solve?

The current saveAsImage function in Apache ECharts allows users to download charts as images, but the dimensions are based on the chart's display size in the browser. This can lead to suboptimal image quality, especially on different screen resolutions.

I propose adding options to specify the width and height for the downloaded image. This would ensure images are always in an optimal format for printing or sharing.

Benefits:
1. More control over image quality and dimensions.
2. Consistent representation of charts regardless of display size.
3. Enhanced usability for presentations and reports.

### What does the proposed API look like?

Example Usage:

`
saveAsImage({
type: 'png', // Image type
width: 800, // Desired width
pixelRatio: 1 // Image resolution
});
`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.