PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.67k stars 9.02k forks source link

PieChart: Draw label outside #2947

Open brucexia opened 7 years ago

brucexia commented 7 years ago

Need to implement something like this. Note the value label is drawn outside ring and with same color, no indicator lines. Do we already have this capability? if not, any advice how to implement?

screen shot 2017-03-21 at 11 46 42 am
Dragon-Boat commented 7 years ago

you can create a class extends PieChartRenderer, and override the drawValues() method to implements this.

brucexia commented 7 years ago

@Dragon-Boat Thank you will try that approach. Another question is there doesn't seem to be a method to specifify the size of the donut, it scales and ends up cutting off the value text like in the screenshot sometimes

screen shot 2017-03-22 at 4 59 01 pm
Dragon-Boat commented 7 years ago

@brucexia you should create your own CustomPieChart extends PieChart, and Override the getDiameter method to return the actual size of the donut. the method will decide how big the donut is ( not change the size of PieChart ).

brucexia commented 7 years ago

@Dragon-Boat thanks. Setting extra offset seems to solve the cut off problem.

BongJaeChoi commented 7 years ago

how to draw value color and line color?