pizza

Better pie, donut, line, and bar graphs.

  • 所有者: zurb/pizza
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

##Pizza Pie Charts

Pizza is a responsive pie, donut, bar, and line graph charting library based on the Snap SVG framework from Adobe. It focuses on easy integration via HTML markup and CSS instead of JavaScript objects, although you can pass JavaScript objects to Pizza as well.

Implementation

The first step is to create a key with a ul and list elements that represent each piece of the pie with a data-pie-id attribute pointing to the ID of your chart container.

<ul data-pie-id="svg">
  <li data-value="60">Water Buffalo (60)</li>
  <li data-value="20">Bison (20)</li>
  <li data-value="12">Sheep (12)</li>
  <li data-value="32">Goat (32)</li>
  <li data-value="50">Shetland Pony (50)</li>
</ul>

After you have created your legend, you can include your chart container anywhere on the page.

<div id="svg"></div>

You can then style your chart with CSS or SCSS.

To initialize your charts, you can call Pizza.init(); at the end of the body of your page.

Data Options

You can pass options to the chart by using the data-options attribute on your legend:

<ul data-pie-id="svg" data-options='{"donut":"true"}'>

Or on initialization:

Pizza.init('#myChart', {
  data: [23, 44, 1, 29, 90]
});

Custom Text

Setting data-text on your li allows you to override the default percent for pie piece labels. You have access to value and percent as variables. All variables are wrapped in handlebar.js style double brackets.

<li data-value="32" data-text="Goats {{percent}} ({{value}} total)">Goat (32)</li>

Will render out Goats 19% (32 total) for example.

Contributing

To contribute you must have Node and Grunt installed on your system.

Compiling:

npm install
bower install
grunt

主要指標

概覽
名稱與所有者zurb/pizza
主編程語言JavaScript
編程語言JavaScript (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2013-10-04 00:32:52
推送於2017-04-16 19:40:05
最后一次提交2015-05-14 09:40:05
發布數3
最新版本名稱v0.2.1 (發布於 )
第一版名稱v0.1.1 (發布於 )
用户参与
星數411
關注者數55
派生數62
提交數125
已啟用問題?
問題數33
打開的問題數20
拉請求數7
打開的拉請求數2
關閉的拉請求數2
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?