﻿    function drawChart(jsonData, type, id) {
      var data = new google.visualization.DataTable(jsonData);

      // Instantiate and draw our chart, passing in some options.
      var chart = new google.visualization.ComboChart(document.getElementById(id));
      chart.draw(data, getFormatting(type));
    }
    
    function getFormatting(type) {
        switch (type) {
            case 2:
                return {
                    chartArea: {width: '100%'},
                    width: 290,
                    height: 200,
                    legend: 'top',
                    colors: ['#6666FF', '#CCCCFF'],
                    hAxis: {textStyle: {fontSize: 8}},
                    vAxes: [{textPosition: 'in'}, {textPosition: 'in'}],
                    seriesType: "bars",
                    series: {1: {type: 'area', targetAxisIndex: 1, lineWidth: 1, curveType: 'function'}}};
            
            case 1:
            default:
                return {
                    chartArea: {width: '100%'},
                    width: 290,
                    height: 200,
                    legend: 'top',
                    colors: ['#FF0000', '#9E0000', '#C78787', '#FFD4D4'],
                    hAxis: {textStyle: {fontSize: 8}},
                    vAxes: [{textPosition: 'in'}, {textPosition: 'in'}],
                    seriesType: "bars",
                    series: {3: {type: 'area', targetAxisIndex: 1, lineWidth: 1, curveType: 'function'}}};
        }
    }

