Fixes #2888 Add manual major interval and minor count override for chart axes#2889
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
🚧 Files skipped from review as they are similar to previous changes (10)
📝 WalkthroughWalkthroughAdds optional ChangesAxis MajorInterval and MinorTicks Feature
Sequence Diagram(s)sequenceDiagram
participant User
participant SingleAxisSettingsView
participant AxisSettingsPresenter
participant Axis
participant AxisBinder
participant OSPAxis as DevExpress OSPAxis
User->>SingleAxisSettingsView: Enter MajorInterval / MinorTicks
SingleAxisSettingsView->>Axis: set MajorInterval, MinorTicks
User->>AxisSettingsPresenter: Change axis unit
AxisSettingsPresenter->>Axis: MajorInterval = null
AxisBinder->>Axis: read MajorInterval, MinorTicks
AxisBinder->>AxisBinder: hasManualTickSettings?
alt Linear axis with manual settings
AxisBinder->>OSPAxis: NumericScaleOptions.GridSpacing = MajorInterval
AxisBinder->>OSPAxis: Tickmarks.MinorVisible, MinorCount
else No manual settings or logarithmic
AxisBinder->>OSPAxis: AutoGrid = true, default MinorCount
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review please |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/OSPSuite.UI.Tests/Binders/AxisBinderSpecs.cs (1)
122-205: ⚡ Quick winAdd a regression spec for invalid
MajorIntervalfallback.Current scenarios validate invalid
MinorCount, but there is no equivalent test forMajorInterval <= 0reverting to automatic grid. Please add one to lock the expected fallback behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/OSPSuite.UI.Tests/Binders/AxisBinderSpecs.cs` around lines 122 - 205, Add a new test class (similar in structure to When_refreshing_adapter_and_a_linear_axis_has_an_out_of_range_minor_count) to verify the fallback behavior when MajorInterval is invalid (<=0). In the Context method, set the axis MajorInterval to an invalid value such as 0 or a negative number. In the Because method, call RefreshRange with the same parameters as other similar tests. Add an Observation method that verifies the axis automatically falls back to automatic grid behavior by checking that AutoGrid is enabled (ShouldBeTrue) rather than throwing an error. This test should be placed after the out-of-range minor count scenario and before the logarithmic axis scenario to maintain the logical test grouping.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/OSPSuite.UI/Binders/AxisBinder.cs`:
- Line 217: The hasManualTickSettings property at line 217 checks only
Axis.MajorInterval.HasValue without validating that the value is greater than
zero, and the same issue occurs at line 226. Create a new validation property
similar to the existing hasValidMinorCount pattern that checks both HasValue and
validates that MajorInterval is greater than zero, then update the
hasManualTickSettings property and the condition at line 226 to use this new
validation method instead of just checking HasValue. This will ensure invalid
MajorInterval values don't propagate to GridSpacing and the binder gracefully
falls back to automatic grid mode.
---
Nitpick comments:
In `@tests/OSPSuite.UI.Tests/Binders/AxisBinderSpecs.cs`:
- Around line 122-205: Add a new test class (similar in structure to
When_refreshing_adapter_and_a_linear_axis_has_an_out_of_range_minor_count) to
verify the fallback behavior when MajorInterval is invalid (<=0). In the Context
method, set the axis MajorInterval to an invalid value such as 0 or a negative
number. In the Because method, call RefreshRange with the same parameters as
other similar tests. Add an Observation method that verifies the axis
automatically falls back to automatic grid behavior by checking that AutoGrid is
enabled (ShouldBeTrue) rather than throwing an error. This test should be placed
after the out-of-range minor count scenario and before the logarithmic axis
scenario to maintain the logical test grouping.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1289cb29-83a6-49c5-843b-8d9457518d63
📒 Files selected for processing (15)
src/OSPSuite.Assets/UIConstants.cssrc/OSPSuite.Core/Chart/Axis.cssrc/OSPSuite.Core/Serialization/Chart/AxisXmlSerializer.cssrc/OSPSuite.Core/Snapshots/Axis.cssrc/OSPSuite.Core/Snapshots/Mappers/AxisMapper.cssrc/OSPSuite.Presentation/Presenters/Charts/AxisSettingsPresenter.cssrc/OSPSuite.UI/Binders/AxisBinder.cssrc/OSPSuite.UI/Views/Charts/AxisSettingsView.cssrc/OSPSuite.UI/Views/Charts/SingleAxisSettingsView.Designer.cssrc/OSPSuite.UI/Views/Charts/SingleAxisSettingsView.cstests/OSPSuite.Core.IntegrationTests/Serializers/AxisXmlSerializerSpecs.cstests/OSPSuite.Core.Tests/Domain/AxisSpecs.cstests/OSPSuite.Core.Tests/Mappers/AxisMapperSpecs.cstests/OSPSuite.HelpersForTests/AssertForSpecs.cstests/OSPSuite.UI.Tests/Binders/AxisBinderSpecs.cs
Fixes #2888
Summary
Adds two optional, per-axis settings that let the user override the automatic tick calculation for chart axes, mirroring how
Min/Maxalready work:float?) → DevExpressNumericScaleOptions.GridSpacing(spacing between major gridlines, in axis units).int?) → DevExpressAxis.MinorCount(number of minor ticks between two major ticks).Behavior
Min/Max).MajorIntervalis reset when the axis unit changes (it is expressed in axis units, likeMin/Max);MinorCountis unit-independent and preserved.Clone.MajorIntervalmust be > 0;MinorCountmust be within the range DevExpress accepts (greater than 0 and less than 100). The binder also falls back to the automatic count for any out-of-range value, so an invalid value can never crash the chart.Tests
UpdateFrom(AxisSpecs)AxisMapperSpecs) and XML round-trip (AxisXmlSerializerSpecs+AssertForSpecs.AreEqualAxis)AxisBinderSpecs): override applied on linear axes, falls back to auto when cleared or out of range, ignored on log axesAll green:
dotnet build0 errors; Core and UI axis specs pass.🤖 Generated with Claude Code
Summary by CodeRabbit
Summary by CodeRabbit
Release Notes