Review: Graph Type's Value Axis is a dropdown

The generic Graph Type dialog showed `valueAxis` as a text field. It now
lists On Left Side, On Right Side and On Both Sides, translated in the
complete catalogs, with a test that the choices match the command's
params and that OK moves the axis. ROADMAP Last updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-10 21:48:51 +07:00
co-authored by Claude Opus 5.5
parent 2f97c8ab49
commit bea68002e9
11 changed files with 58 additions and 1 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+21
View File
@@ -40,6 +40,7 @@ fn choices(command: &str, key: &str) -> Option<form::Choices> {
("text.areaOptions", "fit") => Some(AREA_FIT),
("text.areaOptions", "firstBaseline") => Some(FIRST_BASELINE),
("text.areaOptions", "verticalAlign") => Some(VERTICAL_ALIGN),
("graph.setType", "valueAxis") => Some(VALUE_AXIS),
_ => None,
}
}
@@ -57,6 +58,9 @@ const FIRST_BASELINE: form::Choices =
/// Area Type Options › Align (vertical alignment of the lines in each row/column).
const VERTICAL_ALIGN: form::Choices = &[("Top", "top"), ("Center", "center"), ("Bottom", "bottom"), ("Justify", "justify")];
/// Graph Type › Value Axis (series picked on both axes show none, and OK leaves each where it is).
const VALUE_AXIS: form::Choices = &[("On Left Side", "left"), ("On Right Side", "right"), ("On Both Sides", "both")];
/// Closes before running, so a dialog the command opens stays open.
fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
let cmd = d.str("__command");
@@ -113,4 +117,21 @@ mod tests {
let NodeKind::Text(t) = &app.session.doc().unwrap().doc.node(vectorcraft_doc::NodeId(id)).unwrap().kind else { panic!("text") };
assert_eq!(t.area.vertical_align, VerticalAlign::Center);
}
/// Graph Type › Value Axis is a dropdown of the values `graph.setType` takes, and OK puts the
/// value axis on the side picked.
#[test]
fn graph_type_value_axis_is_a_dropdown_of_its_sides() {
let doc = vectorcraft_engine::find_command("graph.setType").unwrap().params;
let values: Vec<&str> = choices("graph.setType", "valueAxis").unwrap().iter().map(|(_, v)| *v).collect();
assert!(doc.contains(&format!("valueAxis?: {}", values.join("|"))), "{values:?}");
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.run("file.new", json!({"width": 400, "height": 400})).unwrap();
app.run("graph.create", json!({"type": "column", "x": 0, "y": 0, "width": 200, "height": 150})).unwrap();
crate::menus::graph_dialog(&mut app, "graph.setType").unwrap();
assert_eq!(app.ui.dialog.as_ref().unwrap().str("valueAxis"), "left");
app.ui.dialog.as_mut().unwrap().fields.insert("valueAxis".into(), json!("both"));
crate::dialogs::confirm(&mut app).unwrap();
assert_eq!(app.session.execute("graph.setType", &json!({})).unwrap()["valueAxis"], "both");
}
}
+4
View File
@@ -3932,3 +3932,7 @@ theme Appearance Erscheinungsbild
@msg the PSD image is too large to read ({_1} × {_2} pixels) das PSD-Bild ist zu groß zum Lesen ({_1} × {_2} Pixel)
@msg zipped 32-bit PSD image data with prediction can't be read ZIP-komprimierte 32-Bit-PSD-Bilddaten mit Vorhersage können nicht gelesen werden
@msg {depth}-bit PSD files in this colour mode can't be read {depth}-Bit-PSD-Dateien in diesem Farbmodus können nicht gelesen werden
Value Axis Werteachse
On Left Side Links
On Right Side Rechts
On Both Sides Auf beiden Seiten
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -3976,3 +3976,7 @@ axis Both Ambos
Bottom Right Abajo a la derecha
Edge Borde
System Title Bar Barra de título del sistema
Value Axis Eje de valores
On Left Side En el lado izquierdo
On Right Side En el lado derecho
On Both Sides En ambos lados
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -3988,3 +3988,7 @@ axis Both Les deux
effect Soft Doux
Edge Bord
System Title Bar Barre de titre du système
Value Axis Axe des valeurs
On Left Side À gauche
On Right Side À droite
On Both Sides Des deux côtés
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -3978,3 +3978,7 @@ effect Soft Morbido
effect Regular Normale
Edge Bordo
System Title Bar Barra del titolo di sistema
Value Axis Asse dei valori
On Left Side Sul lato sinistro
On Right Side Sul lato destro
On Both Sides Su entrambi i lati
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -3971,3 +3971,7 @@ effect Horizontal 水平
effect Vertical 垂直
Edge エッジ
System Title Bar システムのタイトルバー
Value Axis 数値軸
On Left Side 左側
On Right Side 右側
On Both Sides 両側
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -3974,3 +3974,7 @@ axis Both Оба
Bottom Right Снизу справа
Edge Край
System Title Bar Системная строка заголовка
Value Axis Ось значений
On Left Side Слева
On Right Side Справа
On Both Sides С обеих сторон
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -3959,3 +3959,7 @@ axis Both Обидві
Bottom Right Знизу праворуч
Edge Край
System Title Bar Системний рядок заголовка
Value Axis Вісь значень
On Left Side Ліворуч
On Right Side Праворуч
On Both Sides З обох боків
Can't render this file because it contains an unexpected character in line 659 and column 40.
+4
View File
@@ -3607,3 +3607,7 @@ effect Horizontal 水平
effect Vertical 垂直
Edge 边缘
System Title Bar 系统标题栏
Value Axis 数值轴
On Left Side 左侧
On Right Side 右侧
On Both Sides 两侧
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -3388,3 +3388,7 @@ axis Both 兩者
effect Soft 柔和
Edge 邊緣
System Title Bar 系統標題列
Value Axis 數值軸
On Left Side 左側
On Right Side 右側
On Both Sides 兩側
Can't render this file because it contains an unexpected character in line 6 and column 47.