Skip to content

Commit

Permalink
coin2html: chart fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mkobetic committed Dec 15, 2024
1 parent 07bed61 commit 05c1e5a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 77 deletions.
14 changes: 7 additions & 7 deletions cmd/coin2html/js/src/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ export function viewChart(options?: {
// and max width for the x domain
let max = 0;
const widthFromGroup = (group: PostingGroup) => {
let width: number;
if (State.View.AggregationStyle == AggregationStyle.Flows) {
width = Math.trunc(group.sum.toNumber());
if (opts.negated) width = -width;
} else {
width = Math.trunc(group.balance.toNumber());
}
let width = Math.trunc(
(State.View.AggregationStyle == AggregationStyle.Flows
? group.sum
: group.balance
).toNumber()
);
if (opts.negated) width = -width;
return width < 0 ? 0 : width;
};
dates.forEach((_, i) => {
Expand Down
112 changes: 42 additions & 70 deletions examples/yearly/viewer/index.html

Large diffs are not rendered by default.

0 comments on commit 05c1e5a

Please sign in to comment.