javascript - How to rotate a chart 90 degrees including the text values? -


i have following progress bar, i'd go vertically instead of horizontally. in other words, i'd flip 90 degrees , have text flipped 90 degrees well

progress bar

see code below, code pen here: http://codepen.io/chriscruz/pen/jpgmzw

how rotate chart text value?

html

<!-- change below data attribute play --> <div class="progress-wrap progress" data-progress-percent="50">   <div class="progress-bar-state progress">50</div> </div>  

css

.progress {   width: 100%;   height: 50px; } .progress-wrap:before {   content: '66';   position: absolute;   left: 5px;   line-height: 50px; } .progress-wrap:after {   content: '$250,000';   right: 5px;   position: absolute;   line-height: 50px; } .progress-wrap {   background: #f80;   margin: 20px 0;   overflow: hidden;   position: relative; } .progress-wrap .progress-bar-state {   background: #ddd;   left: 0;   position: absolute;   top: 0;   line-height: 50px; } 

javascript

// on page load...     moveprogressbar();     // on browser resize...     $(window).resize(function() {         moveprogressbar();     });      // signature progress     function moveprogressbar() {       console.log("moveprogressbar");         var getpercent = ($('.progress-wrap').data('progress-percent') / 100);         var getprogresswrapwidth = $('.progress-wrap').width();         var progresstotal = getpercent * getprogresswrapwidth;         var animationlength = 2500;          // on page load, animate percentage bar data percentage length         // .stop() used prevent animation queueing         $('.progress-bar-state').stop().animate({             left: progresstotal         }, animationlength);     } 

css

   .progress {       height: 500px;       width: 50px;     }     .progress-wrap:before {       content: '66';       position: absolute;       top: 5px;       line-height: 50px;     }     .progress-wrap:after {       content: '$250,000';       bottom: 5px;       position: absolute;       line-height: 50px;     }     .progress-wrap {       background: #f80;       margin: 20px 0;       overflow: hidden;       position: relative;     }     .progress-wrap .progress-bar-state {       background: #ddd;       left: 0;       position: absolute;       top: 0;       line-height: 50px;     } 

javascript

moveprogressbar(); // on browser resize... $(window).resize(function() {     moveprogressbar(); });  // signature progress function moveprogressbar() {   console.log("moveprogressbar");     var getpercent = ($('.progress-wrap').data('progress-percent') / 100);     var getprogresswrapwidth = $('.progress-wrap').height();     var progresstotal = getpercent * getprogresswrapwidth;     var animationlength = 2500;      // on page load, animate percentage bar data percentage length     // .stop() used prevent animation queueing     $('.progress-bar-state').stop().animate({         top: progresstotal     }, animationlength); } 

pretty switching height , widths lefts tops , rights bottoms.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -