forked from jettro/c3-angular-directive
-
Notifications
You must be signed in to change notification settings - Fork 1
/
c3-angular.min.js
6 lines (5 loc) · 22.4 KB
/
c3-angular.min.js
1
2
3
4
5
6
/*! c3-angular - v1.3.1 - 2016-08-04
* https://github.com/jettro/c3-angular-directive
* Copyright (c) 2016 ; Licensed */
function ChartAxes(){var a=function(a,b,c,d){var e=c.valuesX;e&&d.addXAxisValues(e);var f=c.valuesXs,g={};if(f){xsItems=f.split(",");for(var h in xsItems)xsItem=xsItems[h].split(":"),g[xsItem[0]]=xsItem[1];d.addXSValues(g)}var i=c.y,j=c.y2,k={};if(j){var l=j.split(",");for(var m in l)k[l[m]]="y2";if(i){var n=i.split(",");for(var o in n)k[n[o]]="y"}d.addYAxis(k)}};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function ChartAxis(){var a=function(a,b,c,d){var e=c.axisRotate;e&&d.rotateAxis()};return{require:"^c3chart",restrict:"E",scope:{},transclude:!0,template:"<div ng-transclude></div>",replace:!0,link:a}}function ChartAxisX(){var a=function(a,b,c,d){var e=c.axisPosition,f=c.axisLabel,g={label:{text:f,position:e}},h=c.paddingLeft,i=c.paddingRight;(h||i)&&(h=h?h:0,i=i?i:0,g.padding={left:parseInt(h),right:parseInt(i)});var j=c.axisHeight;j&&(g.height=parseInt(j)),"false"===c.show&&(g.show=!1),"true"===c.axisLocaltime&&(g.localtime=!0);var k=c.axisMax;k&&(g.max=k);var l=c.axisMin;l&&(g.min=l);var m=c.axisType;m&&(g.type=m),d.addAxisProperties("x",g);var n=c.axisXFormat;n&&d.setXFormat(n)};return{require:"^c3chart",restrict:"E",scope:{},transclude:!0,template:"<div ng-transclude></div>",replace:!0,link:a}}function ChartAxisXTick(){var a=function(a,b,c,d){var e={},f=c.tickCount;f&&(e.count=f);var g=c.tickCulling;g&&(g=angular.lowercase(g),"true"===g?e.culling=!0:"false"===g&&(e.culling=!1));var h=c.tickCullingMax;h&&(e.culling={max:parseInt(h)});var i=c.tickMultiline;i&&(i=angular.lowercase(i),"true"===i?e.multiline=!0:"false"===i&&(e.multiline=!1));var j=c.tickCentered;j&&(j=angular.lowercase(j),"true"===j?e.centered=!0:"false"===j&&(e.centered=!1));var k=c.tickRotate;k&&(e.rotate=k);var l=c.tickFit;l&&(l=angular.lowercase(l),"true"===l?e.fit=!0:"false"===l&&(e.fit=!1));var m=c.tickValues;m&&m&&(e.values=m.indexOf(",")>-1?m.split(","):m);var n=c.tickOuter;n&&(n=angular.lowercase(n),"true"===n?e.outer=!0:"false"===n&&(e.outer=!1));var o=c.format;o&&(e.format=d3.format(o));var p=c.formatTime;p&&(e.format=d3.time.format(p)),d.addXTick(e),c.tickFormatFunction&&d.addXTickFormatFunction(a.tickFormatFunction())};return{require:"^c3chart",restrict:"E",scope:{tickFormatFunction:"&"},replace:!0,link:a}}function ChartAxisY(){var a=function(a,b,c,d){var e=c.axisId,f=c.axisPosition,g=c.axisLabel;e=void 0==e?"y":e;var h={label:{text:g,position:f}};"false"===c.show?h.show=!1:"y2"===e&&(h.show=!0);var i=c.paddingTop,j=c.paddingBottom;(i||j)&&(i=i?i:0,j=j?j:0,h.padding={top:parseInt(i),bottom:parseInt(j)});var k=c.axisMax,l=c.axisMin;k&&(h.max=parseInt(k)),l&&(h.min=parseInt(l)),"true"===c.axisInverted&&(h.inverted=!0),"true"===c.axisInner&&(h.inner=!0);var m=c.axisCenter;m&&(h.center=parseInt(m)),d.addAxisProperties(e,h)};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function ChartAxisYTick(){var a=function(a,b,c,d){var e={},f=c.tickCount;f&&(e.count=f);var g=c.tickOuter;g&&(g=angular.lowercase(g),"true"===g?e.outer=!0:"false"===g&&(e.outer=!1));var h=c.tickValues;h&&(e.values=h.indexOf(",")>-1?h.split(","):h);var i=c.tickFormat;i&&(e.format=d3.format(i)),d.addYTick(e),c.tickFormatFunction&&d.addYTickFormatFunction(a.tickFormatFunction())};return{require:"^c3chart",restrict:"E",scope:{tickFormatFunction:"&"},replace:!0,link:a}}function ChartBar(){var a=function(a,b,c,d){var e={};c.width&&(e.width=parseInt(c.width)),c.ratio&&(e.width||(e.width={}),e.width.ratio=parseFloat(c.ratio)),c.zerobased&&(e.zerobased="true"===c.zerobased),d.addBar(e)};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function C3Chart(a){var b=function(b,c,d,e){var f=d.paddingTop,g=d.paddingRight,h=d.paddingBottom,i=d.paddingLeft,j=d.sortData,k=d.transitionDuration,l=d.initialConfig;f&&e.addPadding("top",f),g&&e.addPadding("right",g),h&&e.addPadding("bottom",h),i&&e.addPadding("left",i),j&&e.addSorting(j),d.labelsFormatFunction&&e.addDataLabelsFormatFunction(b.labelsFormatFunction()),d.onZoomEndFunction&&e.addOnZoomEndFunction(b.onZoomEndFunction()),d.subchartOnBrushFunction&&e.addSubchartOnBrushFunction(b.subchartOnBrushFunction()),d.callbackFunction&&e.addChartCallbackFunction(b.callbackFunction()),k&&e.addTransitionDuration(k),l&&e.addInitialConfig(l),a(function(){e.showGraph()})};return{restrict:"E",controller:"ChartController",scope:{bindto:"@bindtoId",showLabels:"@showLabels",labelsFormatFunction:"&",onZoomEndFunction:"&",showSubchart:"@showSubchart",subchartOnBrushFunction:"&",enableZoom:"@enableZoom",chartData:"=chartData",chartColumns:"=chartColumns",chartX:"=chartX",callbackFunction:"&",emptyLabel:"@emptyLabel"},template:"<div><div id='{{bindto}}'></div><div ng-transclude></div></div>",replace:!0,transclude:!0,link:b}}function ChartColors(){var a=function(a,b,c,d){var e=c.colorPattern;e&&d.addColorPatterns(e.split(","));var f=c.thresholds;f&&d.addColorThresholds(f.split(",")),c.colorFunction&&d.addColorFunction(a.colorFunction())};return{require:"^c3chart",restrict:"E",scope:{colorFunction:"&"},replace:!0,link:a}}function ChartColumn(){var a=function(a,b,c,d){var e=c.columnValues.split(",");e.unshift(c.columnId),d.addColumn(e,c.columnType,c.columnName,c.columnColor)};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function ChartController(a,b){function c(){a.chart=null,a.columns=[],a.types={},a.regions={},a.axis={},a.axes={},a.padding=null,a.emptyLabel=null,a.xValues=null,a.xFormat=null,a.xsValues=null,a.xTick=null,a.yTick=null,a.names=null,a.grid=null,a.legend=null,a.tooltip=null,a.chartSize=null,a.colors=null,a.colorThresholds=null,a.gauge=null,a.jsonKeys=null,a.groups=null,a.sorting=null,a.transitionDuration=null,a.initialConfig=null,a.selection=null}function d(){var d={};a.initialConfig&&(d=a.initialConfig),d.bindto="#"+a.bindto,d.data=d.data||{},a.xValues&&(d.data.x=a.xValues),a.xsValues&&(d.data.xs=a.xsValues),a.columns&&(d.data.columns=a.columns),a.xFormat&&(d.data.xFormat=a.xFormat),d.data.types=d.data.types||a.types,d.data.axes=d.data.axes||a.axes,a.names&&(d.data.names=a.names),null!=a.emptyLabel&&(d.data.empty={label:{text:a.emptyLabel}}),null!=a.padding&&(d.padding=a.padding),null!=a.sorting&&(d.data.order="null"==a.sorting?null:a.sorting),null!=a.transitionDuration&&(d.transition=d.transition||{},d.transition.duration=a.transitionDuration),a.showLabels&&"true"===a.showLabels&&(d.data.labels=!0),a.dataLabelsFormatFunction&&(d.data.labels=d.data.labels||{},d.data.labels.format=a.dataLabelsFormatFunction),null!=a.groups&&(d.data.groups=a.groups),a.showSubchart&&"true"===a.showSubchart&&(d.subchart={show:!0}),a.subchartOnBrushFunction&&(d.subchart=d.subchart||{},d.subchart.onbrush=a.subchartOnBrushFunction),a.enableZoom&&"true"===a.enableZoom&&(d.zoom={enabled:!0}),a.onZoomEndFunction&&(d.zoom=d.zoom||{},d.zoom.onzoomend=a.onZoomEndFunction),d.axis=d.axis||a.axis,a.xTick&&(d.axis.x.tick=a.xTick),a.xTickFormatFunction&&(d.axis.x.tick=d.axis.x.tick||{},d.axis.x.tick.format=a.xTickFormatFunction),a.xType&&(d.axis.x.type=a.xType),a.yTick&&(d.axis.y.tick=a.yTick),a.yTickFormatFunction&&(d.axis.y.tick=d.axis.y.tick||{},d.axis.y.tick.format=a.yTickFormatFunction),null!=a.grid&&(d.grid=a.grid),null!=a.legend&&(d.legend=a.legend),d.tooltip=null!=a.tooltip?a.tooltip:{},a.tooltipTitleFormatFunction&&(d.tooltip.format=d.tooltip.format||{},d.tooltip.format.title=a.tooltipTitleFormatFunction),a.tooltipNameFormatFunction&&(d.tooltip.format=d.tooltip.format||{},d.tooltip.format.name=a.tooltipNameFormatFunction),a.tooltipValueFormatFunction&&(d.tooltip.format=d.tooltip.format||{},d.tooltip.format.value=a.tooltipValueFormatFunction),a.tooltipContentFormatFunction&&(d.tooltip.contents=a.tooltipContentFormatFunction),null!=a.chartSize&&(d.size=a.chartSize),null!=a.colors&&(d.data.colors=a.colors),a.colorFunction&&(d.data.color=a.colorFunction),null!=a.colorPatterns&&(void 0===d.color&&(d.color={}),d.color.pattern=a.colorPatterns),null!=a.colorThresholds&&(void 0===d.color&&(d.color={}),d.color.threshold={values:a.colorThresholds}),d.gauge=null!=a.gauge?a.gauge:{},a.gaugeLabelFormatFunction&&(d.gauge.label=d.gauge.label||{},d.gauge.label.format=a.gaugeLabelFormatFunction),null!=a.point&&(d.point=a.point),null!=a.bar&&(d.bar=a.bar),null!=a.line&&(d.line=a.line),null!=a.regions&&(d.data.regions=a.regions),null!=a.pie&&(d.pie=a.pie),a.pieLabelFormatFunction&&(d.pie.label=d.pie.label||{},d.pie.label.format=a.pieLabelFormatFunction),d.donut=null!=a.donut?a.donut:{},a.donutLabelFormatFunction&&(d.donut.label=d.donut.label||{},d.donut.label.format=a.donutLabelFormatFunction),null!=a.onInit&&(d.oninit=a.onInit),null!=a.onMouseover&&(d.onmouseover=a.onMouseover),null!=a.onMouseout&&(d.onmouseout=a.onMouseout),null!=a.onRendered&&(d.onrendered=a.onRendered),null!=a.onResize&&(d.onresize=a.onResize),null!=a.onResized&&(d.onresized=a.onResized),null!=a.dataOnClick&&(d.data.onclick=function(b){a.$apply(function(){a.dataOnClick({data:b})})}),null!=a.dataOnMouseover&&(d.data.onmouseover=function(b){a.$apply(function(){a.dataOnMouseover({data:b})})}),null!=a.dataOnMouseout&&(d.data.onmouseout=function(b){a.$apply(function(){a.dataOnMouseout({data:b})})}),null!=a.selection&&(d.data.selection=a.selection),a.config=d,a.chartData&&a.chartColumns?a.$watch("chartData",function(){gb()},!0):(a.chart=c3.generate(a.config),a.chartCallbackFunction&&a.chartCallbackFunction(a.chart)),a.$on("$destroy",function(){b(function(){angular.isDefined(a.chart)&&(a.chart=a.chart.destroy(),c())},1e4)})}function e(b,c,d,e){a.columns.push(b),eb(b[0],c,d,e)}function f(b){a.axes=b,a.axis.y2||(a.axis.y2={show:!0})}function g(b){a.dataLabelsFormatFunction=b}function h(b){a.subchartOnBrushFunction=b}function i(b){a.onZoomEndFunction=b}function j(b){a.chartCallbackFunction=b}function k(b){a.transitionDuration=b}function l(b){a.xValues=b}function m(b){a.xsValues=b}function n(b,c){a.axis[b]=c}function o(b){a.xTick=b}function p(b){a.xTickFormatFunction=b}function q(b){a.xType=b}function r(b){a.yTick=b}function s(b){a.yTickFormatFunction=b}function t(){a.axis.rotated=!0}function u(b){a.emptyLabel=b}function v(b,c){null==a.padding&&(a.padding={}),a.padding[b]=parseInt(c)}function w(b){a.sorting=b}function x(b){null==a.grid&&(a.grid={}),null==a.grid[b]&&(a.grid[b]={}),a.grid[b].show=!0}function y(b,c,d,e,f){null==a.grid&&(a.grid={}),"x"===b?(void 0===a.grid.x&&(a.grid.x={}),void 0===a.grid.x.lines&&(a.grid.x.lines=[])):(void 0===a.grid.y&&(a.grid.y={}),void 0===a.grid.y.lines&&(a.grid.y.lines=[]));var g={};g.value=isNaN(+c)?c:+c,g.text=d,e&&(g["class"]=e),f&&(g.position=f),"y2"===b?(g.axis="y2",a.grid.y.lines.push(g)):a.grid[b].lines.push(g)}function z(b){a.legend=b}function A(b){a.tooltip=b}function B(b){a.tooltipTitleFormatFunction=b}function C(b){a.tooltipNameFormatFunction=b}function D(b){a.tooltipValueFormatFunction=b}function E(b){a.tooltipContentFormatFunction=b}function F(b){a.chartSize=b}function G(b){a.colorPatterns=b}function H(b){a.colorThresholds=b,a.colors&&(a.colors.threshold={values:a.colorThresholds})}function I(b){a.colorFunction=b}function J(b){a.onInit=b}function K(b){a.onMouseover=b}function L(b){a.onMouseout=b}function M(b){a.onRendered=b}function N(b){a.onResize=b}function O(b){a.onResized=b}function P(b){a.dataOnClick=b}function Q(b){a.dataOnMouseover=b}function R(b){a.dataOnMouseout=b}function S(b){a.gauge=b}function T(b){a.gaugeLabelFormatFunction=b}function U(b){a.bar=b}function V(b){a.line=b}function W(b,c){a.regions[b]=c}function X(b){a.pie=b}function Y(b){a.pieLabelFormatFunction=b}function Z(b){a.donut=b}function $(b){a.donutLabelFormatFunction=b}function _(b){null==a.groups&&(a.groups=[]),a.groups.push(b)}function ab(b){a.point=b}function bb(){null==a.grid&&(a.grid={}),a.grid.focus={show:!1}}function cb(b){a.xFormat=b}function db(b){a.initialConfig=b}function eb(b,c,d,e){void 0!==c&&(a.types[b]=c),void 0!==d&&(null===a.names&&(a.names={}),a.names[b]=d),void 0!==e&&(null===a.colors&&(a.colors={}),a.colors[b]=e)}function fb(b){a.selection=b}function gb(){a.jsonKeys={},a.jsonKeys.value=[],angular.forEach(a.chartColumns,function(b){a.jsonKeys.value.push(b.id),eb(b.id,b.type,b.name,b.color)}),a.chartX&&(a.jsonKeys.x=a.chartX.id),a.names&&(a.config.data.names=a.names),a.colors&&(a.config.data.colors=a.colors),a.groups&&(a.config.data.groups=a.groups),a.config.data.keys=a.jsonKeys,a.config.data.json=a.chartData,a.chartIsGenerated?(a.config.data.unload=!0,a.chart.load(a.config.data)):(a.chart=c3.generate(a.config),a.chartIsGenerated=!0,a.chartCallbackFunction&&a.chartCallbackFunction(a.chart))}this.showGraph=d,this.addColumn=e,this.addAxisProperties=n,this.rotateAxis=t,this.addPadding=v,this.addSorting=w,this.addSize=F,this.addEmptyLabel=u,this.addColorPatterns=G,this.addColorThresholds=H,this.addColorFunction=I,this.addGrid=x,this.addGridLine=y,this.hideGridFocus=bb,this.addLegend=z,this.addTooltip=A,this.addTooltipTitleFormatFunction=B,this.addTooltipNameFormatFunction=C,this.addTooltipValueFormatFunction=D,this.addTooltipContentFormatFunction=E,this.addYAxis=f,this.addYTick=r,this.addYTickFormatFunction=s,this.addXAxisValues=l,this.addXTick=o,this.addXTickFormatFunction=p,this.addXType=q,this.addXSValues=m,this.addChartCallbackFunction=j,this.addInitialConfig=db,this.addDataLabelsFormatFunction=g,this.addTransitionDuration=k,this.addSubchartOnBrushFunction=h,this.addOnZoomEndFunction=i,this.addGauge=S,this.addGaugeLabelFormatFunction=T,this.addBar=U,this.addLine=V,this.addRegion=W,this.addPie=X,this.addPieLabelFormatFunction=Y,this.addDonut=Z,this.addDonutLabelFormatFunction=$,this.addGroup=_,this.addPoint=ab,this.addOnInitFunction=J,this.addOnMouseoverFunction=K,this.addOnMouseoutFunction=L,this.addOnRenderedFunction=M,this.addOnResizeFunction=N,this.addOnResizedFunction=O,this.addDataOnClickFunction=P,this.addDataOnMouseoverFunction=Q,this.addDataOnMouseoutFunction=R,this.setXFormat=cb,this.addSelection=fb,c()}function ChartDonut(){var a=function(a,b,c,d){var e={};c.showLabel&&(e.label={show:"true"===c.showLabel}),c.thresholdLabel&&(e.label||(e.label={}),e.label.threshold=parseFloat(c.thresholdLabel)),c.expand&&(e.expand="true"===c.expand),c.width&&(e.width=parseInt(c.width)),c.title&&(e.title=c.title),d.addDonut(e),c.labelFormatFunction&&d.addDonutLabelFormatFunction(a.labelFormatFunction())};return{require:"^c3chart",restrict:"E",scope:{labelFormatFunction:"&"},replace:!0,link:a}}function ChartEvents(){var a=function(a,b,c,d){c.onInit&&d.addOnInitFunction(a.onInit),c.onMouseover&&d.addOnMouseoverFunction(a.onMouseover),c.onMouseout&&d.addOnMouseoutFunction(a.onMouseout),c.onResize&&d.addOnResizeFunction(a.onResize),c.onResized&&d.addOnResizedFunction(a.onResized),c.onRendered&&d.addOnRenderedFunction(a.onRendered),c.onClickData&&d.addDataOnClickFunction(a.onClickData),c.onMouseoverData&&d.addDataOnMouseoverFunction(a.onMouseoverData),c.onMouseoutData&&d.addDataOnMouseoutFunction(a.onMouseoutData)};return{require:"^c3chart",restrict:"E",scope:{onInit:"&",onMouseover:"&",onMouseout:"&",onResize:"&",onResized:"&",onRendered:"&",onClickData:"&",onMouseoverData:"&",onMouseoutData:"&"},replace:!0,link:a}}function ChartGauge(){var a=function(a,b,c,d){var e={};c.min&&(e.min=parseInt(c.min)),c.max&&(e.max=parseInt(c.max)),c.width&&(e.width=parseInt(c.width)),c.units&&(e.units=c.units),c.showLabel&&(e.label={show:"true"===c.showLabel}),c.expand&&(e.expand="true"===c.expand),d.addGauge(e),c.labelFormatFunction&&d.addGaugeLabelFormatFunction(a.labelFormatFunction())};return{require:"^c3chart",restrict:"E",scope:{labelFormatFunction:"&"},replace:!0,link:a}}function ChartGrid(){var a=function(a,b,c,d){var e=c.showX;e&&"true"===e&&d.addGrid("x");var f=c.showY;f&&"true"===f&&d.addGrid("y");var g=c.showY2;g&&"true"===g&&d.addGrid("y2");var h=c.showFocus;h&&"false"===h&&d.hideGridFocus()};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a,transclude:!0,template:"<div ng-transclude></div>"}}function ChartGridOptional(){var a=function(a,b,c,d){var e=c.axisId,f=c.gridValue,g=c.gridText,h=c.gridClass,i=c.position;d.addGridLine(e,f,g,h,i)};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function ChartGroup(){var a=function(a,b,c,d){var e=c.groupValues.split(",");d.addGroup(e)};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function ChartLegend(){var a=function(a,b,c,d){var e=null,f=c.showLegend;if(f&&"false"===f)e={show:!1};else{var g=c.legendPosition;g&&(e={position:g});var h=c.legendInset;if(h){e={position:"inset",inset:{anchor:h}};var i=c.legendInsetX;i&&(e.inset.x=parseInt(i));var j=c.legendInsetY;j&&(e.inset.y=parseInt(j));var k=c.legendInsetStep;k&&(e.inset.step=parseInt(k))}}c.onMouseover&&(e=e||{},e.item=e.item||{},e.item.onmouseover=function(b){a.$apply(function(){a.onMouseover({data:b})})}),c.onMouseout&&(e=e||{},e.item=e.item||{},e.item.onmouseout=function(b){a.$apply(function(){a.onMouseout({data:b})})}),c.onClick&&(e=e||{},e.item=e.item||{},e.item.onclick=function(b){a.$apply(function(){a.onClick({data:b})})}),null!=e&&d.addLegend(e)};return{require:"^c3chart",restrict:"E",scope:{onMouseover:"&",onMouseout:"&",onClick:"&"},replace:!0,link:a}}function ChartLine(){var a=function(a,b,c,d){var e={};c.stepType&&(e.step=e.step||{},e.step.type=c.stepType),c.connectNull&&(e.connectNull="true"===c.connectNull),d.addLine(e)};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function ChartPie(){var a=function(a,b,c,d){var e={};c.showLabel&&(e.label={show:"true"===c.showLabel}),c.thresholdLabel&&(e.label||(e.label={}),e.label.threshold=parseFloat(c.thresholdLabel)),c.expand&&(e.expand="true"===c.expand),d.addPie(e),c.labelFormatFunction&&d.addPieLabelFormatFunction(a.labelFormatFunction())};return{require:"^c3chart",restrict:"E",scope:{labelFormatFunction:"&"},replace:!0,link:a}}function ChartPoints(){var a=function(a,b,c,d){var e={};c.showPoint&&(e.show="true"===c.showPoint),c.pointExpandEnabled&&(e.focus||(e.focus={expand:{}}),e.focus.expand.enabled="false"!==c.pointsFocusEnabled),c.pointExpandRadius&&(e.focus||(pie.focus={expand:{}}),e.focus.expand.r=parseInt(c.pointFocusRadius)),c.pointRadius&&(e.r=parseInt(c.pointRadius)),c.pointSelectRadius&&(e.select={r:parseInt(c.pointSelectRadius)}),d.addPoint(e)};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function ChartRegion(){var a=function(a,b,c,d){var e="dashed",f=[],g=[],h=[];c.regionStyle&&(e=c.regionStyle),c.regionStarts&&(f=c.regionStarts.split(",")),c.regionEnds&&(g=c.regionEnds.split(",")),f.length>g.length&&h.push({start:f.pop(),style:e}),f.length<g.length&&h.push({end:g.shift(),style:e}),f.forEach(function(a,b){h.push({start:f[b],end:g[b],style:e})}),d.addRegion(c.regionId,h)};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function Selection(){var a=function(a,b,c,d){var e=c.enabled,f=c.grouped,g=c.multiple;if(e&&"true"===e){var h={enabled:!0};f&&"true"===f&&(h.grouped=!0),g&&"true"===g&&(h.multiple=!0),d.addSelection(h)}};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function ChartSize(){var a=function(a,b,c,d){var e=null,f=c.chartWidth,g=c.chartHeight;(f||g)&&(e={},f&&(e.width=parseInt(f)),g&&(e.height=parseInt(g)),d.addSize(e))};return{require:"^c3chart",restrict:"E",scope:{},replace:!0,link:a}}function ChartTooltip(){var a=function(a,b,c,d){var e=null,f=c.showTooltip,g=(c.hideTooltipTitle,c.joinedTooltip);if(f&&"false"===f)e={show:!1};else{var h=c.groupTooltip;h&&"false"===h&&(e={grouped:!1})}g&&"true"===g&&(e=e||{},e.contents=function(a,b,c,d){var e,f,g,h,i,j,k,l=this,m=l.config,n=m.tooltip_format_title||b,o=m.tooltip_format_name||function(a){return a},p=m.tooltip_format_value||c;for(k={tooltipContainer:"c3-tooltip-container",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name"},f=a[0].x;f<a[0].x+1;f++)a[f]&&(a[f].value||0===a[f].value)&&(e||(g=n?n(a[f].x):a[f].x,e="<table class='"+k.tooltip+"'>"+(g||0===g?"<tr><th colspan='2'>"+g+"</th></tr>":"")),h=p(a[f].value,a[f].ratio,a[f].id,a[f].index),void 0!==h&&(i=o(a[f].name,a[f].ratio,a[f].id,a[f].index),j=l.levelColor?l.levelColor(a[f].value):d(a[f].id),e+="<tr class='"+k.tooltipName+"-"+a[f].id+"'>",e+="<td class='name'><span style='background-color:"+j+"'></span>"+i+"</td>",e+="<td class='value'>"+h+"</td>",e+="</tr>"));return e+"</table>"}),null!=e&&d.addTooltip(e),c.titleFormatFunction&&d.addTooltipTitleFormatFunction(a.titleFormatFunction()),c.nameFormatFunction&&d.addTooltipNameFormatFunction(a.nameFormatFunction()),c.valueFormatFunction&&d.addTooltipValueFormatFunction(a.valueFormatFunction()),c.contentFormatFunction&&d.addTooltipContentFormatFunction(a.contentFormatFunction())};return{require:"^c3chart",restrict:"E",scope:{valueFormatFunction:"&",nameFormatFunction:"&",titleFormatFunction:"&",contentFormatFunction:"&"},replace:!0,link:a}}angular.module("gridshore.c3js.chart",[]),angular.module("gridshore.c3js.chart").directive("chartAxes",ChartAxes),angular.module("gridshore.c3js.chart").directive("chartAxis",ChartAxis),angular.module("gridshore.c3js.chart").directive("chartAxisX",ChartAxisX),angular.module("gridshore.c3js.chart").directive("chartAxisXTick",ChartAxisXTick),angular.module("gridshore.c3js.chart").directive("chartAxisY",ChartAxisY),angular.module("gridshore.c3js.chart").directive("chartAxisYTick",ChartAxisYTick),angular.module("gridshore.c3js.chart").directive("chartBar",ChartBar),angular.module("gridshore.c3js.chart").directive("c3chart",["$timeout",function(a){return C3Chart(a)}]),angular.module("gridshore.c3js.chart").directive("chartColors",ChartColors),angular.module("gridshore.c3js.chart").directive("chartColumn",ChartColumn),angular.module("gridshore.c3js.chart").controller("ChartController",ChartController),ChartController.$inject=["$scope","$timeout"],angular.module("gridshore.c3js.chart").directive("chartDonut",ChartDonut),angular.module("gridshore.c3js.chart").directive("chartEvents",ChartEvents),angular.module("gridshore.c3js.chart").directive("chartGauge",ChartGauge),angular.module("gridshore.c3js.chart").directive("chartGrid",ChartGrid),angular.module("gridshore.c3js.chart").directive("chartGridOptional",ChartGridOptional),angular.module("gridshore.c3js.chart").directive("chartGroup",ChartGroup),angular.module("gridshore.c3js.chart").directive("chartLegend",ChartLegend),angular.module("gridshore.c3js.chart").directive("chartLine",ChartLine),angular.module("gridshore.c3js.chart").directive("chartPie",ChartPie),angular.module("gridshore.c3js.chart").directive("chartPoints",ChartPoints),angular.module("gridshore.c3js.chart").directive("chartRegion",ChartRegion),angular.module("gridshore.c3js.chart").directive("selection",Selection),angular.module("gridshore.c3js.chart").directive("chartSize",ChartSize),angular.module("gridshore.c3js.chart").directive("chartTooltip",ChartTooltip);
//# sourceMappingURL=c3-angular.min.js.map