Skip to content

Commit

Permalink
feat: disabled bar chart widget if there is no data to visualize
Browse files Browse the repository at this point in the history
  • Loading branch information
exelban committed Aug 22, 2024
1 parent 6fd89fe commit bdbaeb8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Kit/Widgets/BarChart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ public class BarChart: WidgetWrapper {
colorZones = self._colorZones
}

guard !value.isEmpty else {
self.setWidth(0)
return
}

var width: CGFloat = Constants.Widget.margin.x*2
var x: CGFloat = 0
let lineWidth = 1 / (NSScreen.main?.backingScaleFactor ?? 1)
Expand Down

0 comments on commit bdbaeb8

Please sign in to comment.