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

Highmaps: Add option to provide custom colorAxis interpolation function #9350

Closed
cscgrad opened this issue Nov 7, 2018 · 5 comments
Closed
Labels
Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur. Type: Feature Request Used when a new feature is requested either directly or indirectly

Comments

@cscgrad
Copy link

cscgrad commented Nov 7, 2018

Expected behaviour

I'm looking for the ability to provide a custom function that calculates data classes on-the-fly (similar to how the built-in linear and logarithmic interpolation options work) to be used to shade map. As a workaround, I'm able to make it work using:

    highChartMap.colorAxis[0].update({
        dataClasses: colorAxisDataClasses
    }, true);

But the rendering becomes choppy when there are a lot of map regions/data points, so I was thinking it would perform faster if I could substitute my own interpolation function.

Product version

Highmaps 6.1.3

@KacperMadej
Copy link
Contributor

Hi @cscgrad

Thank you for submitting the enhancement idea.

@KacperMadej KacperMadej added the Type: Feature Request Used when a new feature is requested either directly or indirectly label Nov 8, 2018
@pawelfus
Copy link
Contributor

Hi @cscgrad

Could you share your demo (e.g. in jsFiddle or any other sandbox)? I'm not sure about this choppy rendering.

At this moment, it should be possible by simple value normalization, something like this:

Highcharts.wrap(
  Highcharts.ColorAxis.prototype,
  'normalizedValue', 
  function (proceed, value) {
    var normalized = myInterpolation(value);
    return proceed.apply(this, normalized);
  }
);

(note: code not tested, simple example appreciated )

@cscgrad
Copy link
Author

cscgrad commented Dec 7, 2018

Hi @pawelfus

My scenario is a multi-level drill-down map (The top-level is the US National map, then the county-level map, and finally the zip-level map). I'm looking to generate dynamic color axis data classes (that support null values) based on the series data. The computation for the dynamic data classes (or ranges) is based on quantiles. I have it working exactly as I want it to, but I was hoping that it could render faster if I could somehow perform the dynamic data class computation internal to highmaps v.s. externally as shown in the example below (the calls to updateMapColorAxis( ) as well as the initial call to getColorAxisDataClasses). I think it would be really cool if you could add a feature like this into highmaps.

Here's the simplest I could make it:
https://jsfiddle.net/254dmbxh/1/

Any suggestions would be appreciated.

@pawelfus
Copy link
Contributor

Thank you for the example! Now I understand the issue - you need customization for dataClasses - I misunderstood your first post, sorry. My idea posted above based on gradient-based colorAxis.

In general, what you did makes sense. If you want to show dataClasses then you need to update colorAxis anyway, I don't think it makes sense to provide specialized API for just drilldown+dataClasses change when colorAxis.update() sorts out the issue. I suggest to create an idea on our UserVoice - if the idea gather more votes it will be implemented :)

Thanks!

@stale
Copy link

stale bot commented Jun 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

@stale stale bot added the Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur. label Jun 10, 2020
@stale stale bot closed this as completed Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur. Type: Feature Request Used when a new feature is requested either directly or indirectly
Projects
None yet
Development

No branches or pull requests

4 participants