Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BudgetMaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
PlayWallDesktop wird heute 10 Jahre alt!
Show more breadcrumbs
Robert Goldmann
BudgetMaster
Commits
248d89e6
Commit
248d89e6
authored
Sep 11, 2017
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
Fixed
#176
- chart full legend add delimiter lines
parent
4419ff40
No related branches found
No related tags found
1 merge request
!213
merge v1_6_0 into master
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/de/deadlocker8/budgetmaster/logic/charts/CategoriesChart.java
+28
-7
28 additions, 7 deletions
...eadlocker8/budgetmaster/logic/charts/CategoriesChart.java
with
28 additions
and
7 deletions
src/de/deadlocker8/budgetmaster/logic/charts/CategoriesChart.java
+
28
−
7
View file @
248d89e6
...
@@ -18,6 +18,7 @@ import javafx.scene.layout.Priority;
...
@@ -18,6 +18,7 @@ import javafx.scene.layout.Priority;
import
javafx.scene.layout.Region
;
import
javafx.scene.layout.Region
;
import
javafx.scene.layout.VBox
;
import
javafx.scene.layout.VBox
;
import
javafx.scene.paint.Color
;
import
javafx.scene.paint.Color
;
import
javafx.scene.text.Font
;
import
javafx.scene.transform.Transform
;
import
javafx.scene.transform.Transform
;
import
javafx.stage.Modality
;
import
javafx.stage.Modality
;
import
javafx.stage.Stage
;
import
javafx.stage.Stage
;
...
@@ -35,6 +36,7 @@ public class CategoriesChart extends VBox implements ChartExportable
...
@@ -35,6 +36,7 @@ public class CategoriesChart extends VBox implements ChartExportable
private
LegendType
legendType
;
private
LegendType
legendType
;
private
final
double
CHART_HEIGHT
=
200
;
private
final
double
CHART_HEIGHT
=
200
;
private
final
double
FULL_LEGEND_ITEM_HEIGHT
=
40
;
private
final
double
FULL_LEGEND_ITEM_HEIGHT
=
40
;
private
final
double
DELIMITER_HEIGHT
=
21
;
public
CategoriesChart
(
String
titleIncomes
,
String
titlePayments
,
ArrayList
<
CategoryInOutSum
>
categoryInOutSums
,
String
currency
,
LegendType
legendType
)
public
CategoriesChart
(
String
titleIncomes
,
String
titlePayments
,
ArrayList
<
CategoryInOutSum
>
categoryInOutSums
,
String
currency
,
LegendType
legendType
)
{
{
...
@@ -176,7 +178,7 @@ public class CategoriesChart extends VBox implements ChartExportable
...
@@ -176,7 +178,7 @@ public class CategoriesChart extends VBox implements ChartExportable
double
totalOut
=
getTotal
(
categoryInOutSums
,
false
);
double
totalOut
=
getTotal
(
categoryInOutSums
,
false
);
HBox
hboxLegend
=
new
HBox
();
HBox
hboxLegend
=
new
HBox
();
hboxLegend
.
setSpacing
(
1
0
);
hboxLegend
.
setSpacing
(
0
);
VBox
vboxCircles
=
new
VBox
();
VBox
vboxCircles
=
new
VBox
();
vboxCircles
.
setSpacing
(
10
);
vboxCircles
.
setSpacing
(
10
);
...
@@ -195,6 +197,7 @@ public class CategoriesChart extends VBox implements ChartExportable
...
@@ -195,6 +197,7 @@ public class CategoriesChart extends VBox implements ChartExportable
Label
labelHeaderName
=
new
Label
(
Localization
.
getString
(
Strings
.
TITLE_CATEGORIES
));
Label
labelHeaderName
=
new
Label
(
Localization
.
getString
(
Strings
.
TITLE_CATEGORIES
));
labelHeaderName
.
setStyle
(
"-fx-font-weight: bold; -fx-underline: true;"
);
labelHeaderName
.
setStyle
(
"-fx-font-weight: bold; -fx-underline: true;"
);
labelHeaderName
.
setMinHeight
(
20
);
labelHeaderName
.
setMinHeight
(
20
);
labelHeaderName
.
setPadding
(
new
Insets
(
0
,
0
,
0
,
10
));
vboxNames
.
getChildren
().
add
(
labelHeaderName
);
vboxNames
.
getChildren
().
add
(
labelHeaderName
);
Label
labelHeaderIn
=
new
Label
(
Localization
.
getString
(
Strings
.
TITLE_INCOMES
));
Label
labelHeaderIn
=
new
Label
(
Localization
.
getString
(
Strings
.
TITLE_INCOMES
));
...
@@ -218,6 +221,7 @@ public class CategoriesChart extends VBox implements ChartExportable
...
@@ -218,6 +221,7 @@ public class CategoriesChart extends VBox implements ChartExportable
Label
labelName
=
new
Label
(
currentItem
.
getName
());
Label
labelName
=
new
Label
(
currentItem
.
getName
());
labelName
.
setStyle
(
"-fx-font-weight: bold;"
);
labelName
.
setStyle
(
"-fx-font-weight: bold;"
);
labelName
.
setMinHeight
(
20
);
labelName
.
setMinHeight
(
20
);
labelName
.
setPadding
(
new
Insets
(
0
,
0
,
0
,
10
));
vboxNames
.
getChildren
().
add
(
labelName
);
vboxNames
.
getChildren
().
add
(
labelName
);
String
percentageIn
=
totalIn
!=
0
?
Helpers
.
NUMBER_FORMAT
.
format
(
Math
.
abs
((
currentItem
.
getBudgetIN
()
/
totalIn
)))
:
"0,00"
;
String
percentageIn
=
totalIn
!=
0
?
Helpers
.
NUMBER_FORMAT
.
format
(
Math
.
abs
((
currentItem
.
getBudgetIN
()
/
totalIn
)))
:
"0,00"
;
...
@@ -231,6 +235,12 @@ public class CategoriesChart extends VBox implements ChartExportable
...
@@ -231,6 +235,12 @@ public class CategoriesChart extends VBox implements ChartExportable
labelOutSum
.
setStyle
(
"-fx-font-weight: bold;"
);
labelOutSum
.
setStyle
(
"-fx-font-weight: bold;"
);
labelOutSum
.
setMinHeight
(
20
);
labelOutSum
.
setMinHeight
(
20
);
vboxOut
.
getChildren
().
add
(
labelOutSum
);
vboxOut
.
getChildren
().
add
(
labelOutSum
);
//add delimiters
vboxCircles
.
getChildren
().
add
(
generateNewSeparator
());
vboxNames
.
getChildren
().
add
(
generateNewSeparator
());
vboxIn
.
getChildren
().
add
(
generateNewSeparator
());
vboxOut
.
getChildren
().
add
(
generateNewSeparator
());
}
}
hboxLegend
.
getChildren
().
add
(
vboxCircles
);
hboxLegend
.
getChildren
().
add
(
vboxCircles
);
...
@@ -263,6 +273,17 @@ public class CategoriesChart extends VBox implements ChartExportable
...
@@ -263,6 +273,17 @@ public class CategoriesChart extends VBox implements ChartExportable
return
legendItem
;
return
legendItem
;
}
}
private
Label
generateNewSeparator
()
{
Label
separator
=
new
Label
();
separator
.
setStyle
(
"-fx-background-color: #212121; -fx-padding: 0;"
);
separator
.
setFont
(
new
Font
(
1
));
separator
.
setMinHeight
(
1
);
separator
.
setMaxHeight
(
1
);
separator
.
setMaxWidth
(
Double
.
MAX_VALUE
);
return
separator
;
}
private
double
getTotal
(
ArrayList
<
CategoryInOutSum
>
categoryInOutSums
,
boolean
useIncomes
)
private
double
getTotal
(
ArrayList
<
CategoryInOutSum
>
categoryInOutSums
,
boolean
useIncomes
)
{
{
double
total
=
0
;
double
total
=
0
;
...
@@ -321,6 +342,6 @@ public class CategoriesChart extends VBox implements ChartExportable
...
@@ -321,6 +342,6 @@ public class CategoriesChart extends VBox implements ChartExportable
@Override
@Override
public
double
getSuggestedHeight
()
public
double
getSuggestedHeight
()
{
{
return
CHART_HEIGHT
+
categoryInOutSums
.
size
()
*
FULL_LEGEND_ITEM_HEIGHT
+
50
;
return
CHART_HEIGHT
+
categoryInOutSums
.
size
()
*
(
FULL_LEGEND_ITEM_HEIGHT
+
DELIMITER_HEIGHT
)
+
50
;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment