diff --git a/.eslintrc.json b/.eslintrc.json index 7defab5..f850ecb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,6 +17,8 @@ ], "react/jsx-boolean-value": "off", "react/sort-comp": "off", - "jsx-a11y/interactive-supports-focus": "off" + "jsx-a11y/interactive-supports-focus": "off", + "react/prop-types": "off", + "no-plusplus": "off" } } \ No newline at end of file diff --git a/src/Components/PortfolioBuilderApp/PortfolioBuilderApp.jsx b/src/Components/PortfolioBuilderApp/PortfolioBuilderApp.jsx index a8b6b49..53bd950 100644 --- a/src/Components/PortfolioBuilderApp/PortfolioBuilderApp.jsx +++ b/src/Components/PortfolioBuilderApp/PortfolioBuilderApp.jsx @@ -12,6 +12,7 @@ class PortfolioBuilderApp extends Component { this.allScripPrices = data.price; this.allScripEPS = data.eps; + this.allScripHistorical = data.historical; this.state = { portfolioScripPrices: { @@ -106,6 +107,7 @@ class PortfolioBuilderApp extends Component { 0) { + const dateCount = allScripHistorical[portfolioScripNames[0]].point.length; + + + for (let dateIndex = 0; dateIndex < dateCount; dateIndex++) { + let datePriceSum = 0; + + portfolioScripNames.forEach((scripName) => { + const tmpPrice = allScripHistorical[scripName].point[dateIndex].price; + const count = portfolioScripCounts[scripName]; + datePriceSum += (tmpPrice * count); + }); + + chartData.push({ + label: dateIndex.toString(), + value: datePriceSum, + }); + } + } + + return chartData; + } + + calcHistoricalChartConfig() { + const tmpDataSource = { + chart: { + numberPrefix: '₹', + chartLeftMargin: 0, + chartRightMargin: 0, + showValues: 0, + setAdaptiveYMin: 1, + theme: 'ocean', + }, + data: this.calcPriceChartData(), + }; + + const chartConfigs = { + type: 'area2d', + width: '100%', + height: 300, + dataFormat: 'json', + dataSource: tmpDataSource, + }; + + return chartConfigs; + } + renderPortfolioEditor() { const portfolioScripPrices = this.props.portfolioScripPrices; const portfolioScripCounts = this.props.portfolioScripCounts; @@ -72,9 +132,7 @@ class PortfolioManager extends Component {
WEIGHT
-
- -
+
@@ -143,6 +201,7 @@ class PortfolioManager extends Component {
+
@@ -195,7 +254,7 @@ class PortfolioManager extends Component {
{this.renderPortfolioEditor()} {this.renderPortfolioOverview()} -
+