Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pages same + graph update in finviz #55

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BAviz/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<nav>
<!-- Add navigation bar options with placeholders -->
<a href=../index.html>Home</a>
<a href="../team">About Us</a>
<a href="../state_sectors">State Small Business Profile by Sector </a>
<a href="../dataviz_fin">Historical Funding Patterns</a>
<a href="../BAviz">Historical Small Business Formation</a>
<a href="../team">About Us</a>
</nav>

<h1>Number of Business Application</h1>
Expand Down
4 changes: 4 additions & 0 deletions BAviz/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
body{
font-family: 'Arial', sans-serif;
margin: 20px; /* ページ全体の余白を追加 */
background-color: #e5e5f7;
opacity: 0.8;
background-image: radial-gradient(#444cf7 0.5px, #e5e5f7 0.5px);
background-size: 10px 10px;
}

.chart-container {
Expand Down
4 changes: 4 additions & 0 deletions dataviz/styles.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #e5e5f7;
opacity: 0.8;
background-image: radial-gradient(#444cf7 0.5px, #e5e5f7 0.5px);
background-size: 10px 10px;
}

h1 {
Expand Down
5 changes: 2 additions & 3 deletions dataviz_fin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@
<title>Financing Visualizations</title>
<link rel="stylesheet" href="styles.css">
<script src="https://d3js.org/d3.v6.min.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>

<nav>
<!-- Add navigation bar options with placeholders -->
<a href=../index.html>Home</a>
<a href="../team">About Us</a>
<a href="../state_sectors">State Small Business Profile by Sector </a>
<a href="../dataviz_fin">Historical Funding Patterns</a>
<a href="../BAviz">Historical Small Business Formation</a>
<a href="../team">About Us</a>
</nav>

=======

<h1>Historical Funding Patterns</h1>
<svg id="values" width="960" height="500"></svg>
<h2>Average Ticket Size of Approved Loans</h2>
Expand Down
3 changes: 2 additions & 1 deletion dataviz_fin/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ d3.csv("SBA_Approved_Loan_Values.csv").then(function(data) {
// Color palette for each year
const color = d3.scaleOrdinal()
.domain(years)
.range(d3.schemeCategory10);
.range(d3.schemeSpectral[7])
.unknown("#ccc");

// Group the data by metric
const groupedData = metrics.map(metric => {
Expand Down
6 changes: 5 additions & 1 deletion dataviz_fin/script_avg.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ d3.csv("SBA_Avg_Tkt_Size.csv").then(function(data) {
.call(d3.axisLeft(y));

// Color palette for each year
//const myColorScheme = ["#DC143C", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"];

const color = d3.scaleOrdinal()
.domain(years)
.range(d3.schemeCategory10);
.range(d3.schemeSpectral[7])
.unknown("#ccc");
//.range(myColorScheme); //range(d3.schemeCategory10);

// Group the data by metric
const groupedData = metrics.map(metric => {
Expand Down
3 changes: 2 additions & 1 deletion dataviz_fin/script_count.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ d3.csv("SBA_Count_Approved_Loans.csv").then(function(data) {
// Color palette for each year
const color = d3.scaleOrdinal()
.domain(years)
.range(d3.schemeCategory10);
.range(d3.schemeSpectral[7])
.unknown("#ccc");

// Group the data by metric
const groupedData = metrics.map(metric => {
Expand Down
18 changes: 0 additions & 18 deletions dataviz_fin/style.css

This file was deleted.

26 changes: 25 additions & 1 deletion dataviz_fin/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
body{
font-family: 'Arial', sans-serif;
margin: 20px; /* ページ全体の余白を追加 */
background-color: #e5e5f7;
opacity: 0.8;
background-image: radial-gradient(#444cf7 0.5px, #e5e5f7 0.5px);
background-size: 10px 10px;
}

.chart-container {
Expand Down Expand Up @@ -57,4 +61,24 @@ select {
p {
bottom: 20px; /* 下端を親要素の下端に配置 */
left: 100px; /* 左端を中央に配置 */
}
}


nav {
background-color: #333;
overflow: hidden;
}

nav a {
float: left;
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}

nav a:hover {
background-color: #ddd;
color: black;
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<nav>
<!-- Add navigation bar options with placeholders -->
<a href=index.html>Home</a>
<a href="team">About Us</a>
<a href="state_sectors">State Small Business Profile by Sector </a>
<a href="dataviz_fin">Historical Funding Patterns</a>
<a href="BAviz">Historical Small Business Formation</a>
<a href="team">About Us</a>
</nav>

<h1>Supporting Small Businesses through Economic Shocks</h1>
Expand Down
2 changes: 1 addition & 1 deletion state_sectors/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<nav>
<!-- Add navigation bar options with placeholders -->
<a href=../index.html>Home</a>
<a href="../team">About Us</a>
<a href="../state_sectors">State Small Business Profile by Sector </a>
<a href="../dataviz_fin">Historical Funding Patterns</a>
<a href="../BAviz">Historical Small Business Formation</a>
<a href="../team">About Us</a>
</nav>
<h1>Which Types of Small Businesses Prevail in Each State?</h1>

Expand Down
4 changes: 4 additions & 0 deletions state_sectors/styles.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #e5e5f7;
opacity: 0.8;
background-image: radial-gradient(#444cf7 0.5px, #e5e5f7 0.5px);
background-size: 10px 10px;
}

h1 {
Expand Down
6 changes: 6 additions & 0 deletions styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ h1 {

body {
font-family: 'Open Sans', sans-serif;
background-color: #e5e5f7;
opacity: 0.8;
background-image: radial-gradient(#444cf7 0.5px, #e5e5f7 0.5px);
background-size: 10px 10px;
}



nav {
background-color: #333;
overflow: hidden;
Expand Down
Binary file added team/images/.DS_Store
Binary file not shown.
3 changes: 0 additions & 3 deletions team/images/Financing Visualizations_files/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ d3.csv("SBA_Approved_Loan_Values.csv").then(function(data) {
svg.append("g")
.attr("transform", `translate(0,${height})`)
.call(d3.axisBottom(x0));
.selectAll("text") // Select all text elements in the X-axis group
.style("font-size", "14px") // Increase font size
.style("font-weight", "bold"); // Make the text bold


// Scale for each year within the metric
Expand Down
93 changes: 93 additions & 0 deletions team/images/Financing Visualizations_files/script_avg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
(function () {

// Set the dimensions and margins of the chart
const margin = {top: 70, right: 60, bottom: 90, left: 80},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;

// Append the svg object to the body of the page
const svg = d3.select("#avg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", `translate(100,20)`);

// Read the data from the CSV file
d3.csv("SBA_Avg_Tkt_Size.csv").then(function(data) {
// Extract unique metrics and years
const metrics = [...new Set(data.map(d => d.Metric))];

const years = [...new Set(data.map(d => d.year))];

// Create a group for each metric
const x0 = d3.scaleBand()
.domain(metrics)
.rangeRound([0, width])
.paddingInner(0.1);
svg.append("g")
.attr("transform", `translate(0,${height})`)
.call(d3.axisBottom(x0));


// Scale for each year within the metric
const x1 = d3.scaleBand()
.domain(years)
.rangeRound([0, x0.bandwidth()])
.padding(0.05);

// Add Y axis
const y = d3.scaleLinear()
.domain([0, d3.max(data, d => +d['Avg'])])
.nice()
.range([height, 0]);
svg.append("g")
.call(d3.axisLeft(y));

// Color palette for each year
const myColorScheme = ["#DC143C", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"];

const color = d3.scaleOrdinal()
.domain(years)
.range(d3.schemeSpectral[10])
.unknown("#ccc");
//.range(myColorScheme); //range(d3.schemeCategory10);

// Group the data by metric
const groupedData = metrics.map(metric => {
return {
metric: metric,
values: data.filter(d => d.Metric === metric)
};
});

// Add groups for each metric and draw bars
const metricGroups = svg.selectAll(".metric-group")
.data(groupedData)
.enter().append("g")
.attr("class", "metric-group")
.attr("transform", d => `translate(${x0(d.metric)}, 0)`);

metricGroups.selectAll("rect")
.data(d => years.map(year => {
return { year: year, value: d.values.find(v => v.year === year)?.['Avg'] || 0 };
}))
.enter().append("rect")
.attr("x", d => x1(d.year))
.attr("y", d => y(d.value))
.attr("width", x1.bandwidth())
.attr("height", d => height - y(d.value))
.attr("fill", d => color(d.year));

metricGroups.each(function(metricGroupData) {
d3.select(this).selectAll(".year-label")
.data(years)
.enter().append("text")
.attr("class", "year-label")
.attr("x", d => x1(d) + x1.bandwidth() / 2)
.attr("y", height + 25) // Adjust this value as needed
.attr("text-anchor", "middle")
.text(d => d);
});
})
})
();
Loading