Struct ::exo::dom::ChartData

Overview

ChartData dom node.

This node is used inside a dom to display a custom chart data. Supported fields of this node are:

  • id: The id of this node
  • name: The name to display
  • status: The stati where the node should be shown
  • rights: One of the rights needed to show the node
  • edit: Defines the edit state of the node
  • sql: The sql query to create the ChartData TODO
  • value: The default/fallback value

Within the layouter this ChartData can be used like this:

<chart id="ChartData_123" name="Your Data" typ="doughnut" collapsed>
 <chart-data sql="SELECT count(ident) FROM user;" />
</chart>

Methods

fn new() -> ChartData

Creates a new ChartData.

Example

let node = exo::dom::ChartData::new();
node.value = 1.23;

Protocols

protocol get color
let output = value.color

Allows a get operation to work.

protocol set color
value.color = input

Allows a set operation to work.

protocol partial_eq
if value == b { }

Allows for partial equality operations to work.

protocol string_debug
println("{:?}", value)

Allows the value to be debug printed.

protocol string_display
println("{}", value)

Allows the value to be display printed.

protocol get id
let output = value.id

Get the id of the node as String. A node Id should be unique inside the complete dom.

Example

let node = exo::dom::ChartData::new();
node.id = "id_123456";
assert_eq!(node.id, "id_123456");
protocol set id
value.id = input

Set the id of the node as String. A node Id should be unique inside the complete dom.

Example

let node = exo::dom::ChartData::new();
node.id = "id_123456";
assert_eq!(node.id, "id_123456");
protocol get name
let output = value.name

Get the name of the node as String. The name is used to display a title or main text.

Example

let node = exo::dom::ChartData::new();
node.name = "Click Here";
assert_eq!(node.name, "Click Here");
protocol set name
value.name = input

Get the name of the node as String. The name is used to display a title or main text.

Example

let node = exo::dom::ChartData::new();
node.name = "Click Here";
assert_eq!(node.name, "Click Here");
protocol get status
let output = value.status

Get the different status of the node as Vec<String>. This node and all it's child will only be displayed, when no status is set or the record has any of the given stati.

Example

let node = exo::dom::ChartData::new();
node.status = ["new", "released"];
assert!(node.status.iter().any(|s| s == "new"));
protocol set status
value.status = input

Set the status of the node as Vec<String>. This node and all it's child will only be displayed, when no status is set or the record has any of the given stati.

Example

let node = exo::dom::ChartData::new();
node.status = ["new", "released"];
assert!(node.status.iter().any(|s| s == "new"));
protocol get edit
let output = value.edit

Get the edit status of the node as Option<bool>. The edit mode can be set as true or false. When the edit mode is not set, it takes the system edit state.

Example

let node = exo::dom::ChartData::new();
node.edit = Some(false);
assert_eq!(node.edit, Some(false));
protocol set edit
value.edit = input

Set the edit status of the node as Option<bool>. The edit mode can be set as true or false. When the edit mode is not set, it takes the system edit state.

Example

let node = exo::dom::ChartData::new();
node.edit = Some(false);
assert_eq!(node.edit, Some(false));
protocol get style
let output = value.style

Get the style of the node as String.

Example

let node = exo::dom::ChartData::new();
node.style = "color: red;";
assert_eq!(node.style, "color: red;");
protocol set style
value.style = input

Set the style of the node as String.

Example

let node = exo::dom::ChartData::new();
node.style = "color: red;";
assert_eq!(node.style, "color: red;");
protocol get rights
let output = value.rights

Get the different rights of the node as Vec<String>. This node and all it's child will only be displayed, when no rights are set or the user has one of the rights.

Example

let node = exo::dom::ChartData::new();
node.rights = ["user_right", "can_release"];
assert!(node.rights.iter().any(|s| s == "can_release"));
protocol set rights
value.rights = input

Get the different rights of the node as Vec<String>. This node and all it's child will only be displayed, when no rights are set or the user has one of the rights.

Example

let node = exo::dom::ChartData::new();
node.rights = ["user_right", "can_release"];
assert!(node.rights.iter().any(|s| s == "can_release"));
protocol get value
let output = value.value

Get the default value.

Example

let node = exo::dom::ChartData::new();
node.value = 1.23;
assert_eq!(node.value, 1.23);
protocol set value
value.value = input

Set the default value.

Example

let node = exo::dom::ChartData::new();
node.value = 1.23;
assert_eq!(node.value, 1.23);