-
Notifications
You must be signed in to change notification settings - Fork 39
Where Styles Live
Timothy M. Shead edited this page Jan 11, 2016
·
5 revisions
The code can manipulate styles in any of three layers:
- In the canvas/axes code, before a mark is created.
- In the mark code, when the mark is instantiated.
- In the HTML code, when the mark is rendered.
We haven't been consistent about where to implement defaults, so here are some guidelines to help cleanup the mess:
- Wherever possible, set default styles - such as the default axis label font size - in the axes / mark instantiation code.
- Where there are context-specific defaults - such as the defaults for a matrix visualization which are different from a generic set of table axes - set them in the canvas/axes code.
- Ideally, the HTML rendering code should never have to supply default styles (there are a handful of exceptions, where the defaults are implicitly affected by other parameters, such as cartesian axis spine position). Rationale: this code may be executed multiple times to create multiple versions of a figure. Also, there could be other backends in the future, and they shouldn't have to replicate more functionality than absolutely necessary.