diff --git a/README-zh.md b/README-zh.md index eb0a688..d67640c 100644 --- a/README-zh.md +++ b/README-zh.md @@ -207,6 +207,6 @@ get_or_try_init_fonts(vec![&buf])); ## 开源协议声明 -This project is licensed under the [Apache License 2.0 license]. +This project is licensed under the [MPL-2.0 license]. -[Apache License 2.0 license]: https://github.com/vicanso/charts-rs/blob/main/LICENSE +[MPL-2.0 license]: https://github.com/vicanso/charts-rs/blob/main/LICENSE diff --git a/README.md b/README.md index bdbdcc7..8f2f28f 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,6 @@ get_or_try_init_fonts(vec![&buf])); ## License -This project is licensed under the [Apache License 2.0 license]. +This project is licensed under the [MPL-2.0 license]. -[Apache License 2.0 license]: https://github.com/vicanso/charts-rs/blob/main/LICENSE +[MPL-2.0 license]: https://github.com/vicanso/charts-rs/blob/main/LICENSE diff --git a/src/charts.rs b/src/charts.rs index 2daaafa..6b196c4 100644 --- a/src/charts.rs +++ b/src/charts.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + mod bar_chart; mod candlestick_chart; mod canvas; diff --git a/src/charts/bar_chart.rs b/src/charts/bar_chart.rs index 4305b07..a09b6b2 100644 --- a/src/charts/bar_chart.rs +++ b/src/charts/bar_chart.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::canvas; use super::color::*; use super::common::*; diff --git a/src/charts/candlestick_chart.rs b/src/charts/candlestick_chart.rs index 74d9293..7fea89b 100644 --- a/src/charts/candlestick_chart.rs +++ b/src/charts/candlestick_chart.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::canvas; use super::color::*; use super::common::*; diff --git a/src/charts/canvas.rs b/src/charts/canvas.rs index 51733d6..6a98205 100644 --- a/src/charts/canvas.rs +++ b/src/charts/canvas.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::component::{ generate_svg, Arrow, Axis, Bubble, Circle, Component, Grid, Legend, Line, Pie, Polygon, Polyline, Rect, SmoothLine, SmoothLineFill, StraightLine, StraightLineFill, Text, LEGEND_WIDTH, diff --git a/src/charts/color.rs b/src/charts/color.rs index 65472be..3565117 100644 --- a/src/charts/color.rs +++ b/src/charts/color.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use serde::{Deserialize, Serialize}; use substring::Substring; diff --git a/src/charts/common.rs b/src/charts/common.rs index 1282621..372539e 100644 --- a/src/charts/common.rs +++ b/src/charts/common.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::{Box, Color}; use crate::Point; use serde::{Deserialize, Serialize}; diff --git a/src/charts/component.rs b/src/charts/component.rs index fc3d7f3..163df25 100644 --- a/src/charts/component.rs +++ b/src/charts/component.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use serde::{Deserialize, Serialize}; use snafu::{ResultExt, Snafu}; use std::fmt; diff --git a/src/charts/encoder.rs b/src/charts/encoder.rs index 07af33f..f18533d 100644 --- a/src/charts/encoder.rs +++ b/src/charts/encoder.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use image::ImageFormat; use once_cell::sync::OnceCell; use resvg::{tiny_skia, usvg}; diff --git a/src/charts/font.rs b/src/charts/font.rs index 9a1536d..2f03734 100644 --- a/src/charts/font.rs +++ b/src/charts/font.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::util::*; use fontdue::layout::{CoordinateSystem, Layout, TextStyle}; use fontdue::Font; diff --git a/src/charts/heatmap_chart.rs b/src/charts/heatmap_chart.rs index 1802ae9..6d9cd76 100644 --- a/src/charts/heatmap_chart.rs +++ b/src/charts/heatmap_chart.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::canvas; use super::color::*; use super::common::*; diff --git a/src/charts/horizontal_bar_chart.rs b/src/charts/horizontal_bar_chart.rs index 1b4024f..e83f40a 100644 --- a/src/charts/horizontal_bar_chart.rs +++ b/src/charts/horizontal_bar_chart.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::canvas; use super::color::*; use super::common::*; diff --git a/src/charts/line_chart.rs b/src/charts/line_chart.rs index 22a2bea..8cd6f7a 100644 --- a/src/charts/line_chart.rs +++ b/src/charts/line_chart.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::canvas; use super::color::*; use super::common::*; diff --git a/src/charts/multi_chart.rs b/src/charts/multi_chart.rs index 9f93fc8..16cf0f7 100644 --- a/src/charts/multi_chart.rs +++ b/src/charts/multi_chart.rs @@ -1,4 +1,6 @@ -use substring::Substring; +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. use super::canvas; use super::component::generate_svg; @@ -9,6 +11,7 @@ use super::{ ScatterChart, TableChart, }; use super::{Box, Color}; +use substring::Substring; pub enum ChildChart { Bar(BarChart, Option<(f32, f32)>), diff --git a/src/charts/params.rs b/src/charts/params.rs index a0425cb..3e4db50 100644 --- a/src/charts/params.rs +++ b/src/charts/params.rs @@ -1,10 +1,12 @@ -use std::sync::Arc; +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. +use super::{Align, Box, Color, LegendCategory, Series, SeriesCategory, Theme, YAxisConfig}; use crate::{ MarkLine, MarkLineCategory, MarkPoint, MarkPointCategory, Position, Symbol, NIL_VALUE, }; - -use super::{Align, Box, Color, LegendCategory, Series, SeriesCategory, Theme, YAxisConfig}; +use std::sync::Arc; /// Gets bool value from serde json. pub(crate) fn get_bool_from_value(value: &serde_json::Value, key: &str) -> Option { diff --git a/src/charts/path.rs b/src/charts/path.rs index f58588c..87ffa69 100644 --- a/src/charts/path.rs +++ b/src/charts/path.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::util::*; use std::fmt; diff --git a/src/charts/pie_chart.rs b/src/charts/pie_chart.rs index cdcd0a0..e66d1dd 100644 --- a/src/charts/pie_chart.rs +++ b/src/charts/pie_chart.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::canvas; use super::color::*; use super::common::*; @@ -10,7 +14,6 @@ use crate::charts::measure_text_width_family; use charts_rs_derive::Chart; use core::f32; use std::sync::Arc; -use std::u8; #[derive(Clone, Debug, Default, Chart)] pub struct PieChart { diff --git a/src/charts/radar_chart.rs b/src/charts/radar_chart.rs index d2637d1..f4f9953 100644 --- a/src/charts/radar_chart.rs +++ b/src/charts/radar_chart.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::canvas; use super::color::*; use super::common::*; diff --git a/src/charts/scatter_chart.rs b/src/charts/scatter_chart.rs index f8aa418..802f780 100644 --- a/src/charts/scatter_chart.rs +++ b/src/charts/scatter_chart.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::canvas; use super::color::*; use super::common::*; diff --git a/src/charts/table_chart.rs b/src/charts/table_chart.rs index 21ba63d..0632362 100644 --- a/src/charts/table_chart.rs +++ b/src/charts/table_chart.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::canvas; use super::color::*; use super::common::*; diff --git a/src/charts/theme.rs b/src/charts/theme.rs index 9c0b24c..05eec0f 100644 --- a/src/charts/theme.rs +++ b/src/charts/theme.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use super::color::Color; use super::common::Align; use super::font::DEFAULT_FONT_FAMILY; diff --git a/src/charts/util.rs b/src/charts/util.rs index 78950a1..99865a3 100644 --- a/src/charts/util.rs +++ b/src/charts/util.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + use serde::{Deserialize, Serialize}; use std::fmt; use substring::Substring; @@ -289,12 +293,10 @@ pub fn get_quadrant(cx: f32, cy: f32, point: &Point) -> u8 { } else { 1 } + } else if point.y > cy { + 3 } else { - if point.y > cy { - 3 - } else { - 2 - } + 2 } } diff --git a/src/lib.rs b/src/lib.rs index a67c770..56dcb9a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,7 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + //! Charts support multi charts: bar chart, horizontal bar chart, //! line chart, pie chart, radar chart and table. //!