@@ -44,7 +44,10 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
44
44
List <({DateTime date, int downloads})> data) {
45
45
final height = 80 ;
46
46
final width = 190 ;
47
- final drawingHeight = 75 ;
47
+ final padding = 4 ;
48
+ final drawingHeight = height - padding;
49
+ final drawingWidth = width - 2 * padding;
50
+
48
51
final lastDay = data.last.date;
49
52
final firstDay = data.first.date;
50
53
final xAxisSpan = lastDay.difference (firstDay);
@@ -54,7 +57,8 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
54
57
55
58
(double , double ) computeCoordinates (DateTime date, int downloads) {
56
59
final duration = date.difference (firstDay);
57
- final x = width * duration.inMilliseconds / xAxisSpan.inMilliseconds;
60
+ final x = padding +
61
+ drawingWidth * duration.inMilliseconds / xAxisSpan.inMilliseconds;
58
62
final y = height - drawingHeight * (downloads / maxDownloads);
59
63
return (x, y);
60
64
}
@@ -114,7 +118,8 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
114
118
115
119
final area = SVGPathElement ();
116
120
area.setAttribute ('class' , 'weekly-sparkline-area' );
117
- area.setAttribute ('d' , '$line L$width $height L0 $height Z' );
121
+ area.setAttribute (
122
+ 'd' , '$line L${drawingWidth + padding } $height L$padding $height Z' );
118
123
119
124
chart.append (sparkline);
120
125
chart.append (area);
@@ -131,7 +136,8 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
131
136
'top:${e .y + toolTipOffsetFromMouse + document .scrollingElement !.scrollTop }px;'
132
137
'left:${e .x }px;' );
133
138
134
- final s = (e.x - chart.getBoundingClientRect ().x) / width;
139
+ final s =
140
+ (e.x - (chart.getBoundingClientRect ().x + padding)) / drawingWidth;
135
141
final selectedDayIndex =
136
142
lowerBoundBy< ({DateTime date, int downloads}), double > (
137
143
data,
0 commit comments