C3.js – Â A D3 based reusable chart library with deeper integration with applications dynamic data
//
Comfortable
C3 makes it easy to generate D3-based charts by wrapping the code required to construct the entire chart. We don’t need to write D3 code any more.
Customizable
C3 gives some classes to each element when generating, so you can define a custom style by the class and it’s possible to extend the structure directly by D3.
Controllable
C3 provides a variety of APIs and callbacks to access the state of the chart. By using them, you can update the chart even if after it’s rendered.
 C3.js | D3-based reusable chart library//
In this guide, we are going to show you how to get started with C3.
C3 generates a chart by calling generate() with the argument object, and an element including the chart will insert into the element specified as a selector in that argument as bindto.
Chart.js – A Sleek, Simple, clean and engaging HTML5 based charts for designers and developers
Chart.js | Open source HTML5 Charts for your website
Everything you need to know to build great looking charts using Chart.js
Six chart types
Line Chart
Bar Chart
Radar Chart
Polar Area Chart
Pie Chart
Doughnut Chart
Visualize your data in 6 different ways. Each of them animated, with a load of customisation options and interactivity extensions.
HTML5 based
<canvas>
Chart.js uses the HTML5 canvas element. It’s supported in all modern browsers, and polyfills support for IE7/8.
Simple and flexible
Chart.js is dependency free and super lightweight. All six core chart types are only 11.01kb when minified, concatenated and served gzipped.
Responsive new
Chart.js will resize your chart if the browser changes size, along with providing the perfect scale granularity for that size
Modular new
Core
Bar
Doughnut
Radar
Line
Polar Area
Chart.js is modular, and each of the chart types have been split up, so you can load only which chart types you need for your project
Interactive new
Chart.js provides default simple support for canvas tooltips on hover/touch, but you can extend chart interactions to trigger events in your application
Chart.js | Documentation//
Creating a chart
To create a chart, we need to instantiate the Chart class. To do this, we need to pass in the 2d context of where we want to draw the chart. Here’s an example.
// Get the context of the canvas element we want to selectvarctx=document.getElementById("myChart").getContext("2d");varmyNewChart=newChart(ctx).PolarArea(data);
We can also get the context of our canvas with jQuery. To do this, we need to get the DOM node out of the jQuery collection, and call the getContext("2d") method on that.
// Get context with jQuery - using jQuery's .get() method.varctx=$("#myChart").get(0).getContext("2d");// This will get the first returned node in the jQuery collection.varmyNewChart=newChart(ctx);
After we’ve instantiated the Chart class on the canvas we want to draw on, Chart.js will handle the scaling for retina displays.
With the Chart class set up, we can go on to create one of the charts Chart.js has available. In the example below, we would be drawing a Polar area chart.
newChart(ctx).PolarArea(data,options);
We call a method of the name of the chart we want to create. We pass in the data for that chart type, and the options for that chart as parameters. Chart.js will merge the global defaults with chart type specific defaults, then merge any options passed in as a second argument after data.
Global chart configuration
This concept was introduced in Chart.js 1.0 to keep configuration DRY, and allow for changing options globally across chart types, avoiding the need to specify options for each instance, or the default for a particular chart type.
Chart.defaults.global={// Boolean - Whether to animate the chartanimation:true,// Number - Number of animation stepsanimationSteps:60,// String - Animation easing effectanimationEasing:"easeOutQuart",// Boolean - If we should show the scale at allshowScale:true,// Boolean - If we want to override with a hard coded scalescaleOverride:false,// ** Required if scaleOverride is true **// Number - The number of steps in a hard coded scalescaleSteps:null,// Number - The value jump in the hard coded scalescaleStepWidth:null,// Number - The scale starting valuescaleStartValue:null,// String - Colour of the scale linescaleLineColor:"rgba(0,0,0,.1)",// Number - Pixel width of the scale linescaleLineWidth:1,// Boolean - Whether to show labels on the scalescaleShowLabels:true,// Interpolated JS string - can access valuescaleLabel:"<%=value%>",// Boolean - Whether the scale should stick to integers, not floats even if drawing space is therescaleIntegersOnly:true,// Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest valuescaleBeginAtZero:false,// String - Scale label font declaration for the scale labelscaleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",// Number - Scale label font size in pixelsscaleFontSize:12,// String - Scale label font weight stylescaleFontStyle:"normal",// String - Scale label font colourscaleFontColor:"#666",// Boolean - whether or not the chart should be responsive and resize when the browser does.responsive:false,// Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire containermaintainAspectRatio:true,// Boolean - Determines whether to draw tooltips on the canvas or notshowTooltips:true,// Function - Determines whether to execute the customTooltips function instead of drawing the built in tooltips (See [Advanced - External Tooltips](#advanced-usage-custom-tooltips))customTooltips:false,// Array - Array of string names to attach tooltip eventstooltipEvents:["mousemove","touchstart","touchmove"],// String - Tooltip background colourtooltipFillColor:"rgba(0,0,0,0.8)",// String - Tooltip label font declaration for the scale labeltooltipFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",// Number - Tooltip label font size in pixelstooltipFontSize:14,// String - Tooltip font weight styletooltipFontStyle:"normal",// String - Tooltip label font colourtooltipFontColor:"#fff",// String - Tooltip title font declaration for the scale labeltooltipTitleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",// Number - Tooltip title font size in pixelstooltipTitleFontSize:14,// String - Tooltip title font weight styletooltipTitleFontStyle:"bold",// String - Tooltip title font colourtooltipTitleFontColor:"#fff",// Number - pixel width of padding around tooltip texttooltipYPadding:6,// Number - pixel width of padding around tooltip texttooltipXPadding:6,// Number - Size of the caret on the tooltiptooltipCaretSize:8,// Number - Pixel radius of the tooltip bordertooltipCornerRadius:6,// Number - Pixel offset from point x to tooltip edgetooltipXOffset:10,// String - Template string for single tooltipstooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>",// String - Template string for multiple tooltipsmultiTooltipTemplate:"<%= value %>",// Function - Will fire on animation progression.onAnimationProgress:function(){},// Function - Will fire on animation completion.onAnimationComplete:function(){}}
If for example, you wanted all charts created to be responsive, and resize when the browser window does, the following setting can be changed:
Chart.defaults.global.responsive=true;
Now, every time we create a chart, options.responsive will be true.
Note: in order to display something, you’ll need to have given the div some dimensions. Here I’ve used inline CSS just for illustration.
Next add a <script> block to the end of your page, containing the following javascript code:
newMorris.Line({// ID of the element in which to draw the chart.element:'myfirstchart',// Chart data records -- each entry in this array corresponds to a point on// the chart.data:[{year:'2008',value:20},{year:'2009',value:10},{year:'2010',value:5},{year:'2011',value:5},{year:'2012',value:20}],// The name of the data record attribute that contains x-values.xkey:'year',// A list of names of data record attributes that contain y-values.ykeys:['value'],// Labels for the ykeys -- will be displayed when you hover over the// chart.labels:['Value']});
Raphaël—JavaScript, SVG Library to simply vector graphics for websites.
Raphaël is a small JavaScript library that should simplify your work with vector graphics on the web.
If you want to create your own specific chart or image crop and rotate widget, for example, you can achieve it simply and easily with this library.
Raphaël [‘ræfeɪəl] uses the SVG W3C Recommendation and VML as a base for creating graphics. This means every graphical object you create is also a DOM object, so you can attach JavaScript event handlers or modify them later. Raphaël’s goal is to provide an adapter that will make drawing vector art compatible cross-browser and easy.
Raphaël currently supports Firefox 3.0+, Safari 3.0+, Chrome 5.0+, Opera 9.5+ and Internet Explorer 6.0+.
Raphaël Reference
var anim = Raphael.animation({cx: 10, cy: 20}, 2e3);
circle1.animate(anim); // run the given animation immediately
circle2.animate(anim.delay(500)); // run the given animation after 500 ms
http://raphaeljs.com/reference.html
jVectorMap – Javascript, HTML, SVG based world, world regions, territories, countries MAPS plugin. Non-Flash, cross-browser interactive and customizable Maps!
jVectorMap is a vector-based, cross-browser and cross-platform component for interactive geography-related data visualization on the web. It provides numerious features like smooth zooming and panning, fully-customizable styling, markers, labels and tooltips. No-Flash!
JavaScript-based
jVectorMap uses only native browser technologies like JavaScript, CSS, HTML, SVG or VML. No Flash or any other proprietary browser plug-in is required. This allows jVectorMap to work in all modern mobile browsers.
Plug-in package includes maps converter written in Python. It’s used to create maps available on this site. If you want to create some custom map you can create it using data in common GIS formats like Shapefile for example.
Many maps of the world, world regions, countries and cities are available for download from this site. All of them are made from the data in public domain or data licensed under the free licenses, so you can use them for any purpose without of charge.
Advanced Sleek Date Range Picker plugin based on Bootstrap, jQuery and Moment.Js
Date Range Picker
An advanced date range picker input based on bootstrap-daterangepicker plugin. The date range picker widget is styled for Bootstrap 3.x and creates a dropdown menu from which a user can select a range of dates. If the plugin is invoked with no options, it will present two calendars to choose a start and end date from. Optionally, you can provide a list of date ranges the user can select from of choosing dates from the calendars. If attached to a text input, the selected dates will be inserted into the text box. Otherwise, you can provide a custom callback function to receive the selection.
Additional enhancements added for this widget:
allows ability to work with Bootstrap input group addons and set the picker position to point at the input-group-addon icon.
enhanced translation features providing ability to add/configure your translation for each language. In order to create your own translation, please follow these steps.
automatically trigger change of base field to enforce Yii ActiveField validation
ability to set the widget to display a preset dropdown of date options within a container (and hidden input).
style the container options as per your need using templates
automatically disable date-range based on disabled/readonly options.
If invoked with no options, it will present two calendars to choose a start and end date from. Optionally, you can provide a list of date ranges the user can select from instead of choosing dates from the calendars. If attached to a text input, the selected dates will be inserted into the text box. Otherwise, you can provide a custom callback function to receive the selection.
The component can also be used as a single date picker by setting the `singleDatePicker` option to `true`.
DEMO: http://www.dangrossman.info/2012/08/20/a-date-range-picker-for-twitter-bootstrap/
The constructor also takes an optional options object and callback function. The function will be called whenever the selected date range has been changed by the user, and is passed the start and end dates (moment date objects) and the predefined range label chosen (if any), as parameters. It will not fire if the picker is closed without any change to the selected dates.
$('input[name="daterange"]').daterangepicker(
{
format: 'YYYY-MM-DD',
startDate: '2013-01-01',
endDate: '2013-12-31'
},
function(start, end, label) {
alert('A date range was chosen: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
}
);
Options
startDate: (Date object, moment object or string) The start of the initially selected date range
endDate: (Date object, moment object or string) The end of the initially selected date range
minDate: (Date object, moment object or string) The earliest date a user may select
maxDate: (Date object, moment object or string) The latest date a user may select
dateLimit: (object) The maximum span between the selected start and end dates. Can have any property you can add to a moment object (i.e. days, months)
timeZone: (string or number) The timezone that will be used to display the startDate and endDate in the calendar. This may be a string such as “-08:00” or an offset in minutes from Greenwich Mean Time. Uses Moment.js #zone, see the docs here for more information. If the timeZone option is not set, the calendar will use the time zone set on the startDate that has been passed in through the options, if it has one. Defaults to the local time zone
showDropdowns: (boolean) Show year and month select boxes above calendars to jump to a specific month and year
showWeekNumbers: (boolean) Show week numbers at the start of each week on the calendars
timePicker: (boolean) Allow selection of dates with times, not just dates
timePickerIncrement: (number) Increment of the minutes selection list for times (i.e. 30 to allow only selection of times ending in 0 or 30)
timePicker12Hour: (boolean) Use 12-hour instead of 24-hour times, adding an AM/PM select box
timePickerSeconds: (boolean) Show seconds in the timePicker
ranges: (object) Set predefined date ranges the user can select from. Each key is the label for the range, and its value an array with two dates representing the bounds of the range
opens: (string: ‘left’/’right’/’center’) Whether the picker appears aligned to the left, to the right, or centered under the HTML element it’s attached to
buttonClasses: (array) CSS class names that will be added to all buttons in the picker
applyClass: (string) CSS class string that will be added to the apply button
cancelClass: (string) CSS class string that will be added to the cancel button
format: (string) Date/time format string used by moment when parsing or displaying the selected dates
separator: (string) Separator string to display between the start and end date when populating a text input the picker is attached to
locale: (object) Allows you to provide localized strings for buttons and labels, and the first day of week for the calendars
singleDatePicker: (boolean) Show only a single calendar to choose one date, instead of a range picker with two calendars; the start and end dates provided to your callback will be the same single date chosen
parentEl: (string) jQuery selector of the parent element that the date range picker will be added to, if not provided this will be 'body'
Functions
Several functions are provided for updating the picker’s option and state after initialization:
setOptions(object, function): This function has the same signature and purpose as the date range picker’s constructor: it sets the picker’s options to their defaults, overrides them with any values in an options object you provide, and sets the callback for selection changes to whatever function you provide
setStartDate(Date/moment/string): Sets the date range picker’s currently selected start date to the provided date
setEndDate(Date/moment/string): Sets the date range picker’s currently selected end date to the provided date
Example usage:
//create a new date range picker
$('#daterange').daterangepicker({ startDate: '2014-03-05', endDate: '2014-03-06' });
//change the selected date range of that picker
$('#daterange').data('daterangepicker').setStartDate('2014-03-01');
$('#daterange').data('daterangepicker').setEndDate('2014-03-31');
Events
Several events are triggered on the element you attach the picker to, which you can listen for:
show.daterangepicker: Triggered when the picker is shown
hide.daterangepicker: Triggered when the picker is hidden
showCalendar.daterangepicker: Triggered when the calendar is shown
hideCalendar.daterangepicker: Triggered when the calendar is hidden
apply.daterangepicker: Triggered when the apply button is clicked
cancel.daterangepicker: Triggered when the cancel button is clicked
Some applications need a “clear” instead of a “cancel” functionality, which can be achieved by changing the button label and watching for the cancel event:
$('#daterange').daterangepicker({
locale: { cancelLabel: 'Clear' }
});
$('#daterange').on('cancel.daterangepicker', function(ev, picker) {
//do something, like clearing an input
$('#daterange').val('');
});
While passing in a callback to the constructor is the easiest way to listen for changes in the selected date range, you can also do something every time the apply button is clicked even if the selection hasn’t changed:
This code is made available under the same license as Bootstrap. Moment.js is included in this repository for convenience. It is available under the MIT license.
angleOffset : starting angle in degrees | default=0.
angleArc : arc size in degrees | default=360.
stopper : stop at min & max on keydown/mousewheel | default=true.
readOnly : disable input and events | default=false.
rotation : direction of progression | default=clockwise.
UI :
cursor : display mode “cursor”, cursor size could be changed passing a numeric value to the option, default width is used when passing boolean value “true” | default=gauge.
thickness : gauge thickness.
lineCap : gauge stroke endings. | default=butt, round=rounded line endings
width : dial width.
displayInput : default=true | false=hide input.
displayPrevious : default=false | true=displays the previous value with transparency.
fgColor : foreground color.
inputColor : input value (number) color.
font : font family.
fontWeight : font weight.
bgColor : background color.
Hooks
<script> $(".dial").knob({'release' : function (v) { /*make something*/ } });</script>
‘release’ : executed on release
Parameters :
value : int, current value
‘change’ : executed at each change of the value
Parameters :
value : int, current value
‘draw’ : when drawing the canvas
Context :
this.g : canvas context 2D (see Canvas documentation)
this.$ : jQuery wrapped element
this.o : options
this.i : input
… console.log(this);
‘cancel’ : triggered on [esc] keydown
‘format’ : allows to format output (add unit %, ms …)
The scope (this) of each hook function is the current Knob instance (refer to the demo code).
Example
<inputtype="text"value="75"class="dial">
<script> $(".dial").knob({'change' : function (v) { console.log(v); } });</script>
Easy Pie Charts – jQuery plugin to render pie charts using canvas elements with customization.
EASY PIE CHART by rendro
Easy pie chart is a jQuery plugin that uses the canvas element to render simple pie charts for single values. These charts are highly customizable, very easy to implement, scale to the resolution of the display of the client to provide sharp charts even on retina displays, and use requestAnimationFrame for smooth animations on modern devices.
EASY PIE CHART by rendro
Browser support
This plugin supports all major browsers that support the canvas element. With excanvas you can even render the charts on IE 7+8.
Get started
To use the easy pie chart plugin you need to load the current version of jQuery (testet with 1.7.2) and the source (css+js) of the plugin. You can also use bower to install the component:
bower install jquery.easy-pie-chart
Then just add the following lines to the head of your website:
The second step is to add a element to your site to represent chart and add the data-percent attribute with the percent number the pie chart should have:
<div class="chart" data-percent="73">73%</div>
Finally you have to initialize the plugin with your desired configuration:
You can pass a set of these options to the initialize function to set a custom behaviour and look for the plugin.
Property (Type)
Default
Description
barColor
#ef1e25
The color of the curcular bar. You can pass either a css valid color string like rgb, rgba hex or string colors. But you can also pass a function that accepts the current percentage as a value to return a dynamically generated color.
trackColor
#f2f2f2
The color of the track for the bar, false to disable rendering.
scaleColor
#dfe0e0
The color of the scale lines, false to disable rendering.
lineCap
round
Defines how the ending of the bar line looks like. Possible values are: butt, round and square.
lineWidth
3
Width of the bar line in px.
size
110
Size of the pie chart in px. It will always be a square.
animate
false
Time in milliseconds for a eased animation of the bar growing, or false to deactivate.
onStart
$.noop
Callback function that is called at the start of any animation (only if animate is not false).
onStop
$.noop
Callback function that is called at the end of any animation (only if animate is not false).
onStep
$.noop
Callback function that is called during animations providing the current value (the context is the plugin, so you can access the DOM element via this.$el).
Plugin API
If you want to update the current percentage of the a pie chart, you can call the update method. The instance of the plugin is saved in the jQuery-data.
jqPlot – Pure javascript / jQuery plotting and charting plugin.
A Versatile and Expandable jQuery Plotting Plugin!
jqPlot is a plotting and charting plugin for the jQuery Javascript framework. jqPlot produces beautiful line, bar and pie charts with many features:
Numerous chart style options.
Date axes with customizable formatting.
Up to 9 Y axes.
Rotated axis text.
Automatic trend line computation.
Tooltips and data point highlighting.
Sensible defaults for ease of use
jqPlot is an open source project dual licensed under the MIT and GPL version 2 licenses. You are free to choose the license that best suits your project
//
Computation and drawing of lines, axes, shadows even the grid itself is handled by pluggable “renderers”. Not only are the plot elements customizable, plugins can expand functionality of the plot too! There are plenty of hooks into the core jqPlot code allowing for custom event handlers, creation of new plot types, adding canvases to the plot, and more!
jqPlot Usage
Introduction
jqPlot is a jQuery plugin to generate pure client-side javascript charts in your web pages.
Below are a few examples to demonstrate jqPlot usage. These plots are shown as static images. Many more examples of dynamically rendered plots can be seen on the test and examples pages here: ../../tests/.
Include the Files
jqPlot requires jQuery (1.4.3+ required for certain features). jQuery is included in the distribution. To use jqPlot include jquery, the jqPlot jQuery plugin, jqPlot css file and optionally the excanvas script for IE support in your web page. Note, excanvas is required only for IE versions below 9. IE 9 includes native support for the canvas element and does not require excanvas:
You can customize the plot by passing options to the $.jqplot function. Options are described in jqPlot Options in the jqPlotOptions.txt file. An example of options usage:
You can use jqPlot plugins (that is, plugins to the jqPlot plugin) by including them in your html after you include the jqPlot plugin. Here is how to include the log axis plugin:
Important note: For jqplot builds r529 and above (0.9.7r529 and higher), you must explicitly enable plugins via either the { show: true } plugin option to the plot or by using the $.jqplot.config.enablePlugins = true; config options set on the page before plot creation. Only plugins that can be immediately active upon loading are affected. This includes non-renderer plugins like cursor, dragable, highlighter, and trendline.
Here is a the same $.jqplot call but with a log y axis:
For a full list of options, see jqPlot Options in the jqPlotOptions.txt file.
You can add as many plugins as you wish. Order is generally not important. Some plugins, like the highlighter plugin which highlights data points near the mouse, don’t need any extra options or setup to function. Highlighter does have additional options which the user can set.
Other plugins, the barRenderer for example, provide functionality the must be specified in the chart options object. To render a series as a bar graph with the bar renderer, you would first include the plugin after jqPlot: