LiveChart icon indicating copy to clipboard operation
LiveChart copied to clipboard

[BUG] No lines drawn on chart if all the y coordinates are the same value

Open odvratnozgodan opened this issue 3 years ago • 2 comments

Describe the bug If the Dataset contains data that doesn't vary the y coordinate the chart doesn't draw anything. Looking at the source code of the library it's probably caused because the lowerBound and upperBound for the Dataset both are the same value and the LiveChartView subtracts those values(result is zero) and then uses that value for various division and multiplication. The problem persists even if a second dataset is passed to the LiveChart with .setSecondDataset() method.

To Reproduce Steps to reproduce the behavior:

  1. Create a dataset with all points having the same y coordinates
  2. pass the dataset as the argument to liveChart.setDataset()
  3. Call liveChart.drawDataset()
  4. See error

Expected behavior The chart should display a line at the bottom of the chart.

Smartphone (please complete the following information):

  • Device: Google Pixel 5
  • OS: Android 12
  • Version [e.g. 1.3.6]

odvratnozgodan avatar May 18 '22 06:05 odvratnozgodan

Same here. If knew that problem earlier I would never use that library. Now I have to use another one

AkmalMahmudov avatar Apr 26 '24 06:04 AkmalMahmudov

Feel free to open a PR, I currently don't have the bandwidth.

Pfuster12 avatar Apr 26 '24 07:04 Pfuster12