Skip to content

Commit 2c39bc4

Browse files
bar should be minimum of 1x pwide, #301
1 parent 38f4421 commit 2c39bc4

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

assets/src/js/imports/chart.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ export function Chart() {
5858
for (i = 0; i < yTicks.length; i++) {
5959
leftOffset = Math.max(leftOffset, 8 + Math.max(5, yTicks[i].textContent.length * 8));
6060
}
61-
var tickWidth = (chart.clientWidth - leftOffset) / bars.length;
62-
barWidth = tickWidth - 2;
61+
var tickWidth = Math.max(1, (chart.clientWidth - leftOffset) / bars.length);
62+
barWidth = Math.max(1, tickWidth - 2);
6363

6464
// update width of each bar now that we know the client width
6565
bars[0].parentElement.style.display = 'none';
@@ -75,6 +75,7 @@ export function Chart() {
7575
bars[i].children[1].setAttribute('width', barWidth);
7676

7777
// tick <line>
78+
bars[i].children[2].style.display = barWidth === 1 ? 'none' : '';
7879
x = i * tickWidth + leftOffset + 0.5 * tickWidth;
7980
bars[i].children[2].setAttribute('x1', x);
8081
bars[i].children[2].setAttribute('x2', x);

src/class-dashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function show(): void
2121
$settings = get_settings();
2222
$stats = new Stats();
2323
$items_per_page = (int) apply_filters('koko_analytics_items_per_page', 20);
24-
$dateFormat = get_option('date_format');
24+
$dateFormat = get_option('date_format', 'Y-m-d');
2525
$dashboard_url = remove_query_arg(['start_date', 'end_date', 'view', 'posts', 'referrers']);
2626

2727
// parse query params

0 commit comments

Comments
 (0)