我需要创建一个显示图表的应用程序,如Highcharts。但是我没有任何图书馆。所以我正在使用oxyplot创建图表。我已经使用oxyplot创建了饼图。
var plotView = new PlotView (this);
plotView.Model = PieViewModel();
this.AddContentView (plotView,
new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
public PlotModel PieViewModel()
{
var 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);
return modelP1;
}
但是现在我需要创建带有单击侦听器和单击效果的甜甜圈图。我怎样才能做到这一点?
提前致谢
@Nisar Ahmad使用oxyplot库查找甜甜圈图的以下代码。
public static PlotModel Simplemodel()
{
var modelP1 = new PlotModel { Title = "Pie Sample1" };
dynamic seriesP1 = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.5, AngleSpan = 360, StartAngle = 0, InnerDiameter = 0.4 };
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);
return modelP1;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句