gwatts / jquery.sparkline

A plugin for the jQuery javascript library to generate small sparkline charts directly in the browser
http://omnipotent.net/jquery.sparkline/
1.24k stars 278 forks source link

how to align the bar vertical center ? #198

Open y01689 opened 6 years ago

y01689 commented 6 years ago

2017-12-28_162942

my method now is below , is there a better solution ?

` var myvalues = [[10,-10],[8,-8],[7,-7],[4,-4],[1,-1],[6,-6],[11,-11], [10,-10],[8,-8],[7,-7],[4,-4],[1,-1],[6,-6],[11,-11], [10,-10],[8,-8],[7,-7],[4,-4],[1,-1],[6,-6],[11,-11], [10,-10],[8,-8],[7,-7],[4,-4],[1,-1],[6,-6],[11,-11], [10,-10],[8,-8],[7,-7],[4,-4],[1,-1],[6,-6],[11,-11]]; //var myvalues = [10,4,5,9,4,7,1] // $('.dynamicsparkline').sparkline(myvalues);

    /* The second argument gives options such as chart type */
    $('.dynamicbar').sparkline(myvalues, {
        type: 'bar', 
        lineColor:false,
        barColor: 'green',
        stackedBarColor:['green','green'],
        tooltipFormatter: function(value){
            console.log(value)
            return Math.abs(value); 
        }
    } );`