c# - Syncfusion Windows Phone 8 chart -


i have pie chart , want explode , other things when slice of pie setected question how can retrieve index selected in code

here xaml

        <chart:sfchart.primaryaxis>             <chart:categoryaxis></chart:categoryaxis>         </chart:sfchart.primaryaxis>         <chart:sfchart.secondaryaxis>             <chart:numericalaxis></chart:numericalaxis>         </chart:sfchart.secondaryaxis>          <chart:pieseries  piecoefficient="0.6" mouseleftbuttondown="pieseries_mouseleftbuttondown" exploderadius="20"  enableanimation="true" x:name="pieseries" showtooltip="true" chart:charttooltip.enableanimation="true" itemssource="{binding expenditure}" xbindingpath="expense" label="" labelposition="outside" ybindingpath="amount"  palette="custom">             <chart:pieseries.colormodel>                  <chart:chartcolormodel>                      <chart:chartcolormodel.custombrushes>                          <solidcolorbrush color="green"/>                          <solidcolorbrush color="black"/>                          <solidcolorbrush color="red"/>                          <solidcolorbrush color="#ffd541"/>                          <solidcolorbrush color="plum"/>                          <solidcolorbrush color="purple"/>                      </chart:chartcolormodel.custombrushes>                  </chart:chartcolormodel>              </chart:pieseries.colormodel>             <chart:pieseries.adornmentsinfo>                 <chart:chartadornmentinfo adornmentsposition="bottom"  horizontalalignment="center" verticalalignment="center"                                                connectorlinestyle="{staticresource linestyle}" showconnectorline="true"                                                connectorheight="30" showlabel="true"  labeltemplate="{staticresource labeltemplate}"                                                segmentlabelcontent="yvalue">                 </chart:chartadornmentinfo>             </chart:pieseries.adornmentsinfo>          </chart:pieseries>     </chart:sfchart> 
  in c# code want mouseleftbuttondown event trigger slice of pie explode    private void pieseries_mouseleftbuttondown(object sender, system.windows.input.mousebuttoneventargs e)         {  } 

instead of trying mouse events, syncfusion provided selectionbehavior , helpful selecting segments in series. these internal segments can access creating custom series inheriting pie series in below snippet.

public class custompieseries : pieseries {     public observablecollection<chartsegment> piesegments { get; set; }     public override void createsegments()     {         base.createsegments();         piesegments = segments;     } }  <local:custompieseries segmentselectionbrush="cornsilk" itemssource="{binding expenditure}" xbindingpath="expense" ybindingpath="amount"   enableanimation="true" piecoefficient="0.6"  exploderadius="20"   x:name="pieseries" showtooltip="true" chart:charttooltip.enableanimation="true"  label="" labelposition="outside"   palette="custom">             <local:custompieseries.colormodel>                  <chart:chartcolormodel> 

. . . add selectionchanged event chart index of selected segment below.

private void sfchart_selectionchanged_1(object sender, syncfusion.ui.xaml.charts.chartselectionchangedeventargs e)     {         int selectedsegmentindex = (chart.series[0] custompieseries).piesegments.indexof(e.selectedsegment);     } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -