]> ToastFreeware Gitweb - chrisu/seepark.git/blobdiff - web/static/c3.js
js: comment out onzoomed
[chrisu/seepark.git] / web / static / c3.js
index ff42e0fbb262b90c4853033069e7e0c881b4d66b..04eb151a3d4925a1c00ab3238337973699741675 100644 (file)
-/* @license C3.js v0.6.1 | (c) C3 Team and other contributors | http://c3js.org/ */
+/* @license C3.js v0.6.7 | (c) C3 Team and other contributors | http://c3js.org/ */
 (function (global, factory) {
     typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
     typeof define === 'function' && define.amd ? define(factory) :
     (global.c3 = factory());
 }(this, (function () { 'use strict';
 
-    var CLASS = {
-        target: 'c3-target',
-        chart: 'c3-chart',
-        chartLine: 'c3-chart-line',
-        chartLines: 'c3-chart-lines',
-        chartBar: 'c3-chart-bar',
-        chartBars: 'c3-chart-bars',
-        chartText: 'c3-chart-text',
-        chartTexts: 'c3-chart-texts',
-        chartArc: 'c3-chart-arc',
-        chartArcs: 'c3-chart-arcs',
-        chartArcsTitle: 'c3-chart-arcs-title',
-        chartArcsBackground: 'c3-chart-arcs-background',
-        chartArcsGaugeUnit: 'c3-chart-arcs-gauge-unit',
-        chartArcsGaugeMax: 'c3-chart-arcs-gauge-max',
-        chartArcsGaugeMin: 'c3-chart-arcs-gauge-min',
-        selectedCircle: 'c3-selected-circle',
-        selectedCircles: 'c3-selected-circles',
-        eventRect: 'c3-event-rect',
-        eventRects: 'c3-event-rects',
-        eventRectsSingle: 'c3-event-rects-single',
-        eventRectsMultiple: 'c3-event-rects-multiple',
-        zoomRect: 'c3-zoom-rect',
-        brush: 'c3-brush',
-        focused: 'c3-focused',
-        defocused: 'c3-defocused',
-        region: 'c3-region',
-        regions: 'c3-regions',
-        title: 'c3-title',
-        tooltipContainer: 'c3-tooltip-container',
-        tooltip: 'c3-tooltip',
-        tooltipName: 'c3-tooltip-name',
-        shape: 'c3-shape',
-        shapes: 'c3-shapes',
-        line: 'c3-line',
-        lines: 'c3-lines',
-        bar: 'c3-bar',
-        bars: 'c3-bars',
-        circle: 'c3-circle',
-        circles: 'c3-circles',
-        arc: 'c3-arc',
-        arcLabelLine: 'c3-arc-label-line',
-        arcs: 'c3-arcs',
-        area: 'c3-area',
-        areas: 'c3-areas',
-        empty: 'c3-empty',
-        text: 'c3-text',
-        texts: 'c3-texts',
-        gaugeValue: 'c3-gauge-value',
-        grid: 'c3-grid',
-        gridLines: 'c3-grid-lines',
-        xgrid: 'c3-xgrid',
-        xgrids: 'c3-xgrids',
-        xgridLine: 'c3-xgrid-line',
-        xgridLines: 'c3-xgrid-lines',
-        xgridFocus: 'c3-xgrid-focus',
-        ygrid: 'c3-ygrid',
-        ygrids: 'c3-ygrids',
-        ygridLine: 'c3-ygrid-line',
-        ygridLines: 'c3-ygrid-lines',
-        axis: 'c3-axis',
-        axisX: 'c3-axis-x',
-        axisXLabel: 'c3-axis-x-label',
-        axisY: 'c3-axis-y',
-        axisYLabel: 'c3-axis-y-label',
-        axisY2: 'c3-axis-y2',
-        axisY2Label: 'c3-axis-y2-label',
-        legendBackground: 'c3-legend-background',
-        legendItem: 'c3-legend-item',
-        legendItemEvent: 'c3-legend-item-event',
-        legendItemTile: 'c3-legend-item-tile',
-        legendItemHidden: 'c3-legend-item-hidden',
-        legendItemFocused: 'c3-legend-item-focused',
-        dragarea: 'c3-dragarea',
-        EXPANDED: '_expanded_',
-        SELECTED: '_selected_',
-        INCLUDED: '_included_'
-    };
-
-    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
-      return typeof obj;
-    } : function (obj) {
-      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
-    };
-
-    var classCallCheck = function (instance, Constructor) {
-      if (!(instance instanceof Constructor)) {
-        throw new TypeError("Cannot call a class as a function");
-      }
-    };
-
-    var defineProperty = function (obj, key, value) {
-      if (key in obj) {
-        Object.defineProperty(obj, key, {
-          value: value,
-          enumerable: true,
-          configurable: true,
-          writable: true
-        });
-      } else {
-        obj[key] = value;
-      }
-
-      return obj;
-    };
-
-    var inherits = function (subClass, superClass) {
-      if (typeof superClass !== "function" && superClass !== null) {
-        throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
-      }
-
-      subClass.prototype = Object.create(superClass && superClass.prototype, {
-        constructor: {
-          value: subClass,
-          enumerable: false,
-          writable: true,
-          configurable: true
-        }
-      });
-      if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
-    };
-
-    var possibleConstructorReturn = function (self, call) {
-      if (!self) {
-        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-      }
+    function ChartInternal(api) {
+        var $$ = this;
+        $$.d3 = window.d3 ? window.d3 : typeof require !== 'undefined' ? require("d3") : undefined;
+        $$.api = api;
+        $$.config = $$.getDefaultConfig();
+        $$.data = {};
+        $$.cache = {};
+        $$.axes = {};
+    }
 
-      return call && (typeof call === "object" || typeof call === "function") ? call : self;
-    };
+    function Chart(config) {
+        var $$ = this.internal = new ChartInternal(this);
+        $$.loadConfig(config);
 
-    var isValue = function isValue(v) {
-        return v || v === 0;
-    };
-    var isFunction = function isFunction(o) {
-        return typeof o === 'function';
-    };
-    var isArray = function isArray(o) {
-        return Array.isArray(o);
-    };
-    var isString = function isString(o) {
-        return typeof o === 'string';
-    };
-    var isUndefined = function isUndefined(v) {
-        return typeof v === 'undefined';
-    };
-    var isDefined = function isDefined(v) {
-        return typeof v !== 'undefined';
-    };
-    var ceil10 = function ceil10(v) {
-        return Math.ceil(v / 10) * 10;
-    };
-    var asHalfPixel = function asHalfPixel(n) {
-        return Math.ceil(n) + 0.5;
-    };
-    var diffDomain = function diffDomain(d) {
-        return d[1] - d[0];
-    };
-    var isEmpty = function isEmpty(o) {
-        return typeof o === 'undefined' || o === null || isString(o) && o.length === 0 || (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && Object.keys(o).length === 0;
-    };
-    var notEmpty = function notEmpty(o) {
-        return !c3_chart_internal_fn.isEmpty(o);
-    };
-    var getOption = function getOption(options, key, defaultValue) {
-        return isDefined(options[key]) ? options[key] : defaultValue;
-    };
-    var hasValue = function hasValue(dict, value) {
-        var found = false;
-        Object.keys(dict).forEach(function (key) {
-            if (dict[key] === value) {
-                found = true;
-            }
-        });
-        return found;
-    };
-    var sanitise = function sanitise(str) {
-        return typeof str === 'string' ? str.replace(/</g, '&lt;').replace(/>/g, '&gt;') : str;
-    };
-    var getPathBox = function getPathBox(path) {
-        var box = path.getBoundingClientRect(),
-            items = [path.pathSegList.getItem(0), path.pathSegList.getItem(1)],
-            minX = items[0].x,
-            minY = Math.min(items[0].y, items[1].y);
-        return { x: minX, y: minY, width: box.width, height: box.height };
-    };
+        $$.beforeInit(config);
+        $$.init();
+        $$.afterInit(config);
 
-    var c3_axis_fn;
-    var c3_axis_internal_fn;
+        // bind "this" to nested API
+        (function bindThis(fn, target, argThis) {
+            Object.keys(fn).forEach(function (key) {
+                target[key] = fn[key].bind(argThis);
+                if (Object.keys(fn[key]).length > 0) {
+                    bindThis(fn[key], target[key], argThis);
+                }
+            });
+        })(Chart.prototype, this, this);
+    }
 
     function AxisInternal(component, params) {
         var internal = this;
 
         internal.axis = internal.generateAxis();
     }
-    c3_axis_internal_fn = AxisInternal.prototype;
 
-    c3_axis_internal_fn.axisX = function (selection, x, tickOffset) {
+    AxisInternal.prototype.axisX = function (selection, x, tickOffset) {
         selection.attr("transform", function (d) {
             return "translate(" + Math.ceil(x(d) + tickOffset) + ", 0)";
         });
     };
-    c3_axis_internal_fn.axisY = function (selection, y) {
+    AxisInternal.prototype.axisY = function (selection, y) {
         selection.attr("transform", function (d) {
             return "translate(0," + Math.ceil(y(d)) + ")";
         });
     };
-    c3_axis_internal_fn.scaleExtent = function (domain) {
+    AxisInternal.prototype.scaleExtent = function (domain) {
         var start = domain[0],
             stop = domain[domain.length - 1];
         return start < stop ? [start, stop] : [stop, start];
     };
-    c3_axis_internal_fn.generateTicks = function (scale) {
+    AxisInternal.prototype.generateTicks = function (scale) {
         var internal = this;
         var i,
             domain,
         }
         return ticks;
     };
-    c3_axis_internal_fn.copyScale = function () {
+    AxisInternal.prototype.copyScale = function () {
         var internal = this;
         var newScale = internal.scale.copy(),
             domain;
         }
         return newScale;
     };
-    c3_axis_internal_fn.textFormatted = function (v) {
+    AxisInternal.prototype.textFormatted = function (v) {
         var internal = this,
             formatted = internal.tickFormat ? internal.tickFormat(v) : v;
         return typeof formatted !== 'undefined' ? formatted : '';
     };
-    c3_axis_internal_fn.updateRange = function () {
+    AxisInternal.prototype.updateRange = function () {
         var internal = this;
         internal.range = internal.scale.rangeExtent ? internal.scale.rangeExtent() : internal.scaleExtent(internal.scale.range());
         return internal.range;
     };
-    c3_axis_internal_fn.updateTickTextCharSize = function (tick) {
+    AxisInternal.prototype.updateTickTextCharSize = function (tick) {
         var internal = this;
         if (internal.tickTextCharSize) {
             return internal.tickTextCharSize;
         internal.tickTextCharSize = size;
         return size;
     };
-    c3_axis_internal_fn.isVertical = function () {
+    AxisInternal.prototype.isVertical = function () {
         return this.orient === 'left' || this.orient === 'right';
     };
-    c3_axis_internal_fn.tspanData = function (d, i, scale) {
+    AxisInternal.prototype.tspanData = function (d, i, scale) {
         var internal = this;
         var splitted = internal.params.tickMultiline ? internal.splitTickText(d, scale) : [].concat(internal.textFormatted(d));
 
             return { index: i, splitted: s, length: splitted.length };
         });
     };
-    c3_axis_internal_fn.splitTickText = function (d, scale) {
+    AxisInternal.prototype.splitTickText = function (d, scale) {
         var internal = this,
             tickText = internal.textFormatted(d),
             maxWidth = internal.params.tickWidth,
 
         return split(splitted, tickText + "");
     };
-    c3_axis_internal_fn.ellipsify = function (splitted, max) {
+    AxisInternal.prototype.ellipsify = function (splitted, max) {
         if (splitted.length <= max) {
             return splitted;
         }
 
         return ellipsified;
     };
-    c3_axis_internal_fn.updateTickLength = function () {
+    AxisInternal.prototype.updateTickLength = function () {
         var internal = this;
         internal.tickLength = Math.max(internal.innerTickSize, 0) + internal.tickPadding;
     };
-    c3_axis_internal_fn.lineY2 = function (d) {
+    AxisInternal.prototype.lineY2 = function (d) {
         var internal = this,
             tickPosition = internal.scale(d) + (internal.tickCentered ? 0 : internal.tickOffset);
         return internal.range[0] < tickPosition && tickPosition < internal.range[1] ? internal.innerTickSize : 0;
     };
-    c3_axis_internal_fn.textY = function () {
+    AxisInternal.prototype.textY = function () {
         var internal = this,
             rotate = internal.tickTextRotate;
         return rotate ? 11.5 - 2.5 * (rotate / 15) * (rotate > 0 ? 1 : -1) : internal.tickLength;
     };
-    c3_axis_internal_fn.textTransform = function () {
+    AxisInternal.prototype.textTransform = function () {
         var internal = this,
             rotate = internal.tickTextRotate;
         return rotate ? "rotate(" + rotate + ")" : "";
     };
-    c3_axis_internal_fn.textTextAnchor = function () {
+    AxisInternal.prototype.textTextAnchor = function () {
         var internal = this,
             rotate = internal.tickTextRotate;
         return rotate ? rotate > 0 ? "start" : "end" : "middle";
     };
-    c3_axis_internal_fn.tspanDx = function () {
+    AxisInternal.prototype.tspanDx = function () {
         var internal = this,
             rotate = internal.tickTextRotate;
         return rotate ? 8 * Math.sin(Math.PI * (rotate / 180)) : 0;
     };
-    c3_axis_internal_fn.tspanDy = function (d, i) {
+    AxisInternal.prototype.tspanDy = function (d, i) {
         var internal = this,
             dy = internal.tickTextCharSize.h;
         if (i === 0) {
         return dy;
     };
 
-    c3_axis_internal_fn.generateAxis = function () {
+    AxisInternal.prototype.generateAxis = function () {
         var internal = this,
             d3 = internal.d3,
             params = internal.params;
         return axis;
     };
 
-    var Axis = function (_Component) {
-        inherits(Axis, _Component);
+    var CLASS = {
+        target: 'c3-target',
+        chart: 'c3-chart',
+        chartLine: 'c3-chart-line',
+        chartLines: 'c3-chart-lines',
+        chartBar: 'c3-chart-bar',
+        chartBars: 'c3-chart-bars',
+        chartText: 'c3-chart-text',
+        chartTexts: 'c3-chart-texts',
+        chartArc: 'c3-chart-arc',
+        chartArcs: 'c3-chart-arcs',
+        chartArcsTitle: 'c3-chart-arcs-title',
+        chartArcsBackground: 'c3-chart-arcs-background',
+        chartArcsGaugeUnit: 'c3-chart-arcs-gauge-unit',
+        chartArcsGaugeMax: 'c3-chart-arcs-gauge-max',
+        chartArcsGaugeMin: 'c3-chart-arcs-gauge-min',
+        selectedCircle: 'c3-selected-circle',
+        selectedCircles: 'c3-selected-circles',
+        eventRect: 'c3-event-rect',
+        eventRects: 'c3-event-rects',
+        eventRectsSingle: 'c3-event-rects-single',
+        eventRectsMultiple: 'c3-event-rects-multiple',
+        zoomRect: 'c3-zoom-rect',
+        brush: 'c3-brush',
+        dragZoom: 'c3-drag-zoom',
+        focused: 'c3-focused',
+        defocused: 'c3-defocused',
+        region: 'c3-region',
+        regions: 'c3-regions',
+        title: 'c3-title',
+        tooltipContainer: 'c3-tooltip-container',
+        tooltip: 'c3-tooltip',
+        tooltipName: 'c3-tooltip-name',
+        shape: 'c3-shape',
+        shapes: 'c3-shapes',
+        line: 'c3-line',
+        lines: 'c3-lines',
+        bar: 'c3-bar',
+        bars: 'c3-bars',
+        circle: 'c3-circle',
+        circles: 'c3-circles',
+        arc: 'c3-arc',
+        arcLabelLine: 'c3-arc-label-line',
+        arcs: 'c3-arcs',
+        area: 'c3-area',
+        areas: 'c3-areas',
+        empty: 'c3-empty',
+        text: 'c3-text',
+        texts: 'c3-texts',
+        gaugeValue: 'c3-gauge-value',
+        grid: 'c3-grid',
+        gridLines: 'c3-grid-lines',
+        xgrid: 'c3-xgrid',
+        xgrids: 'c3-xgrids',
+        xgridLine: 'c3-xgrid-line',
+        xgridLines: 'c3-xgrid-lines',
+        xgridFocus: 'c3-xgrid-focus',
+        ygrid: 'c3-ygrid',
+        ygrids: 'c3-ygrids',
+        ygridLine: 'c3-ygrid-line',
+        ygridLines: 'c3-ygrid-lines',
+        axis: 'c3-axis',
+        axisX: 'c3-axis-x',
+        axisXLabel: 'c3-axis-x-label',
+        axisY: 'c3-axis-y',
+        axisYLabel: 'c3-axis-y-label',
+        axisY2: 'c3-axis-y2',
+        axisY2Label: 'c3-axis-y2-label',
+        legendBackground: 'c3-legend-background',
+        legendItem: 'c3-legend-item',
+        legendItemEvent: 'c3-legend-item-event',
+        legendItemTile: 'c3-legend-item-tile',
+        legendItemHidden: 'c3-legend-item-hidden',
+        legendItemFocused: 'c3-legend-item-focused',
+        dragarea: 'c3-dragarea',
+        EXPANDED: '_expanded_',
+        SELECTED: '_selected_',
+        INCLUDED: '_included_'
+    };
+
+    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
+      return typeof obj;
+    } : function (obj) {
+      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+    };
 
-        function Axis(owner) {
-            classCallCheck(this, Axis);
+    var classCallCheck = function (instance, Constructor) {
+      if (!(instance instanceof Constructor)) {
+        throw new TypeError("Cannot call a class as a function");
+      }
+    };
 
-            var fn = {
-                fn: c3_axis_fn,
-                internal: {
-                    fn: c3_axis_internal_fn
-                }
-            };
+    var defineProperty = function (obj, key, value) {
+      if (key in obj) {
+        Object.defineProperty(obj, key, {
+          value: value,
+          enumerable: true,
+          configurable: true,
+          writable: true
+        });
+      } else {
+        obj[key] = value;
+      }
 
-            var _this = possibleConstructorReturn(this, (Axis.__proto__ || Object.getPrototypeOf(Axis)).call(this, owner, 'axis', fn));
+      return obj;
+    };
 
-            _this.d3 = owner.d3;
-            _this.internal = AxisInternal;
-            return _this;
-        }
+    var asHalfPixel = function asHalfPixel(n) {
+        return Math.ceil(n) + 0.5;
+    };
+    var ceil10 = function ceil10(v) {
+        return Math.ceil(v / 10) * 10;
+    };
+    var diffDomain = function diffDomain(d) {
+        return d[1] - d[0];
+    };
+    var getOption = function getOption(options, key, defaultValue) {
+        return isDefined(options[key]) ? options[key] : defaultValue;
+    };
+    var getPathBox = function getPathBox(path) {
+        var box = path.getBoundingClientRect(),
+            items = [path.pathSegList.getItem(0), path.pathSegList.getItem(1)],
+            minX = items[0].x,
+            minY = Math.min(items[0].y, items[1].y);
+        return { x: minX, y: minY, width: box.width, height: box.height };
+    };
+    var hasValue = function hasValue(dict, value) {
+        var found = false;
+        Object.keys(dict).forEach(function (key) {
+            if (dict[key] === value) {
+                found = true;
+            }
+        });
+        return found;
+    };
+    var isArray = function isArray(o) {
+        return Array.isArray(o);
+    };
+    var isDefined = function isDefined(v) {
+        return typeof v !== 'undefined';
+    };
+    var isEmpty = function isEmpty(o) {
+        return typeof o === 'undefined' || o === null || isString(o) && o.length === 0 || (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && Object.keys(o).length === 0;
+    };
+    var isFunction = function isFunction(o) {
+        return typeof o === 'function';
+    };
+    var isString = function isString(o) {
+        return typeof o === 'string';
+    };
+    var isUndefined = function isUndefined(v) {
+        return typeof v === 'undefined';
+    };
+    var isValue = function isValue(v) {
+        return v || v === 0;
+    };
+    var notEmpty = function notEmpty(o) {
+        return !isEmpty(o);
+    };
+    var sanitise = function sanitise(str) {
+        return typeof str === 'string' ? str.replace(/</g, '&lt;').replace(/>/g, '&gt;') : str;
+    };
 
-        return Axis;
-    }(Component);
+    var Axis = function Axis(owner) {
+        classCallCheck(this, Axis);
 
-    c3_axis_fn = Axis.prototype;
+        this.owner = owner;
+        this.d3 = owner.d3;
+        this.internal = AxisInternal;
+    };
 
-    c3_axis_fn.init = function init() {
+    Axis.prototype.init = function init() {
         var $$ = this.owner,
             config = $$.config,
             main = $$.main;
         .attr("transform", $$.getTranslate('y2')).style("visibility", config.axis_y2_show ? 'visible' : 'hidden');
         $$.axes.y2.append("text").attr("class", CLASS.axisY2Label).attr("transform", config.axis_rotated ? "" : "rotate(-90)").style("text-anchor", this.textAnchorForY2AxisLabel.bind(this));
     };
-    c3_axis_fn.getXAxis = function getXAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) {
+    Axis.prototype.getXAxis = function getXAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) {
         var $$ = this.owner,
             config = $$.config,
             axisParams = {
 
         return axis;
     };
-    c3_axis_fn.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) {
+    Axis.prototype.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) {
         var $$ = this.owner,
             config = $$.config,
             tickValues;
         }
         return tickValues;
     };
-    c3_axis_fn.getYAxis = function getYAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) {
+    Axis.prototype.getYAxis = function getYAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) {
         var $$ = this.owner,
             config = $$.config,
             axisParams = {
         }
         return axis;
     };
-    c3_axis_fn.getId = function getId(id) {
+    Axis.prototype.getId = function getId(id) {
         var config = this.owner.config;
         return id in config.data_axes ? config.data_axes[id] : 'y';
     };
-    c3_axis_fn.getXAxisTickFormat = function getXAxisTickFormat() {
+    Axis.prototype.getXAxisTickFormat = function getXAxisTickFormat() {
         // #2251 previously set any negative values to a whole number,
         // however both should be truncated according to the users format specification
         var $$ = this.owner,
             return format.call($$, v);
         } : format;
     };
-    c3_axis_fn.getTickValues = function getTickValues(tickValues, axis) {
+    Axis.prototype.getTickValues = function getTickValues(tickValues, axis) {
         return tickValues ? tickValues : axis ? axis.tickValues() : undefined;
     };
-    c3_axis_fn.getXAxisTickValues = function getXAxisTickValues() {
+    Axis.prototype.getXAxisTickValues = function getXAxisTickValues() {
         return this.getTickValues(this.owner.config.axis_x_tick_values, this.owner.xAxis);
     };
-    c3_axis_fn.getYAxisTickValues = function getYAxisTickValues() {
+    Axis.prototype.getYAxisTickValues = function getYAxisTickValues() {
         return this.getTickValues(this.owner.config.axis_y_tick_values, this.owner.yAxis);
     };
-    c3_axis_fn.getY2AxisTickValues = function getY2AxisTickValues() {
+    Axis.prototype.getY2AxisTickValues = function getY2AxisTickValues() {
         return this.getTickValues(this.owner.config.axis_y2_tick_values, this.owner.y2Axis);
     };
-    c3_axis_fn.getLabelOptionByAxisId = function getLabelOptionByAxisId(axisId) {
+    Axis.prototype.getLabelOptionByAxisId = function getLabelOptionByAxisId(axisId) {
         var $$ = this.owner,
             config = $$.config,
             option;
         }
         return option;
     };
-    c3_axis_fn.getLabelText = function getLabelText(axisId) {
+    Axis.prototype.getLabelText = function getLabelText(axisId) {
         var option = this.getLabelOptionByAxisId(axisId);
         return isString(option) ? option : option ? option.text : null;
     };
-    c3_axis_fn.setLabelText = function setLabelText(axisId, text) {
+    Axis.prototype.setLabelText = function setLabelText(axisId, text) {
         var $$ = this.owner,
             config = $$.config,
             option = this.getLabelOptionByAxisId(axisId);
             option.text = text;
         }
     };
-    c3_axis_fn.getLabelPosition = function getLabelPosition(axisId, defaultPosition) {
+    Axis.prototype.getLabelPosition = function getLabelPosition(axisId, defaultPosition) {
         var option = this.getLabelOptionByAxisId(axisId),
             position = option && (typeof option === 'undefined' ? 'undefined' : _typeof(option)) === 'object' && option.position ? option.position : defaultPosition;
         return {
             isBottom: position.indexOf('bottom') >= 0
         };
     };
-    c3_axis_fn.getXAxisLabelPosition = function getXAxisLabelPosition() {
+    Axis.prototype.getXAxisLabelPosition = function getXAxisLabelPosition() {
         return this.getLabelPosition('x', this.owner.config.axis_rotated ? 'inner-top' : 'inner-right');
     };
-    c3_axis_fn.getYAxisLabelPosition = function getYAxisLabelPosition() {
+    Axis.prototype.getYAxisLabelPosition = function getYAxisLabelPosition() {
         return this.getLabelPosition('y', this.owner.config.axis_rotated ? 'inner-right' : 'inner-top');
     };
-    c3_axis_fn.getY2AxisLabelPosition = function getY2AxisLabelPosition() {
+    Axis.prototype.getY2AxisLabelPosition = function getY2AxisLabelPosition() {
         return this.getLabelPosition('y2', this.owner.config.axis_rotated ? 'inner-right' : 'inner-top');
     };
-    c3_axis_fn.getLabelPositionById = function getLabelPositionById(id) {
+    Axis.prototype.getLabelPositionById = function getLabelPositionById(id) {
         return id === 'y2' ? this.getY2AxisLabelPosition() : id === 'y' ? this.getYAxisLabelPosition() : this.getXAxisLabelPosition();
     };
-    c3_axis_fn.textForXAxisLabel = function textForXAxisLabel() {
+    Axis.prototype.textForXAxisLabel = function textForXAxisLabel() {
         return this.getLabelText('x');
     };
-    c3_axis_fn.textForYAxisLabel = function textForYAxisLabel() {
+    Axis.prototype.textForYAxisLabel = function textForYAxisLabel() {
         return this.getLabelText('y');
     };
-    c3_axis_fn.textForY2AxisLabel = function textForY2AxisLabel() {
+    Axis.prototype.textForY2AxisLabel = function textForY2AxisLabel() {
         return this.getLabelText('y2');
     };
-    c3_axis_fn.xForAxisLabel = function xForAxisLabel(forHorizontal, position) {
+    Axis.prototype.xForAxisLabel = function xForAxisLabel(forHorizontal, position) {
         var $$ = this.owner;
         if (forHorizontal) {
             return position.isLeft ? 0 : position.isCenter ? $$.width / 2 : $$.width;
             return position.isBottom ? -$$.height : position.isMiddle ? -$$.height / 2 : 0;
         }
     };
-    c3_axis_fn.dxForAxisLabel = function dxForAxisLabel(forHorizontal, position) {
+    Axis.prototype.dxForAxisLabel = function dxForAxisLabel(forHorizontal, position) {
         if (forHorizontal) {
             return position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0";
         } else {
             return position.isTop ? "-0.5em" : position.isBottom ? "0.5em" : "0";
         }
     };
-    c3_axis_fn.textAnchorForAxisLabel = function textAnchorForAxisLabel(forHorizontal, position) {
+    Axis.prototype.textAnchorForAxisLabel = function textAnchorForAxisLabel(forHorizontal, position) {
         if (forHorizontal) {
             return position.isLeft ? 'start' : position.isCenter ? 'middle' : 'end';
         } else {
             return position.isBottom ? 'start' : position.isMiddle ? 'middle' : 'end';
         }
     };
-    c3_axis_fn.xForXAxisLabel = function xForXAxisLabel() {
+    Axis.prototype.xForXAxisLabel = function xForXAxisLabel() {
         return this.xForAxisLabel(!this.owner.config.axis_rotated, this.getXAxisLabelPosition());
     };
-    c3_axis_fn.xForYAxisLabel = function xForYAxisLabel() {
+    Axis.prototype.xForYAxisLabel = function xForYAxisLabel() {
         return this.xForAxisLabel(this.owner.config.axis_rotated, this.getYAxisLabelPosition());
     };
-    c3_axis_fn.xForY2AxisLabel = function xForY2AxisLabel() {
+    Axis.prototype.xForY2AxisLabel = function xForY2AxisLabel() {
         return this.xForAxisLabel(this.owner.config.axis_rotated, this.getY2AxisLabelPosition());
     };
-    c3_axis_fn.dxForXAxisLabel = function dxForXAxisLabel() {
+    Axis.prototype.dxForXAxisLabel = function dxForXAxisLabel() {
         return this.dxForAxisLabel(!this.owner.config.axis_rotated, this.getXAxisLabelPosition());
     };
-    c3_axis_fn.dxForYAxisLabel = function dxForYAxisLabel() {
+    Axis.prototype.dxForYAxisLabel = function dxForYAxisLabel() {
         return this.dxForAxisLabel(this.owner.config.axis_rotated, this.getYAxisLabelPosition());
     };
-    c3_axis_fn.dxForY2AxisLabel = function dxForY2AxisLabel() {
+    Axis.prototype.dxForY2AxisLabel = function dxForY2AxisLabel() {
         return this.dxForAxisLabel(this.owner.config.axis_rotated, this.getY2AxisLabelPosition());
     };
-    c3_axis_fn.dyForXAxisLabel = function dyForXAxisLabel() {
+    Axis.prototype.dyForXAxisLabel = function dyForXAxisLabel() {
         var $$ = this.owner,
             config = $$.config,
             position = this.getXAxisLabelPosition();
             return position.isInner ? "-0.5em" : config.axis_x_height ? config.axis_x_height - 10 : "3em";
         }
     };
-    c3_axis_fn.dyForYAxisLabel = function dyForYAxisLabel() {
+    Axis.prototype.dyForYAxisLabel = function dyForYAxisLabel() {
         var $$ = this.owner,
             position = this.getYAxisLabelPosition();
         if ($$.config.axis_rotated) {
             return position.isInner ? "1.2em" : -10 - ($$.config.axis_y_inner ? 0 : this.getMaxTickWidth('y') + 10);
         }
     };
-    c3_axis_fn.dyForY2AxisLabel = function dyForY2AxisLabel() {
+    Axis.prototype.dyForY2AxisLabel = function dyForY2AxisLabel() {
         var $$ = this.owner,
             position = this.getY2AxisLabelPosition();
         if ($$.config.axis_rotated) {
             return position.isInner ? "-0.5em" : 15 + ($$.config.axis_y2_inner ? 0 : this.getMaxTickWidth('y2') + 15);
         }
     };
-    c3_axis_fn.textAnchorForXAxisLabel = function textAnchorForXAxisLabel() {
+    Axis.prototype.textAnchorForXAxisLabel = function textAnchorForXAxisLabel() {
         var $$ = this.owner;
         return this.textAnchorForAxisLabel(!$$.config.axis_rotated, this.getXAxisLabelPosition());
     };
-    c3_axis_fn.textAnchorForYAxisLabel = function textAnchorForYAxisLabel() {
+    Axis.prototype.textAnchorForYAxisLabel = function textAnchorForYAxisLabel() {
         var $$ = this.owner;
         return this.textAnchorForAxisLabel($$.config.axis_rotated, this.getYAxisLabelPosition());
     };
-    c3_axis_fn.textAnchorForY2AxisLabel = function textAnchorForY2AxisLabel() {
+    Axis.prototype.textAnchorForY2AxisLabel = function textAnchorForY2AxisLabel() {
         var $$ = this.owner;
         return this.textAnchorForAxisLabel($$.config.axis_rotated, this.getY2AxisLabelPosition());
     };
-    c3_axis_fn.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) {
+    Axis.prototype.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) {
         var $$ = this.owner,
             config = $$.config,
             maxWidth = 0,
         return $$.currentMaxTickWidths[id];
     };
 
-    c3_axis_fn.updateLabels = function updateLabels(withTransition) {
+    Axis.prototype.updateLabels = function updateLabels(withTransition) {
         var $$ = this.owner;
         var axisXLabel = $$.main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel),
             axisYLabel = $$.main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel),
         (withTransition ? axisYLabel.transition() : axisYLabel).attr("x", this.xForYAxisLabel.bind(this)).attr("dx", this.dxForYAxisLabel.bind(this)).attr("dy", this.dyForYAxisLabel.bind(this)).text(this.textForYAxisLabel.bind(this));
         (withTransition ? axisY2Label.transition() : axisY2Label).attr("x", this.xForY2AxisLabel.bind(this)).attr("dx", this.dxForY2AxisLabel.bind(this)).attr("dy", this.dyForY2AxisLabel.bind(this)).text(this.textForY2AxisLabel.bind(this));
     };
-    c3_axis_fn.getPadding = function getPadding(padding, key, defaultValue, domainLength) {
+    Axis.prototype.getPadding = function getPadding(padding, key, defaultValue, domainLength) {
         var p = typeof padding === 'number' ? padding : padding[key];
         if (!isValue(p)) {
             return defaultValue;
         // assume padding is pixels if unit is not specified
         return this.convertPixelsToAxisPadding(p, domainLength);
     };
-    c3_axis_fn.convertPixelsToAxisPadding = function convertPixelsToAxisPadding(pixels, domainLength) {
+    Axis.prototype.convertPixelsToAxisPadding = function convertPixelsToAxisPadding(pixels, domainLength) {
         var $$ = this.owner,
             length = $$.config.axis_rotated ? $$.width : $$.height;
         return domainLength * (pixels / length);
     };
-    c3_axis_fn.generateTickValues = function generateTickValues(values, tickCount, forTimeSeries) {
+    Axis.prototype.generateTickValues = function generateTickValues(values, tickCount, forTimeSeries) {
         var tickValues = values,
             targetCount,
             start,
         }
         return tickValues;
     };
-    c3_axis_fn.generateTransitions = function generateTransitions(duration) {
+    Axis.prototype.generateTransitions = function generateTransitions(duration) {
         var $$ = this.owner,
             axes = $$.axes;
         return {
             axisSubX: duration ? axes.subx.transition().duration(duration) : axes.subx
         };
     };
-    c3_axis_fn.redraw = function redraw(duration, isHidden) {
+    Axis.prototype.redraw = function redraw(duration, isHidden) {
         var $$ = this.owner,
             transition = duration ? $$.d3.transition().duration(duration) : null;
         $$.axes.x.style("opacity", isHidden ? 0 : 1).call($$.xAxis, transition);
         $$.axes.subx.style("opacity", isHidden ? 0 : 1).call($$.subXAxis, transition);
     };
 
-    var c3 = { version: "0.6.1" };
-
-    var c3_chart_fn;
-    var c3_chart_internal_fn;
-
-    function Component(owner, componentKey, fn) {
-        this.owner = owner;
-        c3.chart.internal[componentKey] = fn;
-    }
-
-    function Chart(config) {
-        var $$ = this.internal = new ChartInternal(this);
-        $$.loadConfig(config);
-
-        $$.beforeInit(config);
-        $$.init();
-        $$.afterInit(config);
-
-        // bind "this" to nested API
-        (function bindThis(fn, target, argThis) {
-            Object.keys(fn).forEach(function (key) {
-                target[key] = fn[key].bind(argThis);
-                if (Object.keys(fn[key]).length > 0) {
-                    bindThis(fn[key], target[key], argThis);
+    var c3 = {
+        version: "0.6.7",
+        chart: {
+            fn: Chart.prototype,
+            internal: {
+                fn: ChartInternal.prototype,
+                axis: {
+                    fn: Axis.prototype,
+                    internal: {
+                        fn: AxisInternal.prototype
+                    }
                 }
-            });
-        })(c3_chart_fn, this, this);
-    }
-
-    function ChartInternal(api) {
-        var $$ = this;
-        $$.d3 = window.d3 ? window.d3 : typeof require !== 'undefined' ? require("d3") : undefined;
-        $$.api = api;
-        $$.config = $$.getDefaultConfig();
-        $$.data = {};
-        $$.cache = {};
-        $$.axes = {};
-    }
-
-    c3.generate = function (config) {
-        return new Chart(config);
-    };
-
-    c3.chart = {
-        fn: Chart.prototype,
-        internal: {
-            fn: ChartInternal.prototype
+            }
+        },
+        generate: function generate(config) {
+            return new Chart(config);
         }
     };
-    c3_chart_fn = c3.chart.fn;
-    c3_chart_internal_fn = c3.chart.internal.fn;
 
-    c3_chart_internal_fn.beforeInit = function () {
+    ChartInternal.prototype.beforeInit = function () {
         // can do something
     };
-    c3_chart_internal_fn.afterInit = function () {
+    ChartInternal.prototype.afterInit = function () {
         // can do something
     };
-    c3_chart_internal_fn.init = function () {
+    ChartInternal.prototype.init = function () {
         var $$ = this,
             config = $$.config;
 
         }
     };
 
-    c3_chart_internal_fn.initParams = function () {
+    ChartInternal.prototype.initParams = function () {
         var $$ = this,
             d3 = $$.d3,
             config = $$.config;
 
         // MEMO: clipId needs to be unique because it conflicts when multiple charts exist
-        $$.clipId = "c3-" + +new Date() + '-clip', $$.clipIdForXAxis = $$.clipId + '-xaxis', $$.clipIdForYAxis = $$.clipId + '-yaxis', $$.clipIdForGrid = $$.clipId + '-grid', $$.clipIdForSubchart = $$.clipId + '-subchart', $$.clipPath = $$.getClipPath($$.clipId), $$.clipPathForXAxis = $$.getClipPath($$.clipIdForXAxis), $$.clipPathForYAxis = $$.getClipPath($$.clipIdForYAxis);
-        $$.clipPathForGrid = $$.getClipPath($$.clipIdForGrid), $$.clipPathForSubchart = $$.getClipPath($$.clipIdForSubchart), $$.dragStart = null;
+        $$.clipId = "c3-" + +new Date() + '-clip';
+        $$.clipIdForXAxis = $$.clipId + '-xaxis';
+        $$.clipIdForYAxis = $$.clipId + '-yaxis';
+        $$.clipIdForGrid = $$.clipId + '-grid';
+        $$.clipIdForSubchart = $$.clipId + '-subchart';
+        $$.clipPath = $$.getClipPath($$.clipId);
+        $$.clipPathForXAxis = $$.getClipPath($$.clipIdForXAxis);
+        $$.clipPathForYAxis = $$.getClipPath($$.clipIdForYAxis);
+        $$.clipPathForGrid = $$.getClipPath($$.clipIdForGrid);
+        $$.clipPathForSubchart = $$.getClipPath($$.clipIdForSubchart);
+
+        $$.dragStart = null;
         $$.dragging = false;
         $$.flowing = false;
         $$.cancelClick = false;
         $$.axes.subx = d3.selectAll([]); // needs when excluding subchart.js
     };
 
-    c3_chart_internal_fn.initChartElements = function () {
+    ChartInternal.prototype.initChartElements = function () {
         if (this.initBar) {
             this.initBar();
         }
         }
     };
 
-    c3_chart_internal_fn.initWithData = function (data) {
+    ChartInternal.prototype.initWithData = function (data) {
         var $$ = this,
             d3 = $$.d3,
             config = $$.config;
         if ($$.initPie) {
             $$.initPie();
         }
+        if ($$.initDragZoom) {
+            $$.initDragZoom();
+        }
         if ($$.initSubchart) {
             $$.initSubchart();
         }
             $$.initGridLines();
         }
 
+        // Cover whole with rects for events
+        $$.initEventRect();
+
         // Define g for chart
         $$.initChartElements();
 
         // Set targets
         $$.updateTargets($$.data.targets);
 
-        // Cover whole with rects for events
-        $$.initEventRect();
-
         // Set default extent if defined
         if (config.axis_x_selection) {
             $$.brush.selectionAsValue($$.getDefaultSelection());
         $$.api.element = $$.selectChart.node();
     };
 
-    c3_chart_internal_fn.smoothLines = function (el, type) {
+    ChartInternal.prototype.smoothLines = function (el, type) {
         var $$ = this;
         if (type === 'grid') {
             el.each(function () {
         }
     };
 
-    c3_chart_internal_fn.updateSizes = function () {
+    ChartInternal.prototype.updateSizes = function () {
         var $$ = this,
             config = $$.config;
         var legendHeight = $$.legend ? $$.getLegendHeight() : 0,
         }
     };
 
-    c3_chart_internal_fn.updateTargets = function (targets) {
+    ChartInternal.prototype.updateTargets = function (targets) {
         var $$ = this;
 
         /*-- Main --*/
         // Fade-in each chart
         $$.showTargets();
     };
-    c3_chart_internal_fn.showTargets = function () {
+    ChartInternal.prototype.showTargets = function () {
         var $$ = this;
         $$.svg.selectAll('.' + CLASS.target).filter(function (d) {
             return $$.isTargetToShow(d.id);
         }).transition().duration($$.config.transition_duration).style("opacity", 1);
     };
 
-    c3_chart_internal_fn.redraw = function (options, transitions) {
+    ChartInternal.prototype.redraw = function (options, transitions) {
         var $$ = this,
             main = $$.main,
             d3 = $$.d3,
         });
     };
 
-    c3_chart_internal_fn.updateAndRedraw = function (options) {
+    ChartInternal.prototype.updateAndRedraw = function (options) {
         var $$ = this,
             config = $$.config,
             transitions;
         // Draw with new sizes & scales
         $$.redraw(options, transitions);
     };
-    c3_chart_internal_fn.redrawWithoutRescale = function () {
+    ChartInternal.prototype.redrawWithoutRescale = function () {
         this.redraw({
             withY: false,
             withSubchart: false,
         });
     };
 
-    c3_chart_internal_fn.isTimeSeries = function () {
+    ChartInternal.prototype.isTimeSeries = function () {
         return this.config.axis_x_type === 'timeseries';
     };
-    c3_chart_internal_fn.isCategorized = function () {
+    ChartInternal.prototype.isCategorized = function () {
         return this.config.axis_x_type.indexOf('categor') >= 0;
     };
-    c3_chart_internal_fn.isCustomX = function () {
+    ChartInternal.prototype.isCustomX = function () {
         var $$ = this,
             config = $$.config;
         return !$$.isTimeSeries() && (config.data_x || notEmpty(config.data_xs));
     };
 
-    c3_chart_internal_fn.isTimeSeriesY = function () {
+    ChartInternal.prototype.isTimeSeriesY = function () {
         return this.config.axis_y_type === 'timeseries';
     };
 
-    c3_chart_internal_fn.getTranslate = function (target) {
+    ChartInternal.prototype.getTranslate = function (target) {
         var $$ = this,
             config = $$.config,
             x,
         }
         return "translate(" + x + "," + y + ")";
     };
-    c3_chart_internal_fn.initialOpacity = function (d) {
+    ChartInternal.prototype.initialOpacity = function (d) {
         return d.value !== null && this.withoutFadeIn[d.id] ? 1 : 0;
     };
-    c3_chart_internal_fn.initialOpacityForCircle = function (d) {
+    ChartInternal.prototype.initialOpacityForCircle = function (d) {
         return d.value !== null && this.withoutFadeIn[d.id] ? this.opacityForCircle(d) : 0;
     };
-    c3_chart_internal_fn.opacityForCircle = function (d) {
+    ChartInternal.prototype.opacityForCircle = function (d) {
         var isPointShouldBeShown = isFunction(this.config.point_show) ? this.config.point_show(d) : this.config.point_show;
         var opacity = isPointShouldBeShown ? 1 : 0;
         return isValue(d.value) ? this.isScatterType(d) ? 0.5 : opacity : 0;
     };
-    c3_chart_internal_fn.opacityForText = function () {
+    ChartInternal.prototype.opacityForText = function () {
         return this.hasDataLabel() ? 1 : 0;
     };
-    c3_chart_internal_fn.xx = function (d) {
+    ChartInternal.prototype.xx = function (d) {
         return d ? this.x(d.x) : null;
     };
-    c3_chart_internal_fn.xv = function (d) {
+    ChartInternal.prototype.xv = function (d) {
         var $$ = this,
             value = d.value;
         if ($$.isTimeSeries()) {
         }
         return Math.ceil($$.x(value));
     };
-    c3_chart_internal_fn.yv = function (d) {
+    ChartInternal.prototype.yv = function (d) {
         var $$ = this,
             yScale = d.axis && d.axis === 'y2' ? $$.y2 : $$.y;
         return Math.ceil(yScale(d.value));
     };
-    c3_chart_internal_fn.subxx = function (d) {
+    ChartInternal.prototype.subxx = function (d) {
         return d ? this.subX(d.x) : null;
     };
 
-    c3_chart_internal_fn.transformMain = function (withTransition, transitions) {
+    ChartInternal.prototype.transformMain = function (withTransition, transitions) {
         var $$ = this,
             xAxis,
             yAxis,
         y2Axis.attr("transform", $$.getTranslate('y2'));
         $$.main.select('.' + CLASS.chartArcs).attr("transform", $$.getTranslate('arc'));
     };
-    c3_chart_internal_fn.transformAll = function (withTransition, transitions) {
+    ChartInternal.prototype.transformAll = function (withTransition, transitions) {
         var $$ = this;
         $$.transformMain(withTransition, transitions);
         if ($$.config.subchart_show) {
         }
     };
 
-    c3_chart_internal_fn.updateSvgSize = function () {
+    ChartInternal.prototype.updateSvgSize = function () {
         var $$ = this,
             brush = $$.svg.select(".c3-brush .overlay");
         $$.svg.attr('width', $$.currentWidth).attr('height', $$.currentHeight);
         $$.selectChart.style('max-height', $$.currentHeight + "px");
     };
 
-    c3_chart_internal_fn.updateDimension = function (withoutAxis) {
+    ChartInternal.prototype.updateDimension = function (withoutAxis) {
         var $$ = this;
         if (!withoutAxis) {
             if ($$.config.axis_rotated) {
         $$.transformAll(false);
     };
 
-    c3_chart_internal_fn.observeInserted = function (selection) {
+    ChartInternal.prototype.observeInserted = function (selection) {
         var $$ = this,
             observer;
         if (typeof MutationObserver === 'undefined') {
                 }
             });
         });
-        observer.observe(selection.node(), { attributes: true, childList: true, characterData: true });
+        observer.observe(selection.node(), {
+            attributes: true,
+            childList: true,
+            characterData: true
+        });
     };
 
-    c3_chart_internal_fn.bindResize = function () {
+    ChartInternal.prototype.bindResize = function () {
         var $$ = this,
             config = $$.config;
 
         }
     };
 
-    c3_chart_internal_fn.generateResize = function () {
+    ChartInternal.prototype.generateResize = function () {
         var resizeFunctions = [];
+
         function callResizeFunctions() {
             resizeFunctions.forEach(function (f) {
                 f();
         return callResizeFunctions;
     };
 
-    c3_chart_internal_fn.endall = function (transition, callback) {
+    ChartInternal.prototype.endall = function (transition, callback) {
         var n = 0;
         transition.each(function () {
             ++n;
             }
         });
     };
-    c3_chart_internal_fn.generateWait = function () {
+    ChartInternal.prototype.generateWait = function () {
         var transitionsToWait = [],
             f = function f(callback) {
             var timer = setInterval(function () {
         return f;
     };
 
-    c3_chart_internal_fn.parseDate = function (date) {
+    ChartInternal.prototype.parseDate = function (date) {
         var $$ = this,
             parsedDate;
         if (date instanceof Date) {
         return parsedDate;
     };
 
-    c3_chart_internal_fn.isTabVisible = function () {
+    ChartInternal.prototype.isTabVisible = function () {
         var hidden;
         if (typeof document.hidden !== "undefined") {
             // Opera 12.10 and Firefox 18 and later support
         return document[hidden] ? false : true;
     };
 
-    c3_chart_internal_fn.isValue = isValue;
-    c3_chart_internal_fn.isFunction = isFunction;
-    c3_chart_internal_fn.isString = isString;
-    c3_chart_internal_fn.isUndefined = isUndefined;
-    c3_chart_internal_fn.isDefined = isDefined;
-    c3_chart_internal_fn.ceil10 = ceil10;
-    c3_chart_internal_fn.asHalfPixel = asHalfPixel;
-    c3_chart_internal_fn.diffDomain = diffDomain;
-    c3_chart_internal_fn.isEmpty = isEmpty;
-    c3_chart_internal_fn.notEmpty = notEmpty;
-    c3_chart_internal_fn.notEmpty = notEmpty;
-    c3_chart_internal_fn.getOption = getOption;
-    c3_chart_internal_fn.hasValue = hasValue;
-    c3_chart_internal_fn.sanitise = sanitise;
-    c3_chart_internal_fn.getPathBox = getPathBox;
-    c3_chart_internal_fn.CLASS = CLASS;
+    ChartInternal.prototype.getPathBox = getPathBox;
+    ChartInternal.prototype.CLASS = CLASS;
 
     /* jshint ignore:start */
 
             window.SVGPathSegMovetoAbs.prototype.clone = function () {
                 return new window.SVGPathSegMovetoAbs(undefined, this._x, this._y);
             };
-            Object.defineProperty(window.SVGPathSegMovetoAbs.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegMovetoAbs.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegMovetoAbs.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegMovetoAbs.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegMovetoRel = function (owningPathSegList, x, y) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_MOVETO_REL, "m", owningPathSegList);
             window.SVGPathSegMovetoRel.prototype.clone = function () {
                 return new window.SVGPathSegMovetoRel(undefined, this._x, this._y);
             };
-            Object.defineProperty(window.SVGPathSegMovetoRel.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegMovetoRel.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegMovetoRel.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegMovetoRel.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegLinetoAbs = function (owningPathSegList, x, y) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_ABS, "L", owningPathSegList);
             window.SVGPathSegLinetoAbs.prototype.clone = function () {
                 return new window.SVGPathSegLinetoAbs(undefined, this._x, this._y);
             };
-            Object.defineProperty(window.SVGPathSegLinetoAbs.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegLinetoAbs.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegLinetoAbs.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegLinetoAbs.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegLinetoRel = function (owningPathSegList, x, y) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_REL, "l", owningPathSegList);
             window.SVGPathSegLinetoRel.prototype.clone = function () {
                 return new window.SVGPathSegLinetoRel(undefined, this._x, this._y);
             };
-            Object.defineProperty(window.SVGPathSegLinetoRel.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegLinetoRel.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegLinetoRel.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegLinetoRel.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegCurvetoCubicAbs = function (owningPathSegList, x, y, x1, y1, x2, y2) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS, "C", owningPathSegList);
             window.SVGPathSegCurvetoCubicAbs.prototype.clone = function () {
                 return new window.SVGPathSegCurvetoCubicAbs(undefined, this._x, this._y, this._x1, this._y1, this._x2, this._y2);
             };
-            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "x1", { get: function get() {
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "x1", {
+                get: function get() {
                     return this._x1;
-                }, set: function set(x1) {
-                    this._x1 = x1;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "y1", { get: function get() {
+                },
+                set: function set(x1) {
+                    this._x1 = x1;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "y1", {
+                get: function get() {
                     return this._y1;
-                }, set: function set(y1) {
-                    this._y1 = y1;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "x2", { get: function get() {
+                },
+                set: function set(y1) {
+                    this._y1 = y1;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "x2", {
+                get: function get() {
                     return this._x2;
-                }, set: function set(x2) {
-                    this._x2 = x2;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "y2", { get: function get() {
+                },
+                set: function set(x2) {
+                    this._x2 = x2;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "y2", {
+                get: function get() {
                     return this._y2;
-                }, set: function set(y2) {
-                    this._y2 = y2;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y2) {
+                    this._y2 = y2;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegCurvetoCubicRel = function (owningPathSegList, x, y, x1, y1, x2, y2) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL, "c", owningPathSegList);
             window.SVGPathSegCurvetoCubicRel.prototype.clone = function () {
                 return new window.SVGPathSegCurvetoCubicRel(undefined, this._x, this._y, this._x1, this._y1, this._x2, this._y2);
             };
-            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "x1", { get: function get() {
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "x1", {
+                get: function get() {
                     return this._x1;
-                }, set: function set(x1) {
-                    this._x1 = x1;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "y1", { get: function get() {
+                },
+                set: function set(x1) {
+                    this._x1 = x1;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "y1", {
+                get: function get() {
                     return this._y1;
-                }, set: function set(y1) {
-                    this._y1 = y1;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "x2", { get: function get() {
+                },
+                set: function set(y1) {
+                    this._y1 = y1;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "x2", {
+                get: function get() {
                     return this._x2;
-                }, set: function set(x2) {
-                    this._x2 = x2;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "y2", { get: function get() {
+                },
+                set: function set(x2) {
+                    this._x2 = x2;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "y2", {
+                get: function get() {
                     return this._y2;
-                }, set: function set(y2) {
-                    this._y2 = y2;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y2) {
+                    this._y2 = y2;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegCurvetoQuadraticAbs = function (owningPathSegList, x, y, x1, y1) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS, "Q", owningPathSegList);
             window.SVGPathSegCurvetoQuadraticAbs.prototype.clone = function () {
                 return new window.SVGPathSegCurvetoQuadraticAbs(undefined, this._x, this._y, this._x1, this._y1);
             };
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "x1", { get: function get() {
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "x1", {
+                get: function get() {
                     return this._x1;
-                }, set: function set(x1) {
-                    this._x1 = x1;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "y1", { get: function get() {
+                },
+                set: function set(x1) {
+                    this._x1 = x1;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "y1", {
+                get: function get() {
                     return this._y1;
-                }, set: function set(y1) {
-                    this._y1 = y1;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y1) {
+                    this._y1 = y1;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegCurvetoQuadraticRel = function (owningPathSegList, x, y, x1, y1) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL, "q", owningPathSegList);
             window.SVGPathSegCurvetoQuadraticRel.prototype.clone = function () {
                 return new window.SVGPathSegCurvetoQuadraticRel(undefined, this._x, this._y, this._x1, this._y1);
             };
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "x1", { get: function get() {
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "x1", {
+                get: function get() {
                     return this._x1;
-                }, set: function set(x1) {
-                    this._x1 = x1;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "y1", { get: function get() {
+                },
+                set: function set(x1) {
+                    this._x1 = x1;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "y1", {
+                get: function get() {
                     return this._y1;
-                }, set: function set(y1) {
-                    this._y1 = y1;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y1) {
+                    this._y1 = y1;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegArcAbs = function (owningPathSegList, x, y, r1, r2, angle, largeArcFlag, sweepFlag) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_ARC_ABS, "A", owningPathSegList);
             window.SVGPathSegArcAbs.prototype.clone = function () {
                 return new window.SVGPathSegArcAbs(undefined, this._x, this._y, this._r1, this._r2, this._angle, this._largeArcFlag, this._sweepFlag);
             };
-            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "r1", { get: function get() {
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "r1", {
+                get: function get() {
                     return this._r1;
-                }, set: function set(r1) {
-                    this._r1 = r1;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "r2", { get: function get() {
+                },
+                set: function set(r1) {
+                    this._r1 = r1;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "r2", {
+                get: function get() {
                     return this._r2;
-                }, set: function set(r2) {
-                    this._r2 = r2;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "angle", { get: function get() {
+                },
+                set: function set(r2) {
+                    this._r2 = r2;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "angle", {
+                get: function get() {
                     return this._angle;
-                }, set: function set(angle) {
-                    this._angle = angle;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "largeArcFlag", { get: function get() {
+                },
+                set: function set(angle) {
+                    this._angle = angle;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "largeArcFlag", {
+                get: function get() {
                     return this._largeArcFlag;
-                }, set: function set(largeArcFlag) {
-                    this._largeArcFlag = largeArcFlag;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "sweepFlag", { get: function get() {
+                },
+                set: function set(largeArcFlag) {
+                    this._largeArcFlag = largeArcFlag;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcAbs.prototype, "sweepFlag", {
+                get: function get() {
                     return this._sweepFlag;
-                }, set: function set(sweepFlag) {
-                    this._sweepFlag = sweepFlag;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(sweepFlag) {
+                    this._sweepFlag = sweepFlag;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegArcRel = function (owningPathSegList, x, y, r1, r2, angle, largeArcFlag, sweepFlag) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_ARC_REL, "a", owningPathSegList);
             window.SVGPathSegArcRel.prototype.clone = function () {
                 return new window.SVGPathSegArcRel(undefined, this._x, this._y, this._r1, this._r2, this._angle, this._largeArcFlag, this._sweepFlag);
             };
-            Object.defineProperty(window.SVGPathSegArcRel.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegArcRel.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcRel.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcRel.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcRel.prototype, "r1", { get: function get() {
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcRel.prototype, "r1", {
+                get: function get() {
                     return this._r1;
-                }, set: function set(r1) {
-                    this._r1 = r1;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcRel.prototype, "r2", { get: function get() {
+                },
+                set: function set(r1) {
+                    this._r1 = r1;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcRel.prototype, "r2", {
+                get: function get() {
                     return this._r2;
-                }, set: function set(r2) {
-                    this._r2 = r2;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcRel.prototype, "angle", { get: function get() {
+                },
+                set: function set(r2) {
+                    this._r2 = r2;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcRel.prototype, "angle", {
+                get: function get() {
                     return this._angle;
-                }, set: function set(angle) {
-                    this._angle = angle;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcRel.prototype, "largeArcFlag", { get: function get() {
+                },
+                set: function set(angle) {
+                    this._angle = angle;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcRel.prototype, "largeArcFlag", {
+                get: function get() {
                     return this._largeArcFlag;
-                }, set: function set(largeArcFlag) {
-                    this._largeArcFlag = largeArcFlag;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegArcRel.prototype, "sweepFlag", { get: function get() {
+                },
+                set: function set(largeArcFlag) {
+                    this._largeArcFlag = largeArcFlag;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegArcRel.prototype, "sweepFlag", {
+                get: function get() {
                     return this._sweepFlag;
-                }, set: function set(sweepFlag) {
-                    this._sweepFlag = sweepFlag;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(sweepFlag) {
+                    this._sweepFlag = sweepFlag;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegLinetoHorizontalAbs = function (owningPathSegList, x) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS, "H", owningPathSegList);
             window.SVGPathSegLinetoHorizontalAbs.prototype.clone = function () {
                 return new window.SVGPathSegLinetoHorizontalAbs(undefined, this._x);
             };
-            Object.defineProperty(window.SVGPathSegLinetoHorizontalAbs.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegLinetoHorizontalAbs.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegLinetoHorizontalRel = function (owningPathSegList, x) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL, "h", owningPathSegList);
             window.SVGPathSegLinetoHorizontalRel.prototype.clone = function () {
                 return new window.SVGPathSegLinetoHorizontalRel(undefined, this._x);
             };
-            Object.defineProperty(window.SVGPathSegLinetoHorizontalRel.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegLinetoHorizontalRel.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegLinetoVerticalAbs = function (owningPathSegList, y) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS, "V", owningPathSegList);
             window.SVGPathSegLinetoVerticalAbs.prototype.clone = function () {
                 return new window.SVGPathSegLinetoVerticalAbs(undefined, this._y);
             };
-            Object.defineProperty(window.SVGPathSegLinetoVerticalAbs.prototype, "y", { get: function get() {
+            Object.defineProperty(window.SVGPathSegLinetoVerticalAbs.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegLinetoVerticalRel = function (owningPathSegList, y) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL, "v", owningPathSegList);
             window.SVGPathSegLinetoVerticalRel.prototype.clone = function () {
                 return new window.SVGPathSegLinetoVerticalRel(undefined, this._y);
             };
-            Object.defineProperty(window.SVGPathSegLinetoVerticalRel.prototype, "y", { get: function get() {
+            Object.defineProperty(window.SVGPathSegLinetoVerticalRel.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegCurvetoCubicSmoothAbs = function (owningPathSegList, x, y, x2, y2) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, "S", owningPathSegList);
             window.SVGPathSegCurvetoCubicSmoothAbs.prototype.clone = function () {
                 return new window.SVGPathSegCurvetoCubicSmoothAbs(undefined, this._x, this._y, this._x2, this._y2);
             };
-            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "x2", { get: function get() {
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "x2", {
+                get: function get() {
                     return this._x2;
-                }, set: function set(x2) {
-                    this._x2 = x2;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "y2", { get: function get() {
+                },
+                set: function set(x2) {
+                    this._x2 = x2;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "y2", {
+                get: function get() {
                     return this._y2;
-                }, set: function set(y2) {
-                    this._y2 = y2;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y2) {
+                    this._y2 = y2;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegCurvetoCubicSmoothRel = function (owningPathSegList, x, y, x2, y2) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL, "s", owningPathSegList);
             window.SVGPathSegCurvetoCubicSmoothRel.prototype.clone = function () {
                 return new window.SVGPathSegCurvetoCubicSmoothRel(undefined, this._x, this._y, this._x2, this._y2);
             };
-            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "x2", { get: function get() {
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "x2", {
+                get: function get() {
                     return this._x2;
-                }, set: function set(x2) {
-                    this._x2 = x2;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "y2", { get: function get() {
+                },
+                set: function set(x2) {
+                    this._x2 = x2;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "y2", {
+                get: function get() {
                     return this._y2;
-                }, set: function set(y2) {
-                    this._y2 = y2;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y2) {
+                    this._y2 = y2;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegCurvetoQuadraticSmoothAbs = function (owningPathSegList, x, y) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, "T", owningPathSegList);
             window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone = function () {
                 return new window.SVGPathSegCurvetoQuadraticSmoothAbs(undefined, this._x, this._y);
             };
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             window.SVGPathSegCurvetoQuadraticSmoothRel = function (owningPathSegList, x, y) {
                 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, "t", owningPathSegList);
             window.SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone = function () {
                 return new window.SVGPathSegCurvetoQuadraticSmoothRel(undefined, this._x, this._y);
             };
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype, "x", { get: function get() {
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype, "x", {
+                get: function get() {
                     return this._x;
-                }, set: function set(x) {
-                    this._x = x;this._segmentChanged();
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype, "y", { get: function get() {
+                },
+                set: function set(x) {
+                    this._x = x;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype, "y", {
+                get: function get() {
                     return this._y;
-                }, set: function set(y) {
-                    this._y = y;this._segmentChanged();
-                }, enumerable: true });
+                },
+                set: function set(y) {
+                    this._y = y;
+                    this._segmentChanged();
+                },
+                enumerable: true
+            });
 
             // Add createSVGPathSeg* functions to window.SVGPathElement.
             // Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-Interfacewindow.SVGPathElement.
                 this._list = this._parsePath(this._pathElement.getAttribute("d"));
 
                 // Use a MutationObserver to catch changes to the path's "d" attribute.
-                this._mutationObserverConfig = { "attributes": true, "attributeFilter": ["d"] };
+                this._mutationObserverConfig = {
+                    "attributes": true,
+                    "attributeFilter": ["d"]
+                };
                 this._pathElementMutationObserver = new MutationObserver(this._updateListFromPathMutations.bind(this));
                 this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig);
             };
                 enumerable: true
             });
             // FIXME: The following are not implemented and simply return window.SVGPathElement.pathSegList.
-            Object.defineProperty(window.SVGPathElement.prototype, "normalizedPathSegList", { get: function get() {
+            Object.defineProperty(window.SVGPathElement.prototype, "normalizedPathSegList", {
+                get: function get() {
                     return this.pathSegList;
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathElement.prototype, "animatedPathSegList", { get: function get() {
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathElement.prototype, "animatedPathSegList", {
+                get: function get() {
                     return this.pathSegList;
-                }, enumerable: true });
-            Object.defineProperty(window.SVGPathElement.prototype, "animatedNormalizedPathSegList", { get: function get() {
+                },
+                enumerable: true
+            });
+            Object.defineProperty(window.SVGPathElement.prototype, "animatedNormalizedPathSegList", {
+                get: function get() {
                     return this.pathSegList;
-                }, enumerable: true });
+                },
+                enumerable: true
+            });
 
             // Process any pending mutations to the path element and update the list as needed.
             // This should be the first call of all public functions and is needed because
                             this._skipOptionalSpaces();
                             return new window.SVGPathSegClosePath(owningPathSegList);
                         case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:
-                            var points = { x1: this._parseNumber(), y1: this._parseNumber(), x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() };
+                            var points = {
+                                x1: this._parseNumber(),
+                                y1: this._parseNumber(),
+                                x2: this._parseNumber(),
+                                y2: this._parseNumber(),
+                                x: this._parseNumber(),
+                                y: this._parseNumber()
+                            };
                             return new window.SVGPathSegCurvetoCubicRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2);
                         case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
-                            var points = { x1: this._parseNumber(), y1: this._parseNumber(), x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() };
+                            var points = {
+                                x1: this._parseNumber(),
+                                y1: this._parseNumber(),
+                                x2: this._parseNumber(),
+                                y2: this._parseNumber(),
+                                x: this._parseNumber(),
+                                y: this._parseNumber()
+                            };
                             return new window.SVGPathSegCurvetoCubicAbs(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2);
                         case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
-                            var points = { x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() };
+                            var points = {
+                                x2: this._parseNumber(),
+                                y2: this._parseNumber(),
+                                x: this._parseNumber(),
+                                y: this._parseNumber()
+                            };
                             return new window.SVGPathSegCurvetoCubicSmoothRel(owningPathSegList, points.x, points.y, points.x2, points.y2);
                         case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
-                            var points = { x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() };
+                            var points = {
+                                x2: this._parseNumber(),
+                                y2: this._parseNumber(),
+                                x: this._parseNumber(),
+                                y: this._parseNumber()
+                            };
                             return new window.SVGPathSegCurvetoCubicSmoothAbs(owningPathSegList, points.x, points.y, points.x2, points.y2);
                         case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:
-                            var points = { x1: this._parseNumber(), y1: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() };
+                            var points = {
+                                x1: this._parseNumber(),
+                                y1: this._parseNumber(),
+                                x: this._parseNumber(),
+                                y: this._parseNumber()
+                            };
                             return new window.SVGPathSegCurvetoQuadraticRel(owningPathSegList, points.x, points.y, points.x1, points.y1);
                         case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:
-                            var points = { x1: this._parseNumber(), y1: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() };
+                            var points = {
+                                x1: this._parseNumber(),
+                                y1: this._parseNumber(),
+                                x: this._parseNumber(),
+                                y: this._parseNumber()
+                            };
                             return new window.SVGPathSegCurvetoQuadraticAbs(owningPathSegList, points.x, points.y, points.x1, points.y1);
                         case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
                             return new window.SVGPathSegCurvetoQuadraticSmoothRel(owningPathSegList, this._parseNumber(), this._parseNumber());
                         case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
                             return new window.SVGPathSegCurvetoQuadraticSmoothAbs(owningPathSegList, this._parseNumber(), this._parseNumber());
                         case window.SVGPathSeg.PATHSEG_ARC_REL:
-                            var points = { x1: this._parseNumber(), y1: this._parseNumber(), arcAngle: this._parseNumber(), arcLarge: this._parseArcFlag(), arcSweep: this._parseArcFlag(), x: this._parseNumber(), y: this._parseNumber() };
+                            var points = {
+                                x1: this._parseNumber(),
+                                y1: this._parseNumber(),
+                                arcAngle: this._parseNumber(),
+                                arcLarge: this._parseArcFlag(),
+                                arcSweep: this._parseArcFlag(),
+                                x: this._parseNumber(),
+                                y: this._parseNumber()
+                            };
                             return new window.SVGPathSegArcRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.arcAngle, points.arcLarge, points.arcSweep);
                         case window.SVGPathSeg.PATHSEG_ARC_ABS:
-                            var points = { x1: this._parseNumber(), y1: this._parseNumber(), arcAngle: this._parseNumber(), arcLarge: this._parseArcFlag(), arcSweep: this._parseArcFlag(), x: this._parseNumber(), y: this._parseNumber() };
+                            var points = {
+                                x1: this._parseNumber(),
+                                y1: this._parseNumber(),
+                                arcAngle: this._parseNumber(),
+                                arcLarge: this._parseArcFlag(),
+                                arcSweep: this._parseArcFlag(),
+                                x: this._parseNumber(),
+                                y: this._parseNumber()
+                            };
                             return new window.SVGPathSegArcAbs(owningPathSegList, points.x, points.y, points.x1, points.y1, points.arcAngle, points.arcLarge, points.arcSweep);
                         default:
                             throw "Unknown path seg type.";
 
     /* jshint ignore:end */
 
-    c3_chart_fn.axis = function () {};
-    c3_chart_fn.axis.labels = function (labels) {
+    Chart.prototype.axis = function () {};
+    Chart.prototype.axis.labels = function (labels) {
         var $$ = this.internal;
         if (arguments.length) {
             Object.keys(labels).forEach(function (axisId) {
         }
         // TODO: return some values?
     };
-    c3_chart_fn.axis.max = function (max) {
+    Chart.prototype.axis.max = function (max) {
         var $$ = this.internal,
             config = $$.config;
         if (arguments.length) {
             };
         }
     };
-    c3_chart_fn.axis.min = function (min) {
+    Chart.prototype.axis.min = function (min) {
         var $$ = this.internal,
             config = $$.config;
         if (arguments.length) {
             };
         }
     };
-    c3_chart_fn.axis.range = function (range) {
+    Chart.prototype.axis.range = function (range) {
         if (arguments.length) {
             if (isDefined(range.max)) {
                 this.axis.max(range.max);
         }
     };
 
-    c3_chart_fn.category = function (i, category) {
+    Chart.prototype.category = function (i, category) {
         var $$ = this.internal,
             config = $$.config;
         if (arguments.length > 1) {
         }
         return config.axis_x_categories[i];
     };
-    c3_chart_fn.categories = function (categories) {
+    Chart.prototype.categories = function (categories) {
         var $$ = this.internal,
             config = $$.config;
         if (!arguments.length) {
         return config.axis_x_categories;
     };
 
-    c3_chart_fn.resize = function (size) {
+    Chart.prototype.resize = function (size) {
         var $$ = this.internal,
             config = $$.config;
         config.size_width = size ? size.width : null;
         this.flush();
     };
 
-    c3_chart_fn.flush = function () {
+    Chart.prototype.flush = function () {
         var $$ = this.internal;
         $$.updateAndRedraw({ withLegend: true, withTransition: false, withTransitionForTransform: false });
     };
 
-    c3_chart_fn.destroy = function () {
+    Chart.prototype.destroy = function () {
         var $$ = this.internal;
 
         window.clearInterval($$.intervalForObserveInserted);
     };
 
     // TODO: fix
-    c3_chart_fn.color = function (id) {
+    Chart.prototype.color = function (id) {
         var $$ = this.internal;
         return $$.color(id); // more patterns
     };
 
-    c3_chart_fn.data = function (targetIds) {
+    Chart.prototype.data = function (targetIds) {
         var targets = this.internal.data.targets;
         return typeof targetIds === 'undefined' ? targets : targets.filter(function (t) {
             return [].concat(targetIds).indexOf(t.id) >= 0;
         });
     };
-    c3_chart_fn.data.shown = function (targetIds) {
+    Chart.prototype.data.shown = function (targetIds) {
         return this.internal.filterTargetsToShow(this.data(targetIds));
     };
-    c3_chart_fn.data.values = function (targetId) {
+    Chart.prototype.data.values = function (targetId) {
         var targets,
             values = null;
         if (targetId) {
         }
         return values;
     };
-    c3_chart_fn.data.names = function (names) {
+    Chart.prototype.data.names = function (names) {
         this.internal.clearLegendItemTextBoxCache();
         return this.internal.updateDataAttributes('names', names);
     };
-    c3_chart_fn.data.colors = function (colors) {
+    Chart.prototype.data.colors = function (colors) {
         return this.internal.updateDataAttributes('colors', colors);
     };
-    c3_chart_fn.data.axes = function (axes) {
+    Chart.prototype.data.axes = function (axes) {
         return this.internal.updateDataAttributes('axes', axes);
     };
 
-    c3_chart_fn.flow = function (args) {
+    Chart.prototype.flow = function (args) {
         var $$ = this.internal,
             targets,
             data,
         });
     };
 
-    c3_chart_internal_fn.generateFlow = function (args) {
+    ChartInternal.prototype.generateFlow = function (args) {
         var $$ = this,
             config = $$.config,
             d3 = $$.d3;
         };
     };
 
-    c3_chart_fn.focus = function (targetIds) {
+    Chart.prototype.focus = function (targetIds) {
         var $$ = this.internal,
             candidates;
 
         });
     };
 
-    c3_chart_fn.defocus = function (targetIds) {
+    Chart.prototype.defocus = function (targetIds) {
         var $$ = this.internal,
             candidates;
 
         $$.defocusedTargetIds = targetIds;
     };
 
-    c3_chart_fn.revert = function (targetIds) {
+    Chart.prototype.revert = function (targetIds) {
         var $$ = this.internal,
             candidates;
 
         $$.defocusedTargetIds = [];
     };
 
-    c3_chart_fn.xgrids = function (grids) {
+    Chart.prototype.xgrids = function (grids) {
         var $$ = this.internal,
             config = $$.config;
         if (!grids) {
         $$.redrawWithoutRescale();
         return config.grid_x_lines;
     };
-    c3_chart_fn.xgrids.add = function (grids) {
+    Chart.prototype.xgrids.add = function (grids) {
         var $$ = this.internal;
         return this.xgrids($$.config.grid_x_lines.concat(grids ? grids : []));
     };
-    c3_chart_fn.xgrids.remove = function (params) {
+    Chart.prototype.xgrids.remove = function (params) {
         // TODO: multiple
         var $$ = this.internal;
         $$.removeGridLines(params, true);
     };
 
-    c3_chart_fn.ygrids = function (grids) {
+    Chart.prototype.ygrids = function (grids) {
         var $$ = this.internal,
             config = $$.config;
         if (!grids) {
         $$.redrawWithoutRescale();
         return config.grid_y_lines;
     };
-    c3_chart_fn.ygrids.add = function (grids) {
+    Chart.prototype.ygrids.add = function (grids) {
         var $$ = this.internal;
         return this.ygrids($$.config.grid_y_lines.concat(grids ? grids : []));
     };
-    c3_chart_fn.ygrids.remove = function (params) {
+    Chart.prototype.ygrids.remove = function (params) {
         // TODO: multiple
         var $$ = this.internal;
         $$.removeGridLines(params, false);
     };
 
-    c3_chart_fn.groups = function (groups) {
+    Chart.prototype.groups = function (groups) {
         var $$ = this.internal,
             config = $$.config;
         if (isUndefined(groups)) {
         return config.data_groups;
     };
 
-    c3_chart_fn.legend = function () {};
-    c3_chart_fn.legend.show = function (targetIds) {
+    Chart.prototype.legend = function () {};
+    Chart.prototype.legend.show = function (targetIds) {
         var $$ = this.internal;
         $$.showLegend($$.mapToTargetIds(targetIds));
         $$.updateAndRedraw({ withLegend: true });
     };
-    c3_chart_fn.legend.hide = function (targetIds) {
+    Chart.prototype.legend.hide = function (targetIds) {
         var $$ = this.internal;
         $$.hideLegend($$.mapToTargetIds(targetIds));
-        $$.updateAndRedraw({ withLegend: true });
+        $$.updateAndRedraw({ withLegend: false });
     };
 
-    c3_chart_fn.load = function (args) {
+    Chart.prototype.load = function (args) {
         var $$ = this.internal,
             config = $$.config;
         // update xs if specified
         }
         // update names if exists
         if ('names' in args) {
-            c3_chart_fn.data.names.bind(this)(args.names);
+            Chart.prototype.data.names.bind(this)(args.names);
         }
         // update classes if exists
         if ('classes' in args) {
         }
     };
 
-    c3_chart_fn.unload = function (args) {
+    Chart.prototype.unload = function (args) {
         var $$ = this.internal;
         args = args || {};
         if (args instanceof Array) {
         });
     };
 
-    c3_chart_fn.regions = function (regions) {
+    Chart.prototype.regions = function (regions) {
         var $$ = this.internal,
             config = $$.config;
         if (!regions) {
         $$.redrawWithoutRescale();
         return config.regions;
     };
-    c3_chart_fn.regions.add = function (regions) {
+    Chart.prototype.regions.add = function (regions) {
         var $$ = this.internal,
             config = $$.config;
         if (!regions) {
         $$.redrawWithoutRescale();
         return config.regions;
     };
-    c3_chart_fn.regions.remove = function (options) {
+    Chart.prototype.regions.remove = function (options) {
         var $$ = this.internal,
             config = $$.config,
             duration,
         return config.regions;
     };
 
-    c3_chart_fn.selected = function (targetId) {
+    Chart.prototype.selected = function (targetId) {
         var $$ = this.internal,
             d3 = $$.d3;
         return d3.merge($$.main.selectAll('.' + CLASS.shapes + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape).filter(function () {
             });
         }));
     };
-    c3_chart_fn.select = function (ids, indices, resetOther) {
+    Chart.prototype.select = function (ids, indices, resetOther) {
         var $$ = this.internal,
             d3 = $$.d3,
             config = $$.config;
             }
         });
     };
-    c3_chart_fn.unselect = function (ids, indices) {
+    Chart.prototype.unselect = function (ids, indices) {
         var $$ = this.internal,
             d3 = $$.d3,
             config = $$.config;
         });
     };
 
-    c3_chart_fn.show = function (targetIds, options) {
+    Chart.prototype.show = function (targetIds, options) {
         var $$ = this.internal,
             targets;
 
         $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true });
     };
 
-    c3_chart_fn.hide = function (targetIds, options) {
+    Chart.prototype.hide = function (targetIds, options) {
         var $$ = this.internal,
             targets;
 
         $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true });
     };
 
-    c3_chart_fn.toggle = function (targetIds, options) {
+    Chart.prototype.toggle = function (targetIds, options) {
         var that = this,
             $$ = this.internal;
         $$.mapToTargetIds(targetIds).forEach(function (targetId) {
         });
     };
 
-    c3_chart_fn.tooltip = function () {};
-    c3_chart_fn.tooltip.show = function (args) {
+    Chart.prototype.tooltip = function () {};
+    Chart.prototype.tooltip.show = function (args) {
         var $$ = this.internal,
             targets,
             data,
 
         $$.config.tooltip_onshow.call($$, data);
     };
-    c3_chart_fn.tooltip.hide = function () {
+    Chart.prototype.tooltip.hide = function () {
         // TODO: get target data by checking the state of focus
         this.internal.dispatchEvent('mouseout', 0);
 
         this.internal.config.tooltip_onhide.call(this);
     };
 
-    c3_chart_fn.transform = function (type, targetIds) {
+    Chart.prototype.transform = function (type, targetIds) {
         var $$ = this.internal,
             options = ['pie', 'donut'].indexOf(type) >= 0 ? { withTransform: true } : null;
         $$.transformTo(targetIds, type, options);
     };
 
-    c3_chart_internal_fn.transformTo = function (targetIds, type, optionsForRedraw) {
+    ChartInternal.prototype.transformTo = function (targetIds, type, optionsForRedraw) {
         var $$ = this,
             withTransitionForAxis = !$$.hasArcType(),
             options = optionsForRedraw || { withTransitionForAxis: withTransitionForAxis };
         $$.updateAndRedraw(options);
     };
 
-    c3_chart_fn.x = function (x) {
+    Chart.prototype.x = function (x) {
         var $$ = this.internal;
         if (arguments.length) {
             $$.updateTargetX($$.data.targets, x);
         }
         return $$.data.xs;
     };
-    c3_chart_fn.xs = function (xs) {
+    Chart.prototype.xs = function (xs) {
         var $$ = this.internal;
         if (arguments.length) {
             $$.updateTargetXs($$.data.targets, xs);
         return $$.data.xs;
     };
 
-    c3_chart_fn.zoom = function (domain) {
+    Chart.prototype.zoom = function (domain) {
         var $$ = this.internal;
         if (domain) {
             if ($$.isTimeSeries()) {
             return $$.x.domain();
         }
     };
-    c3_chart_fn.zoom.enable = function (enabled) {
+    Chart.prototype.zoom.enable = function (enabled) {
         var $$ = this.internal;
         $$.config.zoom_enabled = enabled;
         $$.updateAndRedraw();
     };
-    c3_chart_fn.unzoom = function () {
+    Chart.prototype.unzoom = function () {
         var $$ = this.internal;
         if ($$.config.subchart_show) {
             $$.brush.clear();
         }
     };
 
-    c3_chart_fn.zoom.max = function (max) {
+    Chart.prototype.zoom.max = function (max) {
         var $$ = this.internal,
             config = $$.config,
             d3 = $$.d3;
         }
     };
 
-    c3_chart_fn.zoom.min = function (min) {
+    Chart.prototype.zoom.min = function (min) {
         var $$ = this.internal,
             config = $$.config,
             d3 = $$.d3;
         }
     };
 
-    c3_chart_fn.zoom.range = function (range) {
+    Chart.prototype.zoom.range = function (range) {
         if (arguments.length) {
             if (isDefined(range.max)) {
                 this.domain.max(range.max);
         }
     };
 
-    c3_chart_internal_fn.initPie = function () {
+    ChartInternal.prototype.initPie = function () {
         var $$ = this,
             d3 = $$.d3;
         $$.pie = d3.pie().value(function (d) {
         $$.pie.sort(orderFct || null);
     };
 
-    c3_chart_internal_fn.updateRadius = function () {
+    ChartInternal.prototype.updateRadius = function () {
         var $$ = this,
             config = $$.config,
             w = config.gauge_width || config.donut_width,
         $$.gaugeArcWidth = w ? w : gaugeArcWidth <= $$.radius - $$.innerRadius ? $$.radius - $$.innerRadius : gaugeArcWidth <= $$.radius ? gaugeArcWidth : $$.radius;
     };
 
-    c3_chart_internal_fn.updateArc = function () {
+    ChartInternal.prototype.updateArc = function () {
         var $$ = this;
         $$.svgArc = $$.getSvgArc();
         $$.svgArcExpanded = $$.getSvgArcExpanded();
         $$.svgArcExpandedSub = $$.getSvgArcExpanded(0.98);
     };
 
-    c3_chart_internal_fn.updateAngle = function (d) {
+    ChartInternal.prototype.updateAngle = function (d) {
         var $$ = this,
             config = $$.config,
             found = false,
         return found ? d : null;
     };
 
-    c3_chart_internal_fn.getSvgArc = function () {
+    ChartInternal.prototype.getSvgArc = function () {
         var $$ = this,
             hasGaugeType = $$.hasType('gauge'),
             singleArcWidth = $$.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
         return newArc;
     };
 
-    c3_chart_internal_fn.getSvgArcExpanded = function (rate) {
+    ChartInternal.prototype.getSvgArcExpanded = function (rate) {
         rate = rate || 1;
         var $$ = this,
             hasGaugeType = $$.hasType('gauge'),
         };
     };
 
-    c3_chart_internal_fn.getArc = function (d, withoutUpdate, force) {
+    ChartInternal.prototype.getArc = function (d, withoutUpdate, force) {
         return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
     };
 
-    c3_chart_internal_fn.transformForArcLabel = function (d) {
+    ChartInternal.prototype.transformForArcLabel = function (d) {
         var $$ = this,
             config = $$.config,
             updated = $$.updateAngle(d),
         return translate;
     };
 
-    c3_chart_internal_fn.getArcRatio = function (d) {
+    ChartInternal.prototype.getArcRatio = function (d) {
         var $$ = this,
             config = $$.config,
             whole = Math.PI * ($$.hasType('gauge') && !config.gauge_fullCircle ? 1 : 2);
         return d ? (d.endAngle - d.startAngle) / whole : null;
     };
 
-    c3_chart_internal_fn.convertToArcData = function (d) {
+    ChartInternal.prototype.convertToArcData = function (d) {
         return this.addName({
             id: d.data.id,
             value: d.value,
         });
     };
 
-    c3_chart_internal_fn.textForArcLabel = function (d) {
+    ChartInternal.prototype.textForArcLabel = function (d) {
         var $$ = this,
             updated,
             value,
         return format ? format(value, ratio, id) : $$.defaultArcValueFormat(value, ratio);
     };
 
-    c3_chart_internal_fn.textForGaugeMinMax = function (value, isMax) {
+    ChartInternal.prototype.textForGaugeMinMax = function (value, isMax) {
         var $$ = this,
             format = $$.getGaugeLabelExtents();
 
         return format ? format(value, isMax) : value;
     };
 
-    c3_chart_internal_fn.expandArc = function (targetIds) {
+    ChartInternal.prototype.expandArc = function (targetIds) {
         var $$ = this,
             interval;
 
                 return;
             }
             $$.d3.select(this).selectAll('path').transition().duration($$.expandDuration(d.data.id)).attr("d", $$.svgArcExpanded).transition().duration($$.expandDuration(d.data.id) * 2).attr("d", $$.svgArcExpandedSub).each(function (d) {
-                if ($$.isDonutType(d.data)) {
-                    // callback here
-                }
+                if ($$.isDonutType(d.data)) ;
             });
         });
     };
 
-    c3_chart_internal_fn.unexpandArc = function (targetIds) {
+    ChartInternal.prototype.unexpandArc = function (targetIds) {
         var $$ = this;
 
         if ($$.transiting) {
         $$.svg.selectAll('.' + CLASS.arc);
     };
 
-    c3_chart_internal_fn.expandDuration = function (id) {
+    ChartInternal.prototype.expandDuration = function (id) {
         var $$ = this,
             config = $$.config;
 
         }
     };
 
-    c3_chart_internal_fn.shouldExpand = function (id) {
+    ChartInternal.prototype.shouldExpand = function (id) {
         var $$ = this,
             config = $$.config;
         return $$.isDonutType(id) && config.donut_expand || $$.isGaugeType(id) && config.gauge_expand || $$.isPieType(id) && config.pie_expand;
     };
 
-    c3_chart_internal_fn.shouldShowArcLabel = function () {
+    ChartInternal.prototype.shouldShowArcLabel = function () {
         var $$ = this,
             config = $$.config,
             shouldShow = true;
         return shouldShow;
     };
 
-    c3_chart_internal_fn.meetsArcLabelThreshold = function (ratio) {
+    ChartInternal.prototype.meetsArcLabelThreshold = function (ratio) {
         var $$ = this,
             config = $$.config,
             threshold = $$.hasType('donut') ? config.donut_label_threshold : config.pie_label_threshold;
         return ratio >= threshold;
     };
 
-    c3_chart_internal_fn.getArcLabelFormat = function () {
+    ChartInternal.prototype.getArcLabelFormat = function () {
         var $$ = this,
             config = $$.config,
             format = config.pie_label_format;
         return format;
     };
 
-    c3_chart_internal_fn.getGaugeLabelExtents = function () {
+    ChartInternal.prototype.getGaugeLabelExtents = function () {
         var $$ = this,
             config = $$.config;
         return config.gauge_label_extents;
     };
 
-    c3_chart_internal_fn.getArcTitle = function () {
+    ChartInternal.prototype.getArcTitle = function () {
         var $$ = this;
         return $$.hasType('donut') ? $$.config.donut_title : "";
     };
 
-    c3_chart_internal_fn.updateTargetsForArc = function (targets) {
+    ChartInternal.prototype.updateTargetsForArc = function (targets) {
         var $$ = this,
             main = $$.main,
             mainPies,
         //mainPieUpdate.exit().remove();
     };
 
-    c3_chart_internal_fn.initArc = function () {
+    ChartInternal.prototype.initArc = function () {
         var $$ = this;
         $$.arcs = $$.main.select('.' + CLASS.chart).append("g").attr("class", CLASS.chartArcs).attr("transform", $$.getTranslate('arc'));
         $$.arcs.append('text').attr('class', CLASS.chartArcsTitle).style("text-anchor", "middle").text($$.getArcTitle());
     };
 
-    c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransform) {
+    ChartInternal.prototype.redrawArc = function (duration, durationForExit, withTransform) {
         var $$ = this,
             d3 = $$.d3,
             config = $$.config,
             main = $$.main,
             arcs,
             mainArc,
-            backgroundArc,
             arcLabelLines,
             mainArcLabelLine,
             hasGaugeType = $$.hasType('gauge');
 
         if (hasGaugeType) {
             var index = 0;
-            backgroundArc = $$.arcs.select('g.' + CLASS.chartArcsBackground).selectAll('path.' + CLASS.chartArcsBackground).data($$.data.targets);
-            backgroundArc.enter().append("path");
-            backgroundArc.attr("class", function (d, i) {
+            var backgroundArc = $$.arcs.select('g.' + CLASS.chartArcsBackground).selectAll('path.' + CLASS.chartArcsBackground).data($$.data.targets);
+
+            backgroundArc.enter().append("path").attr("class", function (d, i) {
                 return CLASS.chartArcsBackground + ' ' + CLASS.chartArcsBackground + '-' + i;
-            }).attr("d", function (d1) {
+            }).merge(backgroundArc).attr("d", function (d1) {
                 if ($$.hiddenTargetIds.indexOf(d1.id) >= 0) {
                     return "M 0 0";
                 }
                 };
                 return $$.getArc(d, true, true);
             });
+
             backgroundArc.exit().remove();
 
             $$.arcs.select('.' + CLASS.chartArcsGaugeUnit).attr("dy", ".75em").text(config.gauge_label_show ? config.gauge_units : '');
             $$.arcs.select('.' + CLASS.chartArcsGaugeMax).attr("dx", $$.innerRadius + ($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2) + "px").attr("dy", "1.2em").text(config.gauge_label_show ? $$.textForGaugeMinMax(config.gauge_max, true) : '');
         }
     };
-    c3_chart_internal_fn.initGauge = function () {
+    ChartInternal.prototype.initGauge = function () {
         var arcs = this.arcs;
         if (this.hasType('gauge')) {
             arcs.append('g').attr("class", CLASS.chartArcsBackground);
             arcs.append("text").attr("class", CLASS.chartArcsGaugeMax).style("text-anchor", "middle").style("pointer-events", "none");
         }
     };
-    c3_chart_internal_fn.getGaugeLabelHeight = function () {
+    ChartInternal.prototype.getGaugeLabelHeight = function () {
         return this.config.gauge_label_show ? 20 : 0;
     };
 
-    c3_chart_internal_fn.hasCaches = function (ids) {
+    ChartInternal.prototype.hasCaches = function (ids) {
         for (var i = 0; i < ids.length; i++) {
             if (!(ids[i] in this.cache)) {
                 return false;
         }
         return true;
     };
-    c3_chart_internal_fn.addCache = function (id, target) {
+    ChartInternal.prototype.addCache = function (id, target) {
         this.cache[id] = this.cloneTarget(target);
     };
-    c3_chart_internal_fn.getCaches = function (ids) {
+    ChartInternal.prototype.getCaches = function (ids) {
         var targets = [],
             i;
         for (i = 0; i < ids.length; i++) {
         return targets;
     };
 
-    c3_chart_internal_fn.categoryName = function (i) {
+    ChartInternal.prototype.categoryName = function (i) {
         var config = this.config;
         return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i;
     };
 
-    c3_chart_internal_fn.generateTargetClass = function (targetId) {
+    ChartInternal.prototype.generateTargetClass = function (targetId) {
         return targetId || targetId === 0 ? ('-' + targetId).replace(/\s/g, '-') : '';
     };
-    c3_chart_internal_fn.generateClass = function (prefix, targetId) {
+    ChartInternal.prototype.generateClass = function (prefix, targetId) {
         return " " + prefix + " " + prefix + this.generateTargetClass(targetId);
     };
-    c3_chart_internal_fn.classText = function (d) {
+    ChartInternal.prototype.classText = function (d) {
         return this.generateClass(CLASS.text, d.index);
     };
-    c3_chart_internal_fn.classTexts = function (d) {
+    ChartInternal.prototype.classTexts = function (d) {
         return this.generateClass(CLASS.texts, d.id);
     };
-    c3_chart_internal_fn.classShape = function (d) {
+    ChartInternal.prototype.classShape = function (d) {
         return this.generateClass(CLASS.shape, d.index);
     };
-    c3_chart_internal_fn.classShapes = function (d) {
+    ChartInternal.prototype.classShapes = function (d) {
         return this.generateClass(CLASS.shapes, d.id);
     };
-    c3_chart_internal_fn.classLine = function (d) {
+    ChartInternal.prototype.classLine = function (d) {
         return this.classShape(d) + this.generateClass(CLASS.line, d.id);
     };
-    c3_chart_internal_fn.classLines = function (d) {
+    ChartInternal.prototype.classLines = function (d) {
         return this.classShapes(d) + this.generateClass(CLASS.lines, d.id);
     };
-    c3_chart_internal_fn.classCircle = function (d) {
+    ChartInternal.prototype.classCircle = function (d) {
         return this.classShape(d) + this.generateClass(CLASS.circle, d.index);
     };
-    c3_chart_internal_fn.classCircles = function (d) {
+    ChartInternal.prototype.classCircles = function (d) {
         return this.classShapes(d) + this.generateClass(CLASS.circles, d.id);
     };
-    c3_chart_internal_fn.classBar = function (d) {
+    ChartInternal.prototype.classBar = function (d) {
         return this.classShape(d) + this.generateClass(CLASS.bar, d.index);
     };
-    c3_chart_internal_fn.classBars = function (d) {
+    ChartInternal.prototype.classBars = function (d) {
         return this.classShapes(d) + this.generateClass(CLASS.bars, d.id);
     };
-    c3_chart_internal_fn.classArc = function (d) {
+    ChartInternal.prototype.classArc = function (d) {
         return this.classShape(d.data) + this.generateClass(CLASS.arc, d.data.id);
     };
-    c3_chart_internal_fn.classArcs = function (d) {
+    ChartInternal.prototype.classArcs = function (d) {
         return this.classShapes(d.data) + this.generateClass(CLASS.arcs, d.data.id);
     };
-    c3_chart_internal_fn.classArea = function (d) {
+    ChartInternal.prototype.classArea = function (d) {
         return this.classShape(d) + this.generateClass(CLASS.area, d.id);
     };
-    c3_chart_internal_fn.classAreas = function (d) {
+    ChartInternal.prototype.classAreas = function (d) {
         return this.classShapes(d) + this.generateClass(CLASS.areas, d.id);
     };
-    c3_chart_internal_fn.classRegion = function (d, i) {
+    ChartInternal.prototype.classRegion = function (d, i) {
         return this.generateClass(CLASS.region, i) + ' ' + ('class' in d ? d['class'] : '');
     };
-    c3_chart_internal_fn.classEvent = function (d) {
+    ChartInternal.prototype.classEvent = function (d) {
         return this.generateClass(CLASS.eventRect, d.index);
     };
-    c3_chart_internal_fn.classTarget = function (id) {
+    ChartInternal.prototype.classTarget = function (id) {
         var $$ = this;
         var additionalClassSuffix = $$.config.data_classes[id],
             additionalClass = '';
         }
         return $$.generateClass(CLASS.target, id) + additionalClass;
     };
-    c3_chart_internal_fn.classFocus = function (d) {
+    ChartInternal.prototype.classFocus = function (d) {
         return this.classFocused(d) + this.classDefocused(d);
     };
-    c3_chart_internal_fn.classFocused = function (d) {
+    ChartInternal.prototype.classFocused = function (d) {
         return ' ' + (this.focusedTargetIds.indexOf(d.id) >= 0 ? CLASS.focused : '');
     };
-    c3_chart_internal_fn.classDefocused = function (d) {
+    ChartInternal.prototype.classDefocused = function (d) {
         return ' ' + (this.defocusedTargetIds.indexOf(d.id) >= 0 ? CLASS.defocused : '');
     };
-    c3_chart_internal_fn.classChartText = function (d) {
+    ChartInternal.prototype.classChartText = function (d) {
         return CLASS.chartText + this.classTarget(d.id);
     };
-    c3_chart_internal_fn.classChartLine = function (d) {
+    ChartInternal.prototype.classChartLine = function (d) {
         return CLASS.chartLine + this.classTarget(d.id);
     };
-    c3_chart_internal_fn.classChartBar = function (d) {
+    ChartInternal.prototype.classChartBar = function (d) {
         return CLASS.chartBar + this.classTarget(d.id);
     };
-    c3_chart_internal_fn.classChartArc = function (d) {
+    ChartInternal.prototype.classChartArc = function (d) {
         return CLASS.chartArc + this.classTarget(d.data.id);
     };
-    c3_chart_internal_fn.getTargetSelectorSuffix = function (targetId) {
+    ChartInternal.prototype.getTargetSelectorSuffix = function (targetId) {
         return this.generateTargetClass(targetId).replace(/([?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\])/g, '\\$1');
     };
-    c3_chart_internal_fn.selectorTarget = function (id, prefix) {
+    ChartInternal.prototype.selectorTarget = function (id, prefix) {
         return (prefix || '') + '.' + CLASS.target + this.getTargetSelectorSuffix(id);
     };
-    c3_chart_internal_fn.selectorTargets = function (ids, prefix) {
+    ChartInternal.prototype.selectorTargets = function (ids, prefix) {
         var $$ = this;
         ids = ids || [];
         return ids.length ? ids.map(function (id) {
             return $$.selectorTarget(id, prefix);
         }) : null;
     };
-    c3_chart_internal_fn.selectorLegend = function (id) {
+    ChartInternal.prototype.selectorLegend = function (id) {
         return '.' + CLASS.legendItem + this.getTargetSelectorSuffix(id);
     };
-    c3_chart_internal_fn.selectorLegends = function (ids) {
+    ChartInternal.prototype.selectorLegends = function (ids) {
         var $$ = this;
         return ids && ids.length ? ids.map(function (id) {
             return $$.selectorLegend(id);
         }) : null;
     };
 
-    c3_chart_internal_fn.getClipPath = function (id) {
+    ChartInternal.prototype.getClipPath = function (id) {
         var isIE9 = window.navigator.appVersion.toLowerCase().indexOf("msie 9.") >= 0;
         return "url(" + (isIE9 ? "" : document.URL.split('#')[0]) + "#" + id + ")";
     };
-    c3_chart_internal_fn.appendClip = function (parent, id) {
+    ChartInternal.prototype.appendClip = function (parent, id) {
         return parent.append("clipPath").attr("id", id).append("rect");
     };
-    c3_chart_internal_fn.getAxisClipX = function (forHorizontal) {
+    ChartInternal.prototype.getAxisClipX = function (forHorizontal) {
         // axis line width + padding for left
         var left = Math.max(30, this.margin.left);
         return forHorizontal ? -(1 + left) : -(left - 1);
     };
-    c3_chart_internal_fn.getAxisClipY = function (forHorizontal) {
+    ChartInternal.prototype.getAxisClipY = function (forHorizontal) {
         return forHorizontal ? -20 : -this.margin.top;
     };
-    c3_chart_internal_fn.getXAxisClipX = function () {
+    ChartInternal.prototype.getXAxisClipX = function () {
         var $$ = this;
         return $$.getAxisClipX(!$$.config.axis_rotated);
     };
-    c3_chart_internal_fn.getXAxisClipY = function () {
+    ChartInternal.prototype.getXAxisClipY = function () {
         var $$ = this;
         return $$.getAxisClipY(!$$.config.axis_rotated);
     };
-    c3_chart_internal_fn.getYAxisClipX = function () {
+    ChartInternal.prototype.getYAxisClipX = function () {
         var $$ = this;
         return $$.config.axis_y_inner ? -1 : $$.getAxisClipX($$.config.axis_rotated);
     };
-    c3_chart_internal_fn.getYAxisClipY = function () {
+    ChartInternal.prototype.getYAxisClipY = function () {
         var $$ = this;
         return $$.getAxisClipY($$.config.axis_rotated);
     };
-    c3_chart_internal_fn.getAxisClipWidth = function (forHorizontal) {
+    ChartInternal.prototype.getAxisClipWidth = function (forHorizontal) {
         var $$ = this,
             left = Math.max(30, $$.margin.left),
             right = Math.max(30, $$.margin.right);
         // width + axis line width + padding for left/right
         return forHorizontal ? $$.width + 2 + left + right : $$.margin.left + 20;
     };
-    c3_chart_internal_fn.getAxisClipHeight = function (forHorizontal) {
+    ChartInternal.prototype.getAxisClipHeight = function (forHorizontal) {
         // less than 20 is not enough to show the axis label 'outer' without legend
         return (forHorizontal ? this.margin.bottom : this.margin.top + this.height) + 20;
     };
-    c3_chart_internal_fn.getXAxisClipWidth = function () {
+    ChartInternal.prototype.getXAxisClipWidth = function () {
         var $$ = this;
         return $$.getAxisClipWidth(!$$.config.axis_rotated);
     };
-    c3_chart_internal_fn.getXAxisClipHeight = function () {
+    ChartInternal.prototype.getXAxisClipHeight = function () {
         var $$ = this;
         return $$.getAxisClipHeight(!$$.config.axis_rotated);
     };
-    c3_chart_internal_fn.getYAxisClipWidth = function () {
+    ChartInternal.prototype.getYAxisClipWidth = function () {
         var $$ = this;
         return $$.getAxisClipWidth($$.config.axis_rotated) + ($$.config.axis_y_inner ? 20 : 0);
     };
-    c3_chart_internal_fn.getYAxisClipHeight = function () {
+    ChartInternal.prototype.getYAxisClipHeight = function () {
         var $$ = this;
         return $$.getAxisClipHeight($$.config.axis_rotated);
     };
 
-    c3_chart_internal_fn.generateColor = function () {
+    ChartInternal.prototype.generateColor = function () {
         var $$ = this,
             config = $$.config,
             d3 = $$.d3,
             return callback instanceof Function ? callback(color, d) : color;
         };
     };
-    c3_chart_internal_fn.generateLevelColor = function () {
+    ChartInternal.prototype.generateLevelColor = function () {
         var $$ = this,
             config = $$.config,
             colors = config.color_pattern,
         } : null;
     };
 
-    c3_chart_internal_fn.getDefaultConfig = function () {
+    ChartInternal.prototype.getDefaultConfig = function () {
         var config = {
             bindto: '#chart',
             svg_classname: undefined,
             resize_auto: true,
             zoom_enabled: false,
             zoom_initialRange: undefined,
+            zoom_type: 'scroll',
+            zoom_disableDefaultBehavior: false,
             zoom_privileged: false,
             zoom_rescale: false,
             zoom_onzoom: function zoom_onzoom() {},
 
         return config;
     };
-    c3_chart_internal_fn.additionalConfig = {};
+    ChartInternal.prototype.additionalConfig = {};
 
-    c3_chart_internal_fn.loadConfig = function (config) {
+    ChartInternal.prototype.loadConfig = function (config) {
         var this_config = this.config,
             target,
             keys,
         });
     };
 
-    c3_chart_internal_fn.convertUrlToData = function (url, mimeType, headers, keys, done) {
+    ChartInternal.prototype.convertUrlToData = function (url, mimeType, headers, keys, done) {
         var $$ = this,
             type = mimeType ? mimeType : 'csv',
             f,
             throw error;
         });
     };
-    c3_chart_internal_fn.convertXsvToData = function (xsv) {
+    ChartInternal.prototype.convertXsvToData = function (xsv) {
         var keys = xsv.columns,
             rows = xsv;
         if (rows.length === 0) {
             return { keys: keys, rows: [].concat(xsv) };
         }
     };
-    c3_chart_internal_fn.convertJsonToData = function (json, keys) {
+    ChartInternal.prototype.convertJsonToData = function (json, keys) {
         var $$ = this,
             new_rows = [],
             targetKeys,
         }
         return data;
     };
-    c3_chart_internal_fn.findValueInJson = function (object, path) {
+    ChartInternal.prototype.findValueInJson = function (object, path) {
         path = path.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties (replace [] with .)
         path = path.replace(/^\./, ''); // strip a leading dot
         var pathArray = path.split('.');
      * @param {any[][]} rows The row data
      * @return {Object}
      */
-    c3_chart_internal_fn.convertRowsToData = function (rows) {
+    ChartInternal.prototype.convertRowsToData = function (rows) {
         var newRows = [];
         var keys = rows[0];
 
      * @param {any[][]} columns The column data
      * @return {Object}
      */
-    c3_chart_internal_fn.convertColumnsToData = function (columns) {
+    ChartInternal.prototype.convertColumnsToData = function (columns) {
         var newRows = [];
         var keys = [];
 
      * @param {boolean} appendXs True to append to $$.data.xs, False to replace.
      * @return {!Array}
      */
-    c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
+    ChartInternal.prototype.convertDataToTargets = function (data, appendXs) {
         var $$ = this,
             config = $$.config,
             targets,
         return targets;
     };
 
-    c3_chart_internal_fn.isX = function (key) {
+    ChartInternal.prototype.isX = function (key) {
         var $$ = this,
             config = $$.config;
         return config.data_x && key === config.data_x || notEmpty(config.data_xs) && hasValue(config.data_xs, key);
     };
-    c3_chart_internal_fn.isNotX = function (key) {
+    ChartInternal.prototype.isNotX = function (key) {
         return !this.isX(key);
     };
-    c3_chart_internal_fn.getXKey = function (id) {
+    ChartInternal.prototype.getXKey = function (id) {
         var $$ = this,
             config = $$.config;
         return config.data_x ? config.data_x : notEmpty(config.data_xs) ? config.data_xs[id] : null;
     };
-    c3_chart_internal_fn.getXValuesOfXKey = function (key, targets) {
+    ChartInternal.prototype.getXValuesOfXKey = function (key, targets) {
         var $$ = this,
             xValues,
             ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : [];
         });
         return xValues;
     };
-    c3_chart_internal_fn.getXValue = function (id, i) {
+    ChartInternal.prototype.getXValue = function (id, i) {
         var $$ = this;
         return id in $$.data.xs && $$.data.xs[id] && isValue($$.data.xs[id][i]) ? $$.data.xs[id][i] : i;
     };
-    c3_chart_internal_fn.getOtherTargetXs = function () {
+    ChartInternal.prototype.getOtherTargetXs = function () {
         var $$ = this,
             idsForX = Object.keys($$.data.xs);
         return idsForX.length ? $$.data.xs[idsForX[0]] : null;
     };
-    c3_chart_internal_fn.getOtherTargetX = function (index) {
+    ChartInternal.prototype.getOtherTargetX = function (index) {
         var xs = this.getOtherTargetXs();
         return xs && index < xs.length ? xs[index] : null;
     };
-    c3_chart_internal_fn.addXs = function (xs) {
+    ChartInternal.prototype.addXs = function (xs) {
         var $$ = this;
         Object.keys(xs).forEach(function (id) {
             $$.config.data_xs[id] = xs[id];
         });
     };
-    c3_chart_internal_fn.addName = function (data) {
+    ChartInternal.prototype.addName = function (data) {
         var $$ = this,
             name;
         if (data) {
         }
         return data;
     };
-    c3_chart_internal_fn.getValueOnIndex = function (values, index) {
+    ChartInternal.prototype.getValueOnIndex = function (values, index) {
         var valueOnIndex = values.filter(function (v) {
             return v.index === index;
         });
         return valueOnIndex.length ? valueOnIndex[0] : null;
     };
-    c3_chart_internal_fn.updateTargetX = function (targets, x) {
+    ChartInternal.prototype.updateTargetX = function (targets, x) {
         var $$ = this;
         targets.forEach(function (t) {
             t.values.forEach(function (v, i) {
             $$.data.xs[t.id] = x;
         });
     };
-    c3_chart_internal_fn.updateTargetXs = function (targets, xs) {
+    ChartInternal.prototype.updateTargetXs = function (targets, xs) {
         var $$ = this;
         targets.forEach(function (t) {
             if (xs[t.id]) {
             }
         });
     };
-    c3_chart_internal_fn.generateTargetX = function (rawX, id, index) {
+    ChartInternal.prototype.generateTargetX = function (rawX, id, index) {
         var $$ = this,
             x;
         if ($$.isTimeSeries()) {
         }
         return x;
     };
-    c3_chart_internal_fn.cloneTarget = function (target) {
+    ChartInternal.prototype.cloneTarget = function (target) {
         return {
             id: target.id,
             id_org: target.id_org,
             values: target.values.map(function (d) {
-                return { x: d.x, value: d.value, id: d.id };
+                return {
+                    x: d.x,
+                    value: d.value,
+                    id: d.id
+                };
             })
         };
     };
-    c3_chart_internal_fn.getMaxDataCount = function () {
+    ChartInternal.prototype.getMaxDataCount = function () {
         var $$ = this;
         return $$.d3.max($$.data.targets, function (t) {
             return t.values.length;
         });
     };
-    c3_chart_internal_fn.mapToIds = function (targets) {
+    ChartInternal.prototype.mapToIds = function (targets) {
         return targets.map(function (d) {
             return d.id;
         });
     };
-    c3_chart_internal_fn.mapToTargetIds = function (ids) {
+    ChartInternal.prototype.mapToTargetIds = function (ids) {
         var $$ = this;
         return ids ? [].concat(ids) : $$.mapToIds($$.data.targets);
     };
-    c3_chart_internal_fn.hasTarget = function (targets, id) {
+    ChartInternal.prototype.hasTarget = function (targets, id) {
         var ids = this.mapToIds(targets),
             i;
         for (i = 0; i < ids.length; i++) {
         }
         return false;
     };
-    c3_chart_internal_fn.isTargetToShow = function (targetId) {
+    ChartInternal.prototype.isTargetToShow = function (targetId) {
         return this.hiddenTargetIds.indexOf(targetId) < 0;
     };
-    c3_chart_internal_fn.isLegendToShow = function (targetId) {
+    ChartInternal.prototype.isLegendToShow = function (targetId) {
         return this.hiddenLegendIds.indexOf(targetId) < 0;
     };
-    c3_chart_internal_fn.filterTargetsToShow = function (targets) {
+    ChartInternal.prototype.filterTargetsToShow = function (targets) {
         var $$ = this;
         return targets.filter(function (t) {
             return $$.isTargetToShow(t.id);
         });
     };
-    c3_chart_internal_fn.mapTargetsToUniqueXs = function (targets) {
+    ChartInternal.prototype.mapTargetsToUniqueXs = function (targets) {
         var $$ = this;
         var xs = $$.d3.set($$.d3.merge(targets.map(function (t) {
             return t.values.map(function (v) {
             return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
         });
     };
-    c3_chart_internal_fn.addHiddenTargetIds = function (targetIds) {
+    ChartInternal.prototype.addHiddenTargetIds = function (targetIds) {
         targetIds = targetIds instanceof Array ? targetIds : new Array(targetIds);
         for (var i = 0; i < targetIds.length; i++) {
             if (this.hiddenTargetIds.indexOf(targetIds[i]) < 0) {
             }
         }
     };
-    c3_chart_internal_fn.removeHiddenTargetIds = function (targetIds) {
+    ChartInternal.prototype.removeHiddenTargetIds = function (targetIds) {
         this.hiddenTargetIds = this.hiddenTargetIds.filter(function (id) {
             return targetIds.indexOf(id) < 0;
         });
     };
-    c3_chart_internal_fn.addHiddenLegendIds = function (targetIds) {
+    ChartInternal.prototype.addHiddenLegendIds = function (targetIds) {
         targetIds = targetIds instanceof Array ? targetIds : new Array(targetIds);
         for (var i = 0; i < targetIds.length; i++) {
             if (this.hiddenLegendIds.indexOf(targetIds[i]) < 0) {
             }
         }
     };
-    c3_chart_internal_fn.removeHiddenLegendIds = function (targetIds) {
+    ChartInternal.prototype.removeHiddenLegendIds = function (targetIds) {
         this.hiddenLegendIds = this.hiddenLegendIds.filter(function (id) {
             return targetIds.indexOf(id) < 0;
         });
     };
-    c3_chart_internal_fn.getValuesAsIdKeyed = function (targets) {
+    ChartInternal.prototype.getValuesAsIdKeyed = function (targets) {
         var ys = {};
         targets.forEach(function (t) {
             ys[t.id] = [];
         });
         return ys;
     };
-    c3_chart_internal_fn.checkValueInTargets = function (targets, checker) {
+    ChartInternal.prototype.checkValueInTargets = function (targets, checker) {
         var ids = Object.keys(targets),
             i,
             j,
         }
         return false;
     };
-    c3_chart_internal_fn.hasNegativeValueInTargets = function (targets) {
+    ChartInternal.prototype.hasNegativeValueInTargets = function (targets) {
         return this.checkValueInTargets(targets, function (v) {
             return v < 0;
         });
     };
-    c3_chart_internal_fn.hasPositiveValueInTargets = function (targets) {
+    ChartInternal.prototype.hasPositiveValueInTargets = function (targets) {
         return this.checkValueInTargets(targets, function (v) {
             return v > 0;
         });
     };
-    c3_chart_internal_fn.isOrderDesc = function () {
+    ChartInternal.prototype.isOrderDesc = function () {
         var config = this.config;
         return typeof config.data_order === 'string' && config.data_order.toLowerCase() === 'desc';
     };
-    c3_chart_internal_fn.isOrderAsc = function () {
+    ChartInternal.prototype.isOrderAsc = function () {
         var config = this.config;
         return typeof config.data_order === 'string' && config.data_order.toLowerCase() === 'asc';
     };
-    c3_chart_internal_fn.getOrderFunction = function () {
+    ChartInternal.prototype.getOrderFunction = function () {
         var $$ = this,
             config = $$.config,
             orderAsc = $$.isOrderAsc(),
             };
         }
     };
-    c3_chart_internal_fn.orderTargets = function (targets) {
+    ChartInternal.prototype.orderTargets = function (targets) {
         var fct = this.getOrderFunction();
         if (fct) {
             targets.sort(fct);
         }
         return targets;
     };
-    c3_chart_internal_fn.filterByX = function (targets, x) {
+    ChartInternal.prototype.filterByX = function (targets, x) {
         return this.d3.merge(targets.map(function (t) {
             return t.values;
         })).filter(function (v) {
             return v.x - x === 0;
         });
     };
-    c3_chart_internal_fn.filterRemoveNull = function (data) {
+    ChartInternal.prototype.filterRemoveNull = function (data) {
         return data.filter(function (d) {
             return isValue(d.value);
         });
     };
-    c3_chart_internal_fn.filterByXDomain = function (targets, xDomain) {
+    ChartInternal.prototype.filterByXDomain = function (targets, xDomain) {
         return targets.map(function (t) {
             return {
                 id: t.id,
             };
         });
     };
-    c3_chart_internal_fn.hasDataLabel = function () {
+    ChartInternal.prototype.hasDataLabel = function () {
         var config = this.config;
         if (typeof config.data_labels === 'boolean' && config.data_labels) {
             return true;
         }
         return false;
     };
-    c3_chart_internal_fn.getDataLabelLength = function (min, max, key) {
+    ChartInternal.prototype.getDataLabelLength = function (min, max, key) {
         var $$ = this,
             lengths = [0, 0],
             paddingCoef = 1.3;
         }).remove();
         return lengths;
     };
-    c3_chart_internal_fn.isNoneArc = function (d) {
+    ChartInternal.prototype.isNoneArc = function (d) {
         return this.hasTarget(this.data.targets, d.id);
-    }, c3_chart_internal_fn.isArc = function (d) {
+    }, ChartInternal.prototype.isArc = function (d) {
         return 'data' in d && this.hasTarget(this.data.targets, d.data.id);
     };
-    c3_chart_internal_fn.findClosestFromTargets = function (targets, pos) {
+    ChartInternal.prototype.findClosestFromTargets = function (targets, pos) {
         var $$ = this,
             candidates;
 
         // decide closest point and return
         return $$.findClosest(candidates, pos);
     };
-    c3_chart_internal_fn.findClosest = function (values, pos) {
+    ChartInternal.prototype.findClosest = function (values, pos) {
         var $$ = this,
             minDist = $$.config.point_sensitivity,
             closest;
 
         return closest;
     };
-    c3_chart_internal_fn.dist = function (data, pos) {
+    ChartInternal.prototype.dist = function (data, pos) {
         var $$ = this,
             config = $$.config,
             xIndex = config.axis_rotated ? 1 : 0,
             x = $$.x(data.x);
         return Math.sqrt(Math.pow(x - pos[xIndex], 2) + Math.pow(y - pos[yIndex], 2));
     };
-    c3_chart_internal_fn.convertValuesToStep = function (values) {
+    ChartInternal.prototype.convertValuesToStep = function (values) {
         var converted = [].concat(values),
             i;
 
 
         return converted;
     };
-    c3_chart_internal_fn.updateDataAttributes = function (name, attrs) {
+    ChartInternal.prototype.updateDataAttributes = function (name, attrs) {
         var $$ = this,
             config = $$.config,
             current = config['data_' + name];
         Object.keys(attrs).forEach(function (id) {
             current[id] = attrs[id];
         });
-        $$.redraw({ withLegend: true });
+        $$.redraw({
+            withLegend: true
+        });
         return current;
     };
 
-    c3_chart_internal_fn.load = function (targets, args) {
+    ChartInternal.prototype.load = function (targets, args) {
         var $$ = this;
         if (targets) {
             // filter loading targets if needed
             args.done();
         }
     };
-    c3_chart_internal_fn.loadFromArgs = function (args) {
+    ChartInternal.prototype.loadFromArgs = function (args) {
         var $$ = this;
         if (args.data) {
             $$.load($$.convertDataToTargets(args.data), args);
             $$.load(null, args);
         }
     };
-    c3_chart_internal_fn.unload = function (targetIds, done) {
+    ChartInternal.prototype.unload = function (targetIds, done) {
         var $$ = this;
         if (!done) {
             done = function done() {};
         });
     };
 
-    c3_chart_internal_fn.getYDomainMin = function (targets) {
+    ChartInternal.prototype.getYDomainMin = function (targets) {
         var $$ = this,
             config = $$.config,
             ids = $$.mapToIds(targets),
             return $$.d3.min(ys[key]);
         }));
     };
-    c3_chart_internal_fn.getYDomainMax = function (targets) {
+    ChartInternal.prototype.getYDomainMax = function (targets) {
         var $$ = this,
             config = $$.config,
             ids = $$.mapToIds(targets),
             return $$.d3.max(ys[key]);
         }));
     };
-    c3_chart_internal_fn.getYDomain = function (targets, axisId, xDomain) {
+    ChartInternal.prototype.getYDomain = function (targets, axisId, xDomain) {
         var $$ = this,
             config = $$.config,
             targetsByAxisId = targets.filter(function (t) {
         domain = [yDomainMin - padding_bottom, yDomainMax + padding_top];
         return isInverted ? domain.reverse() : domain;
     };
-    c3_chart_internal_fn.getXDomainMin = function (targets) {
+    ChartInternal.prototype.getXDomainMin = function (targets) {
         var $$ = this,
             config = $$.config;
         return isDefined(config.axis_x_min) ? $$.isTimeSeries() ? this.parseDate(config.axis_x_min) : config.axis_x_min : $$.d3.min(targets, function (t) {
             });
         });
     };
-    c3_chart_internal_fn.getXDomainMax = function (targets) {
+    ChartInternal.prototype.getXDomainMax = function (targets) {
         var $$ = this,
             config = $$.config;
         return isDefined(config.axis_x_max) ? $$.isTimeSeries() ? this.parseDate(config.axis_x_max) : config.axis_x_max : $$.d3.max(targets, function (t) {
             });
         });
     };
-    c3_chart_internal_fn.getXDomainPadding = function (domain) {
+    ChartInternal.prototype.getXDomainPadding = function (domain) {
         var $$ = this,
             config = $$.config,
             diff = domain[1] - domain[0],
         }
         return { left: paddingLeft, right: paddingRight };
     };
-    c3_chart_internal_fn.getXDomain = function (targets) {
+    ChartInternal.prototype.getXDomain = function (targets) {
         var $$ = this,
             xDomain = [$$.getXDomainMin(targets), $$.getXDomainMax(targets)],
             firstX = xDomain[0],
         }
         return [min, max];
     };
-    c3_chart_internal_fn.updateXDomain = function (targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) {
+    ChartInternal.prototype.updateXDomain = function (targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) {
         var $$ = this,
             config = $$.config;
 
 
         return $$.x.domain();
     };
-    c3_chart_internal_fn.trimXDomain = function (domain) {
+    ChartInternal.prototype.trimXDomain = function (domain) {
         var zoomDomain = this.getZoomDomain(),
             min = zoomDomain[0],
             max = zoomDomain[1];
         return domain;
     };
 
-    c3_chart_internal_fn.drag = function (mouse) {
+    ChartInternal.prototype.drag = function (mouse) {
         var $$ = this,
             config = $$.config,
             main = $$.main,
         });
     };
 
-    c3_chart_internal_fn.dragstart = function (mouse) {
+    ChartInternal.prototype.dragstart = function (mouse) {
         var $$ = this,
             config = $$.config;
         if ($$.hasArcType()) {
         $$.dragging = true;
     };
 
-    c3_chart_internal_fn.dragend = function () {
+    ChartInternal.prototype.dragend = function () {
         var $$ = this,
             config = $$.config;
         if ($$.hasArcType()) {
         $$.dragging = false;
     };
 
-    c3_chart_internal_fn.getYFormat = function (forArc) {
+    ChartInternal.prototype.getYFormat = function (forArc) {
         var $$ = this,
             formatForY = forArc && !$$.hasType('gauge') ? $$.defaultArcValueFormat : $$.yFormat,
             formatForY2 = forArc && !$$.hasType('gauge') ? $$.defaultArcValueFormat : $$.y2Format;
             return format.call($$, v, ratio);
         };
     };
-    c3_chart_internal_fn.yFormat = function (v) {
+    ChartInternal.prototype.yFormat = function (v) {
         var $$ = this,
             config = $$.config,
             format = config.axis_y_tick_format ? config.axis_y_tick_format : $$.defaultValueFormat;
         return format(v);
     };
-    c3_chart_internal_fn.y2Format = function (v) {
+    ChartInternal.prototype.y2Format = function (v) {
         var $$ = this,
             config = $$.config,
             format = config.axis_y2_tick_format ? config.axis_y2_tick_format : $$.defaultValueFormat;
         return format(v);
     };
-    c3_chart_internal_fn.defaultValueFormat = function (v) {
+    ChartInternal.prototype.defaultValueFormat = function (v) {
         return isValue(v) ? +v : "";
     };
-    c3_chart_internal_fn.defaultArcValueFormat = function (v, ratio) {
+    ChartInternal.prototype.defaultArcValueFormat = function (v, ratio) {
         return (ratio * 100).toFixed(1) + '%';
     };
-    c3_chart_internal_fn.dataLabelFormat = function (targetId) {
+    ChartInternal.prototype.dataLabelFormat = function (targetId) {
         var $$ = this,
             data_labels = $$.config.data_labels,
             format,
         return format;
     };
 
-    c3_chart_internal_fn.initGrid = function () {
+    ChartInternal.prototype.initGrid = function () {
         var $$ = this,
             config = $$.config,
             d3 = $$.d3;
             $$.initGridLines();
         }
     };
-    c3_chart_internal_fn.initGridLines = function () {
+    ChartInternal.prototype.initGridLines = function () {
         var $$ = this,
             d3 = $$.d3;
         $$.gridLines = $$.main.append('g').attr("clip-path", $$.clipPathForGrid).attr('class', CLASS.grid + ' ' + CLASS.gridLines);
         $$.gridLines.append('g').attr('class', CLASS.ygridLines);
         $$.xgridLines = d3.selectAll([]);
     };
-    c3_chart_internal_fn.updateXGrid = function (withoutUpdate) {
+    ChartInternal.prototype.updateXGrid = function (withoutUpdate) {
         var $$ = this,
             config = $$.config,
             d3 = $$.d3,
         xgrid.exit().remove();
     };
 
-    c3_chart_internal_fn.updateYGrid = function () {
+    ChartInternal.prototype.updateYGrid = function () {
         var $$ = this,
             config = $$.config,
             gridValues = $$.yAxis.tickValues() || $$.y.ticks(config.grid_y_ticks);
         $$.smoothLines($$.ygrid, 'grid');
     };
 
-    c3_chart_internal_fn.gridTextAnchor = function (d) {
+    ChartInternal.prototype.gridTextAnchor = function (d) {
         return d.position ? d.position : "end";
     };
-    c3_chart_internal_fn.gridTextDx = function (d) {
+    ChartInternal.prototype.gridTextDx = function (d) {
         return d.position === 'start' ? 4 : d.position === 'middle' ? 0 : -4;
     };
-    c3_chart_internal_fn.xGridTextX = function (d) {
+    ChartInternal.prototype.xGridTextX = function (d) {
         return d.position === 'start' ? -this.height : d.position === 'middle' ? -this.height / 2 : 0;
     };
-    c3_chart_internal_fn.yGridTextX = function (d) {
+    ChartInternal.prototype.yGridTextX = function (d) {
         return d.position === 'start' ? 0 : d.position === 'middle' ? this.width / 2 : this.width;
     };
-    c3_chart_internal_fn.updateGrid = function (duration) {
+    ChartInternal.prototype.updateGrid = function (duration) {
         var $$ = this,
             main = $$.main,
             config = $$.config,
         // exit
         ygridLine.exit().transition().duration(duration).style("opacity", 0).remove();
     };
-    c3_chart_internal_fn.redrawGrid = function (withTransition, transition) {
+    ChartInternal.prototype.redrawGrid = function (withTransition, transition) {
         var $$ = this,
             config = $$.config,
             xv = $$.xv.bind($$),
             return d.text;
         }).style("opacity", 1)];
     };
-    c3_chart_internal_fn.showXGridFocus = function (selectedData) {
+    ChartInternal.prototype.showXGridFocus = function (selectedData) {
         var $$ = this,
             config = $$.config,
             dataToShow = selectedData.filter(function (d) {
         focusEl.style("visibility", "visible").data([dataToShow[0]]).attr(config.axis_rotated ? 'y1' : 'x1', xx).attr(config.axis_rotated ? 'y2' : 'x2', xx);
         $$.smoothLines(focusEl, 'grid');
     };
-    c3_chart_internal_fn.hideXGridFocus = function () {
+    ChartInternal.prototype.hideXGridFocus = function () {
         this.main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden");
     };
-    c3_chart_internal_fn.updateXgridFocus = function () {
+    ChartInternal.prototype.updateXgridFocus = function () {
         var $$ = this,
             config = $$.config;
         $$.main.select('line.' + CLASS.xgridFocus).attr("x1", config.axis_rotated ? 0 : -10).attr("x2", config.axis_rotated ? $$.width : -10).attr("y1", config.axis_rotated ? -10 : 0).attr("y2", config.axis_rotated ? -10 : $$.height);
     };
-    c3_chart_internal_fn.generateGridData = function (type, scale) {
+    ChartInternal.prototype.generateGridData = function (type, scale) {
         var $$ = this,
             gridData = [],
             xDomain,
         }
         return gridData;
     };
-    c3_chart_internal_fn.getGridFilterToRemove = function (params) {
+    ChartInternal.prototype.getGridFilterToRemove = function (params) {
         return params ? function (line) {
             var found = false;
             [].concat(params).forEach(function (param) {
             return true;
         };
     };
-    c3_chart_internal_fn.removeGridLines = function (params, forX) {
+    ChartInternal.prototype.removeGridLines = function (params, forX) {
         var $$ = this,
             config = $$.config,
             toRemove = $$.getGridFilterToRemove(params),
         }
     };
 
-    c3_chart_internal_fn.initEventRect = function () {
+    ChartInternal.prototype.initEventRect = function () {
         var $$ = this,
             config = $$.config;
 
             }
         }
     };
-    c3_chart_internal_fn.redrawEventRect = function () {
+    ChartInternal.prototype.redrawEventRect = function () {
         var $$ = this,
             d3 = $$.d3,
             config = $$.config,
             $$.dragend();
         }) : function () {});
     };
-    c3_chart_internal_fn.getMousePosition = function (data) {
+    ChartInternal.prototype.getMousePosition = function (data) {
         var $$ = this;
         return [$$.x(data.x), $$.getYScale(data.id)(data.value)];
     };
-    c3_chart_internal_fn.dispatchEvent = function (type, mouse) {
+    ChartInternal.prototype.dispatchEvent = function (type, mouse) {
         var $$ = this,
             selector = '.' + CLASS.eventRect,
             eventRect = $$.main.select(selector).node(),
         eventRect.dispatchEvent(event);
     };
 
-    c3_chart_internal_fn.initLegend = function () {
+    ChartInternal.prototype.initLegend = function () {
         var $$ = this;
         $$.legendItemTextBox = {};
         $$.legendHasRendered = false;
         // MEMO: translate will be upated by this, so transform not needed in updateLegend()
         $$.updateLegendWithDefaults();
     };
-    c3_chart_internal_fn.updateLegendWithDefaults = function () {
+    ChartInternal.prototype.updateLegendWithDefaults = function () {
         var $$ = this;
         $$.updateLegend($$.mapToIds($$.data.targets), { withTransform: false, withTransitionForTransform: false, withTransition: false });
     };
-    c3_chart_internal_fn.updateSizeForLegend = function (legendHeight, legendWidth) {
+    ChartInternal.prototype.updateSizeForLegend = function (legendHeight, legendWidth) {
         var $$ = this,
             config = $$.config,
             insetLegendPosition = {
             left: $$.isLegendRight ? $$.currentWidth - legendWidth : $$.isLegendInset ? insetLegendPosition.left : 0
         };
     };
-    c3_chart_internal_fn.transformLegend = function (withTransition) {
+    ChartInternal.prototype.transformLegend = function (withTransition) {
         var $$ = this;
         (withTransition ? $$.legend.transition() : $$.legend).attr("transform", $$.getTranslate('legend'));
     };
-    c3_chart_internal_fn.updateLegendStep = function (step) {
+    ChartInternal.prototype.updateLegendStep = function (step) {
         this.legendStep = step;
     };
-    c3_chart_internal_fn.updateLegendItemWidth = function (w) {
+    ChartInternal.prototype.updateLegendItemWidth = function (w) {
         this.legendItemWidth = w;
     };
-    c3_chart_internal_fn.updateLegendItemHeight = function (h) {
+    ChartInternal.prototype.updateLegendItemHeight = function (h) {
         this.legendItemHeight = h;
     };
-    c3_chart_internal_fn.getLegendWidth = function () {
+    ChartInternal.prototype.getLegendWidth = function () {
         var $$ = this;
         return $$.config.legend_show ? $$.isLegendRight || $$.isLegendInset ? $$.legendItemWidth * ($$.legendStep + 1) : $$.currentWidth : 0;
     };
-    c3_chart_internal_fn.getLegendHeight = function () {
+    ChartInternal.prototype.getLegendHeight = function () {
         var $$ = this,
             h = 0;
         if ($$.config.legend_show) {
         }
         return h;
     };
-    c3_chart_internal_fn.opacityForLegend = function (legendItem) {
+    ChartInternal.prototype.opacityForLegend = function (legendItem) {
         return legendItem.classed(CLASS.legendItemHidden) ? null : 1;
     };
-    c3_chart_internal_fn.opacityForUnfocusedLegend = function (legendItem) {
+    ChartInternal.prototype.opacityForUnfocusedLegend = function (legendItem) {
         return legendItem.classed(CLASS.legendItemHidden) ? null : 0.3;
     };
-    c3_chart_internal_fn.toggleFocusLegend = function (targetIds, focus) {
+    ChartInternal.prototype.toggleFocusLegend = function (targetIds, focus) {
         var $$ = this;
         targetIds = $$.mapToTargetIds(targetIds);
         $$.legend.selectAll('.' + CLASS.legendItem).filter(function (id) {
             return opacity.call($$, $$.d3.select(this));
         });
     };
-    c3_chart_internal_fn.revertLegend = function () {
+    ChartInternal.prototype.revertLegend = function () {
         var $$ = this,
             d3 = $$.d3;
         $$.legend.selectAll('.' + CLASS.legendItem).classed(CLASS.legendItemFocused, false).transition().duration(100).style('opacity', function () {
             return $$.opacityForLegend(d3.select(this));
         });
     };
-    c3_chart_internal_fn.showLegend = function (targetIds) {
+    ChartInternal.prototype.showLegend = function (targetIds) {
         var $$ = this,
             config = $$.config;
         if (!config.legend_show) {
             return $$.opacityForLegend($$.d3.select(this));
         });
     };
-    c3_chart_internal_fn.hideLegend = function (targetIds) {
+    ChartInternal.prototype.hideLegend = function (targetIds) {
         var $$ = this,
             config = $$.config;
         if (config.legend_show && isEmpty(targetIds)) {
         $$.addHiddenLegendIds(targetIds);
         $$.legend.selectAll($$.selectorLegends(targetIds)).style('opacity', 0).style('visibility', 'hidden');
     };
-    c3_chart_internal_fn.clearLegendItemTextBoxCache = function () {
+    ChartInternal.prototype.clearLegendItemTextBoxCache = function () {
         this.legendItemTextBox = {};
     };
-    c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
+    ChartInternal.prototype.updateLegend = function (targetIds, options, transitions) {
         var $$ = this,
             config = $$.config;
         var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect, x1ForLegendTile, x2ForLegendTile, yForLegendTile;
         $$.legendHasRendered = true;
     };
 
-    c3_chart_internal_fn.initRegion = function () {
+    ChartInternal.prototype.initRegion = function () {
         var $$ = this;
         $$.region = $$.main.append('g').attr("clip-path", $$.clipPath).attr("class", CLASS.regions);
     };
-    c3_chart_internal_fn.updateRegion = function (duration) {
+    ChartInternal.prototype.updateRegion = function (duration) {
         var $$ = this,
             config = $$.config;
 
         $$.mainRegion = mainRegionEnter.merge(mainRegion).attr('class', $$.classRegion.bind($$));
         mainRegion.exit().transition().duration(duration).style("opacity", 0).remove();
     };
-    c3_chart_internal_fn.redrawRegion = function (withTransition, transition) {
+    ChartInternal.prototype.redrawRegion = function (withTransition, transition) {
         var $$ = this,
             regions = $$.mainRegion;
         return [(withTransition ? regions.transition(transition) : regions).attr("x", $$.regionX.bind($$)).attr("y", $$.regionY.bind($$)).attr("width", $$.regionWidth.bind($$)).attr("height", $$.regionHeight.bind($$)).style("fill-opacity", function (d) {
             return isValue(d.opacity) ? d.opacity : 0.1;
         })];
     };
-    c3_chart_internal_fn.regionX = function (d) {
+    ChartInternal.prototype.regionX = function (d) {
         var $$ = this,
             config = $$.config,
             xPos,
         }
         return xPos;
     };
-    c3_chart_internal_fn.regionY = function (d) {
+    ChartInternal.prototype.regionY = function (d) {
         var $$ = this,
             config = $$.config,
             yPos,
         }
         return yPos;
     };
-    c3_chart_internal_fn.regionWidth = function (d) {
+    ChartInternal.prototype.regionWidth = function (d) {
         var $$ = this,
             config = $$.config,
             start = $$.regionX(d),
         }
         return end < start ? 0 : end - start;
     };
-    c3_chart_internal_fn.regionHeight = function (d) {
+    ChartInternal.prototype.regionHeight = function (d) {
         var $$ = this,
             config = $$.config,
             start = this.regionY(d),
         }
         return end < start ? 0 : end - start;
     };
-    c3_chart_internal_fn.isRegionOnX = function (d) {
+    ChartInternal.prototype.isRegionOnX = function (d) {
         return !d.axis || d.axis === 'x';
     };
 
-    c3_chart_internal_fn.getScale = function (min, max, forTimeseries) {
+    ChartInternal.prototype.getScale = function (min, max, forTimeseries) {
         return (forTimeseries ? this.d3.scaleTime() : this.d3.scaleLinear()).range([min, max]);
     };
-    c3_chart_internal_fn.getX = function (min, max, domain, offset) {
+    ChartInternal.prototype.getX = function (min, max, domain, offset) {
         var $$ = this,
             scale = $$.getScale(min, max, $$.isTimeSeries()),
             _scale = domain ? scale.domain(domain) : scale,
         }
         return scale;
     };
-    c3_chart_internal_fn.getY = function (min, max, domain) {
+    ChartInternal.prototype.getY = function (min, max, domain) {
         var scale = this.getScale(min, max, this.isTimeSeriesY());
         if (domain) {
             scale.domain(domain);
         }
         return scale;
     };
-    c3_chart_internal_fn.getYScale = function (id) {
+    ChartInternal.prototype.getYScale = function (id) {
         return this.axis.getId(id) === 'y2' ? this.y2 : this.y;
     };
-    c3_chart_internal_fn.getSubYScale = function (id) {
+    ChartInternal.prototype.getSubYScale = function (id) {
         return this.axis.getId(id) === 'y2' ? this.subY2 : this.subY;
     };
-    c3_chart_internal_fn.updateScales = function () {
+    ChartInternal.prototype.updateScales = function () {
         var $$ = this,
             config = $$.config,
             forInit = !$$.x;
         }
     };
 
-    c3_chart_internal_fn.selectPoint = function (target, d, i) {
+    ChartInternal.prototype.selectPoint = function (target, d, i) {
         var $$ = this,
             config = $$.config,
             cx = (config.axis_rotated ? $$.circleY : $$.circleX).bind($$),
             return $$.pointSelectR(d) * 1.4;
         }).transition().duration(100).attr("r", r);
     };
-    c3_chart_internal_fn.unselectPoint = function (target, d, i) {
+    ChartInternal.prototype.unselectPoint = function (target, d, i) {
         var $$ = this;
         $$.config.data_onunselected.call($$.api, d, target.node());
         // remove selected-circle from low layer g
         $$.main.select('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS.selectedCircle + '-' + i).transition().duration(100).attr('r', 0).remove();
     };
-    c3_chart_internal_fn.togglePoint = function (selected, target, d, i) {
+    ChartInternal.prototype.togglePoint = function (selected, target, d, i) {
         selected ? this.selectPoint(target, d, i) : this.unselectPoint(target, d, i);
     };
-    c3_chart_internal_fn.selectPath = function (target, d) {
+    ChartInternal.prototype.selectPath = function (target, d) {
         var $$ = this;
         $$.config.data_onselected.call($$, d, target.node());
         if ($$.config.interaction_brighten) {
             });
         }
     };
-    c3_chart_internal_fn.unselectPath = function (target, d) {
+    ChartInternal.prototype.unselectPath = function (target, d) {
         var $$ = this;
         $$.config.data_onunselected.call($$, d, target.node());
         if ($$.config.interaction_brighten) {
             });
         }
     };
-    c3_chart_internal_fn.togglePath = function (selected, target, d, i) {
+    ChartInternal.prototype.togglePath = function (selected, target, d, i) {
         selected ? this.selectPath(target, d, i) : this.unselectPath(target, d, i);
     };
-    c3_chart_internal_fn.getToggle = function (that, d) {
+    ChartInternal.prototype.getToggle = function (that, d) {
         var $$ = this,
             toggle;
         if (that.nodeName === 'circle') {
         }
         return toggle;
     };
-    c3_chart_internal_fn.toggleShape = function (that, d, i) {
+    ChartInternal.prototype.toggleShape = function (that, d, i) {
         var $$ = this,
             d3 = $$.d3,
             config = $$.config,
         }
     };
 
-    c3_chart_internal_fn.initBar = function () {
+    ChartInternal.prototype.initBar = function () {
         var $$ = this;
         $$.main.select('.' + CLASS.chart).append("g").attr("class", CLASS.chartBars);
     };
-    c3_chart_internal_fn.updateTargetsForBar = function (targets) {
+    ChartInternal.prototype.updateTargetsForBar = function (targets) {
         var $$ = this,
             config = $$.config,
             mainBars,
             return config.data_selection_isselectable(d) ? "pointer" : null;
         });
     };
-    c3_chart_internal_fn.updateBar = function (durationForExit) {
+    ChartInternal.prototype.updateBar = function (durationForExit) {
         var $$ = this,
             barData = $$.barData.bind($$),
             classBar = $$.classBar.bind($$),
         $$.mainBar = mainBarEnter.merge(mainBar).style("opacity", initialOpacity);
         mainBar.exit().transition().duration(durationForExit).style("opacity", 0);
     };
-    c3_chart_internal_fn.redrawBar = function (drawBar, withTransition, transition) {
+    ChartInternal.prototype.redrawBar = function (drawBar, withTransition, transition) {
         return [(withTransition ? this.mainBar.transition(transition) : this.mainBar).attr('d', drawBar).style("stroke", this.color).style("fill", this.color).style("opacity", 1)];
     };
-    c3_chart_internal_fn.getBarW = function (axis, barTargetsNum) {
+    ChartInternal.prototype.getBarW = function (axis, barTargetsNum) {
         var $$ = this,
             config = $$.config,
             w = typeof config.bar_width === 'number' ? config.bar_width : barTargetsNum ? axis.tickInterval() * config.bar_width_ratio / barTargetsNum : 0;
         return config.bar_width_max && w > config.bar_width_max ? config.bar_width_max : w;
     };
-    c3_chart_internal_fn.getBars = function (i, id) {
+    ChartInternal.prototype.getBars = function (i, id) {
         var $$ = this;
         return (id ? $$.main.selectAll('.' + CLASS.bars + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.bar + (isValue(i) ? '-' + i : ''));
     };
-    c3_chart_internal_fn.expandBars = function (i, id, reset) {
+    ChartInternal.prototype.expandBars = function (i, id, reset) {
         var $$ = this;
         if (reset) {
             $$.unexpandBars();
         }
         $$.getBars(i, id).classed(CLASS.EXPANDED, true);
     };
-    c3_chart_internal_fn.unexpandBars = function (i) {
+    ChartInternal.prototype.unexpandBars = function (i) {
         var $$ = this;
         $$.getBars(i).classed(CLASS.EXPANDED, false);
     };
-    c3_chart_internal_fn.generateDrawBar = function (barIndices, isSub) {
+    ChartInternal.prototype.generateDrawBar = function (barIndices, isSub) {
         var $$ = this,
             config = $$.config,
             getPoints = $$.generateGetBarPoints(barIndices, isSub);
             return path;
         };
     };
-    c3_chart_internal_fn.generateGetBarPoints = function (barIndices, isSub) {
+    ChartInternal.prototype.generateGetBarPoints = function (barIndices, isSub) {
         var $$ = this,
             axis = isSub ? $$.subXAxis : $$.xAxis,
             barTargetsNum = barIndices.__max__ + 1,
             return [[posX + barSpaceOffset, offset], [posX + barSpaceOffset, posY - (y0 - offset)], [posX + barW - barSpaceOffset, posY - (y0 - offset)], [posX + barW - barSpaceOffset, offset]];
         };
     };
-    c3_chart_internal_fn.isWithinBar = function (mouse, that) {
+    ChartInternal.prototype.isWithinBar = function (mouse, that) {
         var box = that.getBoundingClientRect(),
             seg0 = that.pathSegList.getItem(0),
             seg1 = that.pathSegList.getItem(1),
         return sx < mouse[0] && mouse[0] < ex && ey < mouse[1] && mouse[1] < sy;
     };
 
-    c3_chart_internal_fn.getShapeIndices = function (typeFilter) {
+    ChartInternal.prototype.getShapeIndices = function (typeFilter) {
         var $$ = this,
             config = $$.config,
             indices = {},
         indices.__max__ = i - 1;
         return indices;
     };
-    c3_chart_internal_fn.getShapeX = function (offset, targetsNum, indices, isSub) {
+    ChartInternal.prototype.getShapeX = function (offset, targetsNum, indices, isSub) {
         var $$ = this,
             scale = isSub ? $$.subX : $$.x;
         return function (d) {
             return d.x || d.x === 0 ? scale(d.x) - offset * (targetsNum / 2 - index) : 0;
         };
     };
-    c3_chart_internal_fn.getShapeY = function (isSub) {
+    ChartInternal.prototype.getShapeY = function (isSub) {
         var $$ = this;
         return function (d) {
             var scale = isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id);
             return scale(d.value);
         };
     };
-    c3_chart_internal_fn.getShapeOffset = function (typeFilter, indices, isSub) {
+    ChartInternal.prototype.getShapeOffset = function (typeFilter, indices, isSub) {
         var $$ = this,
             targets = $$.orderTargets($$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))),
             targetIds = targets.map(function (t) {
             return offset;
         };
     };
-    c3_chart_internal_fn.isWithinShape = function (that, d) {
+    ChartInternal.prototype.isWithinShape = function (that, d) {
         var $$ = this,
             shape = $$.d3.select(that),
             isWithin;
         return isWithin;
     };
 
-    c3_chart_internal_fn.getInterpolate = function (d) {
+    ChartInternal.prototype.getInterpolate = function (d) {
         var $$ = this,
             d3 = $$.d3,
             types = {
             'cardinal-open': d3.curveCardinalOpen,
             'cardinal-closed': d3.curveCardinalClosed,
             'monotone': d3.curveMonotoneX,
-            'step': d3.curveStep
+            'step': d3.curveStep,
+            'step-before': d3.curveStepBefore,
+            'step-after': d3.curveStepAfter
         },
             type;
 
         return type;
     };
 
-    c3_chart_internal_fn.initLine = function () {
+    ChartInternal.prototype.initLine = function () {
         var $$ = this;
         $$.main.select('.' + CLASS.chart).append("g").attr("class", CLASS.chartLines);
     };
-    c3_chart_internal_fn.updateTargetsForLine = function (targets) {
+    ChartInternal.prototype.updateTargetsForLine = function (targets) {
         var $$ = this,
             config = $$.config,
             mainLines,
         // MEMO: can not keep same color...
         //mainLineUpdate.exit().remove();
     };
-    c3_chart_internal_fn.updateLine = function (durationForExit) {
+    ChartInternal.prototype.updateLine = function (durationForExit) {
         var $$ = this;
         var mainLine = $$.main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line).data($$.lineData.bind($$));
         var mainLineEnter = mainLine.enter().append('path').attr('class', $$.classLine.bind($$)).style("stroke", $$.color);
         }).attr('transform', null);
         mainLine.exit().transition().duration(durationForExit).style('opacity', 0);
     };
-    c3_chart_internal_fn.redrawLine = function (drawLine, withTransition, transition) {
+    ChartInternal.prototype.redrawLine = function (drawLine, withTransition, transition) {
         return [(withTransition ? this.mainLine.transition(transition) : this.mainLine).attr("d", drawLine).style("stroke", this.color).style("opacity", 1)];
     };
-    c3_chart_internal_fn.generateDrawLine = function (lineIndices, isSub) {
+    ChartInternal.prototype.generateDrawLine = function (lineIndices, isSub) {
         var $$ = this,
             config = $$.config,
             line = $$.d3.line(),
             return path ? path : "M 0 0";
         };
     };
-    c3_chart_internal_fn.generateGetLinePoints = function (lineIndices, isSub) {
+    ChartInternal.prototype.generateGetLinePoints = function (lineIndices, isSub) {
         // partial duplication of generateGetBarPoints
         var $$ = this,
             config = $$.config,
         };
     };
 
-    c3_chart_internal_fn.lineWithRegions = function (d, x, y, _regions) {
+    ChartInternal.prototype.lineWithRegions = function (d, x, y, _regions) {
         var $$ = this,
             config = $$.config,
             prev = -1,
         return s;
     };
 
-    c3_chart_internal_fn.updateArea = function (durationForExit) {
+    ChartInternal.prototype.updateArea = function (durationForExit) {
         var $$ = this,
             d3 = $$.d3;
         var mainArea = $$.main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area).data($$.lineData.bind($$));
         $$.mainArea = mainAreaEnter.merge(mainArea).style("opacity", $$.orgAreaOpacity);
         mainArea.exit().transition().duration(durationForExit).style('opacity', 0);
     };
-    c3_chart_internal_fn.redrawArea = function (drawArea, withTransition, transition) {
+    ChartInternal.prototype.redrawArea = function (drawArea, withTransition, transition) {
         return [(withTransition ? this.mainArea.transition(transition) : this.mainArea).attr("d", drawArea).style("fill", this.color).style("opacity", this.orgAreaOpacity)];
     };
-    c3_chart_internal_fn.generateDrawArea = function (areaIndices, isSub) {
+    ChartInternal.prototype.generateDrawArea = function (areaIndices, isSub) {
         var $$ = this,
             config = $$.config,
             area = $$.d3.area(),
             return path ? path : "M 0 0";
         };
     };
-    c3_chart_internal_fn.getAreaBaseValue = function () {
+    ChartInternal.prototype.getAreaBaseValue = function () {
         return 0;
     };
-    c3_chart_internal_fn.generateGetAreaPoints = function (areaIndices, isSub) {
+    ChartInternal.prototype.generateGetAreaPoints = function (areaIndices, isSub) {
         // partial duplication of generateGetBarPoints
         var $$ = this,
             config = $$.config,
         };
     };
 
-    c3_chart_internal_fn.updateCircle = function (cx, cy) {
+    ChartInternal.prototype.updateCircle = function (cx, cy) {
         var $$ = this;
         var mainCircle = $$.main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle).data($$.lineOrScatterData.bind($$));
         var mainCircleEnter = mainCircle.enter().append("circle").attr("class", $$.classCircle.bind($$)).attr("cx", cx).attr("cy", cy).attr("r", $$.pointR.bind($$)).style("fill", $$.color);
         $$.mainCircle = mainCircleEnter.merge(mainCircle).style("opacity", $$.initialOpacityForCircle.bind($$));
         mainCircle.exit().style("opacity", 0);
     };
-    c3_chart_internal_fn.redrawCircle = function (cx, cy, withTransition, transition) {
+    ChartInternal.prototype.redrawCircle = function (cx, cy, withTransition, transition) {
         var $$ = this,
             selectedCircles = $$.main.selectAll('.' + CLASS.selectedCircle);
         return [(withTransition ? $$.mainCircle.transition(transition) : $$.mainCircle).style('opacity', this.opacityForCircle.bind($$)).style("fill", $$.color).attr("cx", cx).attr("cy", cy), (withTransition ? selectedCircles.transition(transition) : selectedCircles).attr("cx", cx).attr("cy", cy)];
     };
-    c3_chart_internal_fn.circleX = function (d) {
+    ChartInternal.prototype.circleX = function (d) {
         return d.x || d.x === 0 ? this.x(d.x) : null;
     };
-    c3_chart_internal_fn.updateCircleY = function () {
+    ChartInternal.prototype.updateCircleY = function () {
         var $$ = this,
             lineIndices,
             getPoints;
             };
         }
     };
-    c3_chart_internal_fn.getCircles = function (i, id) {
+    ChartInternal.prototype.getCircles = function (i, id) {
         var $$ = this;
         return (id ? $$.main.selectAll('.' + CLASS.circles + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.circle + (isValue(i) ? '-' + i : ''));
     };
-    c3_chart_internal_fn.expandCircles = function (i, id, reset) {
+    ChartInternal.prototype.expandCircles = function (i, id, reset) {
         var $$ = this,
             r = $$.pointExpandedR.bind($$);
         if (reset) {
         }
         $$.getCircles(i, id).classed(CLASS.EXPANDED, true).attr('r', r);
     };
-    c3_chart_internal_fn.unexpandCircles = function (i) {
+    ChartInternal.prototype.unexpandCircles = function (i) {
         var $$ = this,
             r = $$.pointR.bind($$);
         $$.getCircles(i).filter(function () {
             return $$.d3.select(this).classed(CLASS.EXPANDED);
         }).classed(CLASS.EXPANDED, false).attr('r', r);
     };
-    c3_chart_internal_fn.pointR = function (d) {
+    ChartInternal.prototype.pointR = function (d) {
         var $$ = this,
             config = $$.config;
         return $$.isStepType(d) ? 0 : isFunction(config.point_r) ? config.point_r(d) : config.point_r;
     };
-    c3_chart_internal_fn.pointExpandedR = function (d) {
+    ChartInternal.prototype.pointExpandedR = function (d) {
         var $$ = this,
             config = $$.config;
         if (config.point_focus_expand_enabled) {
             return $$.pointR(d);
         }
     };
-    c3_chart_internal_fn.pointSelectR = function (d) {
+    ChartInternal.prototype.pointSelectR = function (d) {
         var $$ = this,
             config = $$.config;
         return isFunction(config.point_select_r) ? config.point_select_r(d) : config.point_select_r ? config.point_select_r : $$.pointR(d) * 4;
     };
-    c3_chart_internal_fn.isWithinCircle = function (that, r) {
+    ChartInternal.prototype.isWithinCircle = function (that, r) {
         var d3 = this.d3,
             mouse = d3.mouse(that),
             d3_this = d3.select(that),
             cy = +d3_this.attr("cy");
         return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < r;
     };
-    c3_chart_internal_fn.isWithinStep = function (that, y) {
+    ChartInternal.prototype.isWithinStep = function (that, y) {
         return Math.abs(y - this.d3.mouse(that)[1]) < 30;
     };
 
-    c3_chart_internal_fn.getCurrentWidth = function () {
+    ChartInternal.prototype.getCurrentWidth = function () {
         var $$ = this,
             config = $$.config;
         return config.size_width ? config.size_width : $$.getParentWidth();
     };
-    c3_chart_internal_fn.getCurrentHeight = function () {
+    ChartInternal.prototype.getCurrentHeight = function () {
         var $$ = this,
             config = $$.config,
             h = config.size_height ? config.size_height : $$.getParentHeight();
         return h > 0 ? h : 320 / ($$.hasType('gauge') && !config.gauge_fullCircle ? 2 : 1);
     };
-    c3_chart_internal_fn.getCurrentPaddingTop = function () {
+    ChartInternal.prototype.getCurrentPaddingTop = function () {
         var $$ = this,
             config = $$.config,
             padding = isValue(config.padding_top) ? config.padding_top : 0;
         }
         return padding;
     };
-    c3_chart_internal_fn.getCurrentPaddingBottom = function () {
+    ChartInternal.prototype.getCurrentPaddingBottom = function () {
         var config = this.config;
         return isValue(config.padding_bottom) ? config.padding_bottom : 0;
     };
-    c3_chart_internal_fn.getCurrentPaddingLeft = function (withoutRecompute) {
+    ChartInternal.prototype.getCurrentPaddingLeft = function (withoutRecompute) {
         var $$ = this,
             config = $$.config;
         if (isValue(config.padding_left)) {
             return ceil10($$.getAxisWidthByAxisId('y', withoutRecompute));
         }
     };
-    c3_chart_internal_fn.getCurrentPaddingRight = function () {
+    ChartInternal.prototype.getCurrentPaddingRight = function () {
         var $$ = this,
             config = $$.config,
             defaultPadding = 10,
         }
     };
 
-    c3_chart_internal_fn.getParentRectValue = function (key) {
+    ChartInternal.prototype.getParentRectValue = function (key) {
         var parent = this.selectChart.node(),
             v;
         while (parent && parent.tagName !== 'BODY') {
         }
         return v;
     };
-    c3_chart_internal_fn.getParentWidth = function () {
+    ChartInternal.prototype.getParentWidth = function () {
         return this.getParentRectValue('width');
     };
-    c3_chart_internal_fn.getParentHeight = function () {
+    ChartInternal.prototype.getParentHeight = function () {
         var h = this.selectChart.style('height');
         return h.indexOf('px') > 0 ? +h.replace('px', '') : 0;
     };
 
-    c3_chart_internal_fn.getSvgLeft = function (withoutRecompute) {
+    ChartInternal.prototype.getSvgLeft = function (withoutRecompute) {
         var $$ = this,
             config = $$.config,
             hasLeftAxisRect = config.axis_rotated || !config.axis_rotated && !config.axis_y_inner,
         return svgLeft > 0 ? svgLeft : 0;
     };
 
-    c3_chart_internal_fn.getAxisWidthByAxisId = function (id, withoutRecompute) {
+    ChartInternal.prototype.getAxisWidthByAxisId = function (id, withoutRecompute) {
         var $$ = this,
             position = $$.axis.getLabelPositionById(id);
         return $$.axis.getMaxTickWidth(id, withoutRecompute) + (position.isInner ? 20 : 40);
     };
-    c3_chart_internal_fn.getHorizontalAxisHeight = function (axisId) {
+    ChartInternal.prototype.getHorizontalAxisHeight = function (axisId) {
         var $$ = this,
             config = $$.config,
             h = 30;
         return h + ($$.axis.getLabelPositionById(axisId).isInner ? 0 : 10) + (axisId === 'y2' ? -10 : 0);
     };
 
-    c3_chart_internal_fn.initBrush = function (scale) {
+    ChartInternal.prototype.initBrush = function (scale) {
         var $$ = this,
             d3 = $$.d3;
         // TODO: dynamically change brushY/brushX according to axis_rotated.
         };
         return $$.brush.updateScale(scale);
     };
-    c3_chart_internal_fn.initSubchart = function () {
+    ChartInternal.prototype.initSubchart = function () {
         var $$ = this,
             config = $$.config,
             context = $$.context = $$.svg.append("g").attr("transform", $$.getTranslate('context')),
         // Add Axis
         $$.axes.subx = context.append("g").attr("class", CLASS.axisX).attr("transform", $$.getTranslate('subx')).attr("clip-path", config.axis_rotated ? "" : $$.clipPathForXAxis);
     };
-    c3_chart_internal_fn.initSubchartBrush = function () {
+    ChartInternal.prototype.initSubchartBrush = function () {
         var $$ = this;
         // Add extent rect for Brush
         $$.initBrush($$.subX).updateExtent();
         $$.context.select('.' + CLASS.brush).call($$.brush);
     };
-    c3_chart_internal_fn.updateTargetsForSubchart = function (targets) {
+    ChartInternal.prototype.updateTargetsForSubchart = function (targets) {
         var $$ = this,
             context = $$.context,
             config = $$.config,
             context.selectAll('.' + CLASS.brush + ' rect').attr(config.axis_rotated ? "width" : "height", config.axis_rotated ? $$.width2 : $$.height2);
         }
     };
-    c3_chart_internal_fn.updateBarForSubchart = function (durationForExit) {
+    ChartInternal.prototype.updateBarForSubchart = function (durationForExit) {
         var $$ = this;
         var contextBar = $$.context.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar).data($$.barData.bind($$));
         var contextBarEnter = contextBar.enter().append('path').attr("class", $$.classBar.bind($$)).style("stroke", 'none').style("fill", $$.color);
         contextBar.exit().transition().duration(durationForExit).style('opacity', 0).remove();
         $$.contextBar = contextBarEnter.merge(contextBar).style("opacity", $$.initialOpacity.bind($$));
     };
-    c3_chart_internal_fn.redrawBarForSubchart = function (drawBarOnSub, withTransition, duration) {
+    ChartInternal.prototype.redrawBarForSubchart = function (drawBarOnSub, withTransition, duration) {
         (withTransition ? this.contextBar.transition(Math.random().toString()).duration(duration) : this.contextBar).attr('d', drawBarOnSub).style('opacity', 1);
     };
-    c3_chart_internal_fn.updateLineForSubchart = function (durationForExit) {
+    ChartInternal.prototype.updateLineForSubchart = function (durationForExit) {
         var $$ = this;
         var contextLine = $$.context.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line).data($$.lineData.bind($$));
         var contextLineEnter = contextLine.enter().append('path').attr('class', $$.classLine.bind($$)).style('stroke', $$.color);
         contextLine.exit().transition().duration(durationForExit).style('opacity', 0).remove();
         $$.contextLine = contextLineEnter.merge(contextLine).style("opacity", $$.initialOpacity.bind($$));
     };
-    c3_chart_internal_fn.redrawLineForSubchart = function (drawLineOnSub, withTransition, duration) {
+    ChartInternal.prototype.redrawLineForSubchart = function (drawLineOnSub, withTransition, duration) {
         (withTransition ? this.contextLine.transition(Math.random().toString()).duration(duration) : this.contextLine).attr("d", drawLineOnSub).style('opacity', 1);
     };
-    c3_chart_internal_fn.updateAreaForSubchart = function (durationForExit) {
+    ChartInternal.prototype.updateAreaForSubchart = function (durationForExit) {
         var $$ = this,
             d3 = $$.d3;
         var contextArea = $$.context.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area).data($$.lineData.bind($$));
         contextArea.exit().transition().duration(durationForExit).style('opacity', 0).remove();
         $$.contextArea = contextAreaEnter.merge(contextArea).style("opacity", 0);
     };
-    c3_chart_internal_fn.redrawAreaForSubchart = function (drawAreaOnSub, withTransition, duration) {
+    ChartInternal.prototype.redrawAreaForSubchart = function (drawAreaOnSub, withTransition, duration) {
         (withTransition ? this.contextArea.transition(Math.random().toString()).duration(duration) : this.contextArea).attr("d", drawAreaOnSub).style("fill", this.color).style("opacity", this.orgAreaOpacity);
     };
-    c3_chart_internal_fn.redrawSubchart = function (withSubchart, transitions, duration, durationForExit, areaIndices, barIndices, lineIndices) {
+    ChartInternal.prototype.redrawSubchart = function (withSubchart, transitions, duration, durationForExit, areaIndices, barIndices, lineIndices) {
         var $$ = this,
             d3 = $$.d3,
             config = $$.config,
             }
         }
     };
-    c3_chart_internal_fn.redrawForBrush = function () {
+    ChartInternal.prototype.redrawForBrush = function () {
         var $$ = this,
             x = $$.x,
             d3 = $$.d3,
         $$.main.select('.' + CLASS.eventRect).call($$.zoom.transform, d3.zoomIdentity.scale($$.width / (s[1] - s[0])).translate(-s[0], 0));
         $$.config.subchart_onbrush.call($$.api, x.orgDomain());
     };
-    c3_chart_internal_fn.transformContext = function (withTransition, transitions) {
+    ChartInternal.prototype.transformContext = function (withTransition, transitions) {
         var $$ = this,
             subXAxis;
         if (transitions && transitions.axisSubX) {
         $$.context.attr("transform", $$.getTranslate('context'));
         subXAxis.attr("transform", $$.getTranslate('subx'));
     };
-    c3_chart_internal_fn.getDefaultSelection = function () {
+    ChartInternal.prototype.getDefaultSelection = function () {
         var $$ = this,
             config = $$.config,
             selection = isFunction(config.axis_x_selection) ? config.axis_x_selection($$.getXDomain($$.data.targets)) : config.axis_x_selection;
         return selection;
     };
 
-    c3_chart_internal_fn.initText = function () {
+    ChartInternal.prototype.initText = function () {
         var $$ = this;
         $$.main.select('.' + CLASS.chart).append("g").attr("class", CLASS.chartTexts);
         $$.mainText = $$.d3.selectAll([]);
     };
-    c3_chart_internal_fn.updateTargetsForText = function (targets) {
+    ChartInternal.prototype.updateTargetsForText = function (targets) {
         var $$ = this,
             classChartText = $$.classChartText.bind($$),
             classTexts = $$.classTexts.bind($$),
             return classChartText(d) + classFocus(d);
         });
     };
-    c3_chart_internal_fn.updateText = function (xForText, yForText, durationForExit) {
+    ChartInternal.prototype.updateText = function (xForText, yForText, durationForExit) {
         var $$ = this,
             config = $$.config,
             barOrLineData = $$.barOrLineData.bind($$),
         });
         mainText.exit().transition().duration(durationForExit).style('fill-opacity', 0).remove();
     };
-    c3_chart_internal_fn.redrawText = function (xForText, yForText, forFlow, withTransition, transition) {
+    ChartInternal.prototype.redrawText = function (xForText, yForText, forFlow, withTransition, transition) {
         return [(withTransition ? this.mainText.transition(transition) : this.mainText).attr('x', xForText).attr('y', yForText).style("fill", this.color).style("fill-opacity", forFlow ? 0 : this.opacityForText.bind(this))];
     };
-    c3_chart_internal_fn.getTextRect = function (text, cls, element) {
+    ChartInternal.prototype.getTextRect = function (text, cls, element) {
         var dummy = this.d3.select('body').append('div').classed('c3', true),
             svg = dummy.append("svg").style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0),
             font = this.d3.select(element).style('font'),
         dummy.remove();
         return rect;
     };
-    c3_chart_internal_fn.generateXYForText = function (areaIndices, barIndices, lineIndices, forX) {
+    ChartInternal.prototype.generateXYForText = function (areaIndices, barIndices, lineIndices, forX) {
         var $$ = this,
             getAreaPoints = $$.generateGetAreaPoints(areaIndices, false),
             getBarPoints = $$.generateGetBarPoints(barIndices, false),
             return getter.call($$, getPoints(d, i), d, this);
         };
     };
-    c3_chart_internal_fn.getXForText = function (points, d, textElement) {
+    ChartInternal.prototype.getXForText = function (points, d, textElement) {
         var $$ = this,
             box = textElement.getBoundingClientRect(),
             xPos,
         }
         return xPos;
     };
-    c3_chart_internal_fn.getYForText = function (points, d, textElement) {
+    ChartInternal.prototype.getYForText = function (points, d, textElement) {
         var $$ = this,
             box = textElement.getBoundingClientRect(),
             yPos;
         return yPos;
     };
 
-    c3_chart_internal_fn.initTitle = function () {
+    ChartInternal.prototype.initTitle = function () {
         var $$ = this;
         $$.title = $$.svg.append("text").text($$.config.title_text).attr("class", $$.CLASS.title);
     };
-    c3_chart_internal_fn.redrawTitle = function () {
+    ChartInternal.prototype.redrawTitle = function () {
         var $$ = this;
         $$.title.attr("x", $$.xForTitle.bind($$)).attr("y", $$.yForTitle.bind($$));
     };
-    c3_chart_internal_fn.xForTitle = function () {
+    ChartInternal.prototype.xForTitle = function () {
         var $$ = this,
             config = $$.config,
             position = config.title_position || 'left',
         }
         return x;
     };
-    c3_chart_internal_fn.yForTitle = function () {
+    ChartInternal.prototype.yForTitle = function () {
         var $$ = this;
         return $$.config.title_padding.top + $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).height;
     };
-    c3_chart_internal_fn.getTitlePadding = function () {
+    ChartInternal.prototype.getTitlePadding = function () {
         var $$ = this;
         return $$.yForTitle() + $$.config.title_padding.bottom;
     };
 
-    c3_chart_internal_fn.initTooltip = function () {
+    ChartInternal.prototype.initTooltip = function () {
         var $$ = this,
             config = $$.config,
             i;
             $$.tooltip.style("top", config.tooltip_init_position.top).style("left", config.tooltip_init_position.left).style("display", "block");
         }
     };
-    c3_chart_internal_fn.getTooltipSortFunction = function () {
+    ChartInternal.prototype.getTooltipSortFunction = function () {
         var $$ = this,
             config = $$.config;
 
             };
         }
     };
-    c3_chart_internal_fn.getTooltipContent = function (d, defaultTitleFormat, defaultValueFormat, color) {
+    ChartInternal.prototype.getTooltipContent = function (d, defaultTitleFormat, defaultValueFormat, color) {
         var $$ = this,
             config = $$.config,
             titleFormat = config.tooltip_format_title || defaultTitleFormat,
         }
         return text + "</table>";
     };
-    c3_chart_internal_fn.tooltipPosition = function (dataToShow, tWidth, tHeight, element) {
+    ChartInternal.prototype.tooltipPosition = function (dataToShow, tWidth, tHeight, element) {
         var $$ = this,
             config = $$.config,
             d3 = $$.d3;
         if (tooltipTop < 0) {
             tooltipTop = 0;
         }
-        return { top: tooltipTop, left: tooltipLeft };
+        return {
+            top: tooltipTop,
+            left: tooltipLeft
+        };
     };
-    c3_chart_internal_fn.showTooltip = function (selectedData, element) {
+    ChartInternal.prototype.showTooltip = function (selectedData, element) {
         var $$ = this,
             config = $$.config;
         var tWidth, tHeight, position;
             dataToShow = selectedData.filter(function (d) {
             return d && isValue(d.value);
         }),
-            positionFunction = config.tooltip_position || c3_chart_internal_fn.tooltipPosition;
+            positionFunction = config.tooltip_position || ChartInternal.prototype.tooltipPosition;
         if (dataToShow.length === 0 || !config.tooltip_show) {
             return;
         }
         // Set tooltip
         $$.tooltip.style("top", position.top + "px").style("left", position.left + 'px');
     };
-    c3_chart_internal_fn.hideTooltip = function () {
+    ChartInternal.prototype.hideTooltip = function () {
         this.tooltip.style("display", "none");
     };
 
-    c3_chart_internal_fn.setTargetType = function (targetIds, type) {
+    ChartInternal.prototype.setTargetType = function (targetIds, type) {
         var $$ = this,
             config = $$.config;
         $$.mapToTargetIds(targetIds).forEach(function (id) {
             config.data_type = type;
         }
     };
-    c3_chart_internal_fn.hasType = function (type, targets) {
+    ChartInternal.prototype.hasType = function (type, targets) {
         var $$ = this,
             types = $$.config.data_types,
             has = false;
         }
         return has;
     };
-    c3_chart_internal_fn.hasArcType = function (targets) {
+    ChartInternal.prototype.hasArcType = function (targets) {
         return this.hasType('pie', targets) || this.hasType('donut', targets) || this.hasType('gauge', targets);
     };
-    c3_chart_internal_fn.isLineType = function (d) {
+    ChartInternal.prototype.isLineType = function (d) {
         var config = this.config,
             id = isString(d) ? d : d.id;
         return !config.data_types[id] || ['line', 'spline', 'area', 'area-spline', 'step', 'area-step'].indexOf(config.data_types[id]) >= 0;
     };
-    c3_chart_internal_fn.isStepType = function (d) {
+    ChartInternal.prototype.isStepType = function (d) {
         var id = isString(d) ? d : d.id;
         return ['step', 'area-step'].indexOf(this.config.data_types[id]) >= 0;
     };
-    c3_chart_internal_fn.isSplineType = function (d) {
+    ChartInternal.prototype.isSplineType = function (d) {
         var id = isString(d) ? d : d.id;
         return ['spline', 'area-spline'].indexOf(this.config.data_types[id]) >= 0;
     };
-    c3_chart_internal_fn.isAreaType = function (d) {
+    ChartInternal.prototype.isAreaType = function (d) {
         var id = isString(d) ? d : d.id;
         return ['area', 'area-spline', 'area-step'].indexOf(this.config.data_types[id]) >= 0;
     };
-    c3_chart_internal_fn.isBarType = function (d) {
+    ChartInternal.prototype.isBarType = function (d) {
         var id = isString(d) ? d : d.id;
         return this.config.data_types[id] === 'bar';
     };
-    c3_chart_internal_fn.isScatterType = function (d) {
+    ChartInternal.prototype.isScatterType = function (d) {
         var id = isString(d) ? d : d.id;
         return this.config.data_types[id] === 'scatter';
     };
-    c3_chart_internal_fn.isPieType = function (d) {
+    ChartInternal.prototype.isPieType = function (d) {
         var id = isString(d) ? d : d.id;
         return this.config.data_types[id] === 'pie';
     };
-    c3_chart_internal_fn.isGaugeType = function (d) {
+    ChartInternal.prototype.isGaugeType = function (d) {
         var id = isString(d) ? d : d.id;
         return this.config.data_types[id] === 'gauge';
     };
-    c3_chart_internal_fn.isDonutType = function (d) {
+    ChartInternal.prototype.isDonutType = function (d) {
         var id = isString(d) ? d : d.id;
         return this.config.data_types[id] === 'donut';
     };
-    c3_chart_internal_fn.isArcType = function (d) {
+    ChartInternal.prototype.isArcType = function (d) {
         return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d);
     };
-    c3_chart_internal_fn.lineData = function (d) {
+    ChartInternal.prototype.lineData = function (d) {
         return this.isLineType(d) ? [d] : [];
     };
-    c3_chart_internal_fn.arcData = function (d) {
+    ChartInternal.prototype.arcData = function (d) {
         return this.isArcType(d.data) ? [d] : [];
     };
     /* not used
      return isScatterType(d) ? d.values : [];
      }
      */
-    c3_chart_internal_fn.barData = function (d) {
+    ChartInternal.prototype.barData = function (d) {
         return this.isBarType(d) ? d.values : [];
     };
-    c3_chart_internal_fn.lineOrScatterData = function (d) {
+    ChartInternal.prototype.lineOrScatterData = function (d) {
         return this.isLineType(d) || this.isScatterType(d) ? d.values : [];
     };
-    c3_chart_internal_fn.barOrLineData = function (d) {
+    ChartInternal.prototype.barOrLineData = function (d) {
         return this.isBarType(d) || this.isLineType(d) ? d.values : [];
     };
 
-    c3_chart_internal_fn.isSafari = function () {
+    ChartInternal.prototype.isSafari = function () {
         var ua = window.navigator.userAgent;
         return ua.indexOf('Safari') >= 0 && ua.indexOf('Chrome') < 0;
     };
-    c3_chart_internal_fn.isChrome = function () {
+    ChartInternal.prototype.isChrome = function () {
         var ua = window.navigator.userAgent;
         return ua.indexOf('Chrome') >= 0;
     };
 
-    c3_chart_internal_fn.initZoom = function () {
+    ChartInternal.prototype.initZoom = function () {
         var $$ = this,
             d3 = $$.d3,
             config = $$.config,
             startEvent;
 
         $$.zoom = d3.zoom().on("start", function () {
+            if (config.zoom_type !== 'scroll') {
+                return;
+            }
+
             var e = d3.event.sourceEvent;
             if (e && e.type === "brush") {
                 return;
             startEvent = e;
             config.zoom_onzoomstart.call($$.api, e);
         }).on("zoom", function () {
+            if (config.zoom_type !== 'scroll') {
+                return;
+            }
+
             var e = d3.event.sourceEvent;
             if (e && e.type === "brush") {
                 return;
             }
-            $$.redrawForZoom.call($$);
+
+            $$.redrawForZoom();
+
+            config.zoom_onzoom.call($$.api, $$.x.orgDomain());
         }).on('end', function () {
+            if (config.zoom_type !== 'scroll') {
+                return;
+            }
+
             var e = d3.event.sourceEvent;
             if (e && e.type === "brush") {
                 return;
 
         return $$.zoom.updateExtent();
     };
-    c3_chart_internal_fn.zoomTransform = function (range) {
+    ChartInternal.prototype.zoomTransform = function (range) {
         var $$ = this,
             s = [$$.x(range[0]), $$.x(range[1])];
         return $$.d3.zoomIdentity.scale($$.width / (s[1] - s[0])).translate(-s[0], 0);
     };
 
-    c3_chart_internal_fn.getZoomDomain = function () {
+    ChartInternal.prototype.initDragZoom = function () {
+        var $$ = this;
+        var d3 = $$.d3;
+        var config = $$.config;
+        var context = $$.context = $$.svg;
+        var brushXPos = $$.margin.left + 20.5;
+        var brushYPos = $$.margin.top + 0.5;
+
+        if (!(config.zoom_type === 'drag' && config.zoom_enabled)) {
+            return;
+        }
+
+        var getZoomedDomain = function getZoomedDomain(selection) {
+            return selection && selection.map(function (x) {
+                return $$.x.invert(x);
+            });
+        };
+
+        var brush = $$.dragZoomBrush = d3.brushX().on("start", function () {
+            $$.api.unzoom();
+
+            $$.svg.select("." + CLASS.dragZoom).classed("disabled", false);
+
+            config.zoom_onzoomstart.call($$.api, d3.event.sourceEvent);
+        }).on("brush", function () {
+            config.zoom_onzoom.call($$.api, getZoomedDomain(d3.event.selection));
+        }).on("end", function () {
+            if (d3.event.selection == null) {
+                return;
+            }
+
+            var zoomedDomain = getZoomedDomain(d3.event.selection);
+
+            if (!config.zoom_disableDefaultBehavior) {
+                $$.api.zoom(zoomedDomain);
+            }
+
+            $$.svg.select("." + CLASS.dragZoom).classed("disabled", true);
+
+            config.zoom_onzoomend.call($$.api, zoomedDomain);
+        });
+
+        context.append("g").classed(CLASS.dragZoom, true).attr("clip-path", $$.clipPath).attr("transform", "translate(" + brushXPos + "," + brushYPos + ")").call(brush);
+    };
+
+    ChartInternal.prototype.getZoomDomain = function () {
         var $$ = this,
             config = $$.config,
             d3 = $$.d3,
             max = d3.max([$$.orgXDomain[1], config.zoom_x_max]);
         return [min, max];
     };
-    c3_chart_internal_fn.redrawForZoom = function () {
+    ChartInternal.prototype.redrawForZoom = function () {
         var $$ = this,
             d3 = $$.d3,
             config = $$.config,
 
         zoom.update();
 
+        if (config.zoom_disableDefaultBehavior) {
+            return;
+        }
+
         if ($$.isCategorized() && x.orgDomain()[0] === $$.orgXDomain[0]) {
             x.domain([$$.orgXDomain[0] - 1e-10, x.orgDomain()[1]]);
         }
+
         $$.redraw({
             withTransition: false,
             withY: config.zoom_rescale,
             withEventRect: false,
             withDimension: false
         });
+
         if (d3.event.sourceEvent && d3.event.sourceEvent.type === 'mousemove') {
             $$.cancelClick = true;
         }
-        config.zoom_onzoom.call($$.api, x.orgDomain());
     };
 
     return c3;