/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

createPaymentsChart = function(options) {
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'chart',
            defaultSeriesType: 'bar',
            borderWidth: 0
        },
        title: {
            text: 'Ежемесячный платеж'
        },
        xAxis: {
            categories: ['5', '10', '15', '20', '25', '30', '35', '40'],
            title: {
                enabled: true,
                text: 'Года',
                align: 'high',
                rotation: 0
            }
        },
        yAxis: {
            title: {
                text: 'Доллары',
                align: 'high'
            },
            labels: {
                enabled: false
            },
            gridLineWidth: 1,
            lineWidth: 1
        },
        tooltip: {
            formatter: function() {
                return '<b>'+ this.x + ' лет' + '</b><br/>'+
                'Ежемесячный платеж: $' + this.y;
            }
        },
        plotOptions: {
            bar: {
                dataLabels: {
                    enabled: true,
                    color: 'auto'
                }
            }
        },
        legend: {
            enabled: false,
            layout: 'vertical',
            style: {
                left: 'auto',
                bottom: 'auto',
                right: '100px',
                top: '100px'
            },
            borderWidth: 1,
            backgroundColor: '#FFFFFF'
        },
        credits: {
            enabled: false
        },
        series: options
    });

}

/*
 * Creates chart for percents
 */

createPercentsChart = function(options) {
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'chart_percents',
            defaultSeriesType: 'bar',
            borderWidth: 0
        },
        title: {
            text: 'Переплата по кредиту'
        },
        xAxis: {
            categories: ['5', '10', '15', '20', '25', '30', '35', '40'],
            min: 0,
            title: {
                enabled: true,
                text: 'Года',
                align: 'high',
                rotation: 0
            }
        },
        yAxis: {
            title: {
                text: 'Доллары',
                align: 'high'
            },
            labels: {
                enabled: false
            },
            gridLineWidth: 1,
            lineWidth: 1
        },
        tooltip: {
            formatter: function() {
                return '<b>'+ this.x + ' лет' +'</b><br/>'+
                'Переплата по кредиту: $'+ this.y;
            }
        },
        plotOptions: {
            bar: {
                dataLabels: {
                    enabled: true,
                    color: 'auto'
                },
                color: '#AA4643'
            }
        },
        legend: {
            enabled: false,
            layout: 'vertical',
            style: {
                left: 'auto',
                bottom: 'auto',
                right: '100px',
                top: '100px'
            },
            borderWidth: 1,
            backgroundColor: '#FFFFFF'
        },
        credits: {
            enabled: false
        },
        series: options
    });

}

