Skip to content

Commit

Permalink
fix asset account page
Browse files Browse the repository at this point in the history
  • Loading branch information
ananthakumaran committed Dec 30, 2023
1 parent 130f624 commit 68e6eb7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/lib/portfolio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function renderPortfolioBreakdown(
legends: groups.map((g) => {
return {
label: g,
color: z(g),
color: z ? z(g) : "",
shape: "square"
};
}),
Expand Down
36 changes: 23 additions & 13 deletions src/routes/(app)/assets/gain/[slug]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import COLORS, { generateColorScheme, genericBarColor } from "$lib/colors";
import { renderAccountOverview } from "$lib/gain";
import { renderAccountOverview, buildLegends } from "$lib/gain";
import { filterCommodityBreakdowns, renderPortfolioBreakdown } from "$lib/portfolio";
import {
ajax,
Expand All @@ -21,6 +21,7 @@
import LevelItem from "$lib/components/LevelItem.svelte";
import { iconify } from "$lib/icon";
import BoxLabel from "$lib/components/BoxLabel.svelte";
import LegendCard from "$lib/components/LegendCard.svelte";
let commodities: string[] = [];
let selectedCommodities: string[] = [];
Expand All @@ -39,6 +40,7 @@
let gain: AccountGain;
let overview: Networth;
let assetBreakdown: AssetBreakdown;
let legends = buildLegends();
let destroyCallback = () => {};
let postings: Posting[] = [];
Expand Down Expand Up @@ -72,19 +74,27 @@
);
selectedCommodities = [...commodities];
securityTypeR = renderPortfolioBreakdown("#d3-portfolio-security-type", security_type, {
({ renderer: securityTypeR } = renderPortfolioBreakdown(
"#d3-portfolio-security-type",
security_type,
{
small: true
}
));
({ renderer: ratingR } = renderPortfolioBreakdown("#d3-portfolio-security-rating", rating, {
small: true
});
ratingR = renderPortfolioBreakdown("#d3-portfolio-security-rating", rating, {
}));
({ renderer: industryR } = renderPortfolioBreakdown(
"#d3-portfolio-security-industry",
industry,
{
small: true,
z: [genericBarColor()]
}
));
({ renderer: portfolioR } = renderPortfolioBreakdown("#d3-portfolio", name_and_security_type, {
small: true
});
industryR = renderPortfolioBreakdown("#d3-portfolio-security-industry", industry, {
small: true,
z: [genericBarColor()]
});
portfolioR = renderPortfolioBreakdown("#d3-portfolio", name_and_security_type, {
small: true
});
}));
if (commodities.length !== 0) {
color = generateColorScheme(commodities);
Expand Down Expand Up @@ -194,7 +204,7 @@
</div>
</div>
{/if}
<svg id="d3-gain-legend" width="100%" height="50" />
<LegendCard {legends} clazz="mb-2" />
<div class="box">
<svg id="d3-account-timeline-breakdown" width="100%" height="450" />
</div>
Expand Down

0 comments on commit 68e6eb7

Please sign in to comment.