@@ -44,7 +44,10 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
4444 List <({DateTime date, int downloads})> data) {
4545 final height = 80 ;
4646 final width = 190 ;
47- final drawingHeight = 75 ;
47+ final padding = 4 ;
48+ final drawingHeight = height - padding;
49+ final drawingWidth = width - 2 * padding;
50+
4851 final lastDay = data.last.date;
4952 final firstDay = data.first.date;
5053 final xAxisSpan = lastDay.difference (firstDay);
@@ -54,7 +57,8 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
5457
5558 (double , double ) computeCoordinates (DateTime date, int downloads) {
5659 final duration = date.difference (firstDay);
57- final x = width * duration.inMilliseconds / xAxisSpan.inMilliseconds;
60+ final x = padding +
61+ drawingWidth * duration.inMilliseconds / xAxisSpan.inMilliseconds;
5862 final y = height - drawingHeight * (downloads / maxDownloads);
5963 return (x, y);
6064 }
@@ -114,7 +118,8 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
114118
115119 final area = SVGPathElement ();
116120 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' );
118123
119124 chart.append (sparkline);
120125 chart.append (area);
@@ -131,7 +136,8 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
131136 'top:${e .y + toolTipOffsetFromMouse + document .scrollingElement !.scrollTop }px;'
132137 'left:${e .x }px;' );
133138
134- final s = (e.x - chart.getBoundingClientRect ().x) / width;
139+ final s =
140+ (e.x - (chart.getBoundingClientRect ().x + padding)) / drawingWidth;
135141 final selectedDayIndex =
136142 lowerBoundBy< ({DateTime date, int downloads}), double > (
137143 data,
0 commit comments