-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Adds ability to smooth lines for line and area charts #3273
Conversation
Can you also add this to the area chart since they're so similar? There's no interpolate() call in there at the moment, but I gave it a shot and it seemed to work swimmingly. |
@rashidkpc done. |
…going outside of the chart bounds, added form-control class to mode selector in area chart
@w33ble Increased the line tension and added the |
@@ -0,0 +1,7 @@ | |||
<div> | |||
<label> | |||
Line Interpolation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we s/Interpolation/Smoothing
this? I don't think most people know what interpolation is. Also, if there's only on or off (linear or smooth) and we don't anticipate adding more options than that why not just make it a checkbox?
Conflicts: src/kibana/plugins/vis_types/vislib/editors/line.html src/kibana/plugins/vis_types/vislib/line.js
Renamed |
@w33ble An algorithm calculates the curvature of the line. If we wanted to know how curvy the lines would be, we'd need to do some measurement at every possible point that is used to calculate the position of each point on a line. Can you show me an example where increasing the y max value by 1 still shows lines being cut-off? I will decrease the yMin values when using the data extents by 1 to make sure this doesn't happen on the lower end. If you can find or think of a better solution, let me know. As of now, this seems as good a fix as any. |
Ok, it would appear that the solution to the lines going off the chart is not to use the |
@stormpython Can you merge master on this one? |
The new smoothing tends to leave the border of the vis less, but it still happens (not the bottom of the chart). The smoothing is less "smooth" now as a result though (note the very pointed peaks here). Perhaps this could perhaps be solved by offering users the ability to pick their smoothing method? @rashidkpc how much do we care that the lines leave the border of the svg? It seems to happen regardless, and seems like a tricky problem to solve - it's the number one reason this PR keeps getting sent back. |
Conflicts: src/kibana/plugins/vis_types/vislib/line.js
@w33ble the lines aren't actually leaving the bottom of the chart there. It only appears to since there are points there with zero values. It is simply going through the point of the circle. The reason it appears cut off is because part of the circle is cut-off, and that is due to the clip path that is set. Half the circle is above the 0 line and half is below. I don't really consider this to be a bad thing. As far as the smoothness goes, I can reduce the tension on the line to make it more curvy. The very pointed peak is so the line goes through the point and does not overshoot it. This will happen no matter what as the algorithm is meant to intersect the points. |
I personally don't much care that they leave the plot. If you choose to have smooth lines you choose to a lie :-) Given that line smoothing is very much for presentation I'd vote to prefer presentation (smoother lines) over accuracy (not going off the chart) |
So, reducing the tension doesn't actually change the slope of the line between points by much. So I could either leave monotone the way it is or use cardinal (and have times where the lines go off the scale). |
I liked how cardinal looked a lot better. I think most datasets probably look bad with monotone, but I'm open to letting the user choose (but defaulting to cardinal). |
…moothlines to cardinal, removing the tickScale function from the .nice calculation in the y axis
@w33ble after talking with @rashidkpc, he agreed with you that |
Adds ability to smooth lines for line and area charts
Closes #825.
Adds ability to smooth lines in line chart.