forio / contour

Apache License 2.0
120 stars 21 forks source link

yAxis:tickValues receive function #253

Closed parikhshiv closed 7 years ago

parikhshiv commented 7 years ago

For issue #252 - allow user to pass in function to yAxis:tickValues parameter. See the following jsfiddle for usage - http://jsfiddle.net/a5L7x0c5/6/.

narenranjit commented 7 years ago

This only runs the function on initialization -- so if you ever call setData again you're basically stuck since there'll be no way to change the original values (for e.g. http://jsfiddle.net/a5L7x0c5/7)

The problem is worse if don't set initial data (http://jsfiddle.net/a5L7x0c5/8) -- in this case you'll never get tickvalues.

If we make this a function it'll need to be called at every render to be useful. What do you think?

drosen0 commented 7 years ago

The example in the fiddle can be done without a callback. Do you have an example use case for this that you couldn't do previously?

narenranjit commented 7 years ago

@drosen0 which fiddle? (and hi!)

drosen0 commented 7 years ago

Hi @narenranjit and @parikhshiv! I could see making tickValues a callback if there were something about the data that could only be inferred at render-time. See these fiddles:

jaimedp commented 7 years ago

FYI I'm exploring a setup where any parameter in the config object can be a function and will be invoked just before rendering.

narenranjit commented 7 years ago

Closing in favor of a more general solution.