-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca33378
commit 8c25ab6
Showing
9 changed files
with
236 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use charming::{ | ||
component::{AngleAxis, Legend, PolarCoordinate, RadiusAxis, Title}, | ||
element::{AxisPointer, AxisPointerType, AxisType, CoordinateSystem, Tooltip, Trigger}, | ||
series::Line, | ||
Chart, | ||
}; | ||
|
||
pub fn chart() -> Chart { | ||
let data = (0..=360) | ||
.into_iter() | ||
.map(|i| { | ||
let t = i as f64 / 180.0 * std::f64::consts::PI; | ||
let r = (2.0 * t).sin() * (2.0 * t).cos(); | ||
vec![r, i as f64] | ||
}) | ||
.collect::<Vec<_>>(); | ||
|
||
Chart::new() | ||
.title(Title::new().text("Two Value-Axes in Polar")) | ||
.legend(Legend::new().data(vec!["line"])) | ||
.polar(PolarCoordinate::new().center(vec!["50%", "54%"])) | ||
.tooltip( | ||
Tooltip::new() | ||
.trigger(Trigger::Axis) | ||
.axis_pointer(AxisPointer::new().type_(AxisPointerType::Cross)), | ||
) | ||
.angle_axis(AngleAxis::new().type_(AxisType::Value).start_angle(0)) | ||
.radius_axis(RadiusAxis::new().min(0)) | ||
.series( | ||
Line::new() | ||
.name("line") | ||
.coordinate_system(CoordinateSystem::Polar) | ||
.show_symbol(false) | ||
.data(data), | ||
) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.