Skip to content

Chart can't display full range #7564

Closed as not planned
Closed as not planned
@ellchr00

Description

@ellchr00

LVGL version

v9.2.2

Platform

VSCODE in MinGW but irrelevant

What happened?

Using a chart (linechart) and setting the range to int32_t MIN and int32_t MAX and a series consistent of 0's does not draw the line in the middle. of the chart window.

I followed the issue into lv_chart.c and found the following problem: In the calculations there will be a wrap around depending on the chart drawing area and it is not possible to draw the full 4 byte range like this.

847: int32_t y_tmp = (int32_t)((int32_t)ser->y_points[p_prev] - chart->ymin[ser->y_axis_sec]) * h;
848: y_tmp = y_tmp / (chart->ymax[ser->y_axis_sec] - chart->ymin[ser->y_axis_sec]);

where h in my case are 133 (pixels) , with a y_point being 0 and chart->ymin being −2147483648.
y_tmp will be 1 instead of the expected 66 -> therefore the line will be at the bottom of the window instead of the middle

multiple instances of said calculations can be found within the code .....

I don't know what the best solution of this problem is .... either using int64_t (not available on all platforms) or via float (undesired performance issue ?)

What is your take on the problem ? Am I the only one experiencing it ? Looking forward to an answer ...

How to reproduce?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions