Commit 921169f7 by Kunj Gupta

Made some changes in Report screen.

parent 93aa5d9e
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(4f, 0));
entriesPie.add(new Entry(8f, 1));
entriesPie.add(new Entry(6f, 2));
ArrayList<Entry> entriesPie1 = new ArrayList<>();
entriesPie1.add(new Entry(57f, 0));
entriesPie1.add(new Entry(43f, 0));
ArrayList<Entry> entriesPie2 = new ArrayList<>();
entriesPie2.add(new Entry(16f, 0));
entriesPie2.add(new Entry(84f, 0));
ArrayList<Entry> entriesPie3 = new ArrayList<>();
entriesPie3.add(new Entry(27f, 0));
entriesPie3.add(new Entry(73f, 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("");
......
......@@ -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">
<com.github.mikephil.charting.charts.PieChart
android:id="@+id/pie1"
<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/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>
<com.github.mikephil.charting.charts.PieChart
android:id="@+id/pie2"
<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" />
<com.github.mikephil.charting.charts.PieChart
android:id="@+id/pie3"
<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="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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment