Best JavaScript Charting Libraries for 2019

Best JavaScript Charting Libraries for 2019

✅Best JavaScript chart libraries for 2019. ✅D3.js. D3.js is a very extensive and powerful graphics JavaScript library. JSCharting. JSCharting chart library supports a large number of chart types including maps, gantt, stock and others that often require separate libraries to use. Highcharts

First, a brief history:

With data collection and use continuing to increase exponentially, the need to visualize this data is becoming more important. Developers seek to consolidate millions of database records into beautiful charts and dashboards that humans can quickly and intuitively interpret.

Data visualization technology has continued to improve over the past decade and many advanced chart libraries are now available to consumers. In the early 2000s, chart generation was dominated by server side image bitmap charts. Plugins such as Flash and Silverlight offered a more interactive charting experience but with a heavy toll on download speed, battery life and system resources.

With the explosion of mobile and tablet usage, plugins were no longer supported on major platforms and developers had to shift to open client side technologies that could run everywhere. At the same time, the advent of very high resolution screens and more common zooming through touch gestures brought resolution independent vector charts to the forefront.

Enter the current era of data visualization dominated by JavaScript and SVG (Scalable Vector Graphics). Charts now run on all browsers, without special plugins, support interactivity and animations and look sharp even on the highest resolution devices. Reviewing over 50 visualization libraries, these 9 products stood out:

D3.js

Building Data Visualizations with D3 and Angular 2

D3.js is a very extensive and powerful graphics JavaScript library. It allows you to bind arbitrary data to a Document Object Model (DOM), and then apply data-driven transformations to the document.

D3 goes well beyond typical charting libraries, including many other smaller technical modules such as axes, colors, hierarchies, contours, easing, polygons, and more. All this makes for a steep learning curve.

Trying to create a simple chart can be complicated. All elements including the axes, and other chart items need to be defined explicitly. Many samples show how CSS can be used to style chart elements. No charting-based features apply automatically. If you want to get into the weeds and use creativity to fully control every element, it is the best choice. Working against the clock to meet data visualization project requirements it may not be the best choice starting from scratch.

D3.js can be a building block for a charting library. Developers have used D3 to make it easier to use chart solutions that consume it, such as NVD3.

D3.js is open source and free to use.

JSCharting

JSCharting chart library supports a large number of chart types including maps, gantt, stock and others that often require separate libraries to use. It includes built-in maps of all world countries, and a library of SVG icons. A suite of standalone micro charts can render in any chart labels or in any div element on a page. UI controls (UiItems) are also included allowing for richer interactive charts. To control data or visualization variables in real-time is easy and charts can be exported to SVG, PNG, PDF, and JPG formats.

The gallery is divided into chart type and feature samples. The chart styling is polished and yields some clean looking charts. The overall visuals provide a clean and professional charting experience.

Included samples use a configuration object to customize charts. The settings to create and control chart types are very simple to use. Few property settings are needed to specify more complex chart types and JSCharting has strong and dynamic defaults meaning it attempts to choose the best settings for the scenarios automatically.

The documentation includes many tutorials and thorough API property descriptions. Many properties include example usage and sample links.

JSCharting is free for non commercial and personal use and also offers commercial license options that includes all chart types and products for a single fee.

Highcharts

Highcharts is a popular JavaScript charting library used by many of the world’s largest companies. Charts are generated using SVG and fallback to VML for backward compatibility all the way to IE6/IE8. The demo charts demonstrate a fairly rich feature set but don’t wow visually. General documentation includes tutorials for many relevant topics and the API documentation is thorough.

The chart uses configuration options to create charts and the API is easy to use.

Highcharts is free for non-commercial and personal use. Commercial licensing is required for other usage and stock, map and gantt charts are licensed separately.

amCharts

amCharts has recently released their version 4 which adds a strong SVG animation engine that allows creating movie-like scenes.

The demo charts look very nice. Most demos offer a number of palettes and a slider UI to adjust chart variables in real-time. Documentation includes many tutorials and full API property descriptions.

Creating a chart feels slightly different from the configuration-based approach, and instead uses a more declarative API. It requires slightly more code to configure charts but gives a better code completion experience.

amCharts offers a free license with branded charts and paid licenses for other usage.

Google Charts

Excel Charts: Visualization Secrets for Impressive Charts

Google charts are powerful and easy to use.

The sample charts look clean and are easy on the eyes. The gallery and extended gallery shows many chart types, but pressing the hamburger menu reveals more types (like calendar) that are not shown in these gallery lists.

Each chart type has a dedicated tutorial with live examples. The tutorials include code for the related features and API listings. This is a pleasant experience getting started with a new chart library.

Charts are customized using the configuration options object. Data sets are populated using a DataTable class which can be consumed by all charts. Each chart type has unique options listed in the type specific tutorials. Property naming is standardized and many options work across all types.

Google charts is free, but there is a caveat. It is a web service and cannot be hosted locally. In the past Google has retired API’s so if your usage is mission critical you may want to pick another option.

ZingChart

ZingChart offers many chart types and integrates with angular, react, and other frameworks. It has a strong feature set with many customization options.

The demo charts show a range of styling themes, some of which look better than others, but the options to style them as needed are there. Demos don’t demonstrate all the available chart types.

Documentation includes tutorials for all the available types, a good number of features, and full API listing.

ZingChart uses configuration options to customize charts. Samples include many property settings such as font styling. These can get in the way of understanding what settings are required for a given chart.

ZingChart can be used for free with branding. Paid licensing is available for non-branded usage.

FushionCharts

FusionCharts has been around for many years starting as a Flash-based chart plugin. It is a robust chart visualization library. It supports many data formats including XML, JSON, and JavaScript, works in modern browsers and is backwards compatible back to IE6. Many JavaScript frameworks and server-side programming languages are also supported.

The chart gallery includes a large number of examples and they have a clean visual appearance.

Documentation includes good API descriptions, and examples of each chart type. The configuration properties are grouped by tasks and chart features.

Charts are created using configuration based options and is relatively easy to use. The list of properties can be lengthy when digging deeper into the API. All configuration properties are shallow such as {chartLeftMargin, showAlternateHGridColor }. It seems like an attempt to improve code completion.

FusionCharts is free for personal use with chart branding. Paid licensing is available for unbranded and commercial use.

KOOLCHART

KoolChart is an HTML 5 canvas-based JavaScript charting library. A mapping and grid product is also available.

Their new v5 release includes a more interactive feature set and updated styling. The visuals are clean and modern. The use of canvas offers better performance at the expense of being raster based.

The samples use a string based XML to apply chart options which seems less practical than other approaches. These options look like HTML5 but are set through a JavaScript string.

The API is well documented with example charts for each property. A 173 page PDF manual is also available.

A two month trial period is available for evaluation. Licensing is required after the trial period expires.

Chart.js

Chart.js is an open source JavaScript library supporting 8 chart types. It is a small js library at just 60kb. Types include line charts, bar charts, area charts, radar, pie charts, bubble, scatter plots, and mixed. A time series is also supported. It uses canvas element for rendering and is responsive on window resize to maintain scale granularity. It is backwards compatible to IE9. Polyfills are available to work with IE7 as well.

The sample visuals are fairly modern looking and include initial animations when drawing for the first time. It animates smoothly when adding series or data points in real-time. Chart options can be modified after and calling an update() function redraws the chart.

Sample source code is not shown the website gallery but is available in the GitHub repo. Configuration options are used to create and modify charts. The options API is clean and intuitive.

The documentation is thorough and includes tutorials with property API and code snippets.

Chart.js is an open source library and free to use for personal and commercial use which is a plus. The limited number of types can be an issue for more advanced dashboard requirements.

Conclusion

The ecosystem of JavaScript charting libraries has evolved considerably over the last decade. Today, there are a large number of charting products that meet very diverse requirements, serving a wide range of projects though hundreds of chart types. Most libraries provide a free trial or branded version enabling you to evaluate the chart effectiveness with your own data, loading and project complexity.

It is easy for most chart libraries to deal with simple curated data sets and static visualizations. However, charts may not always handle things smoothly when real-world, dynamic data is visualized. More work may be required to adjust and arrange elements so that charts appear correct and this manual tweaking can break as new dynamic data is visualized.

To select the best JS chart solution for your unique needs, I recommend testing your own data against a couple of the libraries listed above to ensure an ideal fit for your current and future projects.

30s ad

Excel: the next level. Expert with formulas and charts

Microsoft Excel: Data Visualization w/ Excel Charts & Graphs

Laravel - Learn How to Create Charts with Vue.js and Laravel

JavaScript Tutorial: if-else Statement in JavaScript

JavaScript Tutorial: if-else Statement in JavaScript

This JavaScript tutorial is a step by step guide on JavaScript If Else Statements. Learn how to use If Else in javascript and also JavaScript If Else Statements. if-else Statement in JavaScript. JavaScript's conditional statements: if; if-else; nested-if; if-else-if. These statements allow you to control the flow of your program's execution based upon conditions known only during run time.

Decision Making in programming is similar to decision making in real life. In programming also we face some situations where we want a certain block of code to be executed when some condition is fulfilled.
A programming language uses control statements to control the flow of execution of the program based on certain conditions. These are used to cause the flow of execution to advance and branch based on changes to the state of a program.

JavaScript’s conditional statements:

  • if
  • if-else
  • nested-if
  • if-else-if

These statements allow you to control the flow of your program’s execution based upon conditions known only during run time.

  • if: if statement is the most simple decision making statement. It is used to decide whether a certain statement or block of statements will be executed or not i.e if a certain condition is true then a block of statement is executed otherwise not.
    Syntax:
if(condition) 
{
   // Statements to execute if
   // condition is true
}

Here, condition after evaluation will be either true or false. if statement accepts boolean values – if the value is true then it will execute the block of statements under it.
If we do not provide the curly braces ‘{‘ and ‘}’ after if( condition ) then by default if statement will consider the immediate one statement to be inside its block. For example,

if(condition)
   statement1;
   statement2;

// Here if the condition is true, if block 
// will consider only statement1 to be inside 
// its block.

Flow chart:

Example:

<script type = "text/javaScript"> 

// JavaScript program to illustrate If statement 

var i = 10; 

if (i > 15) 
document.write("10 is less than 15"); 

// This statement will be executed 
// as if considers one statement by default 
document.write("I am Not in if"); 

< /script> 

Output:

I am Not in if
  • if-else: The if statement alone tells us that if a condition is true it will execute a block of statements and if the condition is false it won’t. But what if we want to do something else if the condition is false. Here comes the else statement. We can use the else statement with if statement to execute a block of code when the condition is false.
    Syntax:
if (condition)
{
    // Executes this block if
    // condition is true
}
else
{
    // Executes this block if
    // condition is false
}


Example:

<script type = "text/javaScript"> 

// JavaScript program to illustrate If-else statement 

var i = 10; 

if (i < 15) 
document.write("10 is less than 15"); 
else
document.write("I am Not in if"); 

< /script> 

Output:

i is smaller than 15
  • nested-if A nested if is an if statement that is the target of another if or else. Nested if statements means an if statement inside an if statement. Yes, JavaScript allows us to nest if statements within if statements. i.e, we can place an if statement inside another if statement.
    Syntax:
if (condition1) 
{
   // Executes when condition1 is true
   if (condition2) 
   {
      // Executes when condition2 is true
   }
}

Example:

<script type = "text/javaScript"> 

// JavaScript program to illustrate nested-if statement 

var i = 10; 

if (i == 10) { 

// First if statement 
if (i < 15) 
	document.write("i is smaller than 15"); 

// Nested - if statement 
// Will only be executed if statement above 
// it is true 
if (i < 12) 
	document.write("i is smaller than 12 too"); 
else
	document.write("i is greater than 15"); 
} 
< /script> 

Output:

i is smaller than 15
i is smaller than 12 too
  • if-else-if ladder Here, a user can decide among multiple options.The if statements are executed from the top down. As soon as one of the conditions controlling the if is true, the statement associated with that if is executed, and the rest of the ladder is bypassed. If none of the conditions is true, then the final else statement will be executed.
if (condition)
    statement;
else if (condition)
    statement;
.
.
else
    statement;


Example:

<script type = "text/javaScript"> 
// JavaScript program to illustrate nested-if statement 

var i = 20; 

if (i == 10) 
document.wrte("i is 10"); 
else if (i == 15) 
document.wrte("i is 15"); 
else if (i == 20) 
document.wrte("i is 20"); 
else
document.wrte("i is not present"); 
< /script> 

Output:

i is 20

How to Retrieve full Profile of LinkedIn User using Javascript

How to Retrieve full Profile of LinkedIn User using Javascript

I am trying to retrieve the full profile (especially job history and educational qualifications) of a linkedin user via the Javascript (Fetch LinkedIn Data Using JavaScript)

Here we are fetching LinkedIn data like Username, Email and other fields using JavaScript SDK.

Here we have 2 workarounds.

  1. Configuration of linkedIn developer api
  2. Javascript Code to fetch records

Configuration of linkedIn developer api

In order to fetch records, first we need to create developer api in linkedin which will act as token/identity while fetching data from other linkedin accounts.

So to create api, navigate to https://linkedin.com/developer/apps and click on 'Create Application'.

After navigating, fill in details like name, description and other required fields and then submit.

As we submit, it will create Client ID and Client Secret shown below, which we will be using in our code while communicating to fetch records from other LinkedIn account.

Note: We need to provide localhost Url here under Oauth 2.0. I am using my localhost, but you can probably use other production URLs under Oauth 2.0 where your app is configured. It will make your api  consider the Url as trusted which fetching records.

Javascript Code to fetch records

For getting user details like first name, last name,User image can be written as,

<script type="text/javascript" src="https://platform.linkedin.com/in.js">  
    api_key: XXXXXXX //Client ID  
    onLoad: OnLinkedInFrameworkLoad //Method that will be called on page load  
    authorize: true  
</script>  
<script type="text/javascript">  
    function OnLinkedInFrameworkLoad() {  
        IN.Event.on(IN, "auth", OnLinkedInAuth);  
    }  
  
    function OnLinkedInAuth() {  
        IN.API.Profile("me").result(ShowProfileData);  
    }  
  
    function ShowProfileData(profiles) {  
        var member = profiles.values[0];  
        var id = member.id;  
        var firstName = member.firstName;  
        var lastName = member.lastName;  
        var photo = member.pictureUrl;  
        var headline = member.headline;  
        //use information captured above  
        var stringToBind = "<p>First Name: " + firstName + " <p/><p> Last Name: " + lastName + "<p/><p>User ID: " + id + " and Head Line Provided: " + headline + "<p/>"  
        document.getElementById('profiles').innerHTML = stringToBind;  
    }  
</script>    

Kindly note we need to include 'https://platform.linkedin.com/in.js' as src under script type as it will act on this Javascript SDK provided by Linkedin.

In the same way we can also fetch records of any organization with the companyid as keyword.

<head>  
    <script type="text/javascript" src="https://platform.linkedin.com/in.js">  
        api_key: XXXXXXX ////Client ID  
        onLoad: onLinkedInLoad  
        authorize: true  
    </script>  
</head>  
  
<body>  
    <div id="displayUpdates"></div>  
    <script type="text/javascript">  
        function onLinkedInLoad() {  
            IN.Event.on(IN, "auth", onLinkedInAuth);  
            console.log("On auth");  
        }  
  
        function onLinkedInAuth() {  
            var cpnyID = XXXXX; //the Company ID for which we want updates  
            IN.API.Raw("/companies/" + cpnyID + "/updates?event-type=status-update&start=0&count=10&format=json").result(displayCompanyUpdates);  
            console.log("After auth");  
        }  
  
        function displayCompanyUpdates(result) {  
            var div = document.getElementById("displayUpdates");  
            var el = "<ul>";  
            var resValues = result.values;  
            for (var i in resValues) {  
                var share = resValues[i].updateContent.companyStatusUpdate.share;  
                var isContent = share.content;  
                var isTitled = isContent,  
                    isLinked = isContent,  
                    isDescription = isContent,  
                    isThumbnail = isContent,  
                    isComment = isContent;  
                if (isTitled) {  
                    var title = isContent.title;  
                } else {  
                    var title = "News headline";  
                }  
                var comment = share.comment;  
                if (isLinked) {  
                    var link = isContent.shortenedUrl;  
                } else {  
                    var link = "#";  
                }  
                if (isDescription) {  
                    var description = isContent.description;  
                } else {  
                    var description = "No description";  
                }  
                /* 
                if (isThumbnailz) { 
                var thumbnailUrl = isContent.thumbnailUrl; 
                } else { 
                var thumbnailUrl = "http://placehold.it/60x60"; 
                } 
                */  
                if (share) {  
                    var content = "<a target='_blank' href=" + link + ">" + comment + "</a><br>";  
                    //el += "<li><img src='" + thumbnailUrl + "' alt=''>" + content + "</li>";  
                    el += "<li><div>" + content + "</div></li>";  
                }  
                console.log(share);  
            }  
            el += "</ul>";  
            document.getElementById("displayUpdates").innerHTML = el;  
        }  
    </script>  
</body>  

We can get multiple metadata while fetching records for any any organization. We can get company updates as shown below.

Conclusion

We can also fetch any company specific data like company job updates/post, total likes, comments, and number of views along with a lot of metadata we can fetch which I have shown below.

Thank you for reading !

7 Best Javascript Iframe Libraries

7 Best Javascript Iframe Libraries

Iframes let you build user experiences into embeddable ‘cross-domain components’, which let users interact with other sites without being redirected. I have compiled 7 best Javascript iframe libraries.

Iframes let you build user experiences into embeddable ‘cross-domain components’, which let users interact with other sites without being redirected. I have compiled 7 best Javascript iframe libraries.

1. Zoid

A cross-domain component toolkit, supporting:

  • Render an iframe or popup on a different domain, and pass down props, including objects and functions
  • Call callbacks natively from the child window without worrying about post-messaging or cross-domain restrictions
  • Create and expose components to share functionality from your site to others!
  • Render your component directly as a React, Vue or Angular component!
    It's 'data-down, actions up' style components, but 100% cross-domain using iframes and popups!

Download


2. Postmate

Postmate is a promise-based API built on postMessage. It allows a parent page to speak with a child iFrame across origins with minimal effort.

Download


3. Iframe Resizer

Keep same and cross domain iFrames sized to their content with support for window/content resizing, in page links, nesting and multiple iFrames

Demo

Download


4. Iframely

Embed proxy. Supports over 1800 domains via custom parsers, oEmbed, Twitter Cards and Open Graph

Demo

Download


5. React Frame component

This component allows you to encapsulate your entire React application or per component in an iFrame.

Demo

Download


6. Seamless.js

A seamless iframe makes it so that visitors are unable to distinguish between content within the iframe and content beside the iframe. Seamless.js is a JavaScript library (with no dependencies) that makes working with iframes easy by doing all the seamless stuff for you automatically.

Demo

Download


7. Porthole

A proxy to safely communicate to cross-domain iframes in javascript

Demo

Download


Thank for read!