diff --git a/addons/tau-plot/model/dataset.gd b/addons/tau-plot/model/dataset.gd index 1214578..100f977 100644 --- a/addons/tau-plot/model/dataset.gd +++ b/addons/tau-plot/model/dataset.gd @@ -68,7 +68,7 @@ class Dataset extends RefCounted: push_error("Dataset(): unexpected X element type") - # Convenience method to create and fully initialize a SHARED_X dataset with categorical X values and multiple series from bulk arrays. + ## Convenience method to create and fully initialize a SHARED_X dataset with categorical X values and multiple series from bulk arrays. static func make_shared_x_categorical(p_series_names: PackedStringArray, p_x: PackedStringArray, p_y_by_series: Array[PackedFloat64Array], p_capacity: int = -1) -> Dataset: if p_series_names.is_empty(): push_error("Dataset.make_shared_x_categorical(): p_series_names is empty") @@ -103,7 +103,7 @@ class Dataset extends RefCounted: return dataset - # Convenience method to create and fully initialize a SHARED_X dataset with continuous X values and multiple series from bulk arrays. + ## Convenience method to create and fully initialize a SHARED_X dataset with continuous X values and multiple series from bulk arrays. static func make_shared_x_continuous(p_series_names: PackedStringArray, p_x: PackedFloat64Array, p_y_by_series: Array[PackedFloat64Array], p_capacity: int = -1) -> Dataset: if p_series_names.is_empty(): push_error("Dataset.make_shared_x_continuous(): p_series_names is empty") @@ -138,7 +138,7 @@ class Dataset extends RefCounted: return dataset - # Convenience method to create and fully initialize a PER_SERIES_X dataset with continuous X values, where each series provides its own X/Y arrays. + ## Convenience method to create and fully initialize a PER_SERIES_X dataset with continuous X values, where each series provides its own X/Y arrays. static func make_per_series_x_continuous(p_series_names: PackedStringArray, p_x_by_series: Array[PackedFloat64Array], p_y_by_series: Array[PackedFloat64Array], p_capacity_by_series: PackedInt32Array = PackedInt32Array()) -> Dataset: if p_series_names.is_empty(): push_error("Dataset.make_per_series_x_continuous(): p_series_names is empty") diff --git a/addons/tau-plot/plot/xy/xy_plot.gd b/addons/tau-plot/plot/xy/xy_plot.gd index 1e10fce..fa2eadd 100644 --- a/addons/tau-plot/plot/xy/xy_plot.gd +++ b/addons/tau-plot/plot/xy/xy_plot.gd @@ -595,12 +595,6 @@ func refresh(p_plot_global_position: Vector2, p_legend_position: Position) -> vo _scatter_dirty_panes[pane_index] = true _legend_rebuild_needed = true - # Rebuild legend keys once if any overlay or plot-wide style changed. - # Renderers already have their updated styles at this point, so the - # factory callables will produce Controls with the new appearance. - if _legend_rebuild_needed: - _legend_builder.controller.legend.rebuild() - # Step 3c: Check grid_line config changes, style reference changes, # and pane style mutations. All visual-only. for pane_index in range(pane_count): @@ -704,6 +698,13 @@ func refresh(p_plot_global_position: Vector2, p_legend_position: Position) -> vo _pane_rect_dirty = false _ticks_dirty = false + # Rebuild legend keys once if any overlay or plot-wide style changed. + # Must run after the layout update as some legend keys depends on the + # layout (e.g. scatter with DATA_UNITS marker size policy, which uses + # map_x_to_px). + if _legend_rebuild_needed: + _legend_builder.controller.legend.rebuild() + # Step 7b: Update legend overlay if INSIDE position if _is_inside_legend_position(p_legend_position): var union_global := _pane_stack.global_position + _xy_layout.data_area_union.position