-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
6,969 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
languages: | ||
JavaScript: true | ||
exclude_paths: | ||
- "tests/*" | ||
- "config/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.hbs] | ||
insert_final_newline = false | ||
|
||
[*.{diff,md}] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
/** | ||
Ember CLI sends analytics information by default. The data is completely | ||
anonymous, but there are times when you might want to disable this behavior. | ||
|
||
Setting `disableAnalytics` to true will prevent any data from being sent. | ||
*/ | ||
"disableAnalytics": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 2017, | ||
sourceType: 'module' | ||
}, | ||
extends: 'eslint:recommended', | ||
env: { | ||
browser: true | ||
}, | ||
rules: { | ||
}, | ||
globals: { | ||
"jQuery": true, | ||
"$": true | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# compiled output | ||
/dist | ||
/tmp | ||
|
||
# dependencies | ||
/node_modules | ||
/bower_components | ||
|
||
# misc | ||
/.sass-cache | ||
/connect.lock | ||
/coverage/* | ||
/libpeerconnection.log | ||
npm-debug.log* | ||
yarn-error.log | ||
testem.log | ||
|
||
# ember-try | ||
.node_modules.ember-try/ | ||
bower.json.ember-try | ||
package.json.ember-try | ||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/bower_components | ||
/config/ember-try.js | ||
/dist | ||
/tests | ||
/tmp | ||
**/.gitkeep | ||
.bowerrc | ||
.editorconfig | ||
.ember-cli | ||
.gitignore | ||
.eslintrc.js | ||
.watchmanconfig | ||
.travis.yml | ||
bower.json | ||
ember-cli-build.js | ||
testem.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
language: node_js | ||
node_js: | ||
# we recommend testing addons with the same minimum supported node version as Ember CLI | ||
# so that your addon works for all apps | ||
- "6" | ||
|
||
sudo: required | ||
dist: trusty | ||
addons: | ||
chrome: stable | ||
|
||
cache: | ||
yarn: true | ||
|
||
env: | ||
# we recommend new addons test the current and previous LTS | ||
# as well as latest stable release (bonus points to beta/canary) | ||
- EMBER_TRY_SCENARIO=ember-lts-2.8 | ||
- EMBER_TRY_SCENARIO=ember-release | ||
- EMBER_TRY_SCENARIO=ember-beta | ||
- EMBER_TRY_SCENARIO=ember-canary | ||
- EMBER_TRY_SCENARIO=ember-default | ||
|
||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- env: EMBER_TRY_SCENARIO=ember-canary | ||
- env: EMBER_TRY_SCENARIO=ember-beta | ||
|
||
before_install: | ||
- curl -o- -L https://yarnpkg.com/install.sh | bash | ||
- export PATH=$HOME/.yarn/bin:$PATH | ||
- yarn global add phantomjs-prebuilt | ||
- phantomjs --version | ||
|
||
install: | ||
- yarn install --no-lockfile --non-interactive | ||
|
||
before_script: | ||
- "sudo chown root /opt/google/chrome/chrome-sandbox" | ||
- "sudo chmod 4755 /opt/google/chrome/chrome-sandbox" | ||
|
||
script: | ||
# Usually, it's ok to finish the test scenario without reverting | ||
# to the addon's original dependency state, skipping "cleanup". | ||
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"ignore_dirs": ["tmp", "dist"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Ember CLI echarts | ||
|
||
[![Ember Version](https://embadge.io/v1/badge.svg?start=2.3.0)](https://embadge.io/v1/badge.svg?start=2.3.0) | ||
[![Build Status](https://travis-ci.org/funnelcloudinc/ember-cli-echarts.svg)](https://travis-ci.org/funnelcloudinc/ember-cli-echarts) | ||
[![npm version](https://badge.fury.io/js/ember-cli-echarts.svg)](http://badge.fury.io/js/ember-cli-echarts) | ||
[![Download Total](https://img.shields.io/npm/dt/ember-cli-echarts.svg)](http://badge.fury.io/js/ember-cli-echarts) | ||
[![Ember Observer Score](https://emberobserver.com/badges/ember-cli-echarts.svg)](https://emberobserver.com/addons/ember-cli-echarts) | ||
[![Code Climate](https://codeclimate.com/github/funnelcloudinc/ember-cli-echarts/badges/gpa.svg)](https://codeclimate.com/github/funnelcloudinc/ember-cli-echarts) | ||
|
||
An EmberJS [echarts](http://echarts.baidu.com/) wrapper | ||
|
||
### Shout-out to @offirgolan as a lot of this was stolen from: [ember-cli-nvd3](https://github.com/offirgolan/ember-cli-nvd3) :pizza: :pizza: :pizza: | ||
|
||
## Installation ## | ||
```shell | ||
ember install ember-cli-echarts | ||
``` | ||
|
||
## Looking for help? ## | ||
If it is a bug [please open an issue on GitHub](http://github.com/funnelcloudinc/ember-cli-echarts/issues). | ||
|
||
## echarts Documentation | ||
Before using this addon, you might want to checkout the [echarts Docs](https://ecomfe.github.io/echarts-doc/public/en/api.html#echarts) | ||
|
||
## Basic Usage ## | ||
All you need to get started is to specify which type of chart you want and the data it should display | ||
|
||
```handlebars | ||
{{echarts-chart options=options}} | ||
``` | ||
|
||
## Options | ||
|
||
### Chart Options | ||
All chart specific options can be specified via the `options` property. | ||
|
||
```javascript | ||
// Basic area chart | ||
option = { | ||
xAxis: { | ||
type: 'category', | ||
boundaryGap: false, | ||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] | ||
}, | ||
yAxis: { | ||
type: 'value' | ||
}, | ||
series: [{ | ||
data: [820, 932, 901, 934, 1290, 1330, 1320], | ||
type: 'line', | ||
areaStyle: {} | ||
}] | ||
}; | ||
``` | ||
|
||
```handlebars | ||
{{echarts-chart options=options}} | ||
``` | ||
|
||
### Helper Actions | ||
Currently there are two helper actions provided: | ||
|
||
#### 1. beforeSetup | ||
This is called before echarts has been initialized. | ||
|
||
```javascript | ||
beforeSetup(context, chart) {} | ||
``` | ||
|
||
```handlebars | ||
{{echarts-chart options=options beforeSetup=beforeSetup}} | ||
``` | ||
|
||
#### 2. afterSetup | ||
This is called after all chart options and data have been set, as well as after the chart has been created. | ||
|
||
```javascript | ||
afterSetup(context, chart) {} | ||
``` | ||
|
||
# Want to help? | ||
|
||
## Installation | ||
|
||
* `git clone` this repository | ||
* `npm install` | ||
* `bower install` | ||
|
||
## Running | ||
|
||
* `ember server` | ||
* Visit your app at http://localhost:4200. | ||
|
||
## Running Tests | ||
|
||
* `ember test` | ||
* `ember test --server` | ||
|
||
## Building | ||
|
||
* `ember build` | ||
|
||
For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/). |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import Component from '@ember/component'; | ||
import { get, set, computed, observer } from '@ember/object'; | ||
import { run } from '@ember/runloop'; | ||
import { on } from '@ember/object/evented'; | ||
import echarts from 'echarts'; | ||
|
||
export default Component.extend({ | ||
classNames: ['echarts-chart'], | ||
|
||
options: {}, | ||
notMerge: false, | ||
lazyUpdate: false, | ||
theme: null, | ||
initOptions: { | ||
devicePixelRatio: 1, | ||
renderer: 'canvas', | ||
width: 'auto', | ||
height: 'auto' | ||
}, | ||
|
||
_chart: null, | ||
|
||
beforeSetup() { | ||
}, | ||
afterSetup() { | ||
}, | ||
|
||
init() { | ||
this._super(...arguments); | ||
$(window).on('resize', this.handleResize.bind(this)); | ||
}, | ||
|
||
eventContext: computed(function() { | ||
return get(this, 'targetObject') || this; | ||
}), | ||
|
||
reDraw: on('didInsertElement', observer('options', 'options.{*}', function() { | ||
run.scheduleOnce('render', this, this.drawChart); | ||
})), | ||
|
||
drawChart() { | ||
if (get(this, '_chart') && get(this, '_chart').isDisposed()) { | ||
return; | ||
} | ||
|
||
let chart; | ||
let selector = `#${get(this, 'elementId')}`; | ||
let $el = $(selector); | ||
let context = get(this, 'eventContext'); | ||
|
||
chart = echarts.init($el[0], get(this, 'theme'), get(this, 'initOptions')); | ||
|
||
set(this, '_chart', chart); | ||
|
||
run(() => get(this, 'beforeSetup').call(context, chart)); | ||
|
||
chart.setOption(get(this, 'options'), get(this, 'notMerge'), get(this, 'lazyUpdate')); | ||
|
||
run(() => get(this, 'afterSetup').call(context, chart)); | ||
|
||
return chart; | ||
}, | ||
|
||
handleResize() { | ||
const chart = get(this, '_chart'); | ||
if (chart) { | ||
chart.resize(); | ||
} | ||
}, | ||
|
||
willDestroyElement() { | ||
this._super(...arguments); | ||
const chart = get(this, '_chart'); | ||
if (chart) { | ||
chart.dispose(); | ||
} | ||
$(window).off('resize'); | ||
} | ||
|
||
}); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-cli-echarts/components/echarts-chart'; |
Oops, something went wrong.