JustinGOSSES / wellioviz

d3.js v5 visualization of well logs
https://justingosses.github.io/wellioviz/#introduction
Apache License 2.0
51 stars 12 forks source link

pass through function for color fill instead of just array #51

Open kernant opened 4 years ago

kernant commented 4 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

JustinGOSSES commented 4 years ago

Resources for later: https://stackoverflow.com/questions/41848677/how-to-make-a-color-scale-in-d3-js-to-use-in-fill-attribute

https://github.com/d3/d3-scale-chromatic

The fill variable is currently fill: Array(1) [ 0: Object {curve_name: "RHOB", fill: "yes", fill_direction: "left", cutoffs: Array(3), fill_colors: Array(3), curve2: ""} ] and takes string....what will need to be changed for it to also take a function in place of the string like: var colors = d3.scaleQuantize() .domain([0,50]) .range(["#5E4FA2", "#3288BD", "#66C2A5", "#ABDDA4", "#E6F598", "#FFFFBF", "#FEE08B", "#FDAE61", "#F46D43", "#D53E4F", "#9E0142"]);