Short review javascript libraries for plotting

Highcharts

Highcharts is a pure HTML5/JavaScript charting library that offers intuitive interactive charts for your website or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types.

Google Charts

Google Charts - Offers a variety of charts designed for data visualization solutions. These charts are based on pure HTML5/SVG technology (accepting VML for older versions of IE) so no plugins are required. All of them are interactive and many of them are pannable and scalable. Adding these charts to a page can be done in a few easy steps.

CanvasJS

CanvasJS - easy to use HTML5 and JavaScript library Charting, built on the element Canvas. Graphs can be displayed on various devices, including mobile devices, iPad, Android, Windows phone, Microsoft Surface, on the desktop computers etc. This allows you to create functional graphics that work on all devices without compromising the maintainability or functionality of your web application. CanvasJS comes with beautiful themes and loads 10 times faster than regular flash and SVG Graph- resulting in graphics that are light and beautiful.

ChartJS

Chart JS - Lightweight, object-oriented client-side charting library.

RGraph

RGraph is an HTML5 canvas based and JavaScript library for building web charts with support for over twenty various types visualization. RGraph creates HTML5 charts inside a web browser using JavaScript and a tag canvas.

Usage graphs and charts has a very wide application. With their help, you can show a lot of information in a convenient and understandable way, and, accordingly, understand and understand it faster.

There are several ways to add a graph or chart to a web page. The first one, which you probably already thought of, is to draw it in any graphics editor. But this is not the most convenient and fastest option. It is much easier and faster to make a graph in JavaScript, where all you have to do is set the necessary parameters, view and place it on the page.

In this article, we will tell you about 10 services and tools, which will help in creating graphs and charts in JavaScript. You will find other ways to create in the heading "".

Bluff
To draw a line graph using this service, you just need to copy a few lines of code, set the desired parameters and add text. The code is so simple and clear that you can understand it in just a few seconds.


With PlotKit, you can build charts and graphs that will display correctly in all browsers. On the site you will find documentation, examples of chart types and quick guide(with a description of all parameters and settings) to quickly get started.


This service allows you to make great visual features. Enter the equation, for example 2*sin(4*x)^(x+4), press "Enter" and the function is ready. After that, you just have to copy the url and paste it on your page.


The most powerful tool for building tables, graphs and charts on jQuery. On the site you will find examples of all types of charts, as well as detailed description parameters and setup steps.

fleet
jQuery charting library from Google. You can write nothing more on this, everything is already clear (: But still, we note that the service offers great amount beautiful examples with flexible and easy customization.


Allows you to create charts and tables of data histograms. To build, you need to enter the necessary data and click on the "Calculate" button. Next, copy the code and download a small script. If desired, all data can be entered in the code itself.


The service provides 6 types of charts ( pie chart, line chart, dynamic chart and 3 kinds of histograms). There is a description of the settings, parameters and detailed examples all kinds of diagrams.

Raphael
Raphaël is a small JavaScript library that greatly simplifies the work of creating graphs and charts. This is the most powerful tool of all presented in this review. It will be easier for you to see the capabilities of the library yourself than to read the description about its capabilities.

plotr
Library for building charts on Mootools. A great tool that presents information in a beautiful and understandable way. And to configure it, you only need to change or add values.


The capabilities of this service allow you to build 3D graphics. From the functionality, it is worth highlighting a simple setting, fast work script and the ability to plot cosine and sine graphs.

In terms of interoperability, Fleet will definitely bring you as close to Flash graphics as possible to jQuery. While the plot output is pretty slick and great looking, you can also interact with the data points. I mean you can be able to hover over a data point and get a visual feedback from the value of this point on the graph.

The fleet version of trunk supports pie charts.

Ability to scale the fleet.

In addition, you also have the option to select a section of the graph to return data for a specific "zone". As an added feature for this "zoning" you can also select an area on the graph and zoom in to see the data points a little closer. Very cool.

Sparklines

Restrictions: Pie, Line, Bar, Combination

Sparklines is my favorite mini graphics tool. Really great for toolbar style charts (think toolbar Google Analytics next time you log in). Because they're so tiny, they can be included in a string (as in the example above). Another nice idea that can be used in all graphics plugins is self-updating capabilities. Their Mouse-Speed ​​demo shows you the power of live charting at its best.

Query chart 0.21

Constraints: Area, Line, Bar and combinations of these

jQuery Chart 0.21 is not the prettiest chart plugin, it should be listed there. Its pretty basic in functionality when it comes to the charts it can handle, however it can be flexible if you can put some time and effort into it.

Adding values ​​to a chart is relatively simple:

ChartAdd(( "label" : "Leads", "type" : "Line", "color" : "#008800", "values" : ["100","124","222","44"," 123","23","99"] ));

jQchart

Restrictions: Bar, Line

jQchart is odd, they have built in animation transistors and drag and drop functions to chart, however its a bit clunky - and seemingly pointless. It generates nice charts if you get your CSS set up right, but there's better.

TufteGraph

Constraints: Bar and Stacked Bar

Tuftegraph markets itself as "pretty bar graphs you'll show your mother". It gets closer, the Fleet is prettier, but Tufte makes himself very light. Although that's where the restrictions end - there are multiple options to choose from so you get what you specified. Look at the quick win card.

Graphs are a great visual aid when presenting data. Without them, it is impossible to create a high-quality admin panel. They are not easy to install. However, there is a new library that makes this task easier - xCharts . Today we are going to use this tool along with Bootstrap's Twitter Date Range palette to create a beautiful AJAX chart for your web application that retrieves data from a MySQL table.

HTML

The demo structure of this language is quite simple - we have to add elements on the page to start plotting and to select information. Since we're enabling loading on the page anyway, we can use its styling forms and icons to give this structure a nice look.

index.php

Pretty Charts with jQuery and AJAX | Tutorialzine Demo

It uses a lot of external resources. In the main section, we have the cascading stylesheet files for xCharts , the number sorter, the download (integrated from the super fast CloudFlare CDN), and our style.css file.

Before we close the table label, we have the JQuery library, d3.js (required by the xcharts program), xcharts , a library with user-friendly interface sugar.js (which requires a plugin in the 'dates' range), a plugin in the 'dates' range, and a script.js file. Next, you'll see how it all works together.

MySQL

As I mentioned in the introduction, the script we are writing will get data from a MySQL table and display it in a chart. You can find the SQL code that will create the table in schema.sql in a compressed file, available for download using the top buttons. The table will look like this:

It has only three columns. The "date" column is assigned a unique index, which means that there cannot be duplicate entries on the same day. The column "sales records" indicates the number of sales during the day. Your database will certainly be different, but as long as you get the correct answer in the format for structuring data into a plain text format used to exchange JSON information from a PHP script, there will be no problems anymore (more on this in the next section).

Note: Don't forget to enter your MySQL connection details in setup.php . Then you will have to create a new base MySQL data and import schema.sql from the PHPMyAdmin system or from the management system of your choice.

PHP

In our PHP script we will select records from the table that correspond to the passed initial and final information, collect all the data in an array, and display them in text format data exchange (JSON):

ajax.php

Header("Content-Type: application/json"); // library setup require_once("setup.php"); if (isset($_GET["start"]) AND isset($_GET["end"])) ( $start = $_GET["start"]; $end = $_GET["end"]; $data = array(); // select results $results = ORM::for_table("chart_sales") ->where_gte("date", $start) ->where_lte("date", $end) ->order_by_desc("date") ->find_array(); // create a new array with data foreach ($results as $key => $value) ( ​​$data[$key]["label"] = $value["date"]; $data[$ key]["value"] = $value["sales_order"]; ) echo json_encode($data); )

Here I am using my favorite library - Idiorm . I've used it in the past for website consultations (and many personal projects). It's only one file (located in the library/folder) and makes working with databases a lot easier. All I do is fetch all results from the database that have a time value between the start and end timestamps consistent with the retrieval request.

The resulting JSON response looks something like this:

[( "label": "2013-01-07", "value": "4" ), ( "label": "2013-01-06", "value": "65" ), ( "label": "2013-01-05", "value": "96")]

The label properties contain the MySQL number values ​​in the corresponding row, and the columns contain the number of sales for that day. It's up to the JavaScript code to properly process this data and reshape it into a format suitable for sharing with the xCharts plugin.

JavaScript

All JS code is contained in assets/js/script.js. The code is a little long, and to make it easier to follow, I will present it to you in parts.

First we will set a few variables and initialize the date range picker plugin. Please note that the dat range I used is an offshoot of the original plugin. I chose to work with this version because the original depends on date.js, a legacy data library that conflicts with xCharts. Instead, sugar.js is used - a great useful library with reliable and up-to-date information.

assets/js/script.js

$(function() ( // set default dates using shugar functions var startDate = Date.create().addDays(-6), // 6 days ago endDate = Date.create(); // today var range = $ ("#range"); // show dates in input order range.val(startDate.format("(MM)/(dd)/(yyyy)") + " - " + endDate.format("(MM)/ (dd)/(yyyy)")); // load chart ajaxLoadChart(startDate,endDate); range.daterangepicker(( startDate: startDate, endDate: endDate, ranges: ( "Today": ["today", "today" ], "Yesterday": ["yesterday", "yesterday"], "Last 7 Days": , "Last 30 Days": // You can add more entries here ) ),function(start, end)( ajaxLoadChart(start, end); ));

As you can see, we've successfully applied sugar.js' information and methods to define the initial and end point range. I entered the results of the last 7 days into the script, and updated the range input field.

Now let's create a graph:

// hint when hovering over the chart var tt = $("

").appendTo("body"), topOffset = -32; var data = ( "xScale" : "time", "yScale" : "linear", "main" : [( className: ".stats", "data " : )] ); var opts = ( paddingLeft: 50, paddingTop: 20, paddingRight: 10, axisPaddingLeft: 25, tickHintX: 9, // How many ticks to show horizontally dataFormatX: function(x) ( // convert temporary here the stamp came from // ajax.php into the corresponding JavaScript Date object return Date.create(x); ), tickFormatX: function(x) ( // set the label format for the x axis return x.format("(MM)/(dd )"); ), "mouseover": function (d, i) ( var pos = $(this).offset(); tt.text(d.x.format("(Month) (ord)") + ": " + d.y).css(( top: topOffset + pos.top, left: pos.left )).show(); ), "mouseout": function (x) ( tt.hide(); ) ); // Create a new xChart instance, passing in the type // of the chart, a set of dates, and additional functions var chart = new xChart("line-dotted", data, "#chart" , opts);

First I define an xCharts config object with its properties and inverse functions. In the dataFormatX property, I transform the yyyy-mm-dd strings returned from the AJAX request into the proper ones JavaScript objects Date so that the plugin can display them correctly and do its calculations.

I also use the information handler for the mouseover/mouseout plugin, and use it to show the tooltip (the plugin doesn't come with one of the modules).

Finally, here JavaScript function to load data via AJAX:

// function for loading data via AJAX and displaying it on the chart function ajaxLoadChart(startDate,endDate) ( // if there is no data, the chart will be empty if(!startDate || !endDate)( chart.setData(( "xScale" : "time ", "yScale" : "linear", "main" : [( className: ".stats", data: )] )); return; ) // otherwise, form an ajax request $.getJSON("ajax.php ", ( start: startDate.format("(yyyy)-(MM)-(dd)"), end: endDate.format("(yyyy)-(MM)-(dd)") ), function(data) ( var set = ; $.each(data, function() ( set.push(( x: this.label, y: parseInt(this.value, 10) )); )); chart.setData(( "xScale" : "time", "yScale" : "linear", "main" : [( className: ".stats", data: set )] )); )); ) ));

xCharts provides a method to set the data (the setData) so that you can easily move or replace the displayed data. The className attribute is important because the plugin uses it to define your graph. If you ignore it, all sorts of weird bugs can happen (trust me, I know).

This completes the creation of our beautiful chart!

End!

You can use this example to improve your control areas and visualize statistics in a beautiful interface.

  • Translation

It is almost impossible to imagine a dashboard without charts and graphs. They display complex statistical data quickly and efficiently. What's more, a good diagram also enhances the overall design of your site.

In this article, I'll show you some of the best JavaScript libraries for building charts/charts (and pivot tables). These libraries will help you create beautiful and customizable charts for your future projects.

Although most of the libraries are free and open source, some of them have paid versions with additional functionality.

D3.js - Data Oriented Documents

Today, when we think about graphs, the first thing that comes to mind is D3.js Being an open source project, D3.js, no doubt, gives a lot useful features, which most existing libraries lack. Features such as "Enter and Exit", powerful transitions, and syntax similar to jQuery or Prototype make it one of the best JavaScript libraries for creating graphs and charts. In D3.js, they are generated using HTML, SVG, and CSS.

Unlike many other JavaScript libraries, D3.js doesn't come with prebuilt plots right out of the box. However, you can take a look at the list of graphs created with D3.js to get a general idea.

D3.js doesn't work properly with older browsers like IE8. But you can always use plugins like the aight plugin for cross-browser compatibility.

D3.js has been widely used on websites such as NYTimes, Uber and Weather.com.

Google Charts


Google Charts is a JavaScript library that I use regularly to create simple and easy charts. Provides many pre-built charts such as combo bar charts, column charts, calendar plots, pie charts, geoschemes, and more.

Google charts also has many configuration settings that help you change appearance graphic arts. Graphs are generated using HTML5/SVG to ensure cross-browser compatibility and cross-platform portability to iPhone, iPad and Android. Also contains VML to support older IE versions.

HighchartsJS


Highcharts JS is another very popular charting library. It comes with a lot of animations of various types that can draw a lot of attention to your site. Like other libraries, HighchartsJS contains a lot of pre-built charts: spline, curly, combined, bar, histogram, pie, scatter, etc.

One of the biggest benefits of using HighchartsJS is compatibility with older browsers such as Internet Explorer 6. Standard browsers use SVG to render graphs. In legacy IE, graphics are built through VML.

Although HighchartsJS is free for personal use, you need to purchase a license for commercial use.

Fusioncharts


Fusioncharts is one of the older JavaScript libraries that was first released in 2002. Graphs are generated using HTML5/SVG and VML for better portability and compatibility.

Unlike many libraries, Fusioncharts provides the ability to parse both JSON data and XML. You can also export these graphics in 3 different formats: PNG, JPG and PDF.

Fusioncharts is highly compatible with older browsers such as IE6. And for this reason, it has become one of the most preferred libraries in many trade organizations.

You can use the watermarked version of Fusioncharts for free in both personal and commercial projects. However, you need to purchase a license to get rid of the watermark.

fleet


Flot is a JavaScript library for jQuery that allows you to create graphs/charts. One of the oldest and most popular diagramming libraries.

Flot supports bar charts, scatter charts, bar charts, column charts, and any combination of these chart types. Also compatible with older browsers such as IE 6 and Firefox 2.

Flot is completely free, commercial support is available upon special request to the developer. Here is a list of charting examples created with Flot.

amCharts


amCharts is undoubtedly one of the prettiest charting libraries out there. It is fully divided into 3 independent types: JavaScript Charts, Maps Charts (amMaps) and Stock charts.

AmMaps is my favorite of the three above. Provides features such as heatmaps, drawing lines, adding text to the map, uploading icons or photos to the top of your map, zooming, and more.
amCharts uses SVG to render charts which only works in modern browsers. Graphs may not display correctly in IE below version 9.

EJS Chart is available in free and paid versions. Free version has a limitation not allowing you to use more than 1 chart per page and more than two (numerical) sequences per chart. Check out pricing details.

uvCharts


uvCharts is an open source JavaScript library. source code, claims to have over 100 configuration options. It has charts for 12 different standards right out of the box.

UvCharts is built on the D3.js library. This project promises to eliminate all the complex nuances of D3.js coding and provide an easy implementation of standard view graphs. uvCharts is generated using SVG, HTML and CSS.

Conclusion

Now the choice of the best diagramming library for your future projects is up to you. Developers who want full control over charts will definitely choose D3.js. Almost all of the above libraries have good support on the Stackoverflow forums.

I hope you enjoyed this article. Have a good day.