1
1
use crate :: {
2
2
element:: { Drawable , PointCollection } ,
3
- style:: { IntoFont , RGBColor , TextStyle , BLACK } ,
3
+ style:: { IntoFont , RGBAColor , TextStyle , BLACK } ,
4
4
} ;
5
5
use plotters_backend:: { BackendCoord , DrawingBackend , DrawingErrorKind } ;
6
6
use std:: { error:: Error , f64:: consts:: PI , fmt:: Display } ;
@@ -24,7 +24,7 @@ pub struct Pie<'a, Coord, Label: Display> {
24
24
center : & ' a Coord , // cartesian coord
25
25
radius : & ' a f64 ,
26
26
sizes : & ' a [ f64 ] ,
27
- colors : & ' a [ RGBColor ] ,
27
+ colors : & ' a [ RGBAColor ] ,
28
28
labels : & ' a [ Label ] ,
29
29
total : f64 ,
30
30
start_radian : f64 ,
@@ -40,7 +40,7 @@ impl<'a, Label: Display> Pie<'a, (i32, i32), Label> {
40
40
center : & ' a ( i32 , i32 ) ,
41
41
radius : & ' a f64 ,
42
42
sizes : & ' a [ f64 ] ,
43
- colors : & ' a [ RGBColor ] ,
43
+ colors : & ' a [ RGBAColor ] ,
44
44
labels : & ' a [ Label ] ,
45
45
) -> Self {
46
46
// fold iterator to pre-calculate total from given slice sizes
@@ -69,7 +69,7 @@ impl<'a, Label: Display> Pie<'a, (i32, i32), Label> {
69
69
/// Default is set to start at 0, which is aligned on the x axis.
70
70
/// ```
71
71
/// use plotters::prelude::*;
72
- /// let mut pie = Pie::new(&(50,50), &10.0, &[50.0, 25.25, 20.0, 5.5], &[RED, BLUE, GREEN, WHITE], &["Red", "Blue", "Green", "White"]);
72
+ /// let mut pie = Pie::new(&(50,50), &10.0, &[50.0, 25.25, 20.0, 5.5], &[RED.to_rgba() , BLUE.to_rgba() , GREEN.to_rgba() , WHITE.to_rgba() ], &["Red", "Blue", "Green", "White"]);
73
73
/// pie.start_angle(-90.0); // retract to a right angle, so it starts aligned to a vertical Y axis.
74
74
/// ```
75
75
pub fn start_angle ( & mut self , start_angle : f64 ) {
0 commit comments