How to interpolate a line with a custom Function type? #4282
-
Hi everybody, is there a way to use a custom function to interpolate a line? Going more in deep, I have a composed chart with two components: a Scatter and a Line. The Scatter has a few points, while the line has to be interpolated with this sigmoid: Y=Bottom + (X^Hillslope)*(Top-Bottom)/(X^HillSlope + EC50^HillSlope) (https://www.graphpad.com/guides/prism/9/curve-fitting/REG_DR_stim_variable_2.htm) The result would be something like this: Instead of computing all the line points before with a BE function outside the chart, is there a way to give only the 5 points of the Scatter and to make the chart retrieve the line points following the sigmoid above? Here's the code of the images I shared. Thank you! :)
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi, Most of the time everything is going to be about your data. I would say its simpler just to pre-compute rather than to rely on something internal to recharts/d3. But, I think you should be able to do this. I'm not great at math so I'll leave that to you, but
I think this should be able to be accomplished with https://d3js.org/d3-shape/curve#custom-curves |
Beta Was this translation helpful? Give feedback.
Oh weird, looks like it didn't save right. All I was doing was adding a function in the "type" field like so:
That's basically where you would do your math and then return a custom curve generator