Skip to content
Timothy M. Shead edited this page Jan 20, 2016 · 5 revisions

The code can manipulate styles in any of three layers:

  • In the canvas/axes code, before the axes/mark is created.
  • In the axes/mark constructor, when instantiated.
  • In the HTML code, when the axes/mark is rendered.

We've been very inconsistent in how we choose where to set style 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 constructors.
  • Where there are context-specific defaults - e.g. when the defaults for a matrix visualization differ from a set of generic 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.
Clone this wiki locally