diff --git a/.bowerrc b/.bowerrc index ba0accc5..959e1696 100644 --- a/.bowerrc +++ b/.bowerrc @@ -1,3 +1,4 @@ { - "directory": "app/bower_components" + "directory": "bower_components", + "analytics": false } diff --git a/.editorconfig b/.editorconfig index e717f5eb..2fe4874a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,13 +1,33 @@ -# http://editorconfig.org +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + root = true + [*] -indent_style = space -indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +indent_style = space +indent_size = 2 + +[*.js] +indent_style = space +indent_size = 2 + +[*.hbs] +indent_style = space +indent_size = 2 + +[*.css] +indent_style = space +indent_size = 2 + +[*.html] +indent_style = space +indent_size = 2 -[*.md] +[*.{diff,md}] trim_trailing_whitespace = false diff --git a/.ember-cli b/.ember-cli new file mode 100644 index 00000000..ee64cfed --- /dev/null +++ b/.ember-cli @@ -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 +} diff --git a/.gitignore b/.gitignore index 28b31cc1..86fceae7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,17 @@ -node_modules -temp -.sass-cache -.tmp -app/bower_components +# See http://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 +testem.log diff --git a/.jshintrc b/.jshintrc index d09e0aa9..ff4989b3 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,31 +1,33 @@ { - "node": true, - "esnext": true, - "bitwise": true, - "camelcase": true, + "predef": [ + "document", + "window", + "-Promise", + "c3" + ], + "browser": true, + "boss": true, "curly": true, + "debug": false, + "devel": true, "eqeqeq": true, - "immed": true, - "indent": 2, - "latedef": true, + "evil": true, + "forin": false, + "immed": false, + "laxbreak": false, "newcap": true, "noarg": true, - "quotmark": "single", - "regexp": true, + "noempty": false, + "nonew": false, + "nomen": false, + "onevar": false, + "plusplus": false, + "regexp": false, "undef": true, - "unused": true, + "sub": true, "strict": false, - "trailing": true, - "smarttabs": true, - "white": true, - "globals": { - "EmberC3": true, - "jQuery": true, - "$": true, - "Ember": true, - "Handlebars": true, - "DS": true, - "c3": true, - "d3": true - } + "white": false, + "eqnull": true, + "esnext": true, + "unused": true } diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..0533b918 --- /dev/null +++ b/.npmignore @@ -0,0 +1,12 @@ +bower_components/ +tests/ + +.bowerrc +.editorconfig +.ember-cli +.travis.yml +.npmignore +**/.gitkeep +bower.json +Brocfile.js +testem.json diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..cf23938b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +--- +language: node_js + +sudo: false + +cache: + directories: + - node_modules + +before_install: + - "npm config set spin false" + - "npm install -g npm@^2" + +install: + - npm install -g bower + - npm install + - bower install + +script: + - npm test diff --git a/Brocfile.js b/Brocfile.js new file mode 100644 index 00000000..8bb9e7ff --- /dev/null +++ b/Brocfile.js @@ -0,0 +1,25 @@ +/* jshint node: true */ +/* global require, module */ + +var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); + +var app = new EmberAddon(); + +app.import('bower_components/d3/d3.min.js'); +app.import('bower_components/c3/c3.min.css'); +app.import('bower_components/c3/c3.min.js'); + +// Use `app.import` to add additional libraries to the generated +// output files. +// +// If you need to use different assets in different +// environments, specify an object as the first parameter. That +// object's keys should be the environment name and the values +// should be the asset to use in that environment. +// +// If the library that you are including contains AMD or ES6 +// modules that you would like to import into your application +// please specify an object with the list of modules as keys +// along with the exports of each module as its value. + +module.exports = app.toTree(); diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 71764ec7..00000000 --- a/Gruntfile.js +++ /dev/null @@ -1,444 +0,0 @@ -// Generated on 2014-04-12 using generator-ember 0.8.3 -'use strict'; -var LIVERELOAD_PORT = 35731; -var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT}); -var mountFolder = function (connect, dir) { - return connect.static(require('path').resolve(dir)); -}; - -// # Globbing -// for performance reasons we're only matching one level down: -// 'test/spec/{,*/}*.js' -// use this if you want to match all subfolders: -// 'test/spec/**/*.js' - -module.exports = function (grunt) { - // show elapsed time at the end - require('time-grunt')(grunt); - // load all grunt tasks - require('load-grunt-tasks')(grunt); - - // configurable paths - var yeomanConfig = { - app: 'app', - dist: 'dist', - lib: 'lib', - build: 'build' - }; - - grunt.initConfig({ - yeoman: yeomanConfig, - watch: { - emberTemplates: { - files: [ - '<%= yeoman.app %>/templates/**/*.hbs', - '<%= yeoman.app %>/index.html' - ], - tasks: ['emberTemplates', 'replace:app'] - }, - compass: { - files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], - tasks: ['compass:server'] - }, - compassLib: { - files: ['<%= yeoman.lib %>/styles/{,*/}*.{scss,sass}'], - tasks: ['compass:lib'] - }, - neuter: { - files: ['<%= yeoman.app %>/scripts/{,*/}*.js'], - tasks: ['neuter'] - }, - lib: { - files: [ - '<%= yeoman.lib %>/templates/**/*.hbs', - '<%= yeoman.lib %>/**/*.js' - ], - tasks: ['lib'] - }, - livereload: { - options: { - livereload: LIVERELOAD_PORT - }, - files: [ - '.tmp/scripts/*.js', - '<%= yeoman.app %>/*.html', - '{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css', - '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', - '<%= yeoman.app %>/index.html', - '<%= yeoman.lib %>/templates/{,*/}*.hbs', - '<%= yeoman.lib %>/**/*.js' - ] - } - }, - connect: { - options: { - port: 9002, - // change this to '0.0.0.0' to access the server from outside - hostname: 'localhost' - }, - livereload: { - options: { - middleware: function (connect) { - return [ - lrSnippet, - mountFolder(connect, '.tmp'), - mountFolder(connect, yeomanConfig.app), - mountFolder(connect, yeomanConfig.build) - ]; - } - } - }, - test: { - options: { - middleware: function (connect) { - return [ - mountFolder(connect, 'test'), - mountFolder(connect, '.tmp') - ]; - } - } - }, - dist: { - options: { - middleware: function (connect) { - return [ - mountFolder(connect, yeomanConfig.dist) - ]; - } - } - } - }, - open: { - server: { - path: 'http://localhost:<%= connect.options.port %>' - } - }, - clean: { - dist: { - files: [{ - dot: true, - src: [ - '.tmp', - '<%= yeoman.dist %>/*', - '!<%= yeoman.dist %>/.git*' - ] - }] - }, - server: '.tmp' - }, - jshint: { - options: { - jshintrc: '.jshintrc', - reporter: require('jshint-stylish') - }, - all: [ - 'Gruntfile.js', - '<%= yeoman.app %>/scripts/{,*/}*.js', - '!<%= yeoman.app %>/scripts/vendor/*', - 'test/spec/{,*/}*.js' - ] - }, - mocha: { - all: { - options: { - run: true, - urls: ['http://localhost:<%= connect.options.port %>/index.html'] - } - } - }, - compass: { - options: { - sassDir: '<%= yeoman.app %>/styles', - cssDir: '.tmp/styles', - generatedImagesDir: '.tmp/images/generated', - imagesDir: '<%= yeoman.app %>/images', - javascriptsDir: '<%= yeoman.app %>/scripts', - fontsDir: '<%= yeoman.app %>/styles/fonts', - importPath: 'app/bower_components', - httpImagesPath: '/images', - httpGeneratedImagesPath: '/images/generated', - httpFontsPath: '/styles/fonts', - relativeAssets: false, - debugInfo: true - }, - dist: { - debugInfo: false - }, - server: { - options: {} - }, - lib: { - options: { - sassDir: '<%= yeoman.lib %>/styles', - cssDir: 'build', - javascriptsDir: '<%= yeoman.lib %>/scripts' - } - } - }, - // not used since Uglify task does concat, - // but still available if needed - /*concat: { - dist: {} - },*/ - // not enabled since usemin task does concat and uglify - // check index.html to edit your build targets - // enable this task if you prefer defining your build targets here - /*uglify: { - dist: {} - },*/ - rev: { - dist: { - files: { - src: [ - '<%= yeoman.dist %>/scripts/{,*/}*.js', - '<%= yeoman.dist %>/styles/{,*/}*.css', - '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}', - '<%= yeoman.dist %>/styles/fonts/*' - ] - } - } - }, - useminPrepare: { - html: '.tmp/index.html', - options: { - dest: '<%= yeoman.dist %>' - } - }, - usemin: { - html: ['<%= yeoman.dist %>/{,*/}*.html'], - css: ['<%= yeoman.dist %>/styles/{,*/}*.css'], - options: { - dirs: ['<%= yeoman.dist %>'] - } - }, - imagemin: { - dist: { - files: [{ - expand: true, - cwd: '<%= yeoman.app %>/images', - src: '{,*/}*.{png,jpg,jpeg}', - dest: '<%= yeoman.dist %>/images' - }] - } - }, - svgmin: { - dist: { - files: [{ - expand: true, - cwd: '<%= yeoman.app %>/images', - src: '{,*/}*.svg', - dest: '<%= yeoman.dist %>/images' - }] - } - }, - cssmin: { - dist: { - files: { - '<%= yeoman.dist %>/styles/main.css': [ - '.tmp/styles/{,*/}*.css', - '<%= yeoman.app %>/styles/{,*/}*.css' - ] - } - } - }, - htmlmin: { - dist: { - options: { - /*removeCommentsFromCDATA: true, - // https://github.com/yeoman/grunt-usemin/issues/44 - //collapseWhitespace: true, - collapseBooleanAttributes: true, - removeAttributeQuotes: true, - removeRedundantAttributes: true, - useShortDoctype: true, - removeEmptyAttributes: true, - removeOptionalTags: true*/ - }, - files: [{ - expand: true, - cwd: '<%= yeoman.app %>', - src: '*.html', - dest: '<%= yeoman.dist %>' - }] - } - }, - replace: { - app: { - options: { - variables: { - ember: 'bower_components/ember/ember.js', - ember_data: 'bower_components/ember-data/ember-data.js' - } - }, - files: [ - {src: '<%= yeoman.app %>/index.html', dest: '.tmp/index.html'} - ] - }, - dist: { - options: { - variables: { - ember: 'bower_components/ember/ember.prod.js', - ember_data: 'bower_components/ember-data/ember-data.prod.js' - } - }, - files: [ - {src: '<%= yeoman.app %>/index.html', dest: '.tmp/index.html'} - ] - } - }, - // Put files not handled in other tasks here - copy: { - fonts: { - files: [ - { - expand: true, - flatten: true, - filter: 'isFile', - cwd: '<%= yeoman.app %>/bower_components/', - dest: '<%= yeoman.app %>/styles/fonts/', - src: [ - 'bootstrap-sass/dist/fonts/**', // Bootstrap - 'font-awesome/fonts/**' // Font-Awesome - ] - } - ] - }, - dist: { - files: [ - { - expand: true, - dot: true, - cwd: '<%= yeoman.app %>', - dest: '<%= yeoman.dist %>', - src: [ - '*.{ico,txt}', - '.htaccess', - 'images/{,*/}*.{webp,gif}', - 'styles/fonts/*' - ] - } - ] - } - }, - concurrent: { - server: [ - 'emberTemplates', - 'compass:lib', - 'compass:server', - ], - test: [ - 'emberTemplates', - 'compass' - ], - dist: [ - 'emberTemplates', - 'compass:lib', - 'compass:dist', - 'imagemin', - 'svgmin', - 'htmlmin' - ] - }, - emberTemplates: { - options: { - templateName: function (sourceFile) { - var templatePath = yeomanConfig.app + '/templates/'; - sourceFile = sourceFile.replace(templatePath, ''); - var libTemplatePath = yeomanConfig.lib + '/templates/'; - sourceFile = sourceFile.replace(libTemplatePath, ''); - return sourceFile; - } - }, - dist: { - files: { - '.tmp/scripts/compiled-templates.js': '<%= yeoman.app %>/templates/{,*/}*.hbs' - } - }, - lib: { - files: { - 'build/temp/template.js': '<%= yeoman.lib %>/templates/{,*/}*.hbs' - } - } - }, - neuter: { - app: { - options: { - filepathTransform: function (filepath) { - return yeomanConfig.app + '/' + filepath; - } - }, - src: '<%= yeoman.app %>/scripts/app.js', - dest: '.tmp/scripts/combined-scripts.js' - }, - lib: { - options: { - /* - filepathTransform: function (filepath) { - return yeomanConfig.lib + '/' + filepath; - } - */ - }, - src: '<%= yeoman.lib %>/lib.js', - dest: '<%= yeoman.build %>/lib.js' - } - } - }); - - grunt.registerTask('server', function (target) { - grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); - grunt.task.run(['serve:' + target]); - }); - - grunt.registerTask('serve', function (target) { - if (target === 'dist') { - return grunt.task.run(['build', 'open', 'connect:dist:keepalive']); - } - - grunt.task.run([ - 'clean:server', - 'lib', - 'replace:app', - 'concurrent:server', - 'neuter:app', - 'copy:fonts', - 'connect:livereload', - 'open', - 'watch' - ]); - }); - - grunt.registerTask('test', [ - 'clean:server', - 'replace:app', - 'concurrent:test', - 'connect:test', - 'neuter:app', - 'mocha' - ]); - - grunt.registerTask('build', [ - 'clean:dist', - 'lib', - 'replace:dist', - 'useminPrepare', - 'concurrent:dist', - 'neuter:app', - 'concat', - 'cssmin', - 'uglify', - 'copy', - 'rev', - 'usemin' - ]); - - grunt.registerTask('lib', [ - 'emberTemplates:lib', - 'neuter:lib' - ]); - - grunt.registerTask('default', [ - 'jshint', - 'test', - 'build' - ]); -}; diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 62348bd5..00000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Glavin Wiechert - -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. \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..00e9fbbf --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2015 + +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. diff --git a/README.md b/README.md index 8bc0b8c2..a403d032 100644 --- a/README.md +++ b/README.md @@ -1,85 +1,25 @@ -[Ember-C3](https://github.com/Glavin001/ember-c3) -========== +# Ember-c3 -> Ember component library for [C3, a D3-based reusable chart library](https://github.com/masayuki0812/c3). +This README outlines the details of collaborating on this Ember addon. -**Live Demo:** http://glavin001.github.io/ember-c3/dist/ +## Installation -Alternatively take a look at [Ember-NVD3](https://github.com/Glavin001/ember-nvd3) for your charting needs. +* `git clone` this repository +* `npm install` +* `bower install` ---- +## Running -## Usage +* `ember server` +* Visit your app at http://localhost:4200. -### Install with Bower +## Running Tests -```bash -bower install --save ember-c3 -``` +* `ember test` +* `ember test --server` -Include C3 and the library's script in your application: +## Building -```html - +* `ember build` - - - -``` - -or Ember-CLI users add these to your Brocfile.js -```javascript -app.import('bower_components/d3/d3.min.js'); -app.import('bower_components/c3/c3.css'); -app.import('bower_components/c3/c3.min.js'); -app.import('bower_components/ember-c3/build/lib.js'); -``` - -### Using the Ember Component - -#### Basic - -Where `model` is your C3 data: - -```handlebars -{{c3-chart data=model}} -``` - -#### Advanced - -See http://c3js.org/examples.html for examples of how to use C3. - -```handlebars -{{c3-chart - data=model - axis=axis - regions=regions - bar=bar - pie=pie - donut=donut - grid=grid - legend=legend - tooltip=tooltip - subchart=subchart - zoom=zoom - size=size - padding=padding - color=color - transition=transition - }} -``` - -## Developing - -After cloning repository, install library dependencies. - -```bash -npm install -bower install -``` - -Then build with `grunt`. - -```bash -grunt serve -``` +For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/). diff --git a/addon/.gitkeep b/addon/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/addon/components/c3-chart.js b/addon/components/c3-chart.js new file mode 100644 index 00000000..38d19780 --- /dev/null +++ b/addon/components/c3-chart.js @@ -0,0 +1,166 @@ +import Ember from 'ember'; + +/** + C3 Chart component +*/ +export default Ember.Component.extend({ + /** + Element tag name + */ + tagName: 'div', + + /** + Element classes + */ + classNames: ['c3-chart-component'], + + /** + The data to display + */ + data: {}, + + /** + Axis specifications + */ + axis: {}, + + /** + Region specifications + */ + regions: {}, + + /* + Type of chart + */ + bar: {}, + pie: {}, + donut: {}, + gauge: {}, + + /** + Grid lines + */ + grid: {}, + + /** + Legend + */ + legend: {}, + + /** + Tooltip + */ + tooltip: {}, + + /** + Subchart + */ + subchart: {}, + + /** + Zoom + */ + zoom: {}, + + /** + Size + */ + size: {}, + + /** + Padding + */ + padding: {}, + + /** + Color + */ + color: {}, + + + /** + Transition + */ + transition: {}, + + /** + + */ + _chart: undefined, + + /** + The Chart + */ + chart: function() { + var self = this; + if (Ember.isEqual(self.get('_chart'), undefined)) { + // Empty, create it. + var container = self.get('element'); + if (Ember.isEqual(container, undefined)) { + return undefined; + } else { + var config = self.get('_config'); + var chart = c3.generate(config); + self.set('_chart', chart); + return chart; + } + } else { + // Editor is already created and cached. + return self.get('_chart'); + } + }.property('element', '_config'), + + /** + + */ + _config: function() { + var self = this; + var c = self.getProperties([ + 'data', + 'axis', + 'regions', + 'bar', + 'pie', + 'donut', + 'gauge', + 'grid', + 'legend', + 'tooltip', + 'subchart', + 'zoom', + 'size', + 'padding', + 'color', + 'transition' + ]); + c.bindto = self.get('element'); + return c; + }.property('element', + 'data', + 'axis', + 'regions', + 'bar', + 'pie', + 'donut', + 'gauge', + 'grid', + 'legend', + 'tooltip', + 'subchart', + 'zoom', + 'size', + 'padding', + 'color', + 'transition'), + + /** + Data Observer + */ + dataDidChange: function() { + var self = this; + var chart = self.get('chart'); + chart.load(self.get('data')); + }.observes('data').on('didInsertElement') +}); + +// Ember.Handlebars.helper('c3-chart', Ember.C3.ChartComponent); diff --git a/app/.gitkeep b/app/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/app/README.md b/app/README.md deleted file mode 100644 index 137b49e1..00000000 --- a/app/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Example App - -Take a look at this source code to get a feel for how an Ember application would use Ember C3. diff --git a/app/components/c3-chart.js b/app/components/c3-chart.js new file mode 100644 index 00000000..01341880 --- /dev/null +++ b/app/components/c3-chart.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; +import C3Chart from 'ember-c3/components/c3-chart'; + +export default C3Chart; diff --git a/app/index.html b/app/index.html deleted file mode 100644 index 71887cd4..00000000 --- a/app/index.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - Ember C3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/scripts/app.js b/app/scripts/app.js deleted file mode 100644 index a0c1fe09..00000000 --- a/app/scripts/app.js +++ /dev/null @@ -1,10 +0,0 @@ -var EmberC3 = window.EmberC3 = Ember.Application.create(); - -/* Order and include as you please. */ -require('scripts/controllers/*'); -require('scripts/store'); -require('scripts/models/*'); -require('scripts/routes/*'); -require('scripts/views/*'); -require('scripts/components/*'); -require('scripts/router'); diff --git a/app/scripts/controllers/index_controller.js b/app/scripts/controllers/index_controller.js deleted file mode 100644 index f18e8d1b..00000000 --- a/app/scripts/controllers/index_controller.js +++ /dev/null @@ -1,2 +0,0 @@ -EmberC3.IndexController = Ember.Controller.extend({ -}); diff --git a/app/scripts/router.js b/app/scripts/router.js deleted file mode 100644 index 07904a83..00000000 --- a/app/scripts/router.js +++ /dev/null @@ -1,3 +0,0 @@ -EmberC3.Router.map(function () { - // Add your routes here -}); diff --git a/app/scripts/routes/index_route.js b/app/scripts/routes/index_route.js deleted file mode 100644 index dd881790..00000000 --- a/app/scripts/routes/index_route.js +++ /dev/null @@ -1,23 +0,0 @@ -EmberC3.IndexRoute = Ember.Route.extend({ - model: function() { - return { - columns: [ - ['data1', 30, 20, 50, 40, 60, 50], - ['data2', 200, 130, 90, 240, 130, 220], - ['data3', 300, 200, 160, 400, 250, 250], - ['data4', 200, 130, 90, 240, 130, 220], - ['data5', 130, 120, 150, 140, 160, 150], - ['data6', 90, 70, 20, 50, 60, 120], - ], - type: 'bar', - types: { - data3: 'spline', - data4: 'line', - data6: 'area', - }, - groups: [ - ['data1', 'data2'] - ] - }; - } -}); diff --git a/app/scripts/store.js b/app/scripts/store.js deleted file mode 100644 index cce3a790..00000000 --- a/app/scripts/store.js +++ /dev/null @@ -1 +0,0 @@ -EmberC3.ApplicationAdapter = DS.FixtureAdapter; diff --git a/app/styles/style.scss b/app/styles/style.scss deleted file mode 100644 index 6b06a28c..00000000 --- a/app/styles/style.scss +++ /dev/null @@ -1,5 +0,0 @@ -// SASS! - -html, body { - margin: 50px 0px; -} diff --git a/app/templates/application.hbs b/app/templates/application.hbs deleted file mode 100644 index 60de4003..00000000 --- a/app/templates/application.hbs +++ /dev/null @@ -1,24 +0,0 @@ -
- - -
- {{outlet}} -
- -
diff --git a/app/templates/index.hbs b/app/templates/index.hbs deleted file mode 100644 index 5d6e318b..00000000 --- a/app/templates/index.hbs +++ /dev/null @@ -1,30 +0,0 @@ -
-

Welcome to Ember C3

- -
- -

Generated Chart

-

See the data in the JSON editor below.

- - {{c3-chart data=model}} - -

Usage In Ember

-

See example app source code on GitHub.

-
- \{{c3-chart data=model}} -
- -
- -

Chart Editor

-

- Edit the data below, powered by - Ember JSONEditor, - to see the changes thanks to two-way data binding support. - The data below is from the - Combination Chart - in the C3 examples. -

- {{json-editor json=model}} - -
diff --git a/bower.json b/bower.json index e0919a9a..2679a808 100644 --- a/bower.json +++ b/bower.json @@ -1,22 +1,19 @@ { "name": "ember-c3", - "version": "0.1.2", "dependencies": { - "ember": "^1.4.0", - "handlebars": "^1.3.0", - "c3": ">=0.1.43-0 < 1.0.0-0" - }, - "devDependencies": { - "ember-mocha-adapter": "0.1.2", - "ember-data": "^1.0.0-beta.5", - "bootstrap": "~3.1.1", - "jsoneditor": "~2.3.6", - "ember-jsoneditor": "~0.1.0" - }, - "ignore": [ - "app/", - "dist/", - "lib/" - ], - "main": "build/lib.js" + "handlebars": "~1.3.0", + "jquery": "^1.11.1", + "ember": "1.8.1", + "ember-data": "1.0.0-beta.12", + "ember-resolver": "~0.1.11", + "loader.js": "ember-cli/loader.js#1.0.1", + "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", + "ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4", + "ember-load-initializers": "ember-cli/ember-load-initializers#0.0.2", + "ember-qunit": "0.1.8", + "ember-qunit-notifications": "0.0.5", + "qunit": "~1.17.1", + "c3": ">=0.1.43-0 < 1.0.0-0", + "d3": "~3.4.13" + } } diff --git a/build/lib.css b/build/lib.css deleted file mode 100644 index 8e137afd..00000000 --- a/build/lib.css +++ /dev/null @@ -1,4 +0,0 @@ -@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/glavin\/Development\/ember-c3\/lib\/styles\/lib\.scss}line{font-family:\000032}} -.ember-plugin-example { - color: red; -} diff --git a/build/lib.js b/build/lib.js deleted file mode 100644 index 72603e91..00000000 --- a/build/lib.js +++ /dev/null @@ -1,179 +0,0 @@ -(function() { - -Ember.C3 = Ember.Namespace.create(); -Ember.C3.VERSION = '0.1.2'; - -Ember.libraries.register('Ember C3', Ember.C3.VERSION); - - -})(); - -(function() { - -'use strict'; -/** -C3 Chart component -*/ -Ember.C3.ChartComponent = Ember.Component.extend({ - /** - Element tag name - */ - tagName: 'div', - - /** - Element classes - */ - classNames: ['c3-chart-component'], - - /** - The data to display - */ - data: {}, - - /** - Axis specifications - */ - axis: {}, - - /** - Region specifications - */ - regions: {}, - - /* - Type of chart - */ - bar: {}, - pie: {}, - donut: {}, - - /** - Grid lines - */ - grid: {}, - - /** - Legend - */ - legend: {}, - - /** - Tooltip - */ - tooltip: {}, - - /** - Subchart - */ - subchart: {}, - - /** - Zoom - */ - zoom: {}, - - /** - Size - */ - size: {}, - - /** - Padding - */ - padding: {}, - - /** - Color - */ - color: {}, - - - /** - Transition - */ - transition: {}, - - /** - - */ - _chart: undefined, - - /** - The Chart - */ - chart: function() { - var self = this; - if (Ember.isEqual(self.get('_chart'), undefined)) { - // Empty, create it. - var container = self.get('element'); - console.log(container); - if (Ember.isEqual(container, undefined)) { - return undefined; - } else { - var config = self.get('_config'); - var chart = c3.generate(config); - self.set('_chart', chart); - return chart; - } - } else { - // Editor is already created and cached. - return self.get('_chart'); - } - }.property('element', '_config'), - - /** - - */ - _config: function() { - var self = this; - var c = self.getProperties([ - 'data', - 'axis', - 'regions', - 'bar', - 'pie', - 'donut', - 'grid', - 'legend', - 'tooltip', - 'subchart', - 'zoom', - 'size', - 'padding', - 'color', - 'transition' - ]); - c.bindto = self.get('element'); - return c; - }.property('element', - 'data', - 'axis', - 'regions', - 'bar', - 'pie', - 'donut', - 'grid', - 'legend', - 'tooltip', - 'subchart', - 'zoom', - 'size', - 'padding', - 'color', - 'transition'), - - /** - Data Observer - */ - dataDidChange: function() { - var self = this; - var chart = self.get('chart'); - chart.load(self.get('data')); - }.observes('data').on('didInsertElement') - -}); - -Ember.Handlebars.helper('c3-chart', Ember.C3.ChartComponent); - - -})(); \ No newline at end of file diff --git a/config/environment.js b/config/environment.js new file mode 100644 index 00000000..d63aa2ef --- /dev/null +++ b/config/environment.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function(/* environment, appConfig */) { + return contentSecurityPolicy: { + 'default-src': "'none'", + 'script-src': "'self'", + 'font-src': "'self'", + 'connect-src': "'self'", + 'img-src': "'self'", + 'style-src': "'self'", + 'media-src': "'self'" + } +}; diff --git a/dist/index.html b/dist/index.html index ec8098ef..edc66a3c 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,25 +1,27 @@ - + - - - - Ember C3 - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + Dummy + + + + + + + + + + + + + + + + + + + + + diff --git a/dist/scripts/53846db4.templates.js b/dist/scripts/53846db4.templates.js deleted file mode 100644 index 6d07821f..00000000 --- a/dist/scripts/53846db4.templates.js +++ /dev/null @@ -1 +0,0 @@ -Ember.TEMPLATES.application=Ember.Handlebars.template(function(a,b,c,d,e){this.compilerInfo=[4,">= 1.0.0"],c=this.merge(c,Ember.Handlebars.helpers),e=e||{};var f,g,h="",i=this.escapeExpression;return e.buffer.push('
\n \n\n
\n '),f={},g={},e.buffer.push(i(c._triageMustache.call(b,"outlet",{hash:{},contexts:[b],types:["ID"],hashContexts:g,hashTypes:f,data:e}))),e.buffer.push("\n
\n\n
\n"),h}),Ember.TEMPLATES.index=Ember.Handlebars.template(function(a,b,c,d,e){this.compilerInfo=[4,">= 1.0.0"],c=this.merge(c,Ember.Handlebars.helpers),e=e||{};var f,g,h,i,j="",k=c.helperMissing,l=this.escapeExpression;return e.buffer.push('
\n

Welcome to Ember C3

\n\n
\n\n

Generated Chart

\n

See the data in the JSON editor below.

\n\n '),g={data:b},h={data:"ID"},i={hash:{data:"model"},contexts:[],types:[],hashContexts:g,hashTypes:h,data:e},e.buffer.push(l((f=c["c3-chart"]||b["c3-chart"],f?f.call(b,i):k.call(b,"c3-chart",i)))),e.buffer.push('\n\n

Usage In Ember

\n

See example app source code on GitHub.

\n
\n '),e.buffer.push('{{c3-chart data=model}}\n
\n\n
\n\n

Chart Editor

\n

\n Edit the data below, powered by\n Ember JSONEditor,\n to see the changes thanks to two-way data binding support.\n The data below is from the\n Combination Chart\n in the C3 examples.\n

\n '),g={json:b},h={json:"ID"},i={hash:{json:"model"},contexts:[],types:[],hashContexts:g,hashTypes:h,data:e},e.buffer.push(l((f=c["json-editor"]||b["json-editor"],f?f.call(b,i):k.call(b,"json-editor",i)))),e.buffer.push("\n\n
\n"),j}); \ No newline at end of file diff --git a/dist/scripts/9b56dea4.lib.js b/dist/scripts/9b56dea4.lib.js deleted file mode 100644 index 05b74599..00000000 --- a/dist/scripts/9b56dea4.lib.js +++ /dev/null @@ -1 +0,0 @@ -!function(){Ember.C3=Ember.Namespace.create(),Ember.C3.VERSION="0.1.0",Ember.libraries.register("Ember C3",Ember.C3.VERSION)}(),function(){"use strict";Ember.C3.ChartComponent=Ember.Component.extend({tagName:"div",classNames:["c3-chart-component"],data:{},axis:{},regions:{},bar:{},pie:{},donut:{},grid:{},legend:{},tooltip:{},subchart:{},zoom:{},size:{},padding:{},color:{},transition:{},_chart:void 0,chart:function(){var a=this;if(Ember.isEqual(a.get("_chart"),void 0)){var b=a.get("element");if(console.log(b),Ember.isEqual(b,void 0))return void 0;var c=a.get("_config"),d=c3.generate(c);return a.set("_chart",d),d}return a.get("_chart")}.property("element","_config"),_config:function(){var a=this,b=a.getProperties(["data","axis","regions","bar","pie","donut","grid","legend","tooltip","subchart","zoom","size","padding","color","transition"]);return b.bindto=a.get("element"),b}.property("element","data","axis","regions","bar","pie","donut","grid","legend","tooltip","subchart","zoom","size","padding","color","transition"),dataDidChange:function(){var a=this,b=a.get("chart");b.load(a.get("data"))}.observes("data").on("didInsertElement")}),Ember.Handlebars.helper("c3-chart",Ember.C3.ChartComponent)}(); \ No newline at end of file diff --git a/dist/scripts/a1bea0ca.components.js b/dist/scripts/a1bea0ca.components.js deleted file mode 100644 index cbd6b9ff..00000000 --- a/dist/scripts/a1bea0ca.components.js +++ /dev/null @@ -1,23 +0,0 @@ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=a.length,c=ab.type(a);return"function"===c||ab.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(ab.isFunction(b))return ab.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return ab.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(hb.test(b))return ab.filter(b,a,c);b=ab.filter(b,a)}return ab.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=ob[a]={};return ab.each(a.match(nb)||[],function(a,c){b[c]=!0}),b}function g(){$.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),ab.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=ab.expando+Math.random()}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ub,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:tb.test(c)?ab.parseJSON(c):c}catch(e){}sb.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return $.activeElement}catch(a){}}function m(a,b){return ab.nodeName(a,"table")&&ab.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Kb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)rb.set(a[c],"globalEval",!b||rb.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(rb.hasData(a)&&(f=rb.access(a),g=rb.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)ab.event.add(b,e,j[e][c])}sb.hasData(a)&&(h=sb.access(a),i=ab.extend({},h),sb.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&ab.nodeName(a,b)?ab.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&yb.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d=ab(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:ab.css(d[0],"display");return d.detach(),e}function u(a){var b=$,c=Ob[a];return c||(c=t(a,b),"none"!==c&&c||(Nb=(Nb||ab("