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
好的,先生。餡餅切片怎麼樣?我應該在我的程序中添加哪些代碼? –