ASP.Net Web API 2 and AMCHARTS

Amcharts is one of the best js base chart service out there today.   Amcharts takes JSON data and display all sorts of neat charts.  Here, I am generating JSON data through ASP.Net Web API 2 and show AmCharts graphs.

I followed tutorial document from Amcharts (https://www.amcharts.com/tutorials/using-data-loader-to-connect-charts-to-mysql-data-base/).  This tutorial goes over how to query data from mySQL then generate JSON data then display charts in PHP, but we don’t have to worry about MySQL or PHP, we just create and fetch JSON data from API and goes from there.

First, we will have to know what type of data you want to generate.  We can generalize shape of data we want to work with.  Graphs usually are generated from table of data (or in this case JSON data that fits in table).  If you are to work with 2D graphs, then we will need to generate 2 dimensions of data, x and y. And that’s what we do today.

Let’s start with something simple.  I have system log stored in my DB,  X being time, call it category, Y being some value of some log properties, call it value1 and value2.

Continue reading “ASP.Net Web API 2 and AMCHARTS”