File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -239,9 +239,27 @@ public double PointToValue(double x, double y)
239
239
protected internal double GetActualDesiredIntervalsCount ( Size availableSize )
240
240
{
241
241
double size = ! IsVertical ? availableSize . Width : availableSize . Height ;
242
- double adjustedDesiredIntervalsCount = size * ( ! IsVertical ? 0.54 : 1.0 ) * MaximumLabels ;
243
- var actualDesiredIntervalsCount = Math . Max ( adjustedDesiredIntervalsCount / 100 , 1.0 ) ;
244
- return actualDesiredIntervalsCount ;
242
+
243
+ double spacingFactor = 1.0 ; //If the Axis is Vertical
244
+
245
+ if ( ! IsVertical )
246
+ {
247
+ // Base factor for horizontal labels
248
+ double factor = 0.6 ;
249
+ // Adjust based on label rotation
250
+ double rotationRadians = Math . Abs ( LabelRotation ) * Math . PI / 180 ;
251
+
252
+ if ( rotationRadians > 0 )
253
+ {
254
+ // Rotated labels can be packed more densely
255
+ factor *= 1.0 + 0.3 * Math . Sin ( rotationRadians ) ;
256
+ }
257
+
258
+ spacingFactor = factor ;
259
+ }
260
+
261
+ double adjustedDesiredIntervalsCount = size * spacingFactor * MaximumLabels ;
262
+ return Math . Max ( adjustedDesiredIntervalsCount / 100 , 1.0 ) ;
245
263
}
246
264
247
265
/// <summary>
You can’t perform that action at this time.
0 commit comments