Skip to content

Commit 4c941f2

Browse files
authored
Merge branch 'plotters-rs:master' into master
2 parents 527f3da + 87b286f commit 4c941f2

File tree

9 files changed

+41
-22
lines changed

9 files changed

+41
-22
lines changed

README.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,20 @@ To view the source code for each example, please click on the example image.
158158

159159
```sudo apt install pkg-config libfreetype6-dev libfontconfig1-dev```
160160

161+
### Fedora Linux
162+
163+
```sudo dnf install pkgconf freetype-devel fontconfig-devel```
164+
161165
## Quick Start
162166

163167
To use Plotters, you can simply add Plotters into your `Cargo.toml`
164168
```toml
165169
[dependencies]
166170
plotters = "0.3.3"
167171
```
172+
Create the subdirectory `<Cargo project dir>/plotters-doc-data`
168173

169-
And the following code draws a quadratic function. `src/main.rs`,
174+
And the following code draws a quadratic function. `src/main.rs` writes the chart to `plotters-doc-data/0.png`
170175

171176
```rust
172177
use plotters::prelude::*;
@@ -221,7 +226,7 @@ The feature `evcxr` should be enabled when including Plotters to Jupyter Noteboo
221226
The following code shows a minimal example of this.
222227

223228
```text
224-
:dep plotters = { version = "^0.3.6", default_features = false, features = ["evcxr", "all_series", "all_elements"] }
229+
:dep plotters = { version = "^0.3.6", default-features = false, features = ["evcxr", "all_series", "all_elements"] }
225230
extern crate plotters;
226231
use plotters::prelude::*;
227232
@@ -499,7 +504,7 @@ plotters = { git = "https://github.com/plotters-rs/plotters.git" }
499504

500505
### Reducing Depending Libraries && Turning Off Backends
501506
Plotters now supports use features to control the backend dependencies. By default, `BitMapBackend` and `SVGBackend` are supported,
502-
use `default_features = false` in the dependency description in `Cargo.toml` and you can cherry-pick the backend implementations.
507+
use `default-features = false` in the dependency description in `Cargo.toml` and you can cherry-pick the backend implementations.
503508

504509
- `svg` Enable the `SVGBackend`
505510
- `bitmap` Enable the `BitMapBackend`
@@ -508,16 +513,16 @@ For example, the following dependency description would avoid compiling with bit
508513

509514
```toml
510515
[dependencies]
511-
plotters = { git = "https://github.com/plotters-rs/plotters.git", default_features = false, features = ["svg"] }
516+
plotters = { git = "https://github.com/plotters-rs/plotters.git", default-features = false, features = ["svg"] }
512517
```
513518

514519
The library also allows consumers to make use of the [`Palette`](https://crates.io/crates/palette/) crate's color types by default.
515-
This behavior can also be turned off by setting `default_features = false`.
520+
This behavior can also be turned off by setting `default-features = false`.
516521

517522
### List of Features
518523

519524
This is the full list of features that is defined by `Plotters` crate.
520-
Use `default_features = false` to disable those default enabled features,
525+
Use `default-features = false` to disable those default enabled features,
521526
and then you should be able to cherry-pick what features you want to include into `Plotters` crate.
522527
By doing so, you can minimize the number of dependencies down to only `itertools` and compile time is less than 6s.
523528

RELEASE-NOTES.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ Thus, if plotters is imported with default feature set, there would require no c
5454
should be make with your `Crates.toml`:
5555

5656
```toml
57-
plotters = {version = "0.3", default_features = false, features = ["bitmap_backend", "svg_backend"]} # Instead of using feature "bitmap" and "svg"
57+
plotters = {version = "0.3", default-features = false, features = ["bitmap_backend", "svg_backend"]} # Instead of using feature "bitmap" and "svg"
5858
```
5959

6060
For non tier 1 backends, manmually import is required (Please note tier on backends can be imported in same way). For example:
6161

6262
```toml
63-
plotters = {version = "0.3", default_features = false} # Instead of having features = ["cairo"] at this point
63+
plotters = {version = "0.3", default-features = false} # Instead of having features = ["cairo"] at this point
6464
plotters-cairo = "0.3" # We should import the cairo backend in this way.
6565
```
6666

doc-template/readme.template.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The feature `evcxr` should be enabled when including Plotters to Jupyter Noteboo
6969
The following code shows a minimal example of this.
7070

7171
```text
72-
:dep plotters = { git = "https://github.com/plotters-rs/plotters", default_features = false, features = ["evcxr"] }
72+
:dep plotters = { git = "https://github.com/plotters-rs/plotters", default-features = false, features = ["evcxr"] }
7373
extern crate plotters;
7474
use plotters::prelude::*;
7575
@@ -242,7 +242,7 @@ plotters = { git = "https://github.com/plotters-rs/plotters.git" }
242242

243243
### Reducing Depending Libraries && Turning Off Backends
244244
Plotters now supports use features to control the backend dependencies. By default, `BitMapBackend` and `SVGBackend` are supported,
245-
use `default_features = false` in the dependency description in `Cargo.toml` and you can cherry-pick the backend implementations.
245+
use `default-features = false` in the dependency description in `Cargo.toml` and you can cherry-pick the backend implementations.
246246

247247
- `svg` Enable the `SVGBackend`
248248
- `bitmap` Enable the `BitMapBackend`
@@ -251,16 +251,16 @@ For example, the following dependency description would avoid compiling with bit
251251

252252
```toml
253253
[dependencies]
254-
plotters = { git = "https://github.com/plotters-rs/plotters.git", default_features = false, features = ["svg"] }
254+
plotters = { git = "https://github.com/plotters-rs/plotters.git", default-features = false, features = ["svg"] }
255255
```
256256

257257
The library also allows consumers to make use of the [`Palette`](https://crates.io/crates/palette/) crate's color types by default.
258-
This behavior can also be turned off by setting `default_features = false`.
258+
This behavior can also be turned off by setting `default-features = false`.
259259

260260
### List of Features
261261

262262
This is the full list of features that is defined by `Plotters` crate.
263-
Use `default_features = false` to disable those default enabled features,
263+
Use `default-features = false` to disable those default enabled features,
264264
and then you should be able to cherry-pick what features you want to include into `Plotters` crate.
265265
By doing so, you can minimize the number of dependencies down to only `itertools` and compile time is less than 6s.
266266

plotters-bitmap/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ image_encoder = ["image"]
3030
gif_backend = ["gif", "image_encoder"]
3131

3232
[dev-dependencies.plotters]
33-
default_features = false
33+
default-features = false
3434
features = ["ttf", "line_series", "bitmap_backend"]
3535
path = "../plotters"
3636

plotters-svg/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ debug = []
2626
bitmap_encoder = ["image"]
2727

2828
[dev-dependencies.plotters]
29-
default_features = false
29+
default-features = false
3030
features = ["ttf"]
3131
path = "../plotters"

plotters/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ path = "../plotters-backend"
2222

2323
[dependencies.plotters-bitmap]
2424
version = "0.3.6"
25-
default_features = false
25+
default-features = false
2626
optional = true
2727
path = "../plotters-bitmap"
2828

plotters/src/element/basic_shapes.rs

+14
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,20 @@ impl<Coord> Rectangle<Coord> {
418418
self.margin = (t, b, l, r);
419419
self
420420
}
421+
422+
/// Get the points of the rectangle
423+
/// - returns the element points
424+
pub fn get_points(&self) -> (&Coord, &Coord) {
425+
(&self.points[0], &self.points[1])
426+
}
427+
428+
/// Set the style of the rectangle
429+
/// - `style`: The shape style
430+
/// - returns a mut reference to the rectangle
431+
pub fn set_style<S: Into<ShapeStyle>>(&mut self, style: S) -> &mut Self {
432+
self.style = style.into();
433+
self
434+
}
421435
}
422436

423437
impl<'a, Coord> PointCollection<'a, Coord> for &'a Rectangle<Coord> {

plotters/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ The feature `evcxr` should be enabled when including Plotters to Jupyter Noteboo
362362
The following code shows a minimal example of this.
363363
364364
```text
365-
:dep plotters = { version = "^0.3.6", default_features = false, features = ["evcxr", "all_series", "all_elements"] }
365+
:dep plotters = { version = "^0.3.6", default-features = false, features = ["evcxr", "all_series", "all_elements"] }
366366
extern crate plotters;
367367
use plotters::prelude::*;
368368
@@ -640,7 +640,7 @@ plotters = { git = "https://github.com/plotters-rs/plotters.git" }
640640
641641
### Reducing Depending Libraries && Turning Off Backends
642642
Plotters now supports use features to control the backend dependencies. By default, `BitMapBackend` and `SVGBackend` are supported,
643-
use `default_features = false` in the dependency description in `Cargo.toml` and you can cherry-pick the backend implementations.
643+
use `default-features = false` in the dependency description in `Cargo.toml` and you can cherry-pick the backend implementations.
644644
645645
- `svg` Enable the `SVGBackend`
646646
- `bitmap` Enable the `BitMapBackend`
@@ -649,16 +649,16 @@ For example, the following dependency description would avoid compiling with bit
649649
650650
```toml
651651
[dependencies]
652-
plotters = { git = "https://github.com/plotters-rs/plotters.git", default_features = false, features = ["svg"] }
652+
plotters = { git = "https://github.com/plotters-rs/plotters.git", default-features = false, features = ["svg"] }
653653
```
654654
655655
The library also allows consumers to make use of the [`Palette`](https://crates.io/crates/palette/) crate's color types by default.
656-
This behavior can also be turned off by setting `default_features = false`.
656+
This behavior can also be turned off by setting `default-features = false`.
657657
658658
### List of Features
659659
660660
This is the full list of features that is defined by `Plotters` crate.
661-
Use `default_features = false` to disable those default enabled features,
661+
Use `default-features = false` to disable those default enabled features,
662662
and then you should be able to cherry-pick what features you want to include into `Plotters` crate.
663663
By doing so, you can minimize the number of dependencies down to only `itertools` and compile time is less than 6s.
664664

plotters/src/style/font/web.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl FontData for FontDataInternal {
3434
let body = document.body().unwrap();
3535
let span = document.create_element("span").unwrap();
3636
span.set_text_content(Some(text));
37-
span.set_attribute("style", &format!("display: inline-block; font-family:{}; font-size: {}px; position: fixed; top: 100%", self.0, size)).unwrap();
37+
span.set_attribute("style", &format!("display: inline-block; font-family:{}; font-style:{}; font-size: {}px; position: fixed; top: 100%", self.0, self.1, size)).unwrap();
3838
let span = span.into();
3939
body.append_with_node_1(&span).unwrap();
4040
let elem = JsCast::dyn_into::<HtmlElement>(span).unwrap();

0 commit comments

Comments
 (0)