function Barchart() {

	this.seriesData = [];

	this.setTarget = function(target) {
		this.target = target;
	};
	
	this.getTarget = function () {
	    return this.target;   
	};

	this.setTitle = function(title) {
		this.title = title;
	};

	this.setSubTitle = function(title) {
		this.subTitle = title;
	};

	this.getTitle = function() {
		if (this.title === undefined) {
			return "";
		} else {
			return this.title;
		}
	};
	
	this.getSubTitle = function() {
		if (this.subTitle === undefined) {
			return "";
		} else {
			return this.subTitle;
		}
	};

	this.addSeriesData = function(value) {
		this.seriesData.push(value);
	};
	
	this.setSeriesData = function(data) {
	    this.seriesData = data;
	};

	this.getSeriesData = function() {
		return this.seriesData;
	};
	
	this.getXAxis = function () {
	       temp = [];
	       
	       $(this.seriesData).each(function () {
               temp.push(this.label);
	       });
	       
	       return temp;
	};
	
	this.getData = function () {
	       temp = [];

   	       $(this.seriesData).each(function () {
                  temp.push(this.value);
   	       });

   	       return temp;
	};
	
	this.render = function() {
        chart = new Highcharts.Chart({
        				chart: {
                        					renderTo: this.getTarget(),
                        					defaultSeriesType: 'column',
                        					margin: [ 50, 50, 100, 80]
                        		},
        			        title: {
        					text: this.getTitle()
        				},
        			        subtitle: {
        					text: this.getSubTitle()
        				},
        				xAxis: {
                        					categories: this.getXAxis(),
                        					labels: {
                        						rotation: -45,
                        						align: 'right',
                        						style: {
                        							 font: 'normal 11px'
                        						}
                        					}
                        				},
        				
        				yAxis: {
                        					min: 0,
                        					title: {
                        						text: ''
                        					}
                        				},

        				tooltip: {
                        					formatter: function() {
                        						return '<b>'+ this.x +'</b><br/>'+
                        							 ''+ Highcharts.numberFormat(this.y,0)+' SEK';
                        					}
                        				},
        				legend: {
        					enabled: false
        				},
        				credits: {
            				enabled: false
            			},
        				
        				series: [{
                        					name: '',
                        					data: this.getData(),
                        					dataLabels: {
                        						enabled: true,
                        						rotation: -90,
                        						color: '#FFFFFF',
                        						align: 'right',
                        						x: -3,
                        						y: 10,
                        						formatter: function() {
                        							return this.y;
                        						},
                        						style: {
                        							font: 'normal 13px Verdana, sans-serif'
                        						}
                        					}			
                        				}]
        			});
	};
}
