| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- /*=========================================================================================
- File Name: area-stepped.js
- Description: google area stepped chart
- ----------------------------------------------------------------------------------------
- Item Name: Robust - Responsive Admin Theme
- Version: 1.2
- Author: PIXINVENT
- Author URL: http://www.themeforest.net/user/pixinvent
- ==========================================================================================*/
- // Area Stepped chart
- // ------------------------------
- // Load the Visualization API and the corechart package.
- google.load('visualization', '1.0', {'packages':['corechart']});
- // Set a callback to run when the Google Visualization API is loaded.
- google.setOnLoadCallback(drawAreaStepped);
- // Callback that creates and populates a data table, instantiates the pie chart, passes in the data and draws it.
- function drawAreaStepped() {
- // Create the data table.
- var data = google.visualization.arrayToDataTable([
- ['Director (Year)', 'Rotten Tomatoes', 'IMDB'],
- ['Alfred Hitchcock (1935)', 8.4, 7.9],
- ['Ralph Thomas (1959)', 6.9, 6.5],
- ['Don Sharp (1978)', 6.5, 6.4],
- ['James Hawes (2008)', 4.4, 6.2]
- ]);
- // Set chart options
- var options_bar = {
- height: 400,
- fontSize: 12,
- isStacked: true,
- colors: ['#37BC9B', '#DA4453'],
- chartArea: {
- left: '5%',
- width: '90%',
- height: 350
- },
- vAxis: {
- gridlines:{
- color: '#e9e9e9',
- count: 10
- },
- minValue: 0
- },
- legend: {
- position: 'top',
- alignment: 'center',
- textStyle: {
- fontSize: 12
- }
- }
- };
- // Instantiate and draw our chart, passing in some options.
- var bar = new google.visualization.SteppedAreaChart(document.getElementById('area-stepped'));
- bar.draw(data, options_bar);
- }
- // Resize chart
- // ------------------------------
- $(function () {
- // Resize chart on menu width change and window resize
- $(window).on('resize', resize);
- $(".menu-toggle").on('click', resize);
- // Resize function
- function resize() {
- drawAreaStepped();
- }
- });
|