Articles in this section

How to render ASP.NET Core Pie charts using the Data Manager?

Description

This article shows how to render ASP.NET Core Pie Charts using the Data Manager.

Solution

To fetch remote data, use the url property in the DataManager. The DataManager requires minimal information, such as the web service URL, adaptor, and crossDomain setting, to interact with the service endpoint properly.

The DataManager should be specified in the series of the chart, binding the xName and yName properties to the corresponding properties in the data fetched using the DataManager.

Code Snippet

The following code example shows how to render a pie chart using the data manager.

index.cshtml

<ejs-accumulationchart id="container" title="Potential Project Summary" enableBorderOnMouseMove="false">
       <e-accumulationchart-legendsettings visible="true">
       </e-accumulationchart-legendsettings>
       <e-accumulation-series-collection>
           <e-accumulation-series xName="Xvalue" yName="YValue1" >
               <e-data-manager url='@Url.Action("PotentialProjectSummary", "Home")'></e-data-manager>
           </e-accumulation-series>
       </e-accumulation-series-collection>
   </ejs-accumulationchart>

HomeController.cs

public IActionResult PotentialProjectSummary()
{
   var data = new List<StatusData> { };
           data.Add(new StatusData("Possible", 6));
           data.Add(new StatusData("Won", 2));  
           return Json(new { result = data });
 }
       public class StatusData
       {
           public StatusData(string xval, double yvalue1)
           {
               this.Xvalue = xval;
               this.YValue1 = yvalue1;     
           }
           public string Xvalue { get; set; }
           public double YValue1 { get; set; }   
       }

The following image illustrates the output of the above code.

image.png

Conclusion

I hope you enjoyed learning how to render ASP.NET Core Pie charts using the Data Manager.

You can refer to our ASP.NET Core Chart feature tour page to learn about its other features and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET Core Chart example to understand how to create and visualize data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comment section below. You can also contact us through our support forums, support portal, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied