1
+ use rust_xlsxwriter as xlsx;
2
+ use wasm_bindgen:: prelude:: * ;
3
+
4
+ use crate :: wrapper:: color:: Color ;
5
+
6
+ /// The `ChartSolidFill` struct represents a solid fill for chart elements.
7
+ ///
8
+ /// The `ChartSolidFill` struct is used to define the solid fill properties
9
+ /// for chart elements such as plot areas, chart areas, data series, and other
10
+ /// fillable elements in a chart.
11
+ ///
12
+ /// It is used in conjunction with the {@link Chart} struct.
13
+ #[ wasm_bindgen]
14
+ pub struct ChartSolidFill {
15
+ pub ( crate ) inner : xlsx:: ChartSolidFill ,
16
+ }
17
+
18
+ #[ wasm_bindgen]
19
+ impl ChartSolidFill {
20
+ /// Create a new `ChartSolidFill` object.
21
+ #[ wasm_bindgen( constructor) ]
22
+ pub fn new ( ) -> ChartSolidFill {
23
+ ChartSolidFill {
24
+ inner : xlsx:: ChartSolidFill :: new ( ) ,
25
+ }
26
+ }
27
+
28
+ /// Set the color of a solid fill.
29
+ ///
30
+ /// @param {Color} color - The color property.
31
+ /// @return {ChartSolidFill} - The ChartSolidFill instance.
32
+ #[ wasm_bindgen( js_name = "setColor" ) ]
33
+ pub fn set_color ( mut self , color : & Color ) -> ChartSolidFill {
34
+ self . inner . set_color ( color. inner ) ;
35
+ self
36
+ }
37
+
38
+ /// Set the transparency of a solid fill.
39
+ ///
40
+ /// Set the transparency of a solid fill color for a Chart element.
41
+ /// You must also specify a fill color in order for the transparency to be applied.
42
+ ///
43
+ /// @param {number} transparency - The color transparency in the range 0-100.
44
+ /// @return {ChartSolidFill} - The ChartSolidFill instance.
45
+ #[ wasm_bindgen( js_name = "setTransparency" ) ]
46
+ pub fn set_transparency ( mut self , transparency : u8 ) -> ChartSolidFill {
47
+ self . inner . set_transparency ( transparency) ;
48
+ self
49
+ }
50
+ }
0 commit comments