Skip to content
Snippets Groups Projects
Commit b455402a authored by Robert Goldmann's avatar Robert Goldmann
Browse files

coding style

parent 122cdff9
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ for(var i = 0; i < transactionData.length; i++) ...@@ -17,7 +17,7 @@ for(var i = 0; i < transactionData.length; i++)
var transaction = transactionData[i]; var transaction = transactionData[i];
var categoryName = transaction.category.name; var categoryName = transaction.category.name;
// create new category is not already in dict // create new category if not already in dict
if(!categoryNames.includes(categoryName)) if(!categoryNames.includes(categoryName))
{ {
categoryNames.push(categoryName); categoryNames.push(categoryName);
...@@ -34,7 +34,8 @@ for(var i = 0; i < transactionData.length; i++) ...@@ -34,7 +34,8 @@ for(var i = 0; i < transactionData.length; i++)
if(amount > 0) if(amount > 0)
{ {
incomes[index] = incomes[index] + amount; incomes[index] = incomes[index] + amount;
} else }
else
{ {
expenditures[index] = expenditures[index] + Math.abs(amount); expenditures[index] = expenditures[index] + Math.abs(amount);
} }
...@@ -96,7 +97,7 @@ var plotlyLayout = { ...@@ -96,7 +97,7 @@ var plotlyLayout = {
} }
}, },
barmode: 'stack', barmode: 'stack',
hovermode: 'closest' hovermode: 'closest' // show hover popup only for hovered item
}; };
// Add your Plotly configuration settings here (optional) // Add your Plotly configuration settings here (optional)
......
...@@ -32,7 +32,8 @@ for(var i = 0; i < transactionData.length; i++) ...@@ -32,7 +32,8 @@ for(var i = 0; i < transactionData.length; i++)
{ {
var lastIndex = incomes.length - 1; var lastIndex = incomes.length - 1;
incomes[lastIndex] = incomes[lastIndex] + amount; incomes[lastIndex] = incomes[lastIndex] + amount;
} else }
else
{ {
var lastIndex = expenditures.length - 1; var lastIndex = expenditures.length - 1;
expenditures[lastIndex] = expenditures[lastIndex] + Math.abs(amount); expenditures[lastIndex] = expenditures[lastIndex] + Math.abs(amount);
......
...@@ -32,7 +32,8 @@ for(var i = 0; i < transactionData.length; i++) ...@@ -32,7 +32,8 @@ for(var i = 0; i < transactionData.length; i++)
{ {
var lastIndex = incomes.length - 1; var lastIndex = incomes.length - 1;
incomes[lastIndex] = incomes[lastIndex] + amount; incomes[lastIndex] = incomes[lastIndex] + amount;
} else }
else
{ {
var lastIndex = expenditures.length - 1; var lastIndex = expenditures.length - 1;
expenditures[lastIndex] = expenditures[lastIndex] + Math.abs(amount); expenditures[lastIndex] = expenditures[lastIndex] + Math.abs(amount);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment