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

Do not add interpolated points between points with null values. #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kuba-wyrostek
Copy link

Hopefully fixes #34

@MichaelZinsmaier
Copy link
Owner

MichaelZinsmaier commented May 3, 2016

Hey,

first of all thanks for the contribution!

I did not merge it so far because I'm unsure about the "fence posts", the PR surpresses interpolation between two points in case one of the points includes a null value however the null point itself will be part of the result added either in line 204-206 or 220-222. Probably this still works since other flot plugins will ignore the null point but it might produce artifacts e.g. in case the last point is null. I assume the visibile line would just end before the plot borders ...

If you have time it would be great if you could adjust the PR and maybe add an example for the test folder?
They can be viewed quite conveniently via RawGit

Else I will tackle that myself but it might take some time...

Best Michael

@kripper
Copy link

kripper commented Jun 14, 2016

Works fine.
Thanks.

My test case was:
$.plot("#placeholder", [{data: [[0,10], [1,20], [1.5, null], [2,30], [3,40]]}] );

@ko06
Copy link

ko06 commented Mar 19, 2018

after this effect, my graph working fine

@MichaelZinsmaier
Copy link
Owner

MichaelZinsmaier commented Mar 19, 2018

wow that has a been a long time open...

after checking documentation

"If a null is specified as a point or if one of the coordinates is null or couldn't be converted to a number, the point is ignored when drawing. As a special case, a null value for lines is interpreted as a line segment end, i.e. the points before and after the null value are not connected."

thus the desired behavior would probably be to have line segments in case someone wants them joint it would be his choice to filter null values

PR

  • split line segments work as intended
  • fenceposting works as intended
  • doesn't address the legacy option
  • last point not processed correctly

maybe some preprocessing

var result
var start = 0

for (i = 0; i < points.length; i++) {
if (points[i] != number || i == points.length-1) {
        slice = datapoints.slice(start, i)
        start = i
        
 	   result.concat(processSlice(slice))
  }
}

@MichaelZinsmaier
Copy link
Owner

did add a few commits to a copy of the branch with this implementation
didn't turn out as nice as I hoped for ...

@ko06
Copy link

ko06 commented Mar 25, 2018

shall I give pull request after address this issue with testcases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NULL values are not ignored
4 participants