openpine_vm/visuals/
label.rs1use openpine_compiler::instructions::Color;
2use openpine_macros::Enum;
3use serde::{Deserialize, Serialize};
4
5use crate::visuals::{FontFamily, HorizontalAlign, TextFormatting, XLocation, YLocation};
6
7#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Enum, Serialize, Deserialize)]
9#[openpine(rename_all = "snake")]
10pub enum LabelStyle {
11 None,
13 #[openpine(name = "arrowdown")]
15 ArrowDown,
16 #[openpine(name = "arrowup")]
18 ArrowUp,
19 Circle,
21 Cross,
23 Diamond,
25 Flag,
27 LabelCenter,
29 #[default]
31 LabelDown,
32 LabelLeft,
34 LabelLowerLeft,
36 LabelLowerRight,
38 LabelRight,
40 LabelUp,
42 LabelUpperLeft,
44 LabelUpperRight,
46 Square,
48 TextOutline,
50 #[openpine(name = "triangledown")]
52 TriangleDown,
53 #[openpine(name = "triangleup")]
55 TriangleUp,
56 #[openpine(name = "xcross")]
58 XCross,
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63pub struct Label {
64 pub x: i64,
66 pub y: f64,
68 pub text: String,
70 pub xloc: XLocation,
72 pub yloc: YLocation,
74 pub color: Option<Color>,
76 pub style: LabelStyle,
78 pub text_color: Option<Color>,
80 pub size: u32,
82 pub text_align: HorizontalAlign,
84 pub tooltip: Option<String>,
86 pub text_font_family: FontFamily,
88 pub force_overlay: bool,
90 pub text_formatting: TextFormatting,
92}