@@ -38,17 +38,20 @@ void create(HTMLElement element, Map<String, String> options) {
3838
3939void drawChart (Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
4040 List <({DateTime date, int downloads})> data) {
41- final height = 75 ;
41+ final height = 80 ;
4242 final width = 190 ;
43+ final drawingHeight = 75 ;
4344 final lastDay = data.last.date;
4445 final firstDay = data.first.date;
4546 final xAxisSpan = lastDay.difference (firstDay);
4647 final maxDownloads = data.fold <int >(0 , (a, b) => max <int >(a, b.downloads));
4748
49+ final toolTipOffsetFromMouse = 15 ;
50+
4851 (double , double ) computeCoordinates (DateTime date, int downloads) {
4952 final duration = date.difference (firstDay);
5053 final x = width * duration.inMilliseconds / xAxisSpan.inMilliseconds;
51- final y = 5 + ( height) - (height) * (downloads / maxDownloads);
54+ final y = height - drawingHeight * (downloads / maxDownloads);
5255 return (x, y);
5356 }
5457
@@ -121,7 +124,7 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
121124 sparklineCursor.setAttribute ('style' , 'opacity:1' );
122125 toolTip.setAttribute (
123126 'style' ,
124- 'top:${e .y + 15 + document .scrollingElement !.scrollTop }px;'
127+ 'top:${e .y + toolTipOffsetFromMouse + document .scrollingElement !.scrollTop }px;'
125128 'left:${e .x }px;' );
126129
127130 final s = (e.x - chart.getBoundingClientRect ().x) / width;
0 commit comments