-
Notifications
You must be signed in to change notification settings - Fork 11
fix: fix misc issues with gauge and donuts #950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fb107f6
6f75ebc
6ebff07
3ae143c
caada59
b1a25ed
c585721
6f779ec
0135c4d
9eb1fda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ browserslist | |
LICENSE* | ||
conf/ | ||
coverage/ | ||
test-results/ | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,8 +38,7 @@ export class DonutBuilderService extends D3VisualizationBuilderService< | |
private static readonly DONUT_VALUE_CLASS: string = 'donut-value'; | ||
private static readonly DONUT_ARC_CLASS: string = 'donut-arc'; | ||
|
||
private static readonly DONUT_PADDING_PX: number = 60; | ||
private static readonly LEGEND_SIZE_MULTIPLE: number = 1.5; | ||
private static readonly DONUT_PADDING_PX: number = 10; | ||
|
||
public constructor( | ||
d3: D3UtilService, | ||
|
@@ -128,17 +127,7 @@ export class DonutBuilderService extends D3VisualizationBuilderService< | |
protected decorateDimensions(calculatedDimensions: ChartDimensions): DonutDimensions { | ||
let diameter = Math.min(calculatedDimensions.visualizationWidth, calculatedDimensions.visualizationHeight); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @skjindal93 @aaron-steinfeld Do you guys remember why we need this logic? It seems to reduce the size of donut by a lot. It creates problem with smaller container size. After I removed it, I didn't notice any issues. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically, we wanted the smaller dimension to decide the diameter for the donut. If the screen has more width than the height, the height determines the diameter and vice versa If there is a way to automatically fit in the donut, irrespective of different screen sizes, then that would be perfect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this logic was for sizing, based on the original donut mocks way back. The comments explain it, but it's mostly about legend, padding and fitting a square visualization into potentially rectangular bounding boxes like @skjindal93 mentioned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay, so with the new changes, the Donut is still working fine. It is however making a better use of the space and appearing bigger. Apart from that, I am not seeing any failure in terms of rendering. We might want to reduce the size of the dashboard containers though so that it can match previous size. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little hesitant about this change, mainly wrt the legend. Two things are being changed here.
The logic looks like it's doing these things regardless of legend position (If I vaguely recall, I think when written we always showed right legends) so that should be fixed, but this reads to me like we changed an assumption of a legend into an assumption of no legend, which is equally wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we are already using Flex in container. So css is automatically assigning them correct width and position. The padding also appears to be fine visually. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me share the screenshot in slack |
||
|
||
// Save available width before reducing width by adding padding | ||
const chartWidth = calculatedDimensions.visualizationWidth; | ||
|
||
// Legend takes up to width of donut or remaining available space (This needs more work to look good in all cases) | ||
calculatedDimensions.legendWidth = Math.min( | ||
diameter * DonutBuilderService.LEGEND_SIZE_MULTIPLE, | ||
chartWidth - diameter | ||
); | ||
|
||
// Reduce diameter by padding amount (don't need to do this with legend since it provides its own padding) | ||
diameter -= DonutBuilderService.DONUT_PADDING_PX * 2; | ||
diameter -= DonutBuilderService.DONUT_PADDING_PX; | ||
|
||
// Reduce visualization area to diameter | ||
calculatedDimensions.visualizationWidth = diameter; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Been meaning to do this for... months.