scales.hpp

Tools for scaling graph axes in D3.

namespace D3

Functions

PowScale SqrtScale()
class Scale : public D3::D3_Base
#include <scales.hpp>

Scales in D3 are functions that take input values and map them to output based on a scaling function. They are often used to map data calues to x, y coordinates in pixels describing where on the screen elements should be placed. This is a base class to inherit from - should never be made stand-alone

Subclassed by D3::IdentityScale, D3::QuantizeScale

Public Functions

inline Scale()
inline Scale(bool derived)

Decoy constructor so we don’t construct extra base scales.

template<typename T, size_t SIZE>
inline Scale &SetRange(array<T, SIZE> values)

Set the output values corresponding to values in the domain. Output for values in between will be interpolated with a function determined by the type of the scale. Array should contain same number of elements as the one used to set the domain.

inline Scale &SetRange(double min, double max)
template<typename T, size_t SIZE>
inline Scale &SetDomain(array<T, SIZE> values)

Set the input values corresponding to values in the range. Array should contain same number of elements as the one used to set the range.

inline Scale &SetDomain(double min, double max)
inline Scale Copy()

Make a copy of this scale.

inline double ApplyScale(double input)

Calculate the ouput for [input], based on the scale’s scaling function.

inline int ApplyScale(int input)
inline std::string ApplyScaleString(double input)

Calculate the ouput for [input], based on the scale’s scaling function.

Protected Functions

inline Scale(int id)
class QuantizeScale : public D3::Scale
#include <scales.hpp>

Subclassed by D3::OrdinalScale, D3::QuantileScale, D3::ThresholdScale

Public Functions

inline QuantizeScale()
inline QuantizeScale(bool derived)
template<typename T>
inline double InvertExtent(T y)
class QuantileScale : public D3::QuantizeScale
#include <scales.hpp>

Public Functions

inline QuantileScale()
inline QuantileScale(bool derived)
class ThresholdScale : public D3::QuantizeScale
#include <scales.hpp>

Public Functions

inline ThresholdScale()
inline ThresholdScale(bool derived)
class IdentityScale : public D3::Scale
#include <scales.hpp>

Subclassed by D3::LinearScale

Public Functions

inline IdentityScale()
inline IdentityScale(bool derived)
template<typename T>
inline double Invert(T y)
inline IdentityScale &SetTicks(int count)
inline IdentityScale &SetTickFormat(int count, std::string format)
class LinearScale : public D3::IdentityScale
#include <scales.hpp>

Subclassed by D3::LogScale, D3::PowScale, D3::TimeScale

Public Functions

inline LinearScale()
inline LinearScale(bool derived)
template<typename T, size_t SIZE>
inline LinearScale &SetRangeRound(array<T, SIZE> values)
inline LinearScale &SetRangeRound(double min, double max)
inline LinearScale &SetInterpolate(std::string factory)
inline LinearScale &Clamp(bool clamp)
inline LinearScale &Nice(int count = -1)
class LogScale : public D3::LinearScale
#include <scales.hpp>

Public Functions

inline LogScale()
inline LogScale(bool derived)
class PowScale : public D3::LinearScale
#include <scales.hpp>

Public Functions

inline PowScale()
inline PowScale(bool derived)
inline PowScale &Exponent(double ex)
class TimeScale : public D3::LinearScale
#include <scales.hpp>

Public Functions

inline TimeScale()
inline TimeScale(bool derived)
class OrdinalScale : public D3::QuantizeScale
#include <scales.hpp>

Public Functions

inline OrdinalScale()
inline OrdinalScale(bool derived)
class Category10Scale : private D3::D3_Base
#include <scales.hpp>

Public Functions

inline Category10Scale()
class Category20Scale : private D3::D3_Base
#include <scales.hpp>

Public Functions

inline Category20Scale()
class Category20bScale : private D3::D3_Base
#include <scales.hpp>

Public Functions

inline Category20bScale()
class Category20cScale : private D3::D3_Base
#include <scales.hpp>

Public Functions

inline Category20cScale()

Protected Attributes

int id