Search results

Pie & Doughnut

Pie Chart

To render a pie series, use the series Type as Pie.

pie.razor
<EjsAccumulationChart Title="Mobile Browser Statistics">
        <AccumulationChartSeriesCollection>
            <AccumulationChartSeries DataSource="@StatisticsDetails" XName="Browser" YName="Users"
                                     Name="Browser">
            </AccumulationChartSeries>
        </AccumulationChartSeriesCollection>
  
        <AccumulationChartLegendSettings Visible="true"></AccumulationChartLegendSettings>
</EjsAccumulationChart>

@code{
    public class Statistics
    {
        public string Browser;
        public double Users;
    }

    public List<Statistics> StatisticsDetails = new List<Statistics> 
    {
        new Statistics { Browser = "Chrome", Users = 37 },
        new Statistics { Browser = "UC Browser", Users = 17 },
        new Statistics { Browser = "iPhone", Users = 19 },
        new Statistics { Browser = "Others", Users = 4  },
        new Statistics { Browser = "Opera", Users = 11 },
        new Statistics { Browser = "Android", Users = 12 },
    };
}

Pie Chart

Radius Customization

By default, radius of the pie series will be 80% of the size (minimum of chart width and height). You can customize this using Radius property of the series.

radius.razor
<EjsAccumulationChart Title="Mobile Browser Statistics"> 
        <AccumulationChartSeriesCollection> 
            <AccumulationChartSeries DataSource="@StatisticsDetails" XName="Browser" YName="Users"
                                     Name="Browser" Radius="100%">
            </AccumulationChartSeries>
        </AccumulationChartSeriesCollection>
  
        <AccumulationChartLegendSettings Visible="false"></AccumulationChartLegendSettings>
</EjsAccumulationChart>

@code{
    public class Statistics
    {
        public string Browser;
        public double Users;
    }

    public List<Statistics> StatisticsDetails = new List<Statistics> 
    {
        new Statistics { Browser = "Chrome", Users = 37 },
        new Statistics { Browser = "UC Browser", Users = 17 },
        new Statistics { Browser = "iPhone", Users = 19 },
        new Statistics { Browser = "Others", Users = 4  },
        new Statistics { Browser = "Opera", Users = 11 },
        new Statistics { Browser = "Android", Users = 12 },
    };
}

Radius Customization

Pie Center

The center position of the pie can be changed by Center X and Center Y. By default, center x and center y of the pie series are 50%. You can customize this using Center property of the series.

piecenter.razor
<EjsAccumulationChart  EnableAnimation="false"  Title="Mobile Browser Statistics">
    <AccumulationChartPieCenter X="60%" Y="60%"></AccumulationChartPieCenter>
  
        <AccumulationChartSeriesCollection>
            <AccumulationChartSeries DataSource="@StatisticsDetails" XName="Browser" YName="Users">
            </AccumulationChartSeries>
        </AccumulationChartSeriesCollection>
  
        <AccumulationChartLegendSettings Visible="false"></AccumulationChartLegendSettings>
  
        <AccumulationChartTooltipSettings Enable="true"></AccumulationChartTooltipSettings>
</EjsAccumulationChart>

@code{
    public class Statistics
    {
        public string Browser;
        public double Users;
    }

    public List<Statistics> StatisticsDetails = new List<Statistics> 
    {
        new Statistics { Browser = "Chrome", Users = 37 },
        new Statistics { Browser = "UC Browser", Users = 17 },
        new Statistics { Browser = "iPhone", Users = 19 },
        new Statistics { Browser = "Others", Users = 4  },
        new Statistics { Browser = "Opera", Users = 11 },
        new Statistics { Browser = "Android", Users = 12 },
    };
}

Pie Center

Various Radius Pie Chart

You can use radius mapping to render the slice with different Radius and also use border, fill properties to customize the point.

various-radius.razor
<EjsAccumulationChart Title="Oil and other liquid imports in USA" EnableAnimation="true" EnableSmartLabels="true">
        <AccumulationChartLegendSettings Visible="true"></AccumulationChartLegendSettings> 
  
        <AccumulationChartSeriesCollection> 
            <AccumulationChartSeries DataSource="@StatisticsDetails" XName="Browser" YName="Users" 
                                     InnerRadius="20%" Radius="R">
            </AccumulationChartSeries> 
        </AccumulationChartSeriesCollection>
</EjsAccumulationChart>

@code{
    public class Statistics
    {
        public string Browser;
        public double Users;
        public string R;
    }

    public List<Statistics> StatisticsDetails = new List<Statistics> 
      {
         new Statistics { Browser = "Argentina", Users = 505370, R = "100"},
         new Statistics { Browser = "Belgium",    Users = 551500, R = "118.7"},
         new Statistics { Browser = "Cuba",  Users = 312685 , R = "124.6"},
         new Statistics { Browser = "Dominican Republic", Users = 350000 , R = "137.5"},
         new Statistics { Browser = "Egypt", Users = 301000 , R = "150.8"},
         new Statistics { Browser = "Kazakhstan", Users = 300000, R = "155.5"},
         new Statistics { Browser = "Somalia",  Users = 357022, R = "160.6"}
     };

}

Various Radius Pie Chart

Doughnut Chart

To achieve a doughnut in pie series, customize the InnerRadius property of the series. By setting value greater than 0%, a doughnut will appear. The InnerRadius property takes value from 0% to 100% of the pie radius.

doughnut.razor
<EjsAccumulationChart Title="Mobile Browser Statistics"> 
        <AccumulationChartSeriesCollection> 
            <AccumulationChartSeries DataSource="@StatisticsDetails" XName="Browser" YName="Users"
                                     Name="Browser" InnerRadius="40%">
            </AccumulationChartSeries>
        </AccumulationChartSeriesCollection> 
  
        <AccumulationChartLegendSettings Visible="false"></AccumulationChartLegendSettings>
</EjsAccumulationChart>

@code{
    public class Statistics
    {
        public string Browser;
        public double Users;
    }

    public List<Statistics> StatisticsDetails = new List<Statistics> 
    {
        new Statistics { Browser = "Chrome", Users = 37 },
        new Statistics { Browser = "UC Browser", Users = 17 },
        new Statistics { Browser = "iPhone", Users = 19 },
        new Statistics { Browser = "Others", Users = 4  },
        new Statistics { Browser = "Opera", Users = 11 },
        new Statistics { Browser = "Android", Users = 12 },
    };
}

Doughnut Chart

Start and End angles

You can customize the start and end angle of the pie series using the StartAngle and EndAngle properties. The default value of StartAngle is 0 degree, and EndAngle is 360 degrees. By customizing this, you can achieve a semi pie series.

start-angle.razor
<EjsAccumulationChart Title="Mobile Browser Statistics"> 
        <AccumulationChartSeriesCollection> 
            <AccumulationChartSeries DataSource="@StatisticsDetails" XName="Browser" YName="Users" 
                                     StartAngle="270" EndAngle="90">
            </AccumulationChartSeries> 
        </AccumulationChartSeriesCollection> 
  
        <AccumulationChartLegendSettings Visible="false"> 
        </AccumulationChartLegendSettings>
</EjsAccumulationChart>

@code{
    public class Statistics
    {
        public string Browser;
        public double Users;
    }

    public List<Statistics> StatisticsDetails = new List<Statistics> 
    {
        new Statistics { Browser = "Chrome", Users = 37 },
        new Statistics { Browser = "UC Browser", Users = 17 },
        new Statistics { Browser = "iPhone", Users = 19 },
        new Statistics { Browser = "Others", Users = 4  },
        new Statistics { Browser = "Opera", Users = 11 },
        new Statistics { Browser = "Android", Users = 12 },
    };
}

Start and End angles

Color and Text Mapping

The fill color and the text in the data source can be mapped to the chart using PointColorMapping in series and Name in datalabel respectively.

map.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsAccumulationChart Title="Mobile Browser Statistics">
    <AccumulationChartLegendSettings Visible="true"></AccumulationChartLegendSettings>

    <AccumulationChartSeriesCollection>
        <AccumulationChartSeries DataSource="@StatisticsDetails" XName="Browser" YName="Users" Name="Browser" PointColorMapping="Fill">
            <AccumulationDataLabelSettings Visible="true" Name="Text"></AccumulationDataLabelSettings>
        </AccumulationChartSeries>
    </AccumulationChartSeriesCollection>
</EjsAccumulationChart>

@code{
    public class Statistics
    {
        public string Browser;
        public double Users;
        public string Fill;
        public string Text;
    }

    public List<Statistics> StatisticsDetails = new List<Statistics>
    {
         new Statistics { Browser = "Chrome", Users = 37, Text= "37%", Fill="#498fff" },
         new Statistics { Browser = "UC Browser", Users = 17, Text= "17%", Fill="#ffa060" },
         new Statistics { Browser = "iPhone", Users = 19, Text= "19%", Fill="#ff68b6" },
         new Statistics { Browser = "Others", Users = 4, Text= "4%", Fill="#81e2a1"  },
         new Statistics { Browser = "Opera", Users = 11, Text= "11%", Fill="#ffb980" },
         new Statistics { Browser = "Android", Users = 12, Text= "12%", Fill="#09e1e8" },
    };
}

Color Mapping

See Also