Skip to content

Commit 24e5388

Browse files
Optimize LineChart area fill rendering to avoid data duplication (#4289)
Refactored `LineChart` to draw filled areas by constructing the `GeneralPath` directly from the source points list, rather than creating a temporary `ArrayList` copy. This reduces memory allocation and garbage collection overhead during chart rendering. Exposed `AbstractChart.calculateDrawPoints` as protected to facilitate this reuse. Retained original logic for complex `BOUNDS` fill types where point modification is required. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 753391c commit 24e5388

2 files changed

Lines changed: 365 additions & 275 deletions

File tree

CodenameOne/src/com/codename1/charts/views/AbstractChart.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
public abstract class AbstractChart {
4242
private static final char[] stopCharCandidates = "!@#$%^&*()?><,./+-qwertyuiop[zxcvbnm,./\\|}{".toCharArray();
4343

44-
private static float[] calculateDrawPoints(float p1x, float p1y, float p2x, float p2y,
44+
protected static float[] calculateDrawPoints(float p1x, float p1y, float p2x, float p2y,
4545
int screenHeight, int screenWidth) {
4646
float drawP1x;
4747
float drawP1y;

0 commit comments

Comments
 (0)