Merge pull request #448 from Dejan-Port:select-inserted-chart

This commit is contained in:
Brandon Thomas
2026-10-12 23:35:11 -04:00
+7 -1
View File
@@ -1432,7 +1432,13 @@ fn insert(app: &mut SheetApp, ui: &mut Ui) {
let __k = big_button(ui, Icon::Chart, "Recommended\nCharts", "Recommended Charts", false);
control_keytip(app, ui, &__k, "insert.recommendedCharts");
if __k.clicked() {
act(app, "insert.recommendedCharts", json!({}));
match app.run("insert.recommendedCharts", json!({})) {
// The new chart is selected, as after inserting any other object (see insert.chart
// in dialogs.rs) — otherwise the prior cell/range selection is left in place, and
// Del right after inserting deletes the source data instead of the chart.
Ok(r) => app.selected_chart = r.get("chart").and_then(serde_json::Value::as_u64).and_then(|id| u32::try_from(id).ok()),
Err(e) => app.message = Some(("GridCraft".into(), crate::clean_error(&e))),
}
}
ui.vertical(|ui| {
ui.horizontal(|ui| {