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

Can arearange support null lower/upperbound? #8139

Closed
lzl124631x opened this Issue Apr 5, 2018 · 10 comments

Comments

Projects
None yet
3 participants
@lzl124631x
Copy link

lzl124631x commented Apr 5, 2018

Expected behaviour

For arearange, if upperbound is null, just show the lower bound and highlight the upper area.

1

Actual behaviour

No arearange will show if either bound is missing.

Live demo with steps to reproduce

http://jsfiddle.net/Richard_Liu/o8wmzw0a/2/

Product version

Affected browser(s)

@TorsteinHonsi

This comment has been minimized.

Copy link
Collaborator

TorsteinHonsi commented Apr 6, 2018

You can achieve the same by using an area with a higher threshold value: http://jsfiddle.net/highcharts/o8wmzw0a/4/

It's not perfect however, as the threshold needs to be hard-coded to the Y axis max. In practice you would need to analyze the data for its max value before creating the chart.

@lzl124631x

This comment has been minimized.

Copy link
Author

lzl124631x commented Apr 6, 2018

Yes. I came up that solution before. SO link. But I'd like to prevent the computation because the chart is so dynamic; I need to compute the threshold every time.

I wish I could stick my threshold to the highcharts-computed y-axis min/max (I cannot know these values before the chart is rendered), or -Infinity/Infinity.

This could be a good feature to add. If highcharts wants this feature, maybe I can help.

@TorsteinHonsi

This comment has been minimized.

Copy link
Collaborator

TorsteinHonsi commented Apr 6, 2018

Yes, -Infinity/Infinity was what I had in mind too! Commit coming up.

@lzl124631x

This comment has been minimized.

Copy link
Author

lzl124631x commented Apr 6, 2018

Wow. This is fabulous. Thanks @TorsteinHonsi !

@lzl124631x

This comment has been minimized.

Copy link
Author

lzl124631x commented Apr 20, 2018

@TorsteinHonsi

  • When will 6.1.0 be available?
  • Will arearange automatically inherit this change?
  • May you have a look at this issue? I wanted to contribute to highcharts but I cannot run the test.
@pawelfus

This comment has been minimized.

Copy link
Contributor

pawelfus commented Apr 23, 2018

Hi @lzl124631x

  • v6.1 was released 2018-04-13
  • It's a different case, valid point in area range should have both values, lower and upper. If one of them is nullified, then point on a chart is not rendered.
  • map collection is private, I will leave this up to @TorsteinHonsi
@lzl124631x

This comment has been minimized.

Copy link
Author

lzl124631x commented Apr 23, 2018

@pawelfus Thanks for your response.

It's a different case, valid point in area range should have both values, lower and upper. If one of them is nullified, then point on a chart is not rendered.

I understand this point. But my original thought was extending the arearange. Imagine it supports thresholds being Infinity/-Infinity, I don't need to switch to area any more; besides, arearange could support rendering the following chart.

image

And that's why I investigated how to contribute to highcharts and create a pull request for this feature.

@pawelfus

This comment has been minimized.

Copy link
Contributor

pawelfus commented Apr 24, 2018

@lzl124631x
Thank you for the image - now it's clear what you want to achieve. This is not exactly as your image, but good starting point: http://jsfiddle.net/BlackLabel/o8wmzw0a/20/ - point is not treated as null if one of high/low is defined.

@lzl124631x

This comment has been minimized.

Copy link
Author

lzl124631x commented Apr 25, 2018

@pawelfus
Thanks!

One more thing I wanted to achieve was to drop using area and to only use arearange. I felt that arearange is a superset of area. Area is just a special case where the upper/lower bound are Inifity/-Infinity. I don't want to care whether I should use area or arearange. For example, currently if I get data

lowerBound: [0, 1],
upperBound: [null, 0]

I need to use arearange. And current highcharts will not show the first range (-Infinity ~ 0) :(

But if I get data

lowerBound: [0, 1],
upperBound: [null, null]

I need to use area with threshold being -Infinity.

I don't want to branch between area/arearange depending on the data; just replace the nulls with Infinity/-Infinity and use arearange is good for me.

I'll try your code later. Hopefully it will allow me only use arearange for all input data.


About the jsfiddle:

To allow public access, please change http://code.highcharts.local/highcharts-more.js to http://code.highcharts.com/highcharts-more.js.

The code seems to use some internal fields/functions that I wasn't aware of. I'll have a try tomorrow.

Maybe unrelated, but this always evaluates to false.

if (0 && this.points[i + 1]) {
  point.plotX = this.points[i + 1].plotX;
}
@pawelfus

This comment has been minimized.

Copy link
Contributor

pawelfus commented Apr 25, 2018

Thanks! Updated jsFiddle demo. This if() always evaluates to false and should, I was playing around to get straight lines when point changes null->value but it's not working. We would need to add artificial points like this:

*--*--* <-- extra point
      |
      |
      *

But we have:

*--*
    \
     \
      *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.