Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SVG Graph Animation

SVG Graph Animation

グラフアニメーションが作れるライブラリの紹介

namikuguri

July 11, 2016
Tweet

More Decks by namikuguri

Other Decks in Technology

Transcript

  1. stroke-dasharrayΛ࢖ͬͯԁάϥϑΛඳ͘ <svg viewBox="0 0 63.6619772368 63.6619772368"> <circle class="pie1" cx="31.8309886184" cy="31.8309886184"

    r="15.9154943092"/> … </svg> circle { fill: transparent; stroke-width: 31.8309886184; stroke-dasharray: 0,0,0,100; stroke-dashoffset: 25; } .pie1 { stroke: #082C3D; stroke-dasharray: 33,0,0,0; } … DEMO
  2. CHARTIST.JSΛ࢖ͬͯԁάϥϑΛඳ͘ DEMO <div id="demo"></div> .ct-series-a .ct-area, .ct-series-a .ct-slice-pie { fill:

    #082C3D; } var data = { labels: ['SVG', 'CHARTIST.JS', 'D3.js'], series: [1, 1, 1] }; var options = { showLabel: true }; new Chartist.Pie('#demo', data, options);
  3. D3.jsΛ࢖ͬͯԁάϥϑΛඳ͘ DEMO <div id="demo"></div> // SVGの表示領域を生成 var svg = d3.select('#demo').append('svg')

    .attr('width', svgWidth).attr('height', svgHeight) // SVGの表示領域を生成 var pie = d3.layout.pie() .value(function(d){ return d; }) // 円グラフのサイズを指定 var pie = d3.svg.arc().innerRadius(0).outerRadius(svgWidth / 2); // 円グラフを描画 svg.selectAll('path') .data(pie(list)) .enter() …