Charts: Ability to disable legends completely

Created on 23 Aug 2015  路  3Comments  路  Source: danielgindi/Charts

I could not find a method/setting that would allow to disable the legend completely and reuse the area available for the legend for the chart view itself. Suppose I have a 100 x 100 view and set it as a pie chart view, the legend takes up space on the bottom (default setting). If I mask off the legend somehow since I did not find an api for that (using clear color) the area still shows up empty (the chart is on the upper ~80-90% of the view it seems. Is there a way to completely disable the legend and show the chart in the center of the view?
screen shot 2015-08-23 at 10 34 56 am

Most helpful comment

I remember setting ChartLegend.enabled = false; will not calculate the space? Anway, take a look at calculateOffsets() in PieRadarChartViewBase, it calculates the space there. You should be able to change it.

All 3 comments

I remember setting ChartLegend.enabled = false; will not calculate the space? Anway, take a look at calculateOffsets() in PieRadarChartViewBase, it calculates the space there. You should be able to change it.

Whoa! That did it. I poured over each and every property of ChartLegend, but should have just looked at the super class. Thanks @liuxuan30
Closing issue!

This also works.

ChartLegend *l = _chartView.legend;
l.enabled = false;

Was this page helpful?
0 / 5 - 0 ratings

Related issues

valeIT picture valeIT  路  3Comments

brytnvmg picture brytnvmg  路  4Comments

BrandonShega picture BrandonShega  路  4Comments

sjdevlin picture sjdevlin  路  3Comments

cilasgimenez picture cilasgimenez  路  4Comments