| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- /*=========================================================================================
- File Name: histogram.js
- Description: google histogram chart
- ----------------------------------------------------------------------------------------
- Item Name: Robust - Responsive Admin Theme
- Version: 1.2
- Author: PIXINVENT
- Author URL: http://www.themeforest.net/user/pixinvent
- ==========================================================================================*/
- // Histogram 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(drawHistogram);
- // Callback that creates and populates a data table, instantiates the pie chart, passes in the data and draws it.
- function drawHistogram() {
- // Create the data table.
- var data = google.visualization.arrayToDataTable([
- ['Dinosaur', 'Length'],
- ['Acrocanthosaurus (top-spined lizard)', 12.2],
- ['Albertosaurus (Alberta lizard)', 9.1],
- ['Allosaurus (other lizard)', 12.2],
- ['Apatosaurus (deceptive lizard)', 22.9],
- ['Archaeopteryx (ancient wing)', 0.9],
- ['Argentinosaurus (Argentina lizard)', 36.6],
- ['Baryonyx (heavy claws)', 9.1],
- ['Brachiosaurus (arm lizard)', 30.5],
- ['Ceratosaurus (horned lizard)', 6.1],
- ['Coelophysis (hollow form)', 2.7],
- ['Compsognathus (elegant jaw)', 0.9],
- ['Deinonychus (terrible claw)', 2.7],
- ['Diplodocus (double beam)', 27.1],
- ['Dromicelomimus (emu mimic)', 3.4],
- ['Gallimimus (fowl mimic)', 5.5],
- ['Mamenchisaurus (Mamenchi lizard)', 21.0],
- ['Megalosaurus (big lizard)', 7.9],
- ['Microvenator (small hunter)', 1.2],
- ['Ornithomimus (bird mimic)', 4.6],
- ['Oviraptor (egg robber)', 1.5],
- ['Plateosaurus (flat lizard)', 7.9],
- ['Sauronithoides (narrow-clawed lizard)', 2.0],
- ['Seismosaurus (tremor lizard)', 45.7],
- ['Spinosaurus (spiny lizard)', 12.2],
- ['Supersaurus (super lizard)', 30.5],
- ['Tyrannosaurus (tyrant lizard)', 15.2],
- ['Ultrasaurus (ultra lizard)', 30.5],
- ['Velociraptor (swift robber)', 1.8]
- ]);
- // Set chart options
- var options_histogram = {
- height: 400,
- fontSize: 12,
- colors: ['#bba9e8'],
- 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.Histogram(document.getElementById('histogram'));
- bar.draw(data, options_histogram);
- }
- // 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() {
- drawHistogram();
- }
- });
|