pub use self::PlotOption::*;
pub use self::FillRegionType::*;
pub use self::AlignType::*;
pub use self::DashType::*;
pub use self::ArrowheadType::*;
pub use self::AutoOption::*;
pub use self::LabelOption::*;
pub use self::TickOption::*;
pub use self::Tick::*;
pub use self::BorderLocation2D::*;
pub use self::LegendOption::*;
pub use self::ContourStyle::*;
pub use self::PaletteType::*;
#[deriving(Copy)]
pub enum PlotOption<'l>
{
PointSymbol(char),
PointSize(f64),
Caption(&'l str),
LineWidth(f64),
Color(&'l str),
BorderColor(&'l str),
LineStyle(DashType),
FillAlpha(f64),
FillRegion(FillRegionType),
ArrowType(ArrowheadType),
ArrowSize(f64),
}
#[deriving(Copy)]
pub enum FillRegionType
{
Above,
Below,
Between
}
#[deriving(Copy)]
pub enum AlignType
{
AlignLeft,
AlignRight,
AlignCenter,
AlignTop,
AlignBottom
}
#[deriving(Copy)]
pub enum DashType
{
Solid,
SmallDot,
Dot,
Dash,
DotDash,
DotDotDash
}
impl DashType
{
pub fn to_int(&self) -> i32
{
match *self
{
Solid => 1,
SmallDot => 0,
Dash => 2,
Dot => 3,
DotDash => 4,
DotDotDash => 5
}
}
}
#[deriving(Copy)]
pub enum ArrowheadType
{
Open,
Closed,
Filled,
NoArrow,
}
#[deriving(Copy)]
pub enum AutoOption<T>
{
Fix(T),
Auto
}
impl<T> AutoOption<T>
{
pub fn map<U>(&self, func: |&T| -> U) -> AutoOption<U>
{
match *self
{
Fix(ref v) => Fix(func(v)),
Auto => Auto
}
}
}
#[deriving(Copy)]
pub enum LabelOption<'l>
{
TextOffset(f64, f64),
Font(&'l str, f64),
TextColor(&'l str),
Rotate(f64),
TextAlign(AlignType),
MarkerSymbol(char),
MarkerColor(&'l str),
MarkerSize(f64),
}
#[deriving(Copy)]
pub enum TickOption
{
OnAxis(bool),
Mirror(bool),
Inward(bool),
MinorScale(f64),
MajorScale(f64)
}
pub enum Tick<T>
{
Major(T, AutoOption<String>),
Minor(T)
}
#[deriving(Copy)]
pub enum BorderLocation2D
{
Bottom = 1,
Left = 2,
Top = 4,
Right = 8
}
#[deriving(Copy)]
pub enum LegendOption<'l>
{
Reverse,
Invert,
Horizontal,
Placement(AlignType, AlignType),
Title(&'l str),
MaxRows(u32),
MaxCols(u32),
}
#[deriving(Copy)]
pub enum ContourStyle
{
Linear,
Cubic(u32),
Spline(u32, u32)
}
#[deriving(Copy)]
pub enum PaletteType
{
Gray(f32),
Formula(i32, i32, i32),
CubeHelix(f32, f32, f32, f32),
}
pub const GRAY: PaletteType = Gray(1.0);
pub const COLOR: PaletteType = Formula(3, 11, 16);
pub const RAINBOW: PaletteType = Formula(33, 13, 10);
pub const HOT: PaletteType = Formula(34, 35, 36);
pub const HELIX: PaletteType = CubeHelix(0.5, -0.8, 2.0, 1.0);