pub struct ChartLayout {
pub width: f64,
pub height: f64,
pub grids: Vec<GridLayout>,
pub series: Vec<SeriesLayout>,
pub geo: Vec<GeoLayout>,
pub title_rect: Option<BBox>,
pub legend_rect: Option<BBox>,
pub plot_rect: BBox,
}Expand description
The whole layout of a chart.
Fields§
§width: f64The width of the chart, in canvas pixels.
height: f64The height of the chart, in canvas pixels.
grids: Vec<GridLayout>The grids of the chart.
series: Vec<SeriesLayout>The series of the chart.
geo: Vec<GeoLayout>The maps of the chart, projected into the plot area.
title_rect: Option<BBox>The rectangle the title occupies.
legend_rect: Option<BBox>The rectangle the legend occupies.
plot_rect: BBoxThe rectangle the chart’s plot area occupies.
Implementations§
Source§impl ChartLayout
Inherent implementation of ChartLayout.
impl ChartLayout
Inherent implementation of ChartLayout.
Sourcepub fn compute(
option: &ChartOption,
width: f64,
height: f64,
measurer: &TextMeasurer,
) -> ChartLayout
pub fn compute( option: &ChartOption, width: f64, height: f64, measurer: &TextMeasurer, ) -> ChartLayout
Computes the layout of a chart.
The layout is the bridge between the option and the display list: it resolves the sizes, computes the scales and the ticks, and places every data point in pixel space. The renderer then only has to turn the result into drawing instructions.
measurer is used to size the axis labels; passing a measurer
that has already measured the same labels costs nothing, because
the measurements are cached.
§Arguments
&ChartOption- Shared reference to aChartOption.f64- A 64-bit float (f64).&TextMeasurer- Shared reference to aTextMeasurer.
§Returns
ChartLayout- AChartLayoutvalue.
Sourcepub fn compute_with_maps(
option: &ChartOption,
width: f64,
height: f64,
measurer: &TextMeasurer,
maps: &MapRegistry,
) -> ChartLayout
pub fn compute_with_maps( option: &ChartOption, width: f64, height: f64, measurer: &TextMeasurer, maps: &MapRegistry, ) -> ChartLayout
Computes the layout of a chart that draws maps.
The geometry of a map is far too large to live in an option: the same map is drawn by every chart of an application, and it is registered once. The registry is where the charts look it up.
§Arguments
&ChartOption- Shared reference to aChartOption.f64- A 64-bit float (f64).&TextMeasurer- Shared reference to aTextMeasurer.&MapRegistry- Shared reference to aMapRegistry.
§Returns
ChartLayout- AChartLayoutvalue.