src/mmw/js/src/core/chart.js
// data is same format as for renderVerticalBarChart
data is same format as for renderVerticalBarChart
data is same format as for renderVerticalBarChart
function renderLineChart(chartEl, data, options, tooltipKeyFormatFn) {
    var chart = nv.models.lineChart(),
        svg = makeSvg(chartEl);
    options = options || {};
    _.defaults(options, {
        margin: {top: 20, right: 30, bottom: 40, left: 60},
        yTickFormat: '.02f',
        onRenderComplete: _.noop,
    });
    nv.addGraph(function() {
        chart.showLegend(false)
            .margin(options.margin);
        chart.xAxis
            .tickValues(options.xTickValues)
            .tickFormat(function(month) {
                return options.xAxisLabel(month);
            });
        chart.yAxis
            .axisLabel(options.yAxisLabel)
            .tickFormat(d3.format(options.yTickFormat));
        if (!!tooltipKeyFormatFn) {
            chart.tooltip.keyFormatter(tooltipKeyFormatFn);
        }
        chart.tooltip.valueFormatter(function(d) {
            return chart.yAxis.tickFormat()(d) + ' ' + options.yAxisUnit;
        });
        handleCommonOptions(chart, options);
        d3.select(svg)
            .datum(data)
            .call(chart);
        return chart;
    }, options.onRenderComplete);
}
function renderLineChart ( chartEl , data , options , tooltipKeyFormatFn ) { var chart = nv . models . lineChart ( ) , svg = makeSvg ( chartEl ) ; options = options || { } ; _ . defaults ( options , { margin : { top : 20 , right : 30 , bottom : 40 , left : 60 } , yTickFormat : '.02f' , onRenderComplete : _ . noop , } ) ; nv . addGraph ( function ( ) { chart . showLegend ( false ) . margin ( options . margin ) ; chart . xAxis . tickValues ( options . xTickValues ) . tickFormat ( function ( month ) { return options . xAxisLabel ( month ) ; } ) ; chart . yAxis . axisLabel ( options . yAxisLabel ) . tickFormat ( d3 . format ( options . yTickFormat ) ) ; if ( ! ! tooltipKeyFormatFn ) { chart . tooltip . keyFormatter ( tooltipKeyFormatFn ) ; } chart . tooltip . valueFormatter ( function ( d ) { return chart . yAxis . tickFormat ( ) ( d ) + ' ' + options . yAxisUnit ; } ) ; handleCommonOptions ( chart , options ) ; d3 . select ( svg ) . datum ( data ) . call ( chart ) ; return chart ; } , options . onRenderComplete ) ; }
data is same format as for renderVerticalBarChart
data is same format as for renderVerticalBarChart