Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smoothed lines option causing some curves between points to be unrealistic #4215

Closed
joshuar opened this issue Jun 12, 2015 · 11 comments · Fixed by #78154
Closed

Smoothed lines option causing some curves between points to be unrealistic #4215

joshuar opened this issue Jun 12, 2015 · 11 comments · Fixed by #78154
Labels
bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:XYAxis XY-Axis charts (bar, area, line) Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@joshuar
Copy link

joshuar commented Jun 12, 2015

Sorry, hard to describe other than show a visual:

screenshot from 2015-06-12 11-07-21

Looks like the function used to calculate the curvature of the line between two points has an issue here for the repeater.fritz.box line. Raw data export here. The line in question is for target_host=repeater.fritz.box

@joshuar
Copy link
Author

joshuar commented Jun 12, 2015

Refreshed the display and got more funkiness:

screenshot from 2015-06-12 12-11-09

Uploaded raw data here

@stormpython
Copy link
Contributor

@joshuar This has to do with the fact that we are using the Cardinal Spline algorithm for smoothing lines. It was chosen because it had a nicer smoothing effect than some of the other algorithms. But in light of this, perhaps we should change it.

That being said, anytime you smooth lines when it comes to displaying data, you are essentially lying about the data, as the most accurate representation is a linear interpolation between points.

@stormpython stormpython self-assigned this Jun 12, 2015
@joshuar
Copy link
Author

joshuar commented Jun 13, 2015

@stormpython yeah, the fit seems to be worse when there are fewer data points and they are not evenly spaced. For that data, its ICMP ping round-trip times and that graph is only showing the hosts with RTT above 50ms. For the bad fitting graphs, those hosts have ping times that jump above and below 50ms, hence the uneven spacing and few data points.

Yeah, line fitting like this can be a delicate art :) Not sure if the answer is to allow a user to select the different fits themselves or just put a warning when the option is enabled that the line fitting can lead to inaccurate results?

@sqpdln
Copy link

sqpdln commented Jun 15, 2015

this is addressed here as well: #3737, i've written a comment with another example.

@JulienPalard
Copy link

Another funky one:

funky curve in Kibana 4.1.0

@stormpython
Copy link
Contributor

Upon further investigation, none of the out-of-the-box d3 interpolation functions solve this particular problem. For more information on the d3 interpolation functions see: d3 interpolators.

There are two solutions as I see it currently:

  1. Use linear interpolation
  2. Create our own linear interpolation function (or steal someone else's that solves this problem)

I am removing the discuss tag, and perhaps another issue can be opened as an enhancement for line charts.

@stormpython stormpython removed their assignment Jun 22, 2015
@arabold
Copy link

arabold commented Jul 27, 2015

You run into the problem of "funky curves" quite easily if your data points aren't coming in regular intervals. Here's an example where I'm just missing data and thus the curves go crazy:

image

A valid possibility would be to show gaps where data points are missing. Another good food for thoughts is here: http://www.d3noob.org/2013/01/smoothing-out-lines-in-d3js.html. Maybe it would be best we offer multiple choices (drop-down) instead of a simple checkbox to smoothen lines.

@pemontto
Copy link

pemontto commented Mar 2, 2016

I have another example here where I have cluster of data and then the next point is far in the future, it's like I've pulled a bezier curve control point too far.

screen shot 2016-02-26 at 15 31 36
screen shot 2016-02-26 at 15 33 15

@tbragin tbragin added the Feature:Visualizations Generic visualization features (in case no more specific feature label is available) label Nov 1, 2016
@spalger spalger added bug Fixes for quality problems that affect the customer experience P4 and removed discuss labels Feb 6, 2017
@epixa epixa removed the P4 label Apr 25, 2017
@ppisljar
Copy link
Member

ppisljar commented Sep 5, 2017

looking at the https://github.com/d3/d3-shape/blob/master/README.md#curves monotone seems to be better choice than cardinal

@ppisljar
Copy link
Member

ppisljar commented Sep 5, 2017

i tested the monotone interpolation and it also produces weird lines

@ppisljar
Copy link
Member

ppisljar commented Sep 5, 2017

all the other interpolation types that d3v3 supports do not draw the line thru all the actual data points, which will produce weird results if you are also plotting the circles

@timroes timroes added Feature:Pie Chart Pie chart visualization feature Feature:ElasticCharts Issues related to the elastic-charts library and removed Feature:Pie Chart Pie chart visualization feature labels Apr 11, 2018
@timroes timroes added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Sep 16, 2018
@timroes timroes added Feature:XYAxis XY-Axis charts (bar, area, line) and removed Feature:Visualizations Generic visualization features (in case no more specific feature label is available) labels Oct 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:XYAxis XY-Axis charts (bar, area, line) Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.