From 6172ed3f2f2e8a12fd56977ad1aaf5b271f395bd Mon Sep 17 00:00:00 2001 From: Oleg <18466855+EvaTheSalmon@users.noreply.github.com> Date: Mon, 9 Nov 2026 18:06:22 +0300 Subject: [PATCH] feat(chart): put the log box in the axis scale form The axis scale panel drew its Logarithmic checkbox under the labels, so the form had two left edges. The box now sits in the field column under a Scale type label, reusing the pen form's two strings, and the two grids share one Auto label column, so every field starts at one edge. An invalid bound shows the warning glyph inside its box, through one class-gated style the pen form shares. The resource key the panel no longer reads is removed. Co-Authored-By: Claude Opus 5.5 --- .../UI/Chart/AxisScalePanelDriver.cs | 43 ++ .../UI/Chart/AxisScalePanelLayoutTests.cs | 189 ++++++ .../UI/Chart/AxisScalePanelViewTests.cs | 32 +- .../SemiPlot.Tests.Unit/UI/InterMeasure.cs | 10 +- .../UI/PenEditor/PenGroupsViewTests.cs | 4 +- .../UI/PenEditor/PenListViewTests.cs | 2 +- .../SemiPlot.UI/Chart/AxisScalePanel.axaml | 36 +- .../SemiPlot.UI/Localization/Resources.resx | 3 - .../Localization/Resources.ru.resx | 3 - .../PenEditor/PenEditorWindow.axaml | 12 +- SemiPlot/SemiPlot.UI/Styles/Forms.axaml | 12 + docs/architecture/trend-feature-spec.md | 2 +- docs/architecture/trend-interaction.md | 7 +- docs/architecture/ui-text.md | 10 +- docs/architecture/ui-theme.md | 57 +- .../20261103-axis-scale-checkbox-column.md | 562 ++++++++++++++++++ 16 files changed, 900 insertions(+), 84 deletions(-) create mode 100644 SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelDriver.cs create mode 100644 SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelLayoutTests.cs create mode 100644 docs/plans/completed/20261103-axis-scale-checkbox-column.md diff --git a/SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelDriver.cs b/SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelDriver.cs new file mode 100644 index 0000000..e0eb71b --- /dev/null +++ b/SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelDriver.cs @@ -0,0 +1,43 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Threading; +using Avalonia.VisualTree; + +using SemiPlot.UI.Chart; + +using static SemiPlot.Tests.Unit.UI.Chart.ChartViewTestBuilder; + +namespace SemiPlot.Tests.Unit.UI.Chart; + +/// Opens the axis scale panel on a shown chart and reaches its parts, for the panel's view tests. +internal static class AxisScalePanelDriver +{ + public static (Flyout Flyout, AxisScalePanel Panel) OpenPanel(TrendChartViewModel viewModel, ShownChart shown) + { + HeadlessInput.Click(shown.Window, shown.PlotControl, AxisRegionPoint(viewModel)); + Dispatcher.UIThread.RunJobs(); + + var flyout = (Flyout)FlyoutBase.GetAttachedFlyout(shown.PlotControl)!; + + return (flyout, (AxisScalePanel)flyout.Content!); + } + + public static FlyoutPresenter PresenterOf(AxisScalePanel panel) + { + return panel.GetVisualAncestors().OfType().First(); + } + + public static (Size Panel, Size Message, Size Presenter) SizesOf(AxisScalePanel panel, TextBlock message) + { + return (panel.Bounds.Size, message.Bounds.Size, PresenterOf(panel).Bounds.Size); + } + + public static void TypeInto(Window window, AxisScalePanel panel, string fieldName, string text) + { + var field = panel.FindControl(fieldName)!; + + HeadlessInput.Clear(window, field); + HeadlessInput.Type(window, field, text); + } +} diff --git a/SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelLayoutTests.cs b/SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelLayoutTests.cs new file mode 100644 index 0000000..2e99117 --- /dev/null +++ b/SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelLayoutTests.cs @@ -0,0 +1,189 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Headless.XUnit; +using Avalonia.VisualTree; + +using AwesomeAssertions; + +using SemiPlot.UI.Localization; + +using Xunit; + +using static SemiPlot.Tests.Unit.UI.Chart.AxisScalePanelDriver; +using static SemiPlot.Tests.Unit.UI.Chart.ChartViewTestBuilder; +using static SemiPlot.Tests.Unit.UI.InterMeasure; + +namespace SemiPlot.Tests.Unit.UI.Chart; + +// The axis scale panel's layout and its invalid-field glyph, realised through Avalonia's real pipeline. +[Trait("Component", "UI")] +[Trait("Area", "Chart")] +[Trait("Category", "Unit")] +[Collection(ProcessGlobalStateCollection.Name)] +public sealed class AxisScalePanelLayoutTests +{ + [AvaloniaFact] + public void AnInvalidBound_ShowsTheWarningGlyphInsideTheBoxWithoutResizing() + { + using var culture = new CultureScope("en-US"); + using var viewModel = CreateLoadedViewModel(); + viewModel.SetAxisLimits(1, 10.0, 90.0); + using var shown = ShowChart(viewModel); + var (_, panel) = OpenPanel(viewModel, shown); + var maximum = panel.FindControl("AxisScaleMaximum")!; + var minimum = panel.FindControl("AxisScaleMinimum")!; + var message = panel.FindControl("AxisScaleValidationMessage")!; + var (sizes, maximumBounds, minimumBounds) = (SizesOf(panel, message), maximum.Bounds, minimum.Bounds); + panel.TryFindResource("WarningGeometry", out var warning).Should().BeTrue(); + + TypeInto(shown.Window, panel, "AxisScaleMaximum", "1x"); + HeadlessInput.Clear(shown.Window, minimum); + + var glyphs = new[] { maximum, minimum }.Select(box => + { + box.Classes.Should().Contain("invalid"); + var glyph = box.InnerRightContent.Should().BeOfType().Subject; + glyph.IsEffectivelyVisible.Should().BeTrue(); + glyph.Data.Should().BeSameAs(warning); + ViewProbe.LeftOf(glyph, box).Should().BeGreaterThanOrEqualTo(0); + ViewProbe.RightOf(glyph, box).Should().BeLessThanOrEqualTo(box.Bounds.Width, "the glyph sits inside the box"); + ViewProbe.TopOf(glyph, box).Should().BeGreaterThanOrEqualTo(0); + ViewProbe.BottomOf(glyph, box).Should().BeLessThanOrEqualTo(box.Bounds.Height); + + return glyph; + }).ToList(); + + glyphs[0].Should().NotBeSameAs(glyphs[1], "each box carries a glyph of its own"); + (SizesOf(panel, message), maximum.Bounds, minimum.Bounds).Should().Be((sizes, maximumBounds, minimumBounds)); + } + + [AvaloniaFact] + public void AValidBound_ShowsNoWarningGlyph() + { + using var viewModel = CreateLoadedViewModel(); + viewModel.SetAxisLimits(1, 10.0, 90.0); + using var shown = ShowChart(viewModel); + var (_, panel) = OpenPanel(viewModel, shown); + + foreach (var name in new[] { "AxisScaleMaximum", "AxisScaleMinimum" }) + { + var box = panel.FindControl(name)!; + box.Classes.Should().NotContain("invalid", name); + box.InnerRightContent.Should().BeNull(name); + } + } + + [AvaloniaFact] + public void ABoundCorrected_DropsTheWarningGlyph() + { + using var culture = new CultureScope("en-US"); + using var viewModel = CreateLoadedViewModel(); + viewModel.SetAxisLimits(1, 10.0, 90.0); + using var shown = ShowChart(viewModel); + var (_, panel) = OpenPanel(viewModel, shown); + var maximum = panel.FindControl("AxisScaleMaximum")!; + + TypeInto(shown.Window, panel, "AxisScaleMaximum", "1x"); + maximum.InnerRightContent.Should().BeOfType(); + + TypeInto(shown.Window, panel, "AxisScaleMaximum", "50"); + + maximum.Classes.Should().NotContain("invalid"); + maximum.InnerRightContent.Should().BeNull(); + } + + [AvaloniaTheory] + [InlineData("en-US")] + [InlineData("ru-RU")] + public void TheLogarithmicBox_StartsAtTheFieldEdge_UnderTheScaleTypeLabel(string cultureName) + { + const double Tolerance = 0.5; + using var culture = new CultureScope(cultureName); + using var viewModel = CreateLoadedViewModel(); + using var shown = ShowChart(viewModel); + var (_, panel) = OpenPanel(viewModel, shown); + var box = panel.FindControl("AxisScaleLogarithmic")!; + var bounds = panel.FindControl("AxisScaleBounds")!; + var row = panel.FindControl("AxisScaleType")!; + var fieldEdge = ViewProbe.LeftOf(panel.FindControl("AxisScaleMaximum")!, panel); + + ViewProbe.LeftOf(box, panel).Should().BeApproximately(fieldEdge, Tolerance, "the box starts at the field edge"); + ViewProbe.LeftOf(panel.FindControl("AxisScaleMinimum")!, panel).Should() + .BeApproximately(fieldEdge, Tolerance); + row.GetVisualAncestors().Should().NotContain(bounds, "focus onto the box must leave the pair's grid"); + box.Parent.Should().BeSameAs(row); + row.ColumnDefinitions[0].ActualWidth.Should() + .BeApproximately(bounds.ColumnDefinitions[0].ActualWidth, Tolerance, "the two grids share one label column"); + var label = panel.FindControl("AxisScaleTypeLabel")!; + label.Text.Should().Be(Resources.PenFormScaleTypeLabel); + label.Parent.Should().BeSameAs(row); + Grid.GetColumn(label).Should().Be(0); + box.Content.Should().Be(Resources.PenFormLogarithmic); + } + + [AvaloniaFact] + public void AClickOnTheScaleTypeLabelOrBesideTheBox_LeavesTheFlagAndGivesThePanelTheKeyboard() + { + using var viewModel = CreateLoadedViewModel(); + viewModel.SetAxisLimits(1, 1.0, 90.0); + using var shown = ShowChart(viewModel); + var (flyout, panel) = OpenPanel(viewModel, shown); + var box = panel.FindControl("AxisScaleLogarithmic")!; + var row = panel.FindControl("AxisScaleType")!; + var besideTheBox = new Point( + (ViewProbe.RightOf(box, row) + row.Bounds.Width) / 2.0, + row.Bounds.Height / 2.0); + + box.Bounds.Width.Should().BeLessThan(row.ColumnDefinitions[1].ActualWidth, "the box does not span its column"); + + HeadlessInput.Click(shown.Window, panel.FindControl("AxisScaleTypeLabel")!); + + viewModel.ScaleSettings[1].IsLogarithmic.Should().BeFalse("a click on the label does not toggle"); + box.IsChecked.Should().BeFalse(); + box.IsFocused.Should().BeFalse(); + panel.IsFocused.Should().BeTrue("the panel takes the keyboard"); + + HeadlessInput.Click(shown.Window, row, besideTheBox); + + viewModel.ScaleSettings[1].IsLogarithmic.Should().BeFalse("a click beside the box does not toggle"); + box.IsChecked.Should().BeFalse(); + box.IsFocused.Should().BeFalse(); + panel.IsFocused.Should().BeTrue("the panel takes the keyboard"); + flyout.IsOpen.Should().BeTrue(); + } + + [AvaloniaTheory] + [InlineData("en-US")] + [InlineData("ru-RU")] + public void TheScaleTypeRow_FitsThePanelInInter(string cultureName) + { + const double FieldSlack = 24.0; + using var culture = new CultureScope(cultureName); + using var viewModel = CreateLoadedViewModel(); + using var shown = ShowChart(viewModel); + var (_, panel) = OpenPanel(viewModel, shown); + var bounds = panel.FindControl("AxisScaleBounds")!; + var row = panel.FindControl("AxisScaleType")!; + var field = panel.FindControl("AxisScaleMaximum")!; + var box = panel.FindControl("AxisScaleLogarithmic")!; + var labels = bounds.Children.OfType() + .Append(panel.FindControl("AxisScaleTypeLabel")!) + .ToList(); + labels.Select(label => label.Text).Should().Equal( + Resources.AxisScaleMaximumLabel, Resources.AxisScaleMinimumLabel, Resources.PenFormScaleTypeLabel); + using var typeface = InterTypeface(); + var labelWidths = labels.Select(label => + { + using var font = InterFont(typeface, label.FontSize); + return (double)font.MeasureText(label.Text); + }).ToList(); + var labelColumn = labelWidths.Max(); + var boxWidth = ContentWidthInInter(shown.Window, box, typeface); + TestContext.Current.TestOutputHelper?.WriteLine( + $"{cultureName}: labels {string.Join(", ", labelWidths.Select(width => $"{width:0.0}"))} px, " + + $"label column {labelColumn:0.0} px, box {boxWidth:0.0} px"); + + (labelColumn + bounds.ColumnSpacing + field.Width).Should().BeLessThanOrEqualTo(panel.Width - FieldSlack); + (labelColumn + row.ColumnSpacing + boxWidth).Should().BeLessThanOrEqualTo(panel.Width); + } +} diff --git a/SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelViewTests.cs b/SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelViewTests.cs index 4de2e19..5da2608 100644 --- a/SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelViewTests.cs +++ b/SemiPlot/SemiPlot.Tests.Unit/UI/Chart/AxisScalePanelViewTests.cs @@ -4,7 +4,6 @@ using Avalonia.Headless.XUnit; using Avalonia.Input; using Avalonia.Threading; -using Avalonia.VisualTree; using AwesomeAssertions; @@ -16,6 +15,7 @@ using Xunit; +using static SemiPlot.Tests.Unit.UI.Chart.AxisScalePanelDriver; using static SemiPlot.Tests.Unit.UI.Chart.ChartViewTestBuilder; namespace SemiPlot.Tests.Unit.UI.Chart; @@ -326,7 +326,7 @@ public void TheLogarithmicBox_SwitchesTheAxisAndKeepsThePanelOpenAtItsSize() var box = panel.FindControl("AxisScaleLogarithmic")!; var panelSize = panel.Bounds.Size; var presenterSize = PresenterOf(panel).Bounds.Size; - box.Content.Should().Be(Resources.AxisScaleLogarithmic); + box.Content.Should().Be(Resources.PenFormLogarithmic); box.IsChecked.Should().BeFalse(); HeadlessInput.Click(shown.Window, box); @@ -393,16 +393,6 @@ public void TheMessageLine_KeepsThePanelsSize_EmptyWithAOneLineRuleAndWithTheLog logRuleSizes.Should().Be(emptySizes); } - private static (Flyout Flyout, AxisScalePanel Panel) OpenPanel(TrendChartViewModel viewModel, ShownChart shown) - { - HeadlessInput.Click(shown.Window, shown.PlotControl, AxisRegionPoint(viewModel)); - Dispatcher.UIThread.RunJobs(); - - var flyout = (Flyout)FlyoutBase.GetAttachedFlyout(shown.PlotControl)!; - - return (flyout, (AxisScalePanel)flyout.Content!); - } - private static void ClickOutsideThePanel(ShownChart shown) { HeadlessInput.Click(shown.Window, shown.PlotControl, new Point(shown.PlotControl.Bounds.Width - 20.0, 20.0)); @@ -414,22 +404,4 @@ private static void PressThePanelsEmptyArea(ShownChart shown, AxisScalePanel pan HeadlessInput.Click(shown.Window, panel, new Point(panel.Bounds.Width - 4.0, boundsTop - 5.0)); } - - private static FlyoutPresenter PresenterOf(AxisScalePanel panel) - { - return panel.GetVisualAncestors().OfType().First(); - } - - private static (Size Panel, Size Message, Size Presenter) SizesOf(AxisScalePanel panel, TextBlock message) - { - return (panel.Bounds.Size, message.Bounds.Size, PresenterOf(panel).Bounds.Size); - } - - private static void TypeInto(Window window, AxisScalePanel panel, string fieldName, string text) - { - var field = panel.FindControl(fieldName)!; - - HeadlessInput.Clear(window, field); - HeadlessInput.Type(window, field, text); - } } diff --git a/SemiPlot/SemiPlot.Tests.Unit/UI/InterMeasure.cs b/SemiPlot/SemiPlot.Tests.Unit/UI/InterMeasure.cs index d8a3157..f58fe56 100644 --- a/SemiPlot/SemiPlot.Tests.Unit/UI/InterMeasure.cs +++ b/SemiPlot/SemiPlot.Tests.Unit/UI/InterMeasure.cs @@ -21,12 +21,12 @@ public static SKFont InterFont(SKTypeface typeface, double fontSize) return new SKFont(typeface, (float)fontSize) { LinearMetrics = true, Subpixel = true }; } - /// The header's width with its text measured in Inter, its padding and sort slot as realised. - public static double HeaderWidthInInter(Window window, DataGridColumnHeader header, SKTypeface semiBold) + /// The control's width with its text content measured in Inter, its chrome as realised. + public static double ContentWidthInInter(Window window, ContentControl control, SKTypeface typeface) { - var text = ViewProbe.Descendants(header).Single(block => Equals(block.Text, header.Content)); - var chrome = ViewProbe.UnconstrainedWidthOf(window, header) - ViewProbe.UnconstrainedWidthOf(window, text); - using var font = InterFont(semiBold, header.FontSize); + var text = ViewProbe.Descendants(control).Single(block => Equals(block.Text, control.Content)); + var chrome = ViewProbe.UnconstrainedWidthOf(window, control) - ViewProbe.UnconstrainedWidthOf(window, text); + using var font = InterFont(typeface, text.FontSize); return chrome + font.MeasureText(text.Text); } diff --git a/SemiPlot/SemiPlot.Tests.Unit/UI/PenEditor/PenGroupsViewTests.cs b/SemiPlot/SemiPlot.Tests.Unit/UI/PenEditor/PenGroupsViewTests.cs index ec21b7d..ed9a350 100644 --- a/SemiPlot/SemiPlot.Tests.Unit/UI/PenEditor/PenGroupsViewTests.cs +++ b/SemiPlot/SemiPlot.Tests.Unit/UI/PenEditor/PenGroupsViewTests.cs @@ -782,8 +782,8 @@ public void TheGroupColumns_LeaveTheNameAtLeast100PxInInter(string culture) var viewport = ViewportOf(list); var membership = list.Columns[0].ActualWidth; var actions = Math.Max( - ActionsOpeningWidth, HeaderWidthInInter(window, HeaderOf(list, Resources.PenGroupsColumnActions), semiBold)); - var groupHeader = HeaderWidthInInter(window, HeaderOf(list, Resources.PenGroupsColumnGroup), semiBold); + ActionsOpeningWidth, ContentWidthInInter(window, HeaderOf(list, Resources.PenGroupsColumnActions), semiBold)); + var groupHeader = ContentWidthInInter(window, HeaderOf(list, Resources.PenGroupsColumnGroup), semiBold); var groupColumn = viewport - membership - actions; var name = groupColumn - NameInsets - CountGap - countFont.MeasureText("999"); diff --git a/SemiPlot/SemiPlot.Tests.Unit/UI/PenEditor/PenListViewTests.cs b/SemiPlot/SemiPlot.Tests.Unit/UI/PenEditor/PenListViewTests.cs index e505c2f..cdfd7e1 100644 --- a/SemiPlot/SemiPlot.Tests.Unit/UI/PenEditor/PenListViewTests.cs +++ b/SemiPlot/SemiPlot.Tests.Unit/UI/PenEditor/PenListViewTests.cs @@ -524,7 +524,7 @@ public void AtTheOpeningWidth_EveryPenListColumnFitsTheViewportInInter(string cu var widths = list.Columns .Select((column, index) => { - var headerWidth = HeaderWidthInInter(window, HeaderOf(list, (string)column.Header!), semiBold); + var headerWidth = ContentWidthInInter(window, HeaderOf(list, (string)column.Header!), semiBold); return HeaderMeasuredColumns.GetIsFill(column) ? headerWidth : Math.Max(declaredWidths[index], headerWidth); }) diff --git a/SemiPlot/SemiPlot.UI/Chart/AxisScalePanel.axaml b/SemiPlot/SemiPlot.UI/Chart/AxisScalePanel.axaml index 7e210f9..3872b68 100644 --- a/SemiPlot/SemiPlot.UI/Chart/AxisScalePanel.axaml +++ b/SemiPlot/SemiPlot.UI/Chart/AxisScalePanel.axaml @@ -19,7 +19,8 @@ + RowSpacing="10" + Grid.IsSharedSizeScope="True"> + + + + - + + + + + + + + + + The minimum must be below the maximum - - Logarithmic scale - A logarithmic scale needs a minimum above zero diff --git a/SemiPlot/SemiPlot.UI/Localization/Resources.ru.resx b/SemiPlot/SemiPlot.UI/Localization/Resources.ru.resx index 7ddb143..4bf736e 100644 --- a/SemiPlot/SemiPlot.UI/Localization/Resources.ru.resx +++ b/SemiPlot/SemiPlot.UI/Localization/Resources.ru.resx @@ -165,9 +165,6 @@ Минимум должен быть меньше максимума - - Логарифмическая шкала - Для логарифмической шкалы минимум должен быть больше нуля diff --git a/SemiPlot/SemiPlot.UI/PenEditor/PenEditorWindow.axaml b/SemiPlot/SemiPlot.UI/PenEditor/PenEditorWindow.axaml index d74bea8..90452f5 100644 --- a/SemiPlot/SemiPlot.UI/PenEditor/PenEditorWindow.axaml +++ b/SemiPlot/SemiPlot.UI/PenEditor/PenEditorWindow.axaml @@ -76,17 +76,6 @@ - diff --git a/SemiPlot/SemiPlot.UI/Styles/Forms.axaml b/SemiPlot/SemiPlot.UI/Styles/Forms.axaml index 90d42d9..10fd889 100644 --- a/SemiPlot/SemiPlot.UI/Styles/Forms.axaml +++ b/SemiPlot/SemiPlot.UI/Styles/Forms.axaml @@ -6,6 +6,18 @@ + + diff --git a/docs/architecture/trend-feature-spec.md b/docs/architecture/trend-feature-spec.md index 4cfc0b1..a6c4fc2 100644 --- a/docs/architecture/trend-feature-spec.md +++ b/docs/architecture/trend-feature-spec.md @@ -74,7 +74,7 @@ Acceptance-criterion labels: "UI" — verified in the running application; "Core `Auto` is the window-bounded mode; there is no second autoscale mode to switch into. ### AY-6 — Logarithmic scale (SHOULD) -**Definition.** A log10 axis type beside the auto and manual modes; Ln and other bases are not built. Values ≤ 0 are skipped by the auto range, and there is a default range on empty data. The type is stored per pen as `log_scale_on_start` and edited in the pen editor; the axis scale panel's Logarithmic scale checkbox switches it for the session of one window, and Restore initial scale brings the stored type back. The type **changes the axis in the render**: majors and minor gridlines on log positions, the line projected through the same transform, readable majors over a range narrower than a decade. +**Definition.** A log10 axis type beside the auto and manual modes; Ln and other bases are not built. Values ≤ 0 are skipped by the auto range, and there is a default range on empty data. The type is stored per pen as `log_scale_on_start` and edited in the pen editor; the axis scale panel's Logarithmic checkbox switches it for the session of one window, and Restore initial scale brings the stored type back. The type **changes the axis in the render**: majors and minor gridlines on log positions, the line projected through the same transform, readable majors over a range narrower than a decade. **Acceptance.** Core/test: an auto log range over 1e-6..1e-2 has `Min < 1e-6` and `Max > 1e-2`, and a flat log pen at 0.3 has `Min < 0.3 < Max` (`PenScaleModelTests`); `LogAxis.Ticks` gives majors at the six decades of 1e-6..1e-1 over 400 px and at least two majors with no gap under 40 px over 2..50 and 0.9..1.4 (`LogAxisTests`). UI: over 1e-6..1e-2 the 1e-4 plateau draws within 2 px of the data area's middle and a plateau at `0` draws 2 px above its bottom (`LogAxisRenderTests`); the panel's checkbox switches the axis at once, from a positive minimum typed just before the tick, and is refused over a manual minimum ≤ 0. DB: a written `log_scale_on_start` reads back through both catalogue reads. **Note.** Closed by the log10 axis (`charting.md#log10-y-axis`). Before it, the model supported log but the UI had no toggle and `ChartAxisBinder` only did a linear `SetLimitsY`. diff --git a/docs/architecture/trend-interaction.md b/docs/architecture/trend-interaction.md index 81a491f..a089e45 100644 --- a/docs/architecture/trend-interaction.md +++ b/docs/architecture/trend-interaction.md @@ -165,7 +165,7 @@ as-built mechanics that realize them: place that types limits: the navigation bar carries time navigation only. The scale modes are `auto`, which ranges over the columns inside the visible window, and `manual` (§AY-3, §AY-4); the log10 axis is an axis *type* beside either mode (§AY-6). A pen opens on the type its - `log_scale_on_start` stores, the panel's Logarithmic scale checkbox switches it for the session of the + `log_scale_on_start` stores, the panel's Logarithmic checkbox switches it for the session of the window, and Restore initial scale brings the stored type back with the stored bounds. A log axis needs a minimum above zero: the auto range skips values ≤ 0, the panel refuses the type over a manual minimum ≤ 0, and a sample ≤ 0 draws 2 px above the bottom of the data area while every readout @@ -382,8 +382,9 @@ control in `TrendChartView.axaml` and shown at the pointer) over `Chart/AxisScal field takes the `invalid` border, the message line names the rule, and no commit writes the pair. While the axis is logarithmic, a minimum ≤ 0 is invalid the same way, under `ScaleLogMinimumPositive`. The panel keeps its size (`ui-theme.md#the-axis-scale-panel`). -- The Logarithmic scale checkbox sits in its own row under the bounds, outside `AxisScaleBounds`, so a - press on it ends the pair's edit. It reads the pen's session flag, `IsLogarithmic`, `Mode=OneWay`, +- The Logarithmic checkbox sits in its own row under the bounds, outside `AxisScaleBounds`, so a + press on it ends the pair's edit; the row's label column is shared with the bounds grid + (`ui-theme.md#the-axis-scale-panel`). It reads the pen's session flag, `IsLogarithmic`, `Mode=OneWay`, seeded from the chart's settings at every seed, and writes it only through `ToggleLogarithmicCommand`, which orders its two writes by direction. Switching on, the pending pair is in the chart before `TrendChartViewModel.SetLogarithmic(penId, true)` checks the log rule: in the view the press or Tab onto diff --git a/docs/architecture/ui-text.md b/docs/architecture/ui-text.md index 256683a..a1c5bcf 100644 --- a/docs/architecture/ui-text.md +++ b/docs/architecture/ui-text.md @@ -239,7 +239,8 @@ and `PenEditorColumnUnit` from the pen list, `PenFormMaskPreviewLabel`, and the rest are its own: `PenFormMaskLabel`, `PenFormColorLabel`, `PenFormLineStyleLabel`, `PenFormVisibilityLabel` ("Visibility" / "Видимость") and `PenFormScaleTypeLabel` ("Scale type" / "Тип шкалы"). The visibility box reads `PenFormShowOnChart`, "Show on the chart" / "Показывать на графике", and the scale type box -`PenFormLogarithmic`, "Logarithmic" / "Логарифмическая". The line-style combo box reads +`PenFormLogarithmic`, "Logarithmic" / "Логарифмическая". The axis scale panel reads these two scale type +keys as the pen form reads its bound labels. The line-style combo box reads `PenLineStyleInterpolated` and `PenLineStyleStepped` through `PenLineStyleConverters.ToLabel`, a `FuncValueConverter` consumed through `{x:Static}`. @@ -334,7 +335,8 @@ English log line, names a statement the same way (`data-integration.md#two-error ## The axis scale panel's text `Chart/AxisScalePanel` reads `AxisScaleMaximumLabel` and `AxisScaleMinimumLabel` ("Maximum" / "Максимум", -"Minimum" / "Минимум") and `AxisScaleInitialScale`; it has no apply button, because the pair is written +"Minimum" / "Минимум"), `AxisScaleInitialScale`, and the pen form's `PenFormScaleTypeLabel` and +`PenFormLogarithmic`; it has no apply button, because the pair is written when its edit ends (`trend-interaction.md#the-axis-scale-panel`). Its Autoscale button reads `MenuViewAutoscale`, the same key as the menu item, so one word names the command in both places. The pen's name and unit are data, shown in two `TextBlock`s, so no format key joins them. @@ -342,8 +344,8 @@ The message line shows `AxisScaleBoundInvalid` ("Enter a number in each field" / число") for a field that is not a number in the operator's regional format, `AxisScaleBoundsRequired` ("Enter both bounds" / "Укажите обе границы") for an empty field and `AxisScaleMinimumBelowMaximum` ("The minimum must be below the maximum" / "Минимум должен быть меньше максимума") for an inverted or equal -pair. The checkbox under Minimum reads `AxisScaleLogarithmic` ("Logarithmic scale" / "Логарифмическая -шкала"), the scale type in the industry form the pen editor's log column uses, and +pair. The Scale type row reads `PenFormScaleTypeLabel` ("Scale type" / "Тип шкалы") and its box +`PenFormLogarithmic` ("Logarithmic" / "Логарифмическая"), the pen form's pair for the same setting, and `ScaleLogMinimumPositive`, the pen form's key, fills the message line for a minimum at or below zero on a logarithmic axis and for a tick the chart refuses over a manual minimum at or below zero. A tick refused over a pair that does not read shows that pair's rule instead. The Russian rule wraps to two lines in the diff --git a/docs/architecture/ui-theme.md b/docs/architecture/ui-theme.md index 1cd5d29..606ed3c 100644 --- a/docs/architecture/ui-theme.md +++ b/docs/architecture/ui-theme.md @@ -177,7 +177,7 @@ Semi owns the controls; these twenty keys are ours, and each exists in both vari | `AppSecondaryForegroundBrush` | Minimap end labels, hover line and hover time, chart crosshair, plot axis furniture, the chart's empty-catalogue message, the sidebar group header caption, its fold chevron and a row's unit, the axis scale panel's unit, the message panel's empty text and an entry's remedy, repeat count and time, the pen editor's groups cell, the pen pane's empty hint, its title's id and its mask preview, the groups pane's subtitle, a group row's pen count and "..." glyph, and the delete confirmation's note | `#818594` | `#6F737A` | | `AppAccentBrush` | Minimap window highlight border, the active sidebar row's left bar, a group header's fold chevron under the pointer (`overview.md#the-sidebar-fold`) | `#3574F0` | `#3574F0` | | `AppAccentFillBrush` | Minimap window highlight fill, the active sidebar row's background | `#3574F0` at 0.25 opacity | `#3574F0` at 0.25 opacity | -| `AppSeverityErrorBrush` | The message panel's dot on an `Error` entry; a form's invalid field border, the pen form's warning glyph and a form's message line | `#DB3B4B` | `#E55765` | +| `AppSeverityErrorBrush` | The message panel's dot on an `Error` entry; a form's invalid field border, the warning glyph of the pen form and the axis scale panel, and a form's message line | `#DB3B4B` | `#E55765` | | `AppSeverityWarningBrush` | The same dot on a `Warning` entry | `#E3AE4D` | `#F2C55C` | | `AppSeverityInfoBrush` | The same dot on an `Info` entry | `#3574F0` | `#3574F0` | | `AppConnectionOkBrush` | The status bar's connection indicator, `connection-ok` | `#208A3C` | `#5FAD65` | @@ -220,12 +220,17 @@ colour and text, never size: `Classes.invalid` to its `Is*Valid` flag, and `Styles/Forms.axaml` paints that border with `AppSeverityErrorBrush`. The glyph is a 16 px `PathIcon` of `WarningGeometry` (`Styles/Icons.axaml`) in `AppSeverityErrorBrush`, 8 px from the box's right edge, set as the box's `InnerRightContent` through a - `