【发布时间】:2017-08-29 12:26:28
【问题描述】:
我正在使用 Syncfusion 库在 Xamarin 表单中创建圆环图。我已经创建了它,但是现在我要在每一片甜甜圈上实现一个 On click 事件?我怎样才能做到这一点?请帮帮我?
这是我的圆环图 XAML 页面
<StackLayout>
<RelativeLayout x:Name="relativeLayout">
<Label x:Name="myLabel"
Text="US Sales Total"
FontSize="30"
TextColor="White"
RelativeLayout.XConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=0.5,
Constant=-260}"
RelativeLayout.YConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=0.5,
Constant=-380 }" />
<Label Text="1234"
FontSize="30"
TextColor="White"
RelativeLayout.XConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=0.5,
Constant = +200 }"
RelativeLayout.YConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=0.5,
Constant=-380 }" />
<chart:SfChart x:Name="sfchart"
BackgroundColor="Transparent"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=0}"
RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=0}">
<chart:SfChart.PrimaryAxis >
<chart:CategoryAxis/>
</chart:SfChart.PrimaryAxis>
<chart:SfChart.SecondaryAxis>
<chart:NumericalAxis/>
</chart:SfChart.SecondaryAxis>
<chart:SfChart.Series>
<chart:DoughnutSeries x:Name="series1"
CircularCoefficient="0.8"
DoughnutCoefficient="0.4"
StartAngle="0"
EndAngle="360"
EnableDataPointSelection="True"
DataMarkerPosition="Inside">
<chart:DoughnutSeries.DataMarker>
<chart:ChartDataMarker ShowLabel="true" LabelContent="YValue" />
</chart:DoughnutSeries.DataMarker>
</chart:DoughnutSeries>
</chart:SfChart.Series>
</chart:SfChart>
</RelativeLayout>
</StackLayout>
【问题讨论】:
标签: xamarin charts xamarin.forms syncfusion