Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
359029c9
Commit
359029c9
authored
Apr 12, 2021
by
Manuel Herold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed formatting bugs
parent
3279a264
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
72 deletions
+109
-72
cluster.dart
src/dashboard/lib/data/cluster.dart
+10
-6
cluster_graph.dart
...dashboard/lib/ui/graphs/community_meta/cluster_graph.dart
+99
-66
No files found.
src/dashboard/lib/data/cluster.dart
View file @
359029c9
import
'dart:math'
;
import
'package:dashboard/data/post.dart'
;
import
'package:
logger/logger
.dart'
;
import
'package:
intl/intl
.dart'
;
class
Cluster
{
final
String
label
;
final
int
id
;
final
String
layerName
;
static
final
NumberFormat
format
=
NumberFormat
(
"##.00"
);
List
<
Post
>
nodes
;
Cluster
(
this
.
label
,
this
.
id
,
this
.
layerName
,
this
.
nodes
);
...
...
@@ -19,11 +23,11 @@ class Cluster {
break
;
case
"Percentage_Layer"
:
String
trust
=
label
.
substring
(
0
,
label
.
indexOf
(
" "
));
if
(
trust
==
"1.0"
)
trust
=
"100"
;
else
trust
=
trust
.
substring
(
2
);
return
"
$
trust
% Trust"
;
trust
=
trust
.
substring
(
0
,
min
(
6
,
trust
.
length
));
double
val
=
double
.
parse
(
trust
)
*
100
;
return
"
$
{format.format(val)}
% Trust"
;
break
;
case
"Engagement_Layer"
:
return
"
${label.substring(0, label.indexOf("."))}
comments"
;
...
...
src/dashboard/lib/ui/graphs/community_meta/cluster_graph.dart
View file @
359029c9
import
'dart:math'
;
import
'package:circlegraph/bubble/bubblegraph.dart'
;
import
'package:circlegraph/circlegraph.dart'
;
import
'package:dashboard/data/cluster.dart'
;
import
'package:dashboard/data/community.dart'
;
import
'package:dashboard/graphing/trustcolorcalculator.dart'
;
import
'package:dashboard/loading.dart'
;
import
'package:dashboard/querying/clustergetter.dart'
;
import
'package:dashboard/querying/communitygetter.dart'
;
import
'package:dashboard/ui/graphs/community/community_graph_view_page.dart'
;
import
'package:dashboard/ui/graphs/community/list/cluster_list.dart'
;
import
'package:dashboard/ui/theme/color_holder.dart'
;
import
'package:dashboard/ui/util/logged_in_appbar.dart'
;
import
'package:flutter/material.dart'
;
import
'package:enhanced_future_builder/enhanced_future_builder.dart'
;
class
ClusterGraph
extends
StatefulWidget
{
final
List
<
Cluster
>
clusters
;
...
...
@@ -25,13 +15,62 @@ class ClusterGraph extends StatefulWidget {
class
_ClusterGraphState
extends
State
<
ClusterGraph
>
{
final
List
<
Cluster
>
clusters
;
int
postNodeCount
=
10
;
// Nr of postNodes displayed
int
page
=
0
;
int
nodesPerPage
=
50
;
_ClusterGraphState
(
this
.
clusters
);
void
_previous
()
{
setState
(()
{
page
--;
});
}
void
_next
()
{
setState
(()
{
page
++;
});
}
Widget
build
(
BuildContext
context
)
{
return
SingleChildScrollView
(
return
Column
(
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
if
(
page
>
0
)
IconButton
(
onPressed:
_previous
,
icon:
Icon
(
Icons
.
chevron_left
),
color:
ColorHolder
.
color2
,
iconSize:
30
,
),
SizedBox
(
width:
16
),
Text
(
"Page
${page + 1}
"
,
style:
TextStyle
(
fontSize:
20
,
color:
ColorHolder
.
color2
,
),
),
SizedBox
(
width:
16
),
IconButton
(
onPressed:
_next
,
icon:
Icon
(
Icons
.
chevron_right
),
color:
ColorHolder
.
color2
,
iconSize:
30
,
),
],
),
Expanded
(
child:
SingleChildScrollView
(
scrollDirection:
Axis
.
vertical
,
child:
BubbleGraph
(
clusters
.
where
(
(
element
)
=>
clusters
.
indexOf
(
element
)
>=
page
*
nodesPerPage
&&
clusters
.
indexOf
(
element
)
<
(
page
+
1
)
*
nodesPerPage
,
)
.
map
(
(
Cluster
cluster
)
=>
CircleGraph
(
root:
TreeNodeData
(
...
...
@@ -80,15 +119,9 @@ class _ClusterGraphState extends State<ClusterGraph> {
)
.
toList
(),
),
),
),
],
);
// return SingleChildScrollView(
// child: Wrap(
// children: [
// for (Community community in communities)
// getCommunityNodeWidget(community)
// ],
// ),
// );
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment