Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
juhoojala committed Apr 1, 2016
0 parents commit 12f1bfb
Show file tree
Hide file tree
Showing 14 changed files with 1,085 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
"strict": 0,
"indent": [1, 2, { "SwitchCase": 1 }],
"quotes": [2, "single"],
"linebreak-style": [2, "unix"],
"semi": [2, "always"],
"no-unused-vars": [2, {"args": "all", "argsIgnorePattern": "^_"}],
"react/display-name": 2,
"react/jsx-no-duplicate-props": 2,
"react/jsx-no-undef": 2,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/no-danger": 2,
"react/no-deprecated": 2,
"react/no-did-mount-set-state": [2, "allow-in-func"],
"react/no-did-update-set-state": [2, "allow-in-func"],
"react/no-direct-mutation-state": 2,
"react/no-is-mounted": 2,
"react/no-unknown-property": 2,
"react/prop-types": 1,
"react/react-in-jsx-scope": 2
},
"env": {
"es6": true,
"browser": true,
"mocha": true,
"amd": true,
"node": true
},
"extends": [
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": 6,

"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true,
"packages": true
}
}
}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
lib/
build/
dist/
temp/
.awspublish*
npm-debug.log
node_modules/
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build/
dist/
temp/
.awspublish*
npm-debug.log
node_modules/
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)

Copyright (c) 2015-2016 Lucify Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
105 changes: 105 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@

# A line chart React component

## About

A [controlled](https://facebook.github.io/react/docs/forms.html) React component that shows a small line chart, useful for linked small multiples. Built using React and D3.js

![Animated GIF of component](bar-chart-range-selector.gif)

This is a pre-release of a package belonging to the Lucify platform. It has been published to satisfy dependencies of other packages. Any APIs may change without notice.

## Installation

Add `lucify-small-line-chart` along with its dependencies (React.js and
D3.js) to your project's dependencies:

```shell
$ npm install react d3 lucify-small-line-chart --save
```

Require it in your Javascript:

#### ES5
```javascript
var LucifySmallLineChart = require('lucify-small-line-chart').default;
```

#### ES6
```javascript
import LucifySmallLineChart from 'lucify-small-line-chart';
```

Now you can use it like any other React component.

**Note:** this component has only been tested to work with React 0.13. It
should work with React 0.14 as well, but we can't confirm it at this point.

## Props

[TODO: explain these]

- **data**: React.PropTypes.arrayOf(React.PropTypes.array),
- **margin**: React.PropTypes.objectOf(React.PropTypes.number),
- **width**: React.PropTypes.number,
- **height**: React.PropTypes.number,
- **minY**: React.PropTypes.number,
- **maxY**: React.PropTypes.number,
- **xFormat**: React.PropTypes.func,
- **yFormat**: React.PropTypes.func,
- **yTickFormat**: React.PropTypes.func,
- **xTickMargin**: React.PropTypes.number,
- **xTickFormat**: React.PropTypes.func,
- **transitionLength**: React.PropTypes.number,
- **selectedX**: React.PropTypes.number,
- **handleSelectedChange**: React.PropTypes.func

## Development

Build the Javascript files into `lib/` with:

```shell
$ npm run build
```

Or build the development version and start watching for changes with:

```shell
$ npm run dev
```

To serve the example page on port 3000 and see changes live, start Gulp:

```shell
$ gulp
```

Then point your browser to http://localhost:3000/

## Developing as part of a project

To develop this component in tandem with a parent project using `npm link`,
first link this project to the parent project:

```shell
$ cd path_to_this_project
$ npm link
$ cd path_to_parent_project
$ npm link lucify-small-line-chart
```

Then link the parent project's React folder to this project:

```shell
$ cd path_to_parent_project
$ cd node_modules/react
$ npm link
$ cd path_to_this_project
$ npm link react
```

This is needed in order to prevent React from being loaded twice.

Note that if you do not use Webpack to build your parent project, the
development build will likely not work. You can build the production version
while watching for changes by running `node_modules/.bin/webpack -p --watch`.
Binary file added bar-chart-range-selector.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
machine:
environment:
PROJECT: $CIRCLE_PROJECT_REPONAME
BRANCH: $CIRCLE_BRANCH
COMMIT: $CIRCLE_SHA1
node:
version: 4.2.6

deployment:
staging:
branch: /^(?!nodeploy-).*$/
commands:
- npm run-script deploy
13 changes: 13 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

var gulp = require('gulp');

var opts = {
pageDef: {
adsByGoogle: false,
title: 'Lucify Bar Chart Range Selector – Example'
},
assetContext: 'lucify-bar-chart-range-selector-example/'
};

var builder = require('lucify-component-builder');
builder(gulp, opts);
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

module.exports = require('./src/js/example.jsx').default;
57 changes: 57 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "lucify-small-line-chart",
"version": "0.1.0",
"description": "A React component that shows a small line chart, useful for linked small multiples",
"main": "lib/bar-chart-range-selector.js",
"scripts": {
"dev": "webpack -d --watch",
"build": "webpack -p",
"prepublish": "npm run build",
"test": "echo \"No tests specified\" && exit 0",
"deploy": "lucify-deploy"
},
"repository": {
"type": "git",
"url": "git+https://github.com/lucified/lucify-bar-chart-range-selector.git"
},
"keywords": [
"lucify",
"stacked",
"bar",
"chart",
"React",
"D3",
"range",
"react-component"
],
"author": "Lucify",
"license": "MIT",
"bugs": {
"url": "https://github.com/lucified/lucify-bar-chart-range-selector/issues"
},
"homepage": "https://github.com/lucified/lucify-bar-chart-range-selector#readme",
"dependencies": {
"query-string": ">=3.0.0"
},
"peerDependencies": {
"d3": ">=3.0.0",
"react": "^0.13.0"
},
"devDependencies": {
"autoprefixer": "^6.3.5",
"babel-core": "^6.7.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"css-loader": "^0.23.1",
"gulp": "gulpjs/gulp#4.0",
"lucify-component-builder": "^0.3.8",
"node-sass": "^3.4.2",
"postcss-loader": "^0.8.2",
"postcss-reporter": "^1.3.3",
"sass-loader": "^3.2.0",
"style-loader": "^0.13.1",
"webpack": "^1.12.14"
}
}
Loading

0 comments on commit 12f1bfb

Please sign in to comment.