DEV4 Blog

  • Home
  • /
  • Blog
  • /
  • Charts.js and ASP.NET Example

Using an AJAX call and a web service method.


Code behind method to get objects;


In the web service, a GET endpoint retrieves this data in JSON format;

On client-side, a successful AJAX GET request (to the above method) calls the function which uses the HTML canvas and the JSON data to create a chart.js pie chart;


Using a label control to pass the data to the chart;

The ‘lblChartData’ control will store the information (in this case, numbers of completed and outstanding tasks to be completed) in its Text property.

On client-side, this data is retrieved using jQuery and used to create the dataset for the chart;


Published on 14 Nov 2018

Add new comment...