$('ul.nav a').on('shown.bs.tab', function (e) { var types = $(this).attr("data-identifier"); var typesArray = types.split(","); $.each(typesArray, function (key, value) { eval(value + ".redraw()"); }) }); // Morris graphs ---------------------------------------------------------- // // on doc ready $(function () { // Fuel consumption // // Data set for fuel consumption var fuel_data = [{ "period": "2013-01", "city": 66, "highway": 34, "idle": 9 }, { "period": "2013-02", "city": 62, "highway": 33, "idle": 8 }, { "period": "2013-03", "city": 61, "highway": 32, "idle": 7 }, { "period": "2013-04", "city": 66, "highway": 32, "idle": 6 }, { "period": "2013-05", "city": 67, "highway": 31, "idle": 5 }, { "period": "2013-06", "city": 68, "highway": 43, "idle": 7 }, { "period": "2013-07", "city": 62, "highway": 32, "idle": 5 }, { "period": "2013-08", "city": 61, "highway": 32, "idle": 5 }, { "period": "2013-09", "city": 58, "highway": 32, "idle": 7 }, { "period": "2013-10", "city": 60, "highway": 32, "idle": 7 }, { "period": "2013-11", "city": 60, "highway": 32, "idle": 6 }, { "period": "2013-12", "city": 62, "highway": 32, "idle": 8 }]; // Line chart parameters for fuel consumption var fuel_consumption = { element: 'fuel-consumption', hideHover: 'auto', data: fuel_data, xkey: 'period', xLabels: 'month', ykeys: ['city', 'highway', 'idle'], postUnits: ' l/100km', labels: ['City', 'Highway', 'Idle'], resize: true, lineColors: ['#A52A2A', '#72A0C1', '#7BB661'] //yLabelFormat: function(y) { return y.toString() + ' l/100km'; } } // Make a line chart from the parameters line = Morris.Line(fuel_consumption) // / Fuel consumption // // Fuel projection // // Data set for fuel projection var projection_data = [{ label: 'Until today', value: 180 }, { label: 'Projected', value: 400 }, ] // Donut chart parameters for fuel projection var fuel_projection = { element: 'fuel-projection', hideHover: 'auto', resize: true, data: projection_data, colors: ['#7BB661', '#72A0C1'], formatter: function (y) { return y + " liters" } } // Make a donut chart from the parameters donut = Morris.Donut(fuel_projection) // / Fuel projection // // Fuel emissions // // Data set for fuel emissions var co2_data = [{ month: 'Jan', emissions: 35 }, { month: 'Feb', emissions: 37 }, { month: 'Mar', emissions: 40 }, { month: 'Apr', emissions: 38 }, { month: 'Maj', emissions: 39 }, { month: 'Jun', emissions: 42 }, { month: 'Jul', emissions: 37 }, { month: 'Aug', emissions: 65 }, { month: 'Sep', emissions: 38 }, { month: 'Okt', emissions: 45 }, { month: 'Nov', emissions: 41 }, { month: 'Dec', emissions: 41 }] //Bar chart parameters for CO2 emissions var co2_emissions = { element: 'co2-emissions', resize: true, data: co2_data, xkey: 'month', ykeys: ['emissions'], labels: ['Co2 emissions'], barRatio: 0.4, xLabelAngle: 35, hideHover: 'auto', postUnits: ' g/km', formatter: function (y) { return y + " g/km" } } // Make a bar chart from the parameters bar1 = Morris.Bar(co2_emissions) // / Fuel emisisons // }); // / Morris graphs -------------------------------------------------------- //