Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Krishna Vemulavada
/
vera_2.1_app
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
921169f7
authored
May 07, 2018
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Made some changes in Report screen.
parent
93aa5d9e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
25 deletions
app/src/main/java/com/vsoft/servicenow/ui/ReportScreen.java
app/src/vportal/res/layout/reprots_screen.xml
app/src/main/java/com/vsoft/servicenow/ui/ReportScreen.java
View file @
921169f7
package
com
.
vsoft
.
servicenow
.
ui
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.AppCompatActivity
;
...
...
@@ -63,8 +64,8 @@ public class ReportScreen extends AppCompatActivity {
// Send initial screen view hit.
Util
.
sendScreenName
(
tracker
,
actionBar
.
getTitle
().
toString
());
application_type
=
findViewById
(
R
.
id
.
application_type
);
application_type
.
setSelection
(
1
);
//
application_type = findViewById(R.id.application_type);
//
application_type.setSelection(1);
LineChart
lineChart
=
(
LineChart
)
findViewById
(
R
.
id
.
line_chart
);
PieChart
pieChart1
=
(
PieChart
)
findViewById
(
R
.
id
.
pie1
);
...
...
@@ -90,16 +91,23 @@ public class ReportScreen extends AppCompatActivity {
labels
.
add
(
"June"
);
ArrayList
<
Entry
>
entriesPie
=
new
ArrayList
<>();
entriesPie
.
add
(
new
Entry
(
4
f
,
0
));
entriesPie
.
add
(
new
Entry
(
8
f
,
1
));
entriesPie
.
add
(
new
Entry
(
6
f
,
2
));
ArrayList
<
Entry
>
entriesPie1
=
new
ArrayList
<>();
entriesPie1
.
add
(
new
Entry
(
57
f
,
0
));
entriesPie1
.
add
(
new
Entry
(
43
f
,
0
));
ArrayList
<
Entry
>
entriesPie2
=
new
ArrayList
<>();
entriesPie2
.
add
(
new
Entry
(
16
f
,
0
));
entriesPie2
.
add
(
new
Entry
(
84
f
,
0
));
ArrayList
<
Entry
>
entriesPie3
=
new
ArrayList
<>();
entriesPie3
.
add
(
new
Entry
(
27
f
,
0
));
entriesPie3
.
add
(
new
Entry
(
73
f
,
0
));
ArrayList
<
String
>
labelsPie
=
new
ArrayList
<
String
>();
labelsPie
.
add
(
"
January
"
);
labelsPie
.
add
(
"
February
"
);
labelsPie
.
add
(
"March"
);
labelsPie
.
add
(
""
);
labelsPie
.
add
(
""
);
//
labelsPie.add("March");
LineDataSet
lineDataset
=
new
LineDataSet
(
entries
,
""
);
...
...
@@ -108,13 +116,35 @@ public class ReportScreen extends AppCompatActivity {
lineChart
.
setData
(
lineData
);
// set the data and list of lables into chart
lineChart
.
animateY
(
5000
);
PieDataSet
pieDataSet
=
new
PieDataSet
(
entriesPie
,
""
);
pieDataSet
.
setColors
(
ColorTemplate
.
JOYFUL_COLORS
);
PieData
pieData
=
new
PieData
(
labelsPie
,
pieDataSet
);
pieChart1
.
setData
(
pieData
);
pieChart2
.
setData
(
pieData
);
pieChart3
.
setData
(
pieData
);
PieDataSet
pieDataSet1
=
new
PieDataSet
(
entriesPie1
,
""
);
PieDataSet
pieDataSet2
=
new
PieDataSet
(
entriesPie2
,
""
);
PieDataSet
pieDataSet3
=
new
PieDataSet
(
entriesPie3
,
""
);
pieDataSet1
.
setValueTextSize
(
0.0f
);
pieDataSet2
.
setValueTextSize
(
0.0f
);
pieDataSet3
.
setValueTextSize
(
0.0f
);
pieDataSet1
.
setColors
(
new
int
[]{
Color
.
RED
,
Color
.
GRAY
});
pieDataSet2
.
setColors
(
new
int
[]{
Color
.
argb
(
255
,
255
,
165
,
0
),
Color
.
GRAY
});
pieDataSet3
.
setColors
(
new
int
[]{
Color
.
GREEN
,
Color
.
GRAY
});
PieData
pieData1
=
new
PieData
(
labelsPie
,
pieDataSet1
);
PieData
pieData2
=
new
PieData
(
labelsPie
,
pieDataSet2
);
PieData
pieData3
=
new
PieData
(
labelsPie
,
pieDataSet3
);
pieChart1
.
setDrawSliceText
(
false
);
pieChart1
.
setCenterText
(
"57%"
);
pieChart1
.
setCenterTextSize
(
20.0f
);
pieChart2
.
setDrawSliceText
(
false
);
pieChart2
.
setCenterText
(
"16%"
);
pieChart2
.
setCenterTextSize
(
20.0f
);
pieChart3
.
setDrawSliceText
(
false
);
pieChart3
.
setCenterText
(
"27%"
);
pieChart3
.
setCenterTextSize
(
20.0f
);
pieChart1
.
setData
(
pieData1
);
pieChart2
.
setData
(
pieData2
);
pieChart3
.
setData
(
pieData3
);
pieChart1
.
animateY
(
5000
);
pieChart2
.
animateY
(
5000
);
...
...
@@ -124,6 +154,14 @@ public class ReportScreen extends AppCompatActivity {
pieChart2
.
getLegend
().
setEnabled
(
false
);
pieChart3
.
getLegend
().
setEnabled
(
false
);
pieChart1
.
setTouchEnabled
(
false
);
pieChart2
.
setTouchEnabled
(
false
);
pieChart3
.
setTouchEnabled
(
false
);
pieChart1
.
setOnChartValueSelectedListener
(
null
);
pieChart2
.
setOnChartValueSelectedListener
(
null
);
pieChart3
.
setOnChartValueSelectedListener
(
null
);
pieChart1
.
setDescription
(
""
);
pieChart2
.
setDescription
(
""
);
pieChart3
.
setDescription
(
""
);
...
...
app/src/vportal/res/layout/reprots_screen.xml
View file @
921169f7
...
...
@@ -27,7 +27,8 @@
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:layout_marginTop=
"10dp"
android:entries=
"@array/application_type"
/>
android:entries=
"@array/application_type"
android:visibility=
"gone"
/>
<info.hoang8f.android.segmented.SegmentedGroup
android:id=
"@+id/segmented2"
...
...
@@ -143,7 +144,8 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/status1"
android:text=
" Lorem ipsum sit"
/>
android:text=
" Lorem ipsum sit"
android:visibility=
"gone"
/>
</LinearLayout>
<TextView
...
...
@@ -197,7 +199,8 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/status1"
android:text=
" Lorem ipsum sit"
/>
android:text=
" Lorem ipsum sit"
android:visibility=
"gone"
/>
</LinearLayout>
...
...
@@ -241,27 +244,65 @@
<LinearLayout
android:id=
"@+id/pie_chart_layout"
android:layout_width=
"match_parent"
android:layout_height=
"120dp"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/area_chart"
>
<RelativeLayout
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
>
<com.github.mikephil.charting.charts.PieChart
android:id=
"@+id/pie1"
android:layout_width=
"match_parent"
android:layout_height=
"120dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/pie1"
android:layout_centerInParent=
"true"
android:gravity=
"center"
android:text=
"Consumed"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
/
>
android:layout_weight=
"1"
>
<com.github.mikephil.charting.charts.PieChart
android:id=
"@+id/pie2"
android:layout_width=
"match_parent"
android:layout_height=
"120dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/pie2"
android:layout_centerInParent=
"true"
android:gravity=
"center"
android:text=
"Pending Approval"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
/
>
android:layout_weight=
"1"
>
<com.github.mikephil.charting.charts.PieChart
android:id=
"@+id/pie3"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
/>
android:layout_width=
"match_parent"
android:layout_height=
"120dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/pie3"
android:layout_centerInParent=
"true"
android:gravity=
"center"
android:text=
"Balance If All Approved"
/>
</RelativeLayout>
</LinearLayout>
<TextView
...
...
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