|
<StackLayout Padding="0,20,0,0">
<local:ChartExt x:Name="chart" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" SelectionChanging="Chart_SelectionChanging">
<chart:SfChart.PrimaryAxis>
<chart:CategoryAxis/>
</chart:SfChart.PrimaryAxis>
<chart:SfChart.Legend>
<chart:ChartLegend/>
</chart:SfChart.Legend>
<chart:SfChart.SecondaryAxis>
<chart:NumericalAxis/>
</chart:SfChart.SecondaryAxis>
</local:ChartExt>
</StackLayout> |
|
pieSeries = new PieSeries
{
EnableDataPointSelection = true,
SelectedDataPointColor = Color.Pink,
ExplodeOnTouch = true,
XBindingPath = "Name",
YBindingPath = "Value",
Label = "PieSeries",
ItemsSource = view.PieData,
DataMarker = new ChartDataMarker()
};
pieSeries.ColorModel.Palette = ChartColorPalette.Natural;
chart.Series.Add(pieSeries);
async void Chart_SelectionChanging(object sender, ChartSelectionChangingEventArgs e)
{
if (e.SelectedDataPointIndex > -1)
{
IList items = e.SelectedSeries.ItemsSource as IList;
Model selectedDatapoint = items[e.SelectedDataPointIndex] as Model;
await Navigation.PushModalAsync(new SecondaryPage(selectedDatapoint));
}
}
|