我希望有一个美丽的传奇。我阅读了文档,但找不到这种情况。
我在xaml中有PlotView
<oxy:PlotView Model="{Binding ResidentsPhotoChartViewModel.ChartModel}" Style="{StaticResource PlotViewStyle}" />
PlotView
样式
<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
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
};
}
我希望有类似this的内容,但doesn't look喜欢它。