     public weak var datasource: GraphDatasourceProtocol? {
         didSet {
             guard let datasource = datasource else { return }
-            totalBars = datasource.numberOfBarsInGraphView(self)
-            //TODO: totalBars needs to move
-            barsAndLabels = barsAndLabelsForBarCount(totalBars)
             self.setNeedsLayout()
             self.layoutIfNeeded()
         }

    }
    
    // Customizations
    public var xAxisLabelFont = UIFont.systemFontOfSize(12)
    public var xAxisLabelColor = UIColor.blackColor()
    public let xAxisView = XAxisView()
    public var barCornerRadius: CGFloat = 10
    private var initialLaunchComplete = false
    private var barsAndLabels : (bars: [Bar], xAxisLabels: [XAxisLabel], maxBarValue: CGFloat)!
    
    public var stackedBarAlignment : StackedBarAlignment {

    private var padding: CGFloat {
        return (bounds.size.width - leftPadding - rightPadding - totalWidth) / CGFloat(visibleBars + 1)
    }

    override public func layoutSubviews() {
        super.layoutSubviews()
        
        guard datasource != nil else { return }

        //Layout subviews gets called multiple times before the view appears on screen
        //It doesn't get called with its final frame until the last call.
        //Additionally, we want to regenerate the datapoints and spacing when the user rotates the device
        if previousRect != frame {
            reloadData()
            let cumumlativeWidth = barWidth * CGFloat(totalBars) + CGFloat(padding * CGFloat(totalBars - 1)) + leftPadding + rightPadding
            
            var size = bounds.size
            size.width = cumumlativeWidth
            contentSize = size
            self.showsHorizontalScrollIndicator = true
            
            //Make the view right aligned
            contentOffset.x = cumumlativeWidth - bounds.width
            previousRect = frame
        }
        
        // IF the below two loops are deemed too inefficient, PlotView and XAxisView can perform the offset operations in their normal loops (BUT GROSS CODE IT PRODUCES)
        let oldBars = barsAndLabels.bars
