亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

javascript實(shí)現(xiàn)動(dòng)態(tài)統(tǒng)計(jì)圖開發(fā)實(shí)例

 更新時(shí)間:2015年11月21日 15:02:46   投稿:lijiao  
這篇文章主要介紹了javascript實(shí)現(xiàn)動(dòng)態(tài)統(tǒng)計(jì)圖開發(fā)實(shí)例,需要的朋友可以參考下

本文實(shí)例講述了javascript實(shí)現(xiàn)動(dòng)態(tài)統(tǒng)計(jì)圖的代碼。分享給大家供大家參考。具體如下:
運(yùn)行效果截圖如下:

具體代碼如下
html代碼:

<div id="content">
    <div class="legend">
    <h1>汽車銷量:</h1>
    <div class="skills">
    <ul>
    <li class="jq">大眾</li>
    <li class="css">豐田</li>
    <li class="html">別克</li>
    <li class="php">福特</li>
    <li class="sql">長安</li>
    </ul>
    </div>
    </div>
    <div id="diagram"></div>
    </div>
    <div class="get">
    <div class="arc">
    <span class="text">大眾</span>
    <input type="hidden" class="percent" value="95" />
    <input type="hidden" class="color" value="#97BE0D" />
    </div>
    <div class="arc">
    <span class="text">豐田</span>
    <input type="hidden" class="percent" value="90" />
    <input type="hidden" class="color" value="#D84F5F" />
    </div>
    <div class="arc">
    <span class="text">別克</span>
    <input type="hidden" class="percent" value="80" />
    <input type="hidden" class="color" value="#88B8E6" />
    </div>
    <div class="arc">
    <span class="text">福特</span>
    <input type="hidden" class="percent" value="53" />
    <input type="hidden" class="color" value="#BEDBE9" />
    </div>
    <div class="arc">
    <span class="text">長安</span>
    <input type="hidden" class="percent" value="45" />
    <input type="hidden" class="color" value="#EDEBEE" />
    </div>
    </div>

css代碼:

#content {
position:absolute;
top:50%;
left:50%;
margin:-340px 0 0 -450px;
width:900px;
height:600px;
}
.legend {
float:left;
width:250px;
margin-top:140px;
}
#content h1 {
font-family:'Cabin Sketch', arial, serif;
text-shadow:3px 3px 0 #ddd;
color:#193340;
font-size:40px;
margin-bottom:40px;
text-align:right;
}
.skills {
float:left;
clear:both;
width:100%;
}
.skills ul,
.skills li {
display:block;
list-style:none;
margin:0;
padding:0;
}
.skills li {
float:right;
clear:both;
padding:0 15px;
height:35px;
line-height:35px;
color:#fff;
margin-bottom:1px;
font-size:18px;
}

js代碼:

var o = {
      init: function () {
        this.diagram();
      },
      random: function (l, u) {
        return Math.floor((Math.random() * (u - l + 1)) + l);
      },
      diagram: function () {
        var r = Raphael('diagram', 600, 600),
          rad = 73;
        r.circle(300, 300, 85).attr({ stroke: 'none', fill: '#193340' });
        var title = r.text(300, 300, 'loading...').attr({
          font: '20px Arial',
          fill: '#fff'
        }).toFront();
        r.customAttributes.arc = function (value, color, rad) {
          var v = 3.6 * value,
            alpha = v == 360 ? 359.99 : v,
            random = o.random(91, 240),
            a = (random - alpha) * Math.PI / 180,
            b = random * Math.PI / 180,
            sx = 300 + rad * Math.cos(b),
            sy = 300 - rad * Math.sin(b),
            x = 300 + rad * Math.cos(a),
            y = 300 - rad * Math.sin(a),
            path = [['M', sx, sy], ['A', rad, rad, 0, +(alpha > 180), 1, x, y]];
          return { path: path, stroke: color }
        }
        $('.get').find('.arc').each(function (i) {
          var t = $(this),
            color = t.find('.color').val(),
            value = t.find('.percent').val(),
            text = t.find('.text').text();
          rad += 30;
          var z = r.path().attr({ arc: [value, color, rad], 'stroke-width': 26 });
          z.mouseover(function () {
            this.animate({ 'stroke-width': 50, opacity: .75 }, 1000, 'elastic');
            if (Raphael.type != 'VML') //solves IE problem
    this.toFront();
            title.animate({ opacity: 0 }, 500, '>', function () {
              this.attr({ text: text + '\n' + value + '%' }).animate({ opacity: 1 }, 500, '<');
            });
          }).mouseout(function () {
            this.animate({ 'stroke-width': 26, opacity: 1 }, 1000, 'elastic');
          });
        });
      }
    }
    $(function () { o.init(); });

希望本文所述對大家學(xué)習(xí)javascript程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • 淺析js封裝和作用域

    淺析js封裝和作用域

    在編寫web軟件時(shí),遇到一些可以共用js的情況,于是就想著如何封裝js代碼?;拘枨蠛芎唵危鋵?shí)就是根據(jù)不同的情況封裝js代碼
    2013-07-07
  • JavaScript使用百度ECharts插件繪制餅圖操作示例

    JavaScript使用百度ECharts插件繪制餅圖操作示例

    這篇文章主要介紹了JavaScript使用百度ECharts插件繪制餅圖操作,結(jié)合實(shí)例形式分析了JavaScript使用百度ECharts插件繪制餅圖的原理、步驟及相關(guān)操作注意事項(xiàng),需要的朋友可以參考下
    2019-11-11
  • 微信小程序多音頻播放進(jìn)度條問題

    微信小程序多音頻播放進(jìn)度條問題

    小程序的音頻組件居然沒有進(jìn)度控制的功能,需要我們自己實(shí)現(xiàn),下面腳本之家小編給大家?guī)砹宋⑿判〕绦蚨嘁纛l播放進(jìn)度條問題,感興趣的朋友一起看看吧
    2018-08-08
  • js中this的用法實(shí)例分析

    js中this的用法實(shí)例分析

    這篇文章主要介紹了js中this的用法,實(shí)例分析了js中this的4種常見用法,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-01-01
  • JS實(shí)現(xiàn)針對給定時(shí)間的倒計(jì)時(shí)功能示例

    JS實(shí)現(xiàn)針對給定時(shí)間的倒計(jì)時(shí)功能示例

    這篇文章主要介紹了JS實(shí)現(xiàn)針對給定時(shí)間的倒計(jì)時(shí)功能,結(jié)合具體實(shí)例形式分析了javascript日期時(shí)間的正則判定與動(dòng)態(tài)運(yùn)算相關(guān)操作技巧,需要的朋友可以參考下
    2017-04-04
  • js正則表達(dá)式中test,exec,match方法的區(qū)別說明

    js正則表達(dá)式中test,exec,match方法的區(qū)別說明

    本篇文章主要是對js正則表達(dá)式中test,exec,match方法的區(qū)別進(jìn)行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助
    2014-01-01
  • Bootstrap每天必學(xué)之表單

    Bootstrap每天必學(xué)之表單

    Bootstrap每天必學(xué)之表單,本文講解的就是大家最為常用的提交數(shù)據(jù)的Form表單,感興趣的小伙伴們可以參考一下
    2015-11-11
  • 微信小程序?qū)崿F(xiàn)撥打電話功能的示例代碼

    微信小程序?qū)崿F(xiàn)撥打電話功能的示例代碼

    這篇文章主要介紹了微信小程序?qū)崿F(xiàn)撥打電話功能的示例代碼,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-06-06
  • webpack實(shí)現(xiàn)熱加載自動(dòng)刷新的方法

    webpack實(shí)現(xiàn)熱加載自動(dòng)刷新的方法

    本文介紹了webpack實(shí)現(xiàn)熱加載自動(dòng)刷新的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-07-07
  • JavaScript類型系統(tǒng)之布爾Boolean類型詳解

    JavaScript類型系統(tǒng)之布爾Boolean類型詳解

    這篇文章主要介紹了JavaScript類型系統(tǒng)之布爾Boolean類型詳解的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-06-06

最新評論