Visual bugs and data misrepresentation due to smoothing [BUG]
See original GitHub issueDescribe the bug Great lib, love the simple designs.
It’s however possible with certain datasets and configurations to get some quite strange looking graphs.
As an example take (over-exaggerated) dataset:
Dataset(
mutableListOf(
DataPoint(0f, 0f),
DataPoint(1f, 3.7f),
DataPoint(2f, 3.6f),
DataPoint(3f, 3.5f),
DataPoint(4f, 0f),
DataPoint(5f, 3.2f),
DataPoint(6f, 0f),
DataPoint(7f, 3.3f),
DataPoint(8f, 0f)
)
)
With XML
<com.yabu.livechart.view.LiveChart
android:id="@+id/dimensions_live_chart"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginStart="36dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="36dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="..."
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="..." />
And code
holder.dimensionsLiveChart.setDataset(it)
.drawSmoothPath()
.drawFill(false)
.drawHorizontalGuidelines(steps = 3)
.drawBaselineConditionalColor()
.setBaselineManually(3f)
.setOnTouchCallbackListener(object : LiveChart.OnTouchCallback {
@SuppressLint("SetTextI18n")
override fun onTouchCallback(point: DataPoint) {
//ommited
}
override fun onTouchFinished() {
//omitted
}
})
.drawDataset()
}
This results in:

The bugs I discovered:
- Due to line smoothing, datapoints can incorrectly return values that are higher or lower than the min/max values that were provided in the dataset. For example: using the provided dataset above you can retrieve data point
3.88which is a point provided by smoothing but not a real value. As smoothing is a pure “visual” feature, I find it strange that datapoints are not accurately returned in this case. - It appears line smoothing does not work in conjunctions with the fill color in extreme cases, as fill color is not smoothed. As you can see in the screenshot, “pyramid shapes” are formed of the fill color.
- I’m having problems where the lines are cropped off above or below the chart. This is especially clear when using smoothing, as the large bend artificially makes the graph bigger. I’m wondering how I can fix this, as including padding in XML breaks the graph even further and is clearly not supported.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
What are Visual Bugs : How to find & rectify them | BrowserStack
Visual bugs are problems associated with the user interface (also known as GUI) of a web or mobile application. Although these bugs do...
Read more >Final Notes - College of Liberal Arts & Sciences, The University of Iowa
Using the very old mtcars data set to illustrate estimating a smooth relationship: ... Collections of related graphs are sometimes called ensemble graphics....
Read more >Solving the Top Three Automated Regression Testing Issues - Codoid
A delay in communication or misrepresentation of bugs can lead to 'incurable' ... The tests are highly critical for successful deployment and bug...
Read more >Appendix A: 15 Most Common Issues
Axis, (e) Misrepresentation, (f) Missing Axis, (g) Inconsistent Tick ... with the visualization, calling the credibility of the data into question.
Read more >Visual Bugs | Test IO Academy
Individual bug reports for every occurrence of the problem must not be submitted and will be rejected. The customer only needs a single...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@MilanMalovic yep this fixed it temporary thanks
I think there still some work to do because it dose not seems to be 100% ok as you guys munitioned up there in the comments
@MilanMalovic Yeah that worked for the clipping issue. I now see that it was included in the XML in the README as well, but totally missed it so thanks for that!
The other issues are less visible on large datasets and I can smooth out the original data points myself anyway, so for now I’m good!