Empirical
|
#include <axis.h>
Public Member Functions | |
Axis (std::string type, std::string label="") | |
Axis & | Draw (Selection &selection) |
template<typename T > | |
Axis & | ApplyAxis (const SelectionOrTransition< T > &selection) |
Axis & | SetScale (SCALE_TYPE &scale) |
SCALE_TYPE & | GetScale () |
Get a reference to this object's scale. More... | |
Axis & | AdjustLabelOffset (std::string offset) |
Axis & | Move (int x, int y) |
template<typename T , std::size_t SIZE> | |
Axis & | SetTickValues (emp::array< T, SIZE > values) |
Axis & | SetTickSize (float size) |
Axis & | SetTickSizeInner (float size) |
Axis & | SetTickSizeOuter (float size) |
Axis & | SetTickPadding (int padding) |
Axis & | SetTicks (int count) |
Set the number of ticks along the axis. More... | |
Axis & | SetTickFormat (std::string format) |
template<typename T > | |
Axis & | Rescale (double new_min, double new_max, const D3::SelectionOrTransition< T > &svg) |
int | GetID () const |
void | Log () const |
Public Attributes | |
Selection | group |
Protected Attributes | |
int | id |
Axis objects are in charge of drawing graphical axes onto svg canvases. An axis depicts a scale, so every axis has a scale, and is templated off of the type of that scale.
|
inline |
Consruct an axis - this doesn't draw anything yet, but sets up the necessary infrastructure to draw it when you call the Draw method. Optionally takes a label to label the axis with. This label will also be used to create an id for the axis, to make it easier to select it later. The id will be the same as [label], but with all whitespace removed and "_axis" appended to the end.
For example, if your label was "Per capita mortality", you could select the axis with: D3::Select("#Percapitamortality_axis");
.
|
inline |
Adjust the location of the label text relative to the axis (helpful if numbers are overlapping it). Can be negative. Use "em" (e.g. "2em") to specify distance relative to font size.
|
inline |
|
inline |
Draw axis on [selection] (must contain a single SVG element) with intelligent default positioning
|
inlineinherited |
|
inline |
Get a reference to this object's scale.
|
inlineinherited |
|
inline |
Draw tries to make a good guess about where to place the axis, but sometimes you want to scoot it over. This method will move the axis to the x,y location specified.
|
inline |
Adjust scale and axis to accomodate the new range of data specified by [new_min], and [new_max]. [svg] is a Selection or Transition containing the current axis. If it's a transition, then the rescaling will be animated.
|
inline |
An axis must have a scale. By default, a scale of SCALE_TYPE will be constructed, but usually you want an axis to depict a specific scale. This method points this object's scale member variable at [scale].
|
inline |
Set the format for displaying numbers assoiated with ticks. [format] should be a format following the rules for d3.format()
|
inline |
|
inline |
Set the number of ticks along the axis.
|
inline |
|
inline |
|
inline |
|
inline |
There are a lot of graphical elements associated with an axis, so it's best to group them all together into an html group element. This selection holds a pointer to the group for this axis
|
protectedinherited |