Giter VIP home page Giter VIP logo

Comments (7)

palerdot avatar palerdot commented on May 31, 2024 1

@TrieBr This is the behaviour of d3.interpolateHsl. To quote d3 -

Returns an HSL color space interpolator between the two colors a and b. The colors a and b need not be in HSL; they will be converted to HSL using d3.hsl. 

I agree it is confusing. I will try to accomodate all the d3 interpolators - hcl, hsl, rgb etc so that users can select the interpolator of their choice, in upcoming versions.

from react-d3-speedometer.

palerdot avatar palerdot commented on May 31, 2024

Hi @TrieBr. Start and end color are not discrete colors to be swapped. They form the start and end of all the intermediate gradient colors. Internally, the colors are interpolated from start color to end color. For example, if you draw 1000 segments with start color as pink and end color as yellow, you will see a very fine grained scale gradually starting with start color and ending with end color. Internally, it uses d3 interpolate - https://github.com/d3/d3-interpolate#interpolate.

from react-d3-speedometer.

TrieBr avatar TrieBr commented on May 31, 2024

@palerdot Can you please further explain. You explained that the color will start at pink and then end at yellow. So I would expect if I swapped them then it would start at yellow and end at pink. But in this case its starting at yellow+1 shade to pink+1 shade

from react-d3-speedometer.

palerdot avatar palerdot commented on May 31, 2024

can you tell what you mean by yellow + 1 shade? do you have the color code and some kind of fiddle to show the shades you are describing?

from react-d3-speedometer.

TrieBr avatar TrieBr commented on May 31, 2024

Look at the screenshots. The first speedometer starts on a darker shade of green than the rightmost green on the second speedometer . Same with the other color. The first one ends one shade lighter (It doesn't include the dark red you see on the second one). It seems to me that if I use exactly opposite color ranges, then the speedometer's should have exactly the opposite color range, but that is not the case.

from react-d3-speedometer.

palerdot avatar palerdot commented on May 31, 2024

@TrieBr I could reproduce the issue you are mentioning. I'm reopening this to inspect if this is the behaviour of d3.interpolateHSL and update this issue.

from react-d3-speedometer.

palerdot avatar palerdot commented on May 31, 2024

@TrieBr There is a new option available in 0.6.0 version with segmentColors option/prop, with which we can give custom segment colors. This option gives more control over segment colors. Here is a sample sandbox - https://codesandbox.io/embed/relaxed-silence-c3qkb

from react-d3-speedometer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.