LiveChart
LiveChart copied to clipboard
[BUG] No lines drawn on chart if all the y coordinates are the same value
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:
- Create a dataset with all points having the same
ycoordinates - pass the dataset as the argument to
liveChart.setDataset() - Call
liveChart.drawDataset() - 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]
Same here. If knew that problem earlier I would never use that library. Now I have to use another one
Feel free to open a PR, I currently don't have the bandwidth.