giraffe icon indicating copy to clipboard operation
giraffe copied to clipboard

Ticks generator: allow tick marks to be generated with a function

Open TCL735 opened this issue 4 years ago • 1 comments

Currently, axis ticks can be specified with an array in the configuration properties.

As a user, if I want to generate tick marks dynamically based on the domain (or some other properties), then I would have to do this within my own app and update the array as needed. It would be easier if Giraffe could do all of the heavy lifting and allow the use of a callback function to generate the ticks. Giraffe's role would be to validate the result of this function and have a sensible fallback.

This callback function should be given access to the domain and also several of the other tick-related properties. Ideally, the callback function should have access to:

  • domain
  • total ticks option
  • tick step option
  • tick interval option
  • scaling function (the actual function itself and not just the string "log" or "linear")

This callback function always returns an array of tick marks, similar to the ticks array option. When both are present, the function should override and take precedence.

The biggest use case for this feature is in logarithmic scale because:

  • tick marks for logarithmic scale can vary widely, based on what the user is trying to see with the visualization
  • the existing tick step option is linear and does not handle logarithmic scale
  • the default tick marks generated by Giraffe are unappealing: its logic/pattern is opaque and hard to understand and it chooses tick marks at seemingly strange values

TCL735 avatar Mar 03 '21 01:03 TCL735

Note: this has nothing to do with negative domain values using logarithmic scale.

Negative domain values with logarithmic scale are not in scope for this issue.

Please make a separate issue for negative domain values using logarithmic scale.

TCL735 avatar Mar 03 '21 02:03 TCL735