I want to have a beautiful legend. I read the documentation, but could not find this case.
I have PlotView
in xaml
<oxy:PlotView Model="{Binding ResidentsPhotoChartViewModel.ChartModel}" Style="{StaticResource PlotViewStyle}" />
PlotView
Style
<Style x:Key="PlotViewStyle" TargetType="{x:Type oxy:PlotView}">
<Setter Property="IsLegendVisible" Value="True" />
<Setter Property="LegendOrientation" Value="Horizontal" />
<Setter Property="LegendPosition" Value="BottomCenter" />
<Setter Property="LegendTextColor" Value="White" />
</Style>
PlotModel
in code
public PlotModel ChartModel
{
get
{
return CreateModel(CreatePieSeries(_chartPieSlicesList));
}
}
public ResidentsPhotoChartViewModel()
{
_residentsWithPhotoSlice = CreatePieSlice(CLResources.DontHavePhoto, 0, OxyColors.LimeGreen);
_residentsWithoutPhotoSlice = CreatePieSlice(CLResources.HavePhoto, 0, OxyColors.Red);
_chartPieSlicesList = new List<PieSlice> { _residentsWithPhotoSlice, _residentsWithoutPhotoSlice };
}
private static PlotModel CreateModel(Series series)
{
return new PlotModel
{
Series = {series},
IsLegendVisible = true,
LegendTitle = "LegendTitleFromModel",
};
}
private static PieSeries CreatePieSeries(List<PieSlice> slices)
{
return new PieSeries
{
Title = "SeriesTitle",
StrokeThickness = StrokeThickness,
InnerDiameter = InnerDiameter,
Slices = slices
};
}
I want to have something like this, but it doesn't look like it should.