Skip to content

Commit 1cd3667

Browse files
committed
Change view of bar chart from a lot of days
1 parent 7d540e5 commit 1cd3667

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/scripts/chart/chart-core.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@ function barChart(data) {
251251
.attr('class', 'd3-tip')
252252
.offset([-10, 0])
253253
.html(function (d) {
254-
return "<strong>" + convertShortSummaryTimeToLongString(d.total) + "</strong>";
254+
if (data.length > 9)
255+
return "<strong><span class='red-label'>" + d.date + "</span></strong></br><strong>" + convertShortSummaryTimeToString(d.total) + "</strong>";
256+
else
257+
return "<strong>" + convertShortSummaryTimeToString(d.total) + "</strong>";
255258
});
256259

257260
svg.call(tip);
@@ -276,4 +279,7 @@ function barChart(data) {
276279
svg.append("g")
277280
.attr("transform", "translate(0," + height + ")")
278281
.call(d3.axisBottom(x));
282+
283+
if (data.length > 9)
284+
document.querySelectorAll('#barChart g.tick ').forEach(element => { element.remove() });
279285
}

src/style/chart.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,7 @@ tspan{
8787
top: 100%;
8888
left: 0;
8989
}
90+
91+
.red-label{
92+
color:red;
93+
}

0 commit comments

Comments
 (0)