Create a new plot widget with default settings.
()
| 119 | |
| 120 | impl Default for PlotWidget { |
| 121 | fn default() -> Self { |
| 122 | Self::new() |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | impl PlotWidget { |
| 127 | /// Create a new plot widget with default settings. |
| 128 | pub fn new() -> Self { |
| 129 | Self { |
| 130 | instance_id: NEXT_ID.fetch_add(1, Ordering::Relaxed), |
| 131 | series: IndexMap::new(), |
| 132 | fills: IndexMap::new(), |
| 133 | vlines: IndexMap::new(), |
| 134 | hlines: IndexMap::new(), |
| 135 | hidden_shapes: HashSet::new(), |
| 136 | data_version: 1, |
| 137 | autoscale_on_updates: false, |
| 138 | controls: PlotControls::default(), |
| 139 | highlight_on_hover: true, |
| 140 | show_controls_help: true, |
| 141 | legend_enabled: true, |
| 142 | legend_collapsed: false, |
| 143 | x_axis_label: String::new(), |
| 144 | y_axis_label: String::new(), |
| 145 | x_lim: None, |
| 146 | y_lim: None, |
| 147 | autoscale_y_on_updates: false, |
| 148 | follow_right_edge: false, |
| 149 | follow_reset_counter: 0, |
| 150 | x_axis_scale: AxisScale::Linear, |
| 151 | y_axis_scale: AxisScale::Linear, |
| 152 | x_axis_link: None, |
| 153 | y_axis_link: None, |
| 154 | hover_radius_px: 8.0, |
| 155 | pick_highlight_provider: None, |
| 156 | hover_highlight_provider: None, |
| 157 | cursor_overlay: true, |
| 158 | cursor_provider: None, |
| 159 | crosshairs_enabled: false, |
| 160 | render_strategy: PlotRenderStrategy::default(), |
| 161 | controls_overlay_open: false, |
| 162 | #[cfg(feature = "canvas")] |
| 163 | canvas_caches: crate::plot_renderer::canvas::CanvasCaches::default(), |
| 164 | x_axis_formatter: Some(Arc::new(ticks::default_formatter)), |
| 165 | y_axis_formatter: Some(Arc::new(ticks::default_formatter)), |
| 166 | x_tick_producer: Some(Arc::new(ticks::default_tick_producer)), |
| 167 | y_tick_producer: Some(Arc::new(ticks::default_tick_producer)), |
| 168 | tick_label_size: 10.0, |
| 169 | axis_label_size: 16.0, |
| 170 | data_aspect: None, |
| 171 | style: Arc::new(default_style), |
| 172 | resolved_style: RwLock::new(PlotStyle::default()), |
| 173 | x_ticks: Vec::new(), |
| 174 | y_ticks: Vec::new(), |