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

Use min_value as the lower boundary domain value #32

Open
qur786 opened this issue Apr 29, 2022 · 2 comments
Open

Use min_value as the lower boundary domain value #32

qur786 opened this issue Apr 29, 2022 · 2 comments

Comments

@qur786
Copy link
Contributor

qur786 commented Apr 29, 2022

@g1eb Can we use minimum value calculated from the data that we process and use them to generate color code generator instead of passing (-0.15 * max_value) as the lower value for the domain.

.attr('fill', d => {
        let color = d3.scaleLinear()
          .range(['#ffffff', this.props.color])
          .domain([-0.15 * max_value, max_value])
        return color(d.total) || '#ff4500'
      })

And can you explain the reason, if any, behind using (-0.15 * max_value) as the lower value in the domain.

@g1eb
Copy link
Owner

g1eb commented Apr 29, 2022

Ah, I believe that was because I was originally dealing with skewed data, meaning that values were not normally distributed, some really high but most of them very low and this would result in a visualization where you could barely see any colors or difference between dates.

I see your point though, perhaps we can do something smarter here. I'm thinking along the lines of using min_value and max_value as you suggested but adding in some kind of logic to make sure the colors are not all #ffffff for the dates with low values..

@qur786
Copy link
Contributor Author

qur786 commented May 2, 2022

Ah, I believe that was because I was originally dealing with skewed data, meaning that values were not normally distributed, some really high but most of them very low and this would result in a visualization where you could barely see any colors or difference between dates.

I see your point though, perhaps we can do something smarter here. I'm thinking along the lines of using min_value and max_value as you suggested but adding in some kind of logic to make sure the colors are not all #ffffff for the dates with low values..

thank you @g1eb for the reply. We'll try to use your logic to implement.

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

No branches or pull requests

2 participants