Search code examples
c#xamarinoxyplot

How to disable labels and lines from pie chart?


actually I'm trying to remove the labels and the line which are leading to the labels. The app is in C# and I used OxyPlot to plot the piechart.

Here is my code. As you can see all what I've tried doesn't helped me.

Thanks for your help!

public class MyViewModel
{
    public PlotModel MyModel { get; set; }

    public MyViewModel()
    {

        SingletonItem singletonItem = SingletonItem.Instance;

        PieSeries pieSeries = new PieSeries();

        pieSeries.Slices.Add(new PieSlice("Done", singletonItem.Done) {IsExploded = true, Fill = OxyColors.PaleVioletRed});
        pieSeries.Slices.Add(new PieSlice("Undone", singletonItem.Undone) {IsExploded = true});

        pieSeries.LabelField = "";
        pieSeries.TickDistance = 0;
        pieSeries.ValueField = "";
        MyModel = new PlotModel();
        MyModel.IsLegendVisible = false;
        MyModel.Series.Add(pieSeries);
    }
}

Screenshot of the actually page


Solution

  • I solved this problem by myself. For everyone who need the same information for me these lines helped:

    pieSeries.OutsideLabelFormat = "";
    pieSeries.TickHorizontalLength = 0.00;
    pieSeries.TickRadialLength = 0.00;