Add Polymer doc

This commit is contained in:
Ronny Roeller
2015-12-30 22:55:49 +01:00
parent 91ced9ce03
commit e449889795
7 changed files with 127 additions and 18 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
/.project
/bower_components/

View File

@@ -1,3 +1,4 @@
# Version 1.0.1
language: node_js
sudo: false
node_js:
@@ -11,5 +12,8 @@ before_script:
- bower install
- npm install polylint
- polylint
- export PATH=$PWD/node_modules/.bin:$PATH
script: xvfb-run wct
script:
- xvfb-run wct
- ./gpages_build.sh Collaborne info@collaborne.com

View File

@@ -1,3 +1,6 @@
_[Demo and API Docs](http://collaborne.github.io/d3-progress-meter)_
d3-progress-meter [![Bower version](https://badge.fury.io/bo/d3-progress-meter.svg)](http://badge.fury.io/bo/d3-progress-meter) [![Travis state](https://travis-ci.org/Collaborne/d3-progress-meter.svg?branch=master)](https://travis-ci.org/Collaborne/d3-progress-meter)
=================
@@ -7,26 +10,10 @@ The component has been inspired by [EK-progress-meter](https://github.com/pinkho
![Screenshot](/doc/screenshot.png "Screenshot")
## Usage
To use this element:
`bower install d3-progress-meter`
```html
<d3-progress-meter radius="100" percentage="0.35" current-text="70" goal-text="Goal: 200" type-text="transactions"></d3-progress-meter>
```
## Properties
Property | Type | Description | Example
---------------- | ------ | ------------------------------------------------------------------------ | -------
**radius** | Number | Radius of the meter. The element will have twice the size of the radius. | 100
**percentage** | Number | Progress in percent | 0.4
**current-text** | String | Large number showing current progress | $8
**goal-text** | String | Small text indicating when progress will be 100% | Goal: $20
**type-text** | String | Bottom text describing for what progress is measured | Sales
## License

View File

@@ -23,6 +23,7 @@
"d3": "~3.5.6"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"

View File

@@ -2,6 +2,18 @@
<script src="../d3/d3.min.js"></script>
<!--
An animated chart that shows the progress as a meter
### Example
```html
<d3-progress-meter radius="100" percentage="0.35" current-text="70" goal-text="Goal: 200" type-text="transactions"></d3-progress-meter>
```
@demo demo/index.html
-->
<dom-module id="d3-progress-meter">
<template>
@@ -62,22 +74,46 @@
Polymer({
is: 'd3-progress-meter',
properties: {
/**
* Amount of progress made (absolute number)
*/
progress: {
type: Number,
value: 0
},
/**
* Radius of the meter. The element will have twice the size of the radius
*/
radius: {
type: Number,
value: 100,
observer: '_radiusChanged'
},
/**
* Progress in percent
*/
percentage: {
type: Number,
observer: '_percentageChanged'
},
/**
* Large number showing current progress
*/
currentText: String,
/**
* Small text indicating when progress will be 100%
*/
goalText: String,
/**
* Bottom text describing for what progress is measured
*/
typeText: String,
diameter: {
type: Number,
computed: '_computeDiameter(radius)'

65
gpages_build.sh Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/bash -x
# Version 1.0
#
# Modified to work with Travis CI automated builds
# Original license follows
#
# @license
# Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
# This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
# The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
# The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
# Code distributed by Google as part of the polymer project is also
# subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
#
# This script pushes a demo-friendly version of your element and its
# dependencies to gh-pages.
# usage gp Polymer core-item [branch]
# Run in a clean directory passing in a GitHub org and repo name
org=`echo ${TRAVIS_REPO_SLUG} | cut -f 1 -d /`
repo=`echo ${TRAVIS_REPO_SLUG} | cut -f 2 -d /`
name=$1
email=$2
branch=${3:-"master"} # default to master when branch isn't specified
mkdir temp && cd temp
# make folder (same as input, no checking!)
mkdir $repo
git clone "https://${GH_TOKEN}@${GH_REF}" --single-branch
# switch to gh-pages branch
pushd $repo >/dev/null
git checkout --orphan gh-pages
# remove all content
git rm -rf -q .
# use bower to install runtime deployment
bower cache clean $repo # ensure we're getting the latest from the desired branch.
git show ${branch}:bower.json > bower.json
echo "{
\"directory\": \"components\"
}
" > .bowerrc
bower install
bower install $org/$repo#$branch
git checkout ${branch} -- demo
rm -rf components/$repo/demo
mv demo components/$repo/
# redirect by default to the component folder
echo "<META http-equiv="refresh" content=\"0;URL=components/$repo/\">" >index.html
git config user.name $name
git config user.email $email
# send it all to github
git add -A .
git commit -am 'Deploy to GitHub Pages'
git push --force --quiet -u "https://${GH_TOKEN}@${GH_REF}" gh-pages > /dev/null 2>&1
popd >/dev/null

15
index.html Normal file
View File

@@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>d3-progress-meter</title>
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-component-page/iron-component-page.html">
</head>
<body>
<iron-component-page></iron-component-page>
</body>
</html>