MpAndroidChart Piechart legends cutting issue at the bottom center

前端 未结 4 1909
名媛妹妹
名媛妹妹 2021-01-20 13:21

I have attached the screenshot of my usage chart. In red box display the legends and they are cutting in pie chart. Below is my code:

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-20 13:29

    i have solved this issue by adding the titles in normal list view

     ListView list = (ListView) findViewById(R.id.list_chart);
     list.setAdapter(new ChartTextLegendAdapter(this, values, colors));
    

    and hide the titles within Legend

    this is my layout XML

    
    
    
        
    
        
    
    
    

    and dont forgot to pass the values and ArrayList of colors manully

     for (int c : ColorTemplate.PASTEL_COLORS)
                colors.add(c);
            for (int c : ColorTemplate.LIBERTY_COLORS)
                colors.add(c);
            for (int c : ColorTemplate.COLORFUL_COLORS)
                colors.add(c);
            for (int c : ColorTemplate.JOYFUL_COLORS)
                colors.add(c);
            for (int c : ColorTemplate.VORDIPLOM_COLORS)
                colors.add(c);
    
            colors.add(ColorTemplate.getHoloBlue());
    
    
            values.DetailAmount = getIntent().getStringArrayListExtra("amount");
            values.DetailId = getIntent().getIntegerArrayListExtra("id");
            values.DetailName = getIntent().getStringArrayListExtra("names");
            values.DetailEnglishName = getIntent().getStringArrayListExtra("enames");
            month_name = getIntent().getStringExtra("month_name");
    

    hope this will solve your issue too.

提交回复
热议问题