File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
stars-core/src/main/kotlin/tools/aqua/stars/core/metric/utils Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,16 @@ val currentTimeAndDate: String =
50
50
* accordingly.
51
51
*/
52
52
fun plotDataAsLineChart (
53
- plot : Plot ,
53
+ plot : Plot ? ,
54
54
fileName : String ,
55
55
folder : String ,
56
56
subFolder : String = "",
57
57
yAxisScaleMaxValue : Number ? = null,
58
58
) {
59
+ if (plot == null ){
60
+ println (" Skip plotting, as there was no data provided." )
61
+ return
62
+ }
59
63
var innerPlot = plot
60
64
val plotFolder = getAndCreatePlotFolder(folder, subFolder)
61
65
@@ -76,11 +80,15 @@ fun plotDataAsLineChart(
76
80
* resulting path
77
81
*/
78
82
fun plotDataAsBarChart (
79
- plot : Plot ,
83
+ plot : Plot ? ,
80
84
fileName : String ,
81
85
folder : String ,
82
86
subFolder : String = "",
83
87
) {
88
+ if (plot == null ){
89
+ println (" Skip plotting, as there was no data provided." )
90
+ return
91
+ }
84
92
var innerPlot = plot
85
93
val plotFolder = getAndCreatePlotFolder(folder, subFolder)
86
94
@@ -107,7 +115,7 @@ fun <T : Number> getPlot(
107
115
xAxisName : String ,
108
116
yAxisName : String ,
109
117
legendHeader : String
110
- ): Plot {
118
+ ): Plot ? {
111
119
return getPlot(mapOf (legendEntry to yValues), xAxisName, yAxisName, legendHeader)
112
120
}
113
121
@@ -126,9 +134,10 @@ fun <T : Number> getPlot(
126
134
xAxisName : String ,
127
135
yAxisName : String ,
128
136
legendHeader : String
129
- ): Plot {
130
- // Check that every value list is filled
131
- check(! nameToValuesMap.values.any { it.isEmpty() })
137
+ ): Plot ? {
138
+ if (nameToValuesMap.values.any { it.isEmpty() }) {
139
+ return null
140
+ }
132
141
// Check that every value list has the exact same amount of elements
133
142
check(nameToValuesMap.values.map { it.size }.distinct().count() == 1 )
134
143
You can’t perform that action at this time.
0 commit comments