Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public PageChart()
- {
- InitializeComponent();
- var model = new PlotModel { Title = "Temperatura Corporal " };
- var rand = new Random();
- double[] cakePopularity = new double[5];
- for (int i = 0; i < 5; ++i)
- {
- cakePopularity[i] = rand.NextDouble();
- }
- var sum = cakePopularity.Sum();
- var barSeries = new ColumnSeries
- {
- ItemsSource = new List<ColumnItem>(new[]
- {
- new ColumnItem{ Value = (cakePopularity[0] / sum * 100) },
- new ColumnItem{ Value = (cakePopularity[1] / sum * 100) },
- new ColumnItem{ Value = (cakePopularity[2] / sum * 100) },
- new ColumnItem{ Value = (cakePopularity[3] / sum * 100) },
- new ColumnItem{ Value = (cakePopularity[4] / sum * 100) }
- }),
- LabelPlacement = LabelPlacement.Inside,
- LabelFormatString = "{0:.00}%"
- };
- model.Series.Add(barSeries);
- model.Axes.Add(new CategoryAxis
- {
- Position = AxisPosition.Bottom,
- //Key = "CakeAxis",
- ItemsSource = new[]
- {
- "A",
- "B",
- "C",
- "D",
- "E"
- }
- });
- var grid = new Grid ();
- grid.Children.Add(new PlotView
- {
- Model = model,
- VerticalOptions = LayoutOptions.Center,
- HeightRequest = 500,
- HorizontalOptions = LayoutOptions.Fill,
- });
- Content = grid;
- }
Add Comment
Please, Sign In to add comment