influxdata / giraffe

A foundation for visualizations in the InfluxDB UI
https://influxdata.github.io/giraffe/
MIT License
183 stars 33 forks source link

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

Open TCL735 opened 3 years ago

TCL735 commented 3 years ago

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:

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:

TCL735 commented 3 years ago

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.