0
美好的一天每个人。我目前正在创建一个Xamarin.Forms便携式应用程序。 我能够使用OxyPlot显示图表。但我想通过设计使它更具有可视性。Xamarin.Forms:更改图表的字体大小和字体颜色
你知道我将如何改变PlotModel标题和每个PieSlice标签的颜色和字体大小。我应该添加什么代码?如果您可以建议我可以在图表中添加更多内容,我们将非常感谢。非常感谢。
这里是我的代码:
public PieViewModel()
{
modelP1 = new PlotModel { Title = "Pie Sample1"};
dynamic seriesP1 = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 };
seriesP1.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = false, Fill = OxyColors.PaleVioletRed });
seriesP1.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true });
seriesP1.Slices.Add(new PieSlice("Asia", 4157) { IsExploded = true });
seriesP1.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true });
seriesP1.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true });
modelP1.Series.Add(seriesP1);
this.SalesModel = modelP1;
}
先生,我将如何将此代码添加到我的代码来更改我的标题颜色? this.TitleColor = OxyColors.Automatic; –
如果您未定义标题颜色,则默认为OxyColors.Automatic。当您创建PlotModel类的新实例以查看更改时,请尝试以下操作:'modelP1 = new PlotModel {Title =“Pie Sample1”,TitleColor = OxyColors.Gold};' – hankide
好的,先生。馅饼切片怎么样?我应该在我的程序中添加哪些代码? –