2016-05-09 7 views
1

ハイチャートのようなチャートを表示するアプリケーションを作成する必要があります。しかし、私はそのための図書館を持っていませんでした。だから私はチャートを作成するためにoxyplotを使用しています。私はこのようにオキシプロットを使って円グラフを作成しています。xamarin.androidで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; 
    } 

今、クリックリスナーとエフェクトをクリックしてドーナツチャートを作成する必要があります。 どうすればいいですか?アドバンス

答えて

3

@Nisarアフマド で

おかげでドーナツグラフのための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; 

    } 
関連する問題