File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
projects/observability/src/shared/components Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ export class DonutBuilderService extends D3VisualizationBuilderService<
3939 private static readonly DONUT_ARC_CLASS : string = 'donut-arc' ;
4040
4141 private static readonly DONUT_PADDING_PX : number = 10 ;
42- private static readonly MAX_DIAMETER_FOR_DONUT : number = 320 ;
4342 private static readonly MAX_FONT_SIZE_FOR_TITLE : number = 15 ;
4443 private static readonly MAX_FONT_SIZE_FOR_VALUE : number = 64 ;
4544
@@ -138,14 +137,12 @@ export class DonutBuilderService extends D3VisualizationBuilderService<
138137 protected decorateDimensions ( calculatedDimensions : ChartDimensions ) : DonutDimensions {
139138 let diameter = Math . min ( calculatedDimensions . visualizationWidth , calculatedDimensions . visualizationHeight ) ;
140139
140+ diameter -= DonutBuilderService . DONUT_PADDING_PX ;
141+
141142 // Reduce visualization area to diameter
142143 calculatedDimensions . visualizationWidth = diameter ;
143144 calculatedDimensions . visualizationHeight = diameter ;
144145
145- diameter -= DonutBuilderService . DONUT_PADDING_PX ;
146- diameter =
147- diameter > DonutBuilderService . MAX_DIAMETER_FOR_DONUT ? DonutBuilderService . MAX_DIAMETER_FOR_DONUT : diameter ;
148-
149146 return {
150147 ...calculatedDimensions ,
151148 donutOuterRadius : diameter / 2 ,
Original file line number Diff line number Diff line change 44.legend-entries {
55 display : flex ;
66 flex-wrap : wrap ;
7+ overflow : hidden ;
78
89 & .legend-row {
910 flex-direction : row ;
4546 }
4647
4748 .legend-label {
48- @include body-2-medium ($gray-4 );
49+ @include chart-small-regular ($gray-4 );
4950 @include ellipsis-overflow ();
5051 flex : 1 ;
5152 min-width : 24px ;
5253 }
5354
5455 .legend-value {
55- @include body-2-medium ($gray-9 );
56+ @include chart-small-regular ($gray-9 );
5657 padding-left : 16px ;
5758 }
5859 }
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ export abstract class D3VisualizationBuilderService<
226226 let legendWidth = isLegendVisible
227227 ? 0
228228 : isSideLegend
229- ? Math . min ( legendRect . width , this . getMaxLegendWidth ( ) )
229+ ? Math . min ( this . getLegendWidth ( outerRect . width ) , this . getMaxLegendWidth ( ) )
230230 : isTopOrBottomLegend
231231 ? outerRect . width
232232 : 0 ;
@@ -264,6 +264,10 @@ export abstract class D3VisualizationBuilderService<
264264 } ) ;
265265 }
266266
267+ private getLegendWidth ( outerRectWidth : number ) : number {
268+ return outerRectWidth >= 200 ? outerRectWidth * 0.35 : 0 ;
269+ }
270+
267271 private isLegendVisible ( config : ChartConfig ) : boolean {
268272 return config . legend === LegendPosition . None ;
269273 }
You can’t perform that action at this time.
0 commit comments