2017-01-10 101 views
0

我想在android中使用MPAndroidChart繪製水平條形圖。請檢查下面的代碼。Android:使用`MPAndroidChart`繪製水平條形圖

activity_mail.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.example.graphs.graphs2.MainActivity"> 



    <com.github.mikephil.charting.charts.HorizontalBarChart 
     android:id="@+id/chart" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
</RelativeLayout> 

MainActivity.java

import android.graphics.Color; 
import android.support.v7.app.AppCompatActivity; 
import android.os.Bundle; 

import com.github.mikephil.charting.charts.HorizontalBarChart; 
import com.github.mikephil.charting.data.BarData; 
import com.github.mikephil.charting.data.BarDataSet; 
import com.github.mikephil.charting.data.BarEntry; 
import com.github.mikephil.charting.utils.ColorTemplate; 

import java.util.ArrayList; 

public class MainActivity extends AppCompatActivity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     HorizontalBarChart chart = (HorizontalBarChart) findViewById(R.id.chart); 

     BarData data = new BarData(getDataSet()); 
     chart.setData(data); 
     chart.animateXY(2000, 2000); 
     chart.invalidate(); 
    } 

    private BarDataSet getDataSet() { 

     ArrayList<BarEntry> entries = new ArrayList(); 
       entries.add(new BarEntry(4f, 0)); 
       entries.add(new BarEntry(8f, 1)); 
       entries.add(new BarEntry(6f, 2)); 
       entries.add(new BarEntry(12f, 3)); 
       entries.add(new BarEntry(18f, 4)); 
       entries.add(new BarEntry(9f, 5)); 

     BarDataSet dataset = new BarDataSet(entries,"hi"); 
     return dataset; 
    } 

    private ArrayList<String> getXAxisValues() { 
     ArrayList<String> labels = new ArrayList(); 
       labels.add("January"); 
       labels.add("February"); 
       labels.add("March"); 
       labels.add("April"); 
       labels.add("May"); 
       labels.add("June"); 
     return labels; 
    } 


} 

這給了我下面的圖表。 enter image description here

然而,條形圖我要的是像下面... enter image description here

所以我需要做一些事情......

  1. 彩條
  2. 刪除引導線
  3. 顯示每個欄的左側的說明
  4. 顯示「%」標記在酒吧的末尾數字(例如:第一個欄,顯示4%代替4

我參觀了這個帖子,以及,圖書館的authher似乎已經做了一些什麼,我的要求,所以大概可能與這個圖書館。我該怎麼辦?

回答

5

着色杆:

BarDataSet#setColor(List<Integer>)

移除網格線:

chart.getXAxis().setDrawGridLines(false); 
chart.getLeftAxis().setDrawGridLines(false); 

顯示說明:

分別添加文本視圖,TH E視力表

添加%至值:

xAxis.setValueFormatter(new IAxisValueFormatter() { 
    @Override 
    public String getFormattedValue(float value, AxisBase axis) { 
     return (int) Math.floor(value) + "%"; 
    } 

}); 
+0

這應該是公認的答案 –

0
activity_main.xml 

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.example.graphs.graphs2.MainActivity"> 



    <com.github.mikephil.charting.charts.HorizontalBarChart 
     android:id="@+id/chart" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
</RelativeLayout> 



InsightActivity.java 









package com.animedix.health_hive.buzz.insights; 


import android.app.Activity; 
import android.os.Bundle; 
import android.support.annotation.Nullable; 
import android.support.v7.widget.Toolbar; 
import android.util.Log; 
import android.view.View; 
import android.widget.ImageView; 
import android.widget.TextView; 

import com.animedix.health_hive.R; 
import com.github.mikephil.charting.charts.HorizontalBarChart; 
import com.github.mikephil.charting.data.BarData; 
import com.github.mikephil.charting.data.BarDataSet; 
import com.github.mikephil.charting.data.BarEntry; 
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; 
import com.github.mikephil.charting.utils.ColorTemplate; 

import java.text.ParseException; 
import java.text.SimpleDateFormat; 
import java.util.ArrayList; 
import java.util.Calendar; 
import java.util.Date; 

public class InsightsActivity extends Activity { 


    TextView Firstday, Secondday, Thirdday, Fourthday, Fifthday, SixthDay, Seventhday, 
      Firstdate, Seconddate, Thirddate, Fourthdate, Fifthdate, SixthDate, Seventhdate,tool_title; 
    Toolbar toolbar_insight; 
    ImageView img_back; 
    Calendar Todaydate; 
    HorizontalBarChart barChart,second_barchart,third_barchart,fourth_barchart,fifth_barchart,sixth_barchart,seventh_barchart; 
    ArrayList<BarEntry> bargroup1,bargroup2,bargroup3,bargroup4,bargroup5,bargroup6,bargroup7; 

    @Override 
    protected void onCreate(@Nullable Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_insight); 

     Calendar c = Calendar.getInstance(); 
     /*Date date = c.getTime(); 
     int day = c.get(Calendar.DAY_OF_WEEK); 
     System.out.println("Current time => " + day);*/ 

     SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); 
     String formattedDate = df.format(c.getTime()); 
     Log.e("today","today "+formattedDate); 


     toolbar_insight = (Toolbar) findViewById(R.id.toolbar_insight); 
     img_back = (ImageView) toolbar_insight.findViewById(R.id.img_back); 
     Firstday = (TextView) findViewById(R.id.txt_first_day); 
     Secondday = (TextView) findViewById(R.id.txt_second_day); 
     Thirdday = (TextView) findViewById(R.id.txt_third_day); 
     Fourthday = (TextView) findViewById(R.id.txt_fourth_day); 
     Fifthday = (TextView) findViewById(R.id.txt_fifth_day); 
     SixthDay = (TextView) findViewById(R.id.txt_sixth_day); 
     Seventhday = (TextView) findViewById(R.id.txt_seventh_day); 
     Firstdate = (TextView) findViewById(R.id.txt_first_date); 
     Seconddate = (TextView) findViewById(R.id.txt_second_date); 
     Thirddate = (TextView) findViewById(R.id.txt_third_date); 
     Fourthdate = (TextView) findViewById(R.id.txt_fourth_date); 
     Fifthdate = (TextView) findViewById(R.id.txt_fifth_date); 
     SixthDate = (TextView) findViewById(R.id.txt_sixth_date); 
     Seventhdate = (TextView) findViewById(R.id.txt_seventh_date); 
     tool_title = (TextView) toolbar_insight.findViewById(R.id.txt_careteam); 
     tool_title.setText("The Buzz"); 

     tool_title.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View v) { 
       finish(); 
      } 
     }); 

     img_back.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View v) { 
       finish(); 
      } 
     }); 


     Calendar calendar = Calendar.getInstance(); 
     SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 
     Date myDate = null; 
     try { 
      myDate = dateFormat.parse(formattedDate); 
     } catch (ParseException e) { 
      e.printStackTrace(); 
     } 
     calendar.setTime(myDate); 
     calendar.add(Calendar.DAY_OF_YEAR, -7); 


     Calendar calendar1 = Calendar.getInstance(); 
     SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
     Date myDate1 = null; 
     try { 
      myDate1 = dateFormat1.parse(formattedDate); 
     } catch (ParseException e) { 
      e.printStackTrace(); 
     } 
     calendar1.setTime(myDate1); 
     calendar1.add(Calendar.DAY_OF_YEAR, -6); 

     Calendar calendar2 = Calendar.getInstance(); 
     SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
     Date myDate2 = null; 
     try { 
      myDate2 = dateFormat2.parse(formattedDate); 
     } catch (ParseException e) { 
      e.printStackTrace(); 
     } 
     calendar2.setTime(myDate2); 
     calendar2.add(Calendar.DAY_OF_YEAR, -5); 


     Calendar calendar3 = Calendar.getInstance(); 
     SimpleDateFormat dateFormat3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
     Date myDate3 = null; 
     try { 
      myDate3 = dateFormat3.parse(formattedDate); 
     } catch (ParseException e) { 
      e.printStackTrace(); 
     } 
     calendar3.setTime(myDate3); 
     calendar3.add(Calendar.DAY_OF_YEAR, -4); 


     Calendar calendar4 = Calendar.getInstance(); 
     SimpleDateFormat dateFormat4 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
     Date myDate4 = null; 
     try { 
      myDate4 = dateFormat4.parse(formattedDate); 
     } catch (ParseException e) { 
      e.printStackTrace(); 
     } 
     calendar4.setTime(myDate4); 
     calendar4.add(Calendar.DAY_OF_YEAR, -3); 


     Calendar calendar5 = Calendar.getInstance(); 
     SimpleDateFormat dateFormat5 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
     Date myDate5 = null; 
     try { 
      myDate5 = dateFormat5.parse(formattedDate); 
     } catch (ParseException e) { 
      e.printStackTrace(); 
     } 
     calendar5.setTime(myDate5); 
     calendar5.add(Calendar.DAY_OF_YEAR, -2); 


     Calendar calendar6 = Calendar.getInstance(); 
     SimpleDateFormat dateFormat6 = new SimpleDateFormat("yyyy-MM-dd"); 
     Date myDate6 = null; 
     try { 
      myDate6 = dateFormat6.parse(formattedDate); 
     } catch (ParseException e) { 
      e.printStackTrace(); 
     } 
     calendar6.setTime(myDate6); 
     calendar6.add(Calendar.DAY_OF_YEAR, -1); 


     Date newDate = calendar.getTime(); 
     Date newDate1 = calendar1.getTime(); 
     Date newDate2 = calendar2.getTime(); 
     Date newDate3 = calendar3.getTime(); 
     Date newDate4 = calendar4.getTime(); 
     Date newDate5 = calendar5.getTime(); 
     Date newDate6 = calendar6.getTime(); 


     Log.e("test", "test" + newDate.toString()); 
     Log.e("test", "test" + newDate1.toString()); 
     Log.e("test", "test" + newDate2.toString()); 
     Log.e("test", "test" + newDate3.toString()); 
     Log.e("test", "test" + newDate4.toString()); 
     Log.e("test", "test" + newDate5.toString()); 
     Log.e("test", "test" + newDate6.toString()); 



     Log.e("substring",newDate.toString().substring(0, Math.min(newDate.toString().length(), 10))); 
     String date=newDate.toString().substring(0, Math.min(newDate.toString().length(), 10)); 
     String date1=newDate1.toString().substring(0, Math.min(newDate1.toString().length(), 10)); 
     String date2=newDate2.toString().substring(0, Math.min(newDate2.toString().length(), 10)); 
     String date3=newDate3.toString().substring(0, Math.min(newDate3.toString().length(), 10)); 
     String date4=newDate4.toString().substring(0, Math.min(newDate4.toString().length(), 10)); 
     String date5=newDate5.toString().substring(0, Math.min(newDate5.toString().length(), 10)); 
     String date6=newDate6.toString().substring(0, Math.min(newDate6.toString().length(), 10)); 
     String[] day = date.split(" "); 
     String[] day1 = date1.split(" "); 
     String[] day2 = date2.split(" "); 
     String[] day3 = date3.split(" "); 
     String[] day4 = date4.split(" "); 
     String[] day5 = date5.split(" "); 
     String[] day6 = date6.split(" "); 
     Firstday.setText(day[0]); 
     Firstdate.setText(day[2] + "/" +day[1]); 
     Secondday.setText(day1[0]); 
     Seconddate.setText(day1[2] + "/" +day[1]); 
     Thirdday.setText(day2[0]); 
     Thirddate.setText(day2[2] + "/" +day[1]); 
     Fourthday.setText(day3[0]); 
     Fourthdate.setText(day3[2] + "/" +day[1]); 
     Fifthday.setText(day4[0]); 
     Fifthdate.setText(day4[2] + "/" +day[1]); 
     SixthDay.setText(day5[0]); 
     SixthDate.setText(day5[2] + "/" +day[1]); 
     Seventhday.setText(day6[0]); 
     Seventhdate.setText(day6[2] + "/" +day[1]); 



     barChart = (HorizontalBarChart) findViewById(R.id.barchart); 
     second_barchart = (HorizontalBarChart) findViewById(R.id.second_barchart); 
     third_barchart = (HorizontalBarChart) findViewById(R.id.third_barchart); 
     fourth_barchart = (HorizontalBarChart) findViewById(R.id.fourth_barchart); 
     fifth_barchart = (HorizontalBarChart) findViewById(R.id.fifth_barchart); 
     sixth_barchart = (HorizontalBarChart) findViewById(R.id.sixth_barchart); 
     seventh_barchart = (HorizontalBarChart) findViewById(R.id.seventh_barchart); 


     // create BarEntry for Bar Group 1 
     /*bargroup1 = new ArrayList<>(); 
     bargroup1.add(new BarEntry(8f, 0)); 
     bargroup1.add(new BarEntry(6f, 1)); 

     // create BarEntry for Bar Group 1 
     bargroup2 = new ArrayList<>(); 
     bargroup2.add(new BarEntry(2f, 0)); 
     bargroup2.add(new BarEntry(10f, 0)); 


     bargroup3 = new ArrayList<>(); 
     bargroup3.add(new BarEntry(5f, 0)); 
     bargroup3.add(new BarEntry(25f, 0)); 


     bargroup4 = new ArrayList<>(); 
     bargroup4.add(new BarEntry(6f, 0)); 
     bargroup4.add(new BarEntry(10f, 0)); 


     bargroup5 = new ArrayList<>(); 
     bargroup5.add(new BarEntry(6f, 0)); 
     bargroup5.add(new BarEntry(10f, 0)); 

     bargroup6 = new ArrayList<>(); 
     bargroup6.add(new BarEntry(4f, 0)); 
     bargroup6.add(new BarEntry(17f, 0)); 

     bargroup7 = new ArrayList<>(); 
     bargroup7.add(new BarEntry(17f, 0)); 
     bargroup7.add(new BarEntry(17f, 0)); 

     BarDataSet barDataSet1 = new BarDataSet(bargroup1, "Bar Group 1"); 
     barDataSet1.setColors(ColorTemplate.COLORFUL_COLORS); 

     BarDataSet barDataSet2 = new BarDataSet(bargroup2, "Brand 2"); 
     barDataSet2.setColors(ColorTemplate.COLORFUL_COLORS); 

     BarDataSet barDataSet3 = new BarDataSet(bargroup3, "Brand 2"); 
     barDataSet3.setColors(ColorTemplate.COLORFUL_COLORS); 

     BarDataSet barDataSet4 = new BarDataSet(bargroup4, "Brand 2"); 
     barDataSet4.setColors(ColorTemplate.COLORFUL_COLORS); 

     BarDataSet barDataSet5 = new BarDataSet(bargroup5, "Brand 2"); 
     barDataSet5.setColors(ColorTemplate.COLORFUL_COLORS); 

     BarDataSet barDataSet6 = new BarDataSet(bargroup6, "Brand 2"); 
     barDataSet6.setColors(ColorTemplate.COLORFUL_COLORS); 

     BarDataSet barDataSet7 = new BarDataSet(bargroup7, "Brand 2"); 
     barDataSet7.setColors(ColorTemplate.COLORFUL_COLORS); 

     ArrayList<String> labels = new ArrayList<String>();*/ 

     /*ArrayList<IBarDataSet> dataSets = new ArrayList<>(); // combined all dataset into an arraylist 
     dataSets.add(barDataSet1); 
     *//*dataSets.add(barDataSet2); 
     dataSets.add(barDataSet3); 
     dataSets.add(barDataSet4); 
     dataSets.add(barDataSet5); 
     dataSets.add(barDataSet6); 
     dataSets.add(barDataSet7);*//* 
     BarData data = new BarData(labels, dataSets); // initialize the Bardata with argument labels and dataSet 

     barChart.setData(data); 
     barChart.setDescription("Set Bar Chart Description"); // set the description 
     barChart.animateY(5000);*/ 



     // create BarEntry for Bar Group 1 
     ArrayList<BarEntry> bargroup1 = new ArrayList<>(); 
     bargroup1.add(new BarEntry(18f, 0)); 
     bargroup1.add(new BarEntry(28f, 1)); 
     bargroup1.add(new BarEntry(18f, 2)); 
     bargroup1.add(new BarEntry(48f, 3)); 

     // create BarEntry for Bar Group 1 
     ArrayList<BarEntry> bargroup2 = new ArrayList<>(); 
     bargroup2.add(new BarEntry(6f, 0)); 

     // create BarEntry for Bar Group 1 
     ArrayList<BarEntry> bargroup3 = new ArrayList<>(); 
     bargroup3.add(new BarEntry(9f, 0)); 
     // create BarEntry for Bar Group 1 
     ArrayList<BarEntry> bargroup4 = new ArrayList<>(); 
     bargroup4.add(new BarEntry(16f, 0)); 
     // create BarEntry for Bar Group 1 
     ArrayList<BarEntry> bargroup5 = new ArrayList<>(); 
     bargroup5.add(new BarEntry(26f, 0)); 
     // create BarEntry for Bar Group 1 
     ArrayList<BarEntry> bargroup6 = new ArrayList<>(); 
     bargroup6.add(new BarEntry(36f, 0)); 
     // create BarEntry for Bar Group 1 
     ArrayList<BarEntry> bargroup7 = new ArrayList<>(); 
     bargroup7.add(new BarEntry(46f, 0)); 


     BarDataSet barDataSet1 = new BarDataSet(bargroup1, ""); // creating dataset for group1 

     //barDataSet1.setColor(Color.rgb(0, 155, 0)); 
     barDataSet1.setColors(ColorTemplate.COLORFUL_COLORS); 

     BarDataSet barDataSet2 = new BarDataSet(bargroup2, ""); // creating dataset for group1 
     barDataSet2.setColors(ColorTemplate.COLORFUL_COLORS); 

     BarDataSet barDataSet3 = new BarDataSet(bargroup3, ""); // creating dataset for group1 
     barDataSet3.setColors(ColorTemplate.COLORFUL_COLORS); 

     BarDataSet barDataSet4 = new BarDataSet(bargroup4, ""); // creating dataset for group1 
     barDataSet4.setColors(ColorTemplate.COLORFUL_COLORS); 
     BarDataSet barDataSet5 = new BarDataSet(bargroup5, ""); // creating dataset for group1 
     barDataSet5.setColors(ColorTemplate.COLORFUL_COLORS); 
     BarDataSet barDataSet6 = new BarDataSet(bargroup6, ""); // creating dataset for group1 
     barDataSet6.setColors(ColorTemplate.COLORFUL_COLORS); 
     BarDataSet barDataSet7 = new BarDataSet(bargroup7, ""); // creating dataset for group1 
     barDataSet7.setColors(ColorTemplate.COLORFUL_COLORS); 

     ArrayList<String> labels = new ArrayList<String>(); 
     labels.add(""); 
     labels.add(""); 
     labels.add(""); 
     labels.add(""); 


     ArrayList<IBarDataSet> dataSets = new ArrayList<>(); // combined all dataset into an arraylist 
     dataSets.add(barDataSet1); 
     BarData data = new BarData(labels, dataSets); // initialize the Bardata with argument labels and dataSet 
     barChart.setData(data); 

     ArrayList<IBarDataSet> dataSets1 = new ArrayList<>(); // combined all dataset into an arraylist 
     dataSets1.add(barDataSet2); 
     BarData data1 = new BarData(labels, dataSets1); // initialize the Bardata with argument labels and dataSet 
     second_barchart.setData(data1); 

     ArrayList<IBarDataSet> dataSets2 = new ArrayList<>(); // combined all dataset into an arraylist 
     dataSets2.add(barDataSet3); 
     BarData data2 = new BarData(labels, dataSets2); // initialize the Bardata with argument labels and dataSet 
     third_barchart.setData(data2); 

     ArrayList<IBarDataSet> dataSets3 = new ArrayList<>(); // combined all dataset into an arraylist 
     dataSets3.add(barDataSet4); 
     BarData data3 = new BarData(labels, dataSets3); // initialize the Bardata with argument labels and dataSet 
     fourth_barchart.setData(data3); 


     ArrayList<IBarDataSet> dataSets4 = new ArrayList<>(); // combined all dataset into an arraylist 
     dataSets4.add(barDataSet5); 
     BarData data4 = new BarData(labels, dataSets4); // initialize the Bardata with argument labels and dataSet 
     fifth_barchart.setData(data4); 


     ArrayList<IBarDataSet> dataSets5 = new ArrayList<>(); // combined all dataset into an arraylist 
     dataSets5.add(barDataSet6); 
     BarData data5 = new BarData(labels, dataSets5); // initialize the Bardata with argument labels and dataSet 
     sixth_barchart.setData(data5); 


     ArrayList<IBarDataSet> dataSets6 = new ArrayList<>(); // combined all dataset into an arraylist 
     dataSets6.add(barDataSet6); 
     BarData data6 = new BarData(labels, dataSets6); // initialize the Bardata with argument labels and dataSet 
     seventh_barchart.setData(data6); 



     barChart.animateY(3000); 
     second_barchart.animateY(3000); 
     third_barchart.animateY(3000); 
     fourth_barchart.animateY(3000); 
     fifth_barchart.animateY(3000); 
     sixth_barchart.animateY(3000); 
     seventh_barchart.animateY(3000); 

     barChart.getXAxis().setDrawGridLines(false); 
     barChart.getXAxis().setDrawAxisLine(false); 

     barChart.getDrawingCache(false); 

     barChart.getAxisLeft().setDrawTopYLabelEntry(false); 
     barChart.getAxisLeft().setDrawTopYLabelEntry(false); 
     barChart.getAxisLeft().setDrawLimitLinesBehindData(false); 
     barChart.getAxisLeft().setDrawAxisLine(false); 
     barChart.getAxisLeft().setDrawZeroLine(false); 
     barChart.getAxisLeft().setDrawGridLines(false); 

     barChart.getAxisRight().setDrawZeroLine(false); 
     barChart.getAxisRight().setDrawLimitLinesBehindData(false); 
     barChart.getAxisRight().setDrawAxisLine(false); 
     barChart.getAxisRight().setDrawGridLines(false); 
     barChart.getAxisRight().setDrawTopYLabelEntry(false); 


     second_barchart.getXAxis().setDrawGridLines(false); 
     second_barchart.getXAxis().setDrawAxisLine(false); 

     second_barchart.getDrawingCache(false); 

     second_barchart.getAxisLeft().setDrawTopYLabelEntry(false); 
     second_barchart.getAxisLeft().setDrawTopYLabelEntry(false); 
     second_barchart.getAxisLeft().setDrawLimitLinesBehindData(false); 
     second_barchart.getAxisLeft().setDrawAxisLine(false); 
     second_barchart.getAxisLeft().setDrawZeroLine(false); 
     second_barchart.getAxisLeft().setDrawGridLines(false); 

     second_barchart.getAxisRight().setDrawZeroLine(false); 
     second_barchart.getAxisRight().setDrawLimitLinesBehindData(false); 
     second_barchart.getAxisRight().setDrawAxisLine(false); 
     second_barchart.getAxisRight().setDrawGridLines(false); 
     second_barchart.getAxisRight().setDrawTopYLabelEntry(false); 

     third_barchart.getXAxis().setDrawGridLines(false); 
     third_barchart.getXAxis().setDrawAxisLine(false); 

     third_barchart.getDrawingCache(false); 

     third_barchart.getAxisLeft().setDrawTopYLabelEntry(false); 
     third_barchart.getAxisLeft().setDrawTopYLabelEntry(false); 
     third_barchart.getAxisLeft().setDrawLimitLinesBehindData(false); 
     third_barchart.getAxisLeft().setDrawAxisLine(false); 
     third_barchart.getAxisLeft().setDrawZeroLine(false); 
     third_barchart.getAxisLeft().setDrawGridLines(false); 

     third_barchart.getAxisRight().setDrawZeroLine(false); 
     third_barchart.getAxisRight().setDrawLimitLinesBehindData(false); 
     third_barchart.getAxisRight().setDrawAxisLine(false); 
     third_barchart.getAxisRight().setDrawGridLines(false); 
     third_barchart.getAxisRight().setDrawTopYLabelEntry(false); 

     fourth_barchart.getXAxis().setDrawGridLines(false); 
     fourth_barchart.getXAxis().setDrawAxisLine(false); 

     fourth_barchart.getDrawingCache(false); 

     fourth_barchart.getAxisLeft().setDrawTopYLabelEntry(false); 
     fourth_barchart.getAxisLeft().setDrawTopYLabelEntry(false); 
     fourth_barchart.getAxisLeft().setDrawLimitLinesBehindData(false); 
     fourth_barchart.getAxisLeft().setDrawAxisLine(false); 
     fourth_barchart.getAxisLeft().setDrawZeroLine(false); 
     fourth_barchart.getAxisLeft().setDrawGridLines(false); 

     fourth_barchart.getAxisRight().setDrawZeroLine(false); 
     fourth_barchart.getAxisRight().setDrawLimitLinesBehindData(false); 
     fourth_barchart.getAxisRight().setDrawAxisLine(false); 
     fourth_barchart.getAxisRight().setDrawGridLines(false); 
     fourth_barchart.getAxisRight().setDrawTopYLabelEntry(false); 

     fifth_barchart.getXAxis().setDrawGridLines(false); 
     fifth_barchart.getXAxis().setDrawAxisLine(false); 

     fifth_barchart.getDrawingCache(false); 

     fifth_barchart.getAxisLeft().setDrawTopYLabelEntry(false); 
     fifth_barchart.getAxisLeft().setDrawTopYLabelEntry(false); 
     fifth_barchart.getAxisLeft().setDrawLimitLinesBehindData(false); 
     fifth_barchart.getAxisLeft().setDrawAxisLine(false); 
     fifth_barchart.getAxisLeft().setDrawZeroLine(false); 
     fifth_barchart.getAxisLeft().setDrawGridLines(false); 

     fifth_barchart.getAxisRight().setDrawZeroLine(false); 
     fifth_barchart.getAxisRight().setDrawLimitLinesBehindData(false); 
     fifth_barchart.getAxisRight().setDrawAxisLine(false); 
     fifth_barchart.getAxisRight().setDrawGridLines(false); 
     fifth_barchart.getAxisRight().setDrawTopYLabelEntry(false); 

     sixth_barchart.getXAxis().setDrawGridLines(false); 
     sixth_barchart.getXAxis().setDrawAxisLine(false); 

     sixth_barchart.getDrawingCache(false); 

     sixth_barchart.getAxisLeft().setDrawTopYLabelEntry(false); 
     sixth_barchart.getAxisLeft().setDrawLimitLinesBehindData(false); 
     sixth_barchart.getAxisLeft().setDrawAxisLine(false); 
     sixth_barchart.getAxisLeft().setDrawZeroLine(false); 
     sixth_barchart.getAxisLeft().setDrawGridLines(false); 

     sixth_barchart.getAxisRight().setDrawZeroLine(false); 
     sixth_barchart.getAxisRight().setDrawLimitLinesBehindData(false); 
     sixth_barchart.getAxisRight().setDrawAxisLine(false); 
     sixth_barchart.getAxisRight().setDrawGridLines(false); 
     sixth_barchart.getAxisRight().setDrawTopYLabelEntry(false); 


     seventh_barchart.getXAxis().setDrawGridLines(false); 
     seventh_barchart.getXAxis().setDrawAxisLine(false); 
     seventh_barchart.getDrawingCache(false); 

     seventh_barchart.getAxisLeft().setDrawTopYLabelEntry(false); 
     seventh_barchart.getAxisLeft().setDrawLimitLinesBehindData(false); 
     seventh_barchart.getAxisLeft().setDrawAxisLine(false); 
     seventh_barchart.getAxisLeft().setDrawZeroLine(false); 
     seventh_barchart.getAxisLeft().setDrawGridLines(false); 

     seventh_barchart.getAxisRight().setDrawZeroLine(false); 
     seventh_barchart.getAxisRight().setDrawLimitLinesBehindData(false); 
     seventh_barchart.getAxisRight().setDrawAxisLine(false); 
     seventh_barchart.getAxisRight().setDrawGridLines(false); 
     seventh_barchart.getAxisRight().setDrawTopYLabelEntry(false); 





    } 

} 
[I need to remove top & below entry of the chart 10,20,30 & remove description in Chart..][1] 


    [1]: https://i.stack.imgur.com/DUMcl.png 
+0

請對你的回答一些解釋。 –