2016-05-09 4 views
1

Мне нужно создать приложение, которое показывает диаграмму как Highcharts. Но у меня не было библиотеки для этого. Поэтому я использую oxyplot для создания диаграмм. Я создал круговую диаграмму, используя оксиплот, как это.Как я могу создать диаграмму пончика, используя оксиплот в xamarin.android?

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 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; 

    } 

 Смежные вопросы

  • Нет связанных вопросов^_^