Tech

Visualize Your Data Using an Integration of FusionCharts and ASP.NET

With ever-growing competition for business, organizations across various domains feel the need to record user interactions and business operations. It helps to understand, process, analyze, and communicate the big data collected every day across various operation channels. 

Having an efficient data visualization system in place can help you achieve improved business outputs in less time. Data visualization offers an attractive visual format through graphical representation that allows users to explore data and uncover hidden insights.

But what’s the most important thing for data visualization?

A Technology Framework!

Nowadays, multiple technology frameworks are available to ensure users get the best data visualization for making informed decisions. But before moving on to that, let’s help you make a more firm decision to leverage data visualization tools by shedding light on the multiple benefits.

Benefits of Data Visualization

When you are considering strategies and goals to help your business prosper, data visualization helps you make the most impact by providing the following unparalleled benefits:

Improves absorption of business operations

One of the most important advantages of data visualization is that it enables easy and quick assimilation of big data. The human eye can process visual images almost 60,000 times faster than numbers and text, making data visualization the most efficient way to absorb and process information. 

Through various forms of graphical representations, data visualization allows business owners and decision-makers to uncover meaningful and vital relationships among multidimensional data sets and provides new methods of interpreting data (bar graphs, histograms, pie charts, PowerPoint presentations, etc.).

Quick access to meaningful business insights

Organizations across different industry verticals leverage visual data tools for improving their ability to extract relevant business insights within big data sets. What’s more exciting is that organizations can maintain their relevance in their increasingly competitive industries by uncovering hidden business insights without investing too much. Such hidden patterns offer crucial business information that can improve the decision-making process for maximum growth.

Improved understanding of business operations

The current competitive environment makes it necessary for businesses to find meaningful correlations in the data through data visualization. Doing so enables organizations to see interconnectivity among various business operations as and when they occur.

Having a multifaceted view of business and its operating dynamics enables leaders to generate more productivity through efficient business operations.

Constructively communicates business insights

Generally, business reports consist of formal documents that contain lengthy details, static tables, and outdated chart models. 

On the other hand, data visualization tools put you one step ahead by presenting valuable business insights and encompassing complex business operations and market trends.

The dashboard’s interactiveness helps business decision-makers act upon the interpreted information through efficient data analytics.

Knowing that such benefits are provided by data visualization, you might be wondering about the best platform to help you create the most appealing form of data visualization. 

Hold onto your seat as we take you on a journey to find the best platform and best framework to create an appealing and effective data visualization.

Though many server-side frameworks are available in the market today, ASP.NET comes with significant advantages. Being a closed-source and reliable platform, ASP.NET is a favorite among small and medium enterprises.

But which platform provides the best ASP.NET integration for appealing data visualization?

Without a doubt, the answer is FusionCharts. 

Why FusionCharts?

FusionCharts is a widely used, JavaScript-based charting and data visualization tool that has established itself as a renowned leader in the paid-for market. It provides the platform for you to create 90 different types of charts and allows integration with many other platforms and frameworks. 

One distinguishing feature that makes FusionCharts very popular is that you don’t need to start each visualization from scratch every time. Instead, you can choose from a wide range of “live” example templates.

The FusionCharts suite enables you to configure your chart according to your functional or visual ideas. On top of that, it offers attributes to help you add layers through annotations to build complex visualizations for configuring your charts in the best possible way.

What Is the ASP.NET Module for FusionCharts?

The combination of ASP.NET with FusionCharts at your disposal helps you to create over 150 different types of charts for your application. Compared to other charting libraries that only allow low-resolution static images, ASP.NET with FusionCharts enables the most interactive and responsive charts for all screen sizes. 

When using the ASP.NET module for FusionCharts, you don’t need to worry about JavaScript methods and objects. This combination enables you to write your application in ASP.NET and collect data from your SQL servers to create attractive and responsive charts that support zooming, panning, APIs, animation, drill-downs, real-time updates, and exporting features.

A Complete Guide to Visualizing Data with the Combination of ASP.NET and FusionCharts

Prerequisite

To proceed with creating charts, you need to have an ASP.NET project set up. In case you haven’t set up the project yet, you can create it using Visual Studio. If you use UNIX-based systems such as Mac and Linux, you just need to open Visual Studio and create a new ASP.NET project. In the case of Windows-based systems, create a web application project. 

Installation dependencies

You need to download the FusionCharts library to get the ASP.NET wrapper.

Upon opening the new project, follow the below steps:

  • Right-click on References and select Edit References. Now browse to the FusionCharts that you have downloaded and select asp-net-wrapper ( integrations > asp.net-cs > fusioncharts-wrapper-assembly > FusionCharts.dll (for C#).
  • The next step is to create a new folder named Script in your project and copy js files (for local files) in it.
  • Now create a new web form in your project directory named “index.” The file “index.aspx” will be created.

The directory structure should look like this:

Preparing the data

Let’s take an example and create a chart for “Countries with Most Oil Reserves” to guide you better.

 

Countries No. of oil reserves
Venezuela 290k
Saudi Arabia 260k
Canada 180k
Iran 140k
Russia 115k
UAE 100k
US 30k
China 30k

 

As we are plotting a single data set, let’s create a column in the 2-D chart with “Countries” as a data label along the X-axis and “No of oil reseves” along the Y-axis. Let’s prepare the data for the single series chart.

As FusionCharts accept the data in JSON format, we will first add the data in index.aspx.cs (C#) and then convert it into the JSON format.

//store label-value pair
var dataValuePair = new List<KeyValuePair<string, double>>();
dataValuePair.Add(new KeyValuePair<string, double>(“Venezuela”, 290));
dataValuePair.Add(new KeyValuePair<string, double>(“Saudi”, 260));
dataValuePair.Add(new KeyValuePair<string, double>(“Canada”, 180));
dataValuePair.Add(new KeyValuePair<string, double>(“Iran”, 140));
dataValuePair.Add(new KeyValuePair<string, double>(“Russia”, 115));
dataValuePair.Add(new KeyValuePair<string, double>(“UAE”, 100));
dataValuePair.Add(new KeyValuePair<string, double>(“US”, 30));
dataValuePair.Add(new KeyValuePair<string, double>(“China”, 30));

StringBuilder data = new StringBuilder();

data.Append(“‘data’:[“);
foreach (KeyValuePair<string, double> pair in dataValuePair) {
data.AppendFormat(“{{‘label’:'{0}’,’value’:'{1}’}},”, pair.Key, pair.Value);
}
data.Replace(“,”, “]”, data.Length – 1, 1);

 

Configuring your chart

As the data is read, you can work on styling, positioning, and giving context to your chart. 

Follow the steps below:

Step 1: In the index.aspx file, include the Fusioncharts JavaScript files to apply the style to the chart.

// Include FusionCharts core file
<script type=“text/javascript” src=“https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js”></script>

// Include FusionCharts Theme file
<script type=“text/javascript” src=“https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js”></script>

Step 2:  Now add the chart attributes in index.aspx.cs(C#) file. FusionCharts accepts data in JSON format, so we convert these attributes into JSON format.

Dictionary<string, string> chartConfig = new Dictionary<string, string>();
chartConfig.Add(“caption”, “Countries With Most Oil Reserves [2017-18]”);
chartConfig.Add(“subCaption”, “In MMbbl = One Million barrels”);
chartConfig.Add(“xAxisName”, “Country”);
chartConfig.Add(“yAxisName”, “Reserves (MMbbl)”);
chartConfig.Add(“numberSuffix”, “k”);
chartConfig.Add(“theme”, “fusion”);

StringBuilder jsonData = new StringBuilder();

// json data to use as chart data source
jsonData.Append(“{‘chart’:{“);
foreach (var config in chartConfig) {
jsonData.AppendFormat(“‘{0}’:'{1}’,”, config.Key, config.Value);
}
jsonData.Replace(“,”, “},”, jsonData.Length – 1, 1);

 

Create a chart

Now moving further, let’s create a 2-D column chart using the asp-net-wrapper showing “Countries with Most Oil Reserves.”

The index.aspx.cs(C#)  file will have the chart constructor, attributes, and data source required to render the chart. The consolidated code is shown below:

using System;
using System.Collections.Generic;
using System.Text;
using FusionCharts.Charts;
namespace FusionChartsProject {
  public partial class index : System.Web.UI.Page {
      protected void Page_Load(object sender, EventArgs e) {
          //store label-value pair
          var dataValuePair = new List<KeyValuePair<string, double>>();
          dataValuePair.Add(new KeyValuePair<string, double>(“Venezuela”, 290));
          dataValuePair.Add(new KeyValuePair<string, double>(“Saudi”, 260));
          dataValuePair.Add(new KeyValuePair<string, double>(“Canada”, 180));
          dataValuePair.Add(new KeyValuePair<string, double>(“Iran”, 140));
          dataValuePair.Add(new KeyValuePair<string, double>(“Russia”, 115));
          dataValuePair.Add(new KeyValuePair<string, double>(“UAE”, 100));
          dataValuePair.Add(new KeyValuePair<string, double>(“US”, 30));
          dataValuePair.Add(new KeyValuePair<string, double>(“China”, 30));
          StringBuilder jsonData = new StringBuilder();
          StringBuilder data = new StringBuilder();

          // store chart config name-config value pair
          Dictionary<string, string> chartConfig = new Dictionary<string, string>();
          chartConfig.Add(“caption”, “Countries With Most Oil Reserves [2017-18]”);
          chartConfig.Add(“subCaption”, “In MMbbl = One Million barrels”);
          chartConfig.Add(“xAxisName”, “Country”);
          chartConfig.Add(“yAxisName”, “Reserves (MMbbl)”);
          chartConfig.Add(“numberSuffix”, “k”);
          chartConfig.Add(“theme”, “fusion”);

          // json data to use as chart data source
          jsonData.Append(“{‘chart’:{“);
          foreach (var config in chartConfig) {
              jsonData.AppendFormat(“‘{0}’:'{1}’,”, config.Key, config.Value);
          }
          jsonData.Replace(“,”, “},”, jsonData.Length – 1, 1);

          // build  data object from label-value pair
          data.Append(“‘data’:[“);
          foreach (KeyValuePair<string, double> pair in dataValuePair) {
              data.AppendFormat(“{{‘label’:'{0}’,’value’:'{1}’}},”, pair.Key, pair.Value);
          }
          data.Replace(“,”, “]”, data.Length – 1, 1);
          jsonData.Append(data.ToString());
          jsonData.Append(“}”);

          //Create chart instance
          // charttype, chartID, width, height, data format, data
          Chart MyFirstChart = new Chart(“column2d”, “first_chart”, “800”, “550”, “json”, jsonData.ToString());

          // render chart
          Literal1.Text = MyFirstChart.Render();
      }
  }

}

 

The index.aspx file will have an HTML template that includes the JavaScript files and container for the chart. The HTML template is shown below:

<%@ Page Language=“C#” AutoEventWireup=“true” CodeBehind=“index.aspx.cs” Inherits=“FusionChartsProject.index” %>
<!DOCTYPE html>
<html xmlns=” http://www.w3.org/1999/xhtml”>
<head runat=“server”>
  <title>fusioncharts</title>
</head>
<body>
  <script type=“text/javascript” src=“https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js”></script>
  <script type=“text/javascript” src=“https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js”></script>
  <div style=“text-align:center”>
      <asp:Literal ID=“Literal1” runat=“server”></asp:Literal>
  </div>
</body>
</html>

 

For local files, you can include the JavaScript files in the above code from the script folder, as follows:

// Include FusionCharts core file
<script type=“text/javascript” src=“Script/fusioncharts.js”></script>

// Include FusionCharts Theme file
<script type=“text/javascript” src=“Script/themes/fusioncharts.theme.fusion.js”></script>

 

Chart rendering

As the container for the chart is created in index.aspx file, now click on the run, and you’ll be redirected to http://127.0.0.1:8080/

You’ll be able to see the chart as shown below:

And that’s all! Your first chart using asp-net-wrapper is ready.

Wrap Up

Data visualization in its most efficient form can completely turn your business around by providing deep insights into the business’s key performance indicators and other crucial metrics. 

With the FusionCharts JavaScript library, you can ensure the best combination of different frameworks. It provides you with a significant competitive edge by facilitating features like chart exports, drill-down, selective display of data, and scroll and zoom to your charts.

Ethan

Ethan is the founder, owner, and CEO of EntrepreneursBreak, a leading online resource for entrepreneurs and small business owners. With over a decade of experience in business and entrepreneurship, Ethan is passionate about helping others achieve their goals and reach their full potential.

Recent Posts

A Roadmap to Choosing Your Legal Champion: Tips for Finding the Right Lake Oswego Personal Injury Attorney

So, you've found yourself in a bind, facing the daunting task of choosing a personal…

1 hour ago

Mastering the Craft: The Art and Science of Roofing Contractors

Roofing contractors are the unsung heroes of the construction industry, tasked with the monumental responsibility…

7 hours ago

How Immigration Lawyers in Portland Are Helping People?

The global landscape has evolved in a way that has made immigration a tricky and…

11 hours ago

Latest Advances In General Dentistry

Imagine walking into a Cottage Grove, fresh with the scent of dew-kissed leaves. Now, replace…

11 hours ago

Common Procedures Performed By Infertility Specialists

Hello, and welcome to the fascinating world of fertility medicine. I want to take you…

11 hours ago

An Inside Look at the Life of an Anesthesiologist

Have you ever wondered what life would be like as an anesthesiologist? It's a world…

11 hours ago

This website uses cookies.