diff --git a/frontend/src/App.js b/frontend/src/App.js
index 7be4c5a..2c5e847 100644
--- a/frontend/src/App.js
+++ b/frontend/src/App.js
@@ -12,6 +12,14 @@ function App() {
const handleStockSelection = (stock) => {
setSelectedStock(stock);
};
+ // Function to format the profit/loss percentage
+ const formatPercentage = (percentage) => {
+ if (percentage > 0) {
+ return `+${percentage.toFixed(2)}%`;
+ } else {
+ return `${percentage.toFixed(2)}%`; // Negative values already have a minus sign
+ }
+ };
return (
@@ -39,7 +47,12 @@ function App() {
{selectedStock ? `${selectedStock.name}` : 'Overall Portfolio'}
{selectedStock && (
-
Current Value: ${selectedStock.value_held.toFixed(2)} {selectedStock.profit_loss_percentage.toFixed(2)}%
+
+ Current Value: ${selectedStock.value_held.toFixed(2)}
+ = 0 ? 'green' : 'red' }}>
+ {` (${formatPercentage(selectedStock.profit_loss_percentage)})`}
+
+
Shares Held: {selectedStock.shares_held}
{/* Add other details you want to display */}
diff --git a/frontend/src/StockGraphing.js b/frontend/src/StockGraphing.js
index 2295b13..c6de15d 100644
--- a/frontend/src/StockGraphing.js
+++ b/frontend/src/StockGraphing.js
@@ -19,10 +19,10 @@ function StockGraph({ ticker }) { // Use destructuring to get the ticker prop
data: stockData.map(data => data.value),
fill: true,
label: '',
- backgroundColor: 'rgba(75, 192, 192, 0.2)', // Light green background
- borderColor: 'rgb(75, 192, 192)',
- borderWidth: 2,
- tension: 0.1,
+ backgroundColor: 'rgba(245, 245, 245, 0.2)',
+ borderColor: 'rgb(245, 245, 245)',
+ borderWidth: 0.8,
+ tension: 0.08,
pointRadius: 0,
hoverRadius: 0,
}]
@@ -47,7 +47,7 @@ function StockGraph({ ticker }) { // Use destructuring to get the ticker prop
intersect: true
},
animation: {
- duration: 1000 // Animation duration in milliseconds
+ duration: 2000 // Animation duration in milliseconds
}
};