├── .babelrc
├── .editorconfig
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── .postcssrc.js
├── Json
├── data.json
└── test.json
├── README.md
├── build
├── build.js
├── check-versions.js
├── dev-client.js
├── dev-server.js
├── utils.js
├── vue-loader.conf.js
├── webpack.base.conf.js
├── webpack.dev.conf.js
├── webpack.prod.conf.js
└── webpack.test.conf.js
├── config
├── dev.env.js
├── index.js
├── prod.env.js
└── test.env.js
├── index.html
├── linechart.png
├── package.json
├── src
├── App.vue
├── App_backup.vue
├── assets
│ └── logo.png
├── components
│ ├── HelloWorld.vue
│ ├── LineChart.js
│ ├── LineChart_backup.js
│ └── LineChart_backup2.js
├── main.js
└── router
│ └── index.js
├── static
└── .gitkeep
├── test
├── e2e
│ ├── custom-assertions
│ │ └── elementCount.js
│ ├── nightwatch.conf.js
│ ├── runner.js
│ └── specs
│ │ └── test.js
└── unit
│ ├── .eslintrc
│ ├── index.js
│ ├── karma.conf.js
│ └── specs
│ └── Hello.spec.js
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false,
5 | "targets": {
6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7 | }
8 | }],
9 | "stage-2"
10 | ],
11 | "plugins": ["transform-runtime"],
12 | "env": {
13 | "test": {
14 | "presets": ["env", "stage-2"],
15 | "plugins": ["istanbul"]
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | /build/
2 | /config/
3 | /dist/
4 | /*.js
5 | /test/unit/coverage/
6 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | // https://eslint.org/docs/user-guide/configuring
2 |
3 | module.exports = {
4 | root: true,
5 | parser: 'babel-eslint',
6 | parserOptions: {
7 | sourceType: 'module'
8 | },
9 | env: {
10 | browser: true,
11 | },
12 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md
13 | extends: 'standard',
14 | // required to lint *.vue files
15 | plugins: [
16 | 'html'
17 | ],
18 | // add your custom rules here
19 | 'rules': {
20 | // allow paren-less arrow functions
21 | 'arrow-parens': 0,
22 | // allow async-await
23 | 'generator-star-spacing': 0,
24 | // allow debugger during development
25 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | /dist/
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | /test/unit/coverage/
8 | /test/e2e/reports/
9 | selenium-debug.log
10 |
11 | # Editor directories and files
12 | .idea
13 | .vscode
14 | *.suo
15 | *.ntvs*
16 | *.njsproj
17 | *.sln
18 |
--------------------------------------------------------------------------------
/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | // to edit target browsers: use "browserslist" field in package.json
6 | "autoprefixer": {}
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Json/data.json:
--------------------------------------------------------------------------------
1 | [{"week":"Week 37 2017","Kwadraat A":0,"Kwadraat B":0,"Kwadraat C":0,"Kwadraat D":0},{"week":"Week 38 2017","Kwadraat A":0,"Kwadraat B":2,"Kwadraat C":0,"Kwadraat D":3},{"week":"Week 39 2017","Kwadraat A":19,"Kwadraat B":11,"Kwadraat C":0,"Kwadraat D":5},{"week":"Week 40 2017","Kwadraat A":0,"Kwadraat B":0,"Kwadraat C":0,"Kwadraat D":0},{"week":"Week 41 2017","Kwadraat A":68,"Kwadraat B":0,"Kwadraat C":0,"Kwadraat D":7},{"week":"Week 42 2017","Kwadraat A":0,"Kwadraat B":4,"Kwadraat C":0,"Kwadraat D":23},{"week":"Week 43 2017","Kwadraat A":0,"Kwadraat B":0,"Kwadraat C":0,"Kwadraat D":0},{"week":"Week 44 2017","Kwadraat A":0,"Kwadraat B":0,"Kwadraat C":0,"Kwadraat D":0}]
--------------------------------------------------------------------------------
/Json/test.json:
--------------------------------------------------------------------------------
1 | {
2 | labels: ['Kwadraat A', 'Kwadraat B', 'Kwadraat C', 'Kwadraat D'],
3 | datasets: [
4 | {
5 | label: 'Week 37 2017',
6 | // borderColor: '#FC2525',
7 | // pointBackgroundColor: 'white',
8 | // borderWidth: 1,
9 | // pointBorderColor: 'white',
10 | // backgroundColor: this.gradient,
11 | data: [0, 0, 0, 0]
12 | }, {
13 | label: 'Week 38 2017',
14 | // borderColor: '#05CBE1',
15 | // pointBackgroundColor: 'white',
16 | // borderWidth: 1,
17 | // pointBorderColor: 'white',
18 | // backgroundColor: this.gradient2,
19 | data: [0, 2, 0, 3]
20 | }, {
21 | label: 'Week 39 2017',
22 | // borderColor: '#FC0025',
23 | // pointBackgroundColor: 'white',
24 | // borderWidth: 1,
25 | // pointBorderColor: 'white',
26 | // backgroundColor: this.gradient,
27 | data: [19, 11, 0, 5]
28 | }, {
29 | label: 'Week 40 2017',
30 | // borderColor: '#05CB00',
31 | // pointBackgroundColor: 'white',
32 | // borderWidth: 1,
33 | // pointBorderColor: 'white',
34 | // backgroundColor: this.gradient2,
35 | data: [0, 0, 0, 0]
36 | }, {
37 | label: 'Week 41 2017',
38 | // borderColor: '#002525',
39 | // pointBackgroundColor: 'white',
40 | // borderWidth: 1,
41 | // pointBorderColor: 'white',
42 | // backgroundColor: this.gradient,
43 | data: [68, 0, 0, 6]
44 | }, {
45 | label: 'Week 42 2017',
46 | // borderColor: '#0500E1',
47 | // pointBackgroundColor: 'white',
48 | // borderWidth: 1,
49 | // pointBorderColor: 'white',
50 | // backgroundColor: this.gradient2,
51 | data: [0, 4, 0, 23]
52 | }, {
53 | label: 'Week 43 2017',
54 | // borderColor: '#FC2500',
55 | // pointBackgroundColor: 'white',
56 | // borderWidth: 1,
57 | // pointBorderColor: 'white',
58 | // backgroundColor: this.gradient,
59 | data: [0, 0, 0, 0]
60 | }, {
61 | label: 'Week 44 2017',
62 | // borderColor: '#00CBE1',
63 | // pointBackgroundColor: 'white',
64 | // borderWidth: 1,
65 | // pointBorderColor: 'white',
66 | // backgroundColor: this.gradient2,
67 | data: [0, 0, 0, 0]
68 | }
69 | ]
70 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # awesome-charts-vue
2 |
3 | > A Vue.js project
4 |
5 | 
6 |
7 | Chart data at https://api.myjson.com/bins/8sqwr
8 |
9 | ## Build Setup
10 |
11 | ``` bash
12 | # install dependencies
13 | npm install
14 |
15 | # serve with hot reload at localhost:8080
16 | npm run dev
17 | ```
18 |
19 |
--------------------------------------------------------------------------------
/build/build.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | require('./check-versions')()
3 |
4 | process.env.NODE_ENV = 'production'
5 |
6 | const ora = require('ora')
7 | const rm = require('rimraf')
8 | const path = require('path')
9 | const chalk = require('chalk')
10 | const webpack = require('webpack')
11 | const config = require('../config')
12 | const webpackConfig = require('./webpack.prod.conf')
13 |
14 | const spinner = ora('building for production...')
15 | spinner.start()
16 |
17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18 | if (err) throw err
19 | webpack(webpackConfig, function (err, stats) {
20 | spinner.stop()
21 | if (err) throw err
22 | process.stdout.write(stats.toString({
23 | colors: true,
24 | modules: false,
25 | children: false,
26 | chunks: false,
27 | chunkModules: false
28 | }) + '\n\n')
29 |
30 | if (stats.hasErrors()) {
31 | console.log(chalk.red(' Build failed with errors.\n'))
32 | process.exit(1)
33 | }
34 |
35 | console.log(chalk.cyan(' Build complete.\n'))
36 | console.log(chalk.yellow(
37 | ' Tip: built files are meant to be served over an HTTP server.\n' +
38 | ' Opening index.html over file:// won\'t work.\n'
39 | ))
40 | })
41 | })
42 |
--------------------------------------------------------------------------------
/build/check-versions.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const chalk = require('chalk')
3 | const semver = require('semver')
4 | const packageConfig = require('../package.json')
5 | const shell = require('shelljs')
6 | function exec (cmd) {
7 | return require('child_process').execSync(cmd).toString().trim()
8 | }
9 |
10 | const versionRequirements = [
11 | {
12 | name: 'node',
13 | currentVersion: semver.clean(process.version),
14 | versionRequirement: packageConfig.engines.node
15 | }
16 | ]
17 |
18 | if (shell.which('npm')) {
19 | versionRequirements.push({
20 | name: 'npm',
21 | currentVersion: exec('npm --version'),
22 | versionRequirement: packageConfig.engines.npm
23 | })
24 | }
25 |
26 | module.exports = function () {
27 | const warnings = []
28 | for (let i = 0; i < versionRequirements.length; i++) {
29 | const mod = versionRequirements[i]
30 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
31 | warnings.push(mod.name + ': ' +
32 | chalk.red(mod.currentVersion) + ' should be ' +
33 | chalk.green(mod.versionRequirement)
34 | )
35 | }
36 | }
37 |
38 | if (warnings.length) {
39 | console.log('')
40 | console.log(chalk.yellow('To use this template, you must update following to modules:'))
41 | console.log()
42 | for (let i = 0; i < warnings.length; i++) {
43 | const warning = warnings[i]
44 | console.log(' ' + warning)
45 | }
46 | console.log()
47 | process.exit(1)
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/build/dev-client.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | 'use strict'
3 | require('eventsource-polyfill')
4 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
5 |
6 | hotClient.subscribe(function (event) {
7 | if (event.action === 'reload') {
8 | window.location.reload()
9 | }
10 | })
11 |
--------------------------------------------------------------------------------
/build/dev-server.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | require('./check-versions')()
3 |
4 | const config = require('../config')
5 | if (!process.env.NODE_ENV) {
6 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
7 | }
8 |
9 | const opn = require('opn')
10 | const path = require('path')
11 | const express = require('express')
12 | const webpack = require('webpack')
13 | const proxyMiddleware = require('http-proxy-middleware')
14 | const webpackConfig = (process.env.NODE_ENV === 'testing' || process.env.NODE_ENV === 'production')
15 | ? require('./webpack.prod.conf')
16 | : require('./webpack.dev.conf')
17 |
18 | // default port where dev server listens for incoming traffic
19 | const port = process.env.PORT || config.dev.port
20 | // automatically open browser, if not set will be false
21 | const autoOpenBrowser = !!config.dev.autoOpenBrowser
22 | // Define HTTP proxies to your custom API backend
23 | // https://github.com/chimurai/http-proxy-middleware
24 | const proxyTable = config.dev.proxyTable
25 |
26 | const app = express()
27 | const compiler = webpack(webpackConfig)
28 |
29 | const devMiddleware = require('webpack-dev-middleware')(compiler, {
30 | publicPath: webpackConfig.output.publicPath,
31 | quiet: true
32 | })
33 |
34 | const hotMiddleware = require('webpack-hot-middleware')(compiler, {
35 | log: false,
36 | heartbeat: 2000
37 | })
38 | // force page reload when html-webpack-plugin template changes
39 | // currently disabled until this is resolved:
40 | // https://github.com/jantimon/html-webpack-plugin/issues/680
41 | // compiler.plugin('compilation', function (compilation) {
42 | // compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
43 | // hotMiddleware.publish({ action: 'reload' })
44 | // cb()
45 | // })
46 | // })
47 |
48 | // enable hot-reload and state-preserving
49 | // compilation error display
50 | app.use(hotMiddleware)
51 |
52 | // proxy api requests
53 | Object.keys(proxyTable).forEach(function (context) {
54 | let options = proxyTable[context]
55 | if (typeof options === 'string') {
56 | options = { target: options }
57 | }
58 | app.use(proxyMiddleware(options.filter || context, options))
59 | })
60 |
61 | // handle fallback for HTML5 history API
62 | app.use(require('connect-history-api-fallback')())
63 |
64 | // serve webpack bundle output
65 | app.use(devMiddleware)
66 |
67 | // serve pure static assets
68 | const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
69 | app.use(staticPath, express.static('./static'))
70 |
71 | const uri = 'http://localhost:' + port
72 |
73 | var _resolve
74 | var _reject
75 | var readyPromise = new Promise((resolve, reject) => {
76 | _resolve = resolve
77 | _reject = reject
78 | })
79 |
80 | var server
81 | var portfinder = require('portfinder')
82 | portfinder.basePort = port
83 |
84 | console.log('> Starting dev server...')
85 | devMiddleware.waitUntilValid(() => {
86 | portfinder.getPort((err, port) => {
87 | if (err) {
88 | _reject(err)
89 | }
90 | process.env.PORT = port
91 | var uri = 'http://localhost:' + port
92 | console.log('> Listening at ' + uri + '\n')
93 | // when env is testing, don't need open it
94 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
95 | opn(uri)
96 | }
97 | server = app.listen(port)
98 | _resolve()
99 | })
100 | })
101 |
102 | module.exports = {
103 | ready: readyPromise,
104 | close: () => {
105 | server.close()
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/build/utils.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const config = require('../config')
4 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
5 |
6 | exports.assetsPath = function (_path) {
7 | const assetsSubDirectory = process.env.NODE_ENV === 'production'
8 | ? config.build.assetsSubDirectory
9 | : config.dev.assetsSubDirectory
10 | return path.posix.join(assetsSubDirectory, _path)
11 | }
12 |
13 | exports.cssLoaders = function (options) {
14 | options = options || {}
15 |
16 | const cssLoader = {
17 | loader: 'css-loader',
18 | options: {
19 | minimize: process.env.NODE_ENV === 'production',
20 | sourceMap: options.sourceMap
21 | }
22 | }
23 |
24 | // generate loader string to be used with extract text plugin
25 | function generateLoaders (loader, loaderOptions) {
26 | const loaders = [cssLoader]
27 | if (loader) {
28 | loaders.push({
29 | loader: loader + '-loader',
30 | options: Object.assign({}, loaderOptions, {
31 | sourceMap: options.sourceMap
32 | })
33 | })
34 | }
35 |
36 | // Extract CSS when that option is specified
37 | // (which is the case during production build)
38 | if (options.extract) {
39 | return ExtractTextPlugin.extract({
40 | use: loaders,
41 | fallback: 'vue-style-loader'
42 | })
43 | } else {
44 | return ['vue-style-loader'].concat(loaders)
45 | }
46 | }
47 |
48 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html
49 | return {
50 | css: generateLoaders(),
51 | postcss: generateLoaders(),
52 | less: generateLoaders('less'),
53 | sass: generateLoaders('sass', { indentedSyntax: true }),
54 | scss: generateLoaders('sass'),
55 | stylus: generateLoaders('stylus'),
56 | styl: generateLoaders('stylus')
57 | }
58 | }
59 |
60 | // Generate loaders for standalone style files (outside of .vue)
61 | exports.styleLoaders = function (options) {
62 | const output = []
63 | const loaders = exports.cssLoaders(options)
64 | for (const extension in loaders) {
65 | const loader = loaders[extension]
66 | output.push({
67 | test: new RegExp('\\.' + extension + '$'),
68 | use: loader
69 | })
70 | }
71 | return output
72 | }
73 |
--------------------------------------------------------------------------------
/build/vue-loader.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const utils = require('./utils')
3 | const config = require('../config')
4 | const isProduction = process.env.NODE_ENV === 'production'
5 |
6 | module.exports = {
7 | loaders: utils.cssLoaders({
8 | sourceMap: isProduction
9 | ? config.build.productionSourceMap
10 | : config.dev.cssSourceMap,
11 | extract: isProduction
12 | }),
13 | transformToRequire: {
14 | video: 'src',
15 | source: 'src',
16 | img: 'src',
17 | image: 'xlink:href'
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/build/webpack.base.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const utils = require('./utils')
4 | const config = require('../config')
5 | const vueLoaderConfig = require('./vue-loader.conf')
6 |
7 | function resolve (dir) {
8 | return path.join(__dirname, '..', dir)
9 | }
10 |
11 | module.exports = {
12 | entry: {
13 | app: './src/main.js'
14 | },
15 | output: {
16 | path: config.build.assetsRoot,
17 | filename: '[name].js',
18 | publicPath: process.env.NODE_ENV === 'production'
19 | ? config.build.assetsPublicPath
20 | : config.dev.assetsPublicPath
21 | },
22 | resolve: {
23 | extensions: ['.js', '.vue', '.json'],
24 | alias: {
25 | 'vue$': 'vue/dist/vue.esm.js',
26 | '@': resolve('src'),
27 | }
28 | },
29 | module: {
30 | rules: [
31 | {
32 | test: /\.(js|vue)$/,
33 | loader: 'eslint-loader',
34 | enforce: 'pre',
35 | include: [resolve('src'), resolve('test')],
36 | options: {
37 | formatter: require('eslint-friendly-formatter')
38 | }
39 | },
40 | {
41 | test: /\.vue$/,
42 | loader: 'vue-loader',
43 | options: vueLoaderConfig
44 | },
45 | {
46 | test: /\.js$/,
47 | loader: 'babel-loader',
48 | include: [resolve('src'), resolve('test')]
49 | },
50 | {
51 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
52 | loader: 'url-loader',
53 | options: {
54 | limit: 10000,
55 | name: utils.assetsPath('img/[name].[hash:7].[ext]')
56 | }
57 | },
58 | {
59 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
60 | loader: 'url-loader',
61 | options: {
62 | limit: 10000,
63 | name: utils.assetsPath('media/[name].[hash:7].[ext]')
64 | }
65 | },
66 | {
67 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
68 | loader: 'url-loader',
69 | options: {
70 | limit: 10000,
71 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
72 | }
73 | }
74 | ]
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const utils = require('./utils')
3 | const webpack = require('webpack')
4 | const config = require('../config')
5 | const merge = require('webpack-merge')
6 | const baseWebpackConfig = require('./webpack.base.conf')
7 | const HtmlWebpackPlugin = require('html-webpack-plugin')
8 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
9 |
10 | // add hot-reload related code to entry chunks
11 | Object.keys(baseWebpackConfig.entry).forEach(function (name) {
12 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
13 | })
14 |
15 | module.exports = merge(baseWebpackConfig, {
16 | module: {
17 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
18 | },
19 | // cheap-module-eval-source-map is faster for development
20 | devtool: '#cheap-module-eval-source-map',
21 | plugins: [
22 | new webpack.DefinePlugin({
23 | 'process.env': config.dev.env
24 | }),
25 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
26 | new webpack.HotModuleReplacementPlugin(),
27 | new webpack.NoEmitOnErrorsPlugin(),
28 | // https://github.com/ampedandwired/html-webpack-plugin
29 | new HtmlWebpackPlugin({
30 | filename: 'index.html',
31 | template: 'index.html',
32 | inject: true
33 | }),
34 | new FriendlyErrorsPlugin()
35 | ]
36 | })
37 |
--------------------------------------------------------------------------------
/build/webpack.prod.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const utils = require('./utils')
4 | const webpack = require('webpack')
5 | const config = require('../config')
6 | const merge = require('webpack-merge')
7 | const baseWebpackConfig = require('./webpack.base.conf')
8 | const CopyWebpackPlugin = require('copy-webpack-plugin')
9 | const HtmlWebpackPlugin = require('html-webpack-plugin')
10 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
12 |
13 | const env = process.env.NODE_ENV === 'testing'
14 | ? require('../config/test.env')
15 | : config.build.env
16 |
17 | const webpackConfig = merge(baseWebpackConfig, {
18 | module: {
19 | rules: utils.styleLoaders({
20 | sourceMap: config.build.productionSourceMap,
21 | extract: true
22 | })
23 | },
24 | devtool: config.build.productionSourceMap ? '#source-map' : false,
25 | output: {
26 | path: config.build.assetsRoot,
27 | filename: utils.assetsPath('js/[name].[chunkhash].js'),
28 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
29 | },
30 | plugins: [
31 | // http://vuejs.github.io/vue-loader/en/workflow/production.html
32 | new webpack.DefinePlugin({
33 | 'process.env': env
34 | }),
35 | // UglifyJs do not support ES6+, you can also use babel-minify for better treeshaking: https://github.com/babel/minify
36 | new webpack.optimize.UglifyJsPlugin({
37 | compress: {
38 | warnings: false
39 | },
40 | sourceMap: true,
41 | parallel: true
42 | }),
43 | // extract css into its own file
44 | new ExtractTextPlugin({
45 | filename: utils.assetsPath('css/[name].[contenthash].css')
46 | }),
47 | // Compress extracted CSS. We are using this plugin so that possible
48 | // duplicated CSS from different components can be deduped.
49 | new OptimizeCSSPlugin({
50 | cssProcessorOptions: config.build.productionSourceMap
51 | ? { safe: true, map: { inline: false } }
52 | : { safe: true }
53 | }),
54 | // generate dist index.html with correct asset hash for caching.
55 | // you can customize output by editing /index.html
56 | // see https://github.com/ampedandwired/html-webpack-plugin
57 | new HtmlWebpackPlugin({
58 | filename: process.env.NODE_ENV === 'testing'
59 | ? 'index.html'
60 | : config.build.index,
61 | template: 'index.html',
62 | inject: true,
63 | minify: {
64 | removeComments: true,
65 | collapseWhitespace: true,
66 | removeAttributeQuotes: true
67 | // more options:
68 | // https://github.com/kangax/html-minifier#options-quick-reference
69 | },
70 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin
71 | chunksSortMode: 'dependency'
72 | }),
73 | // keep module.id stable when vender modules does not change
74 | new webpack.HashedModuleIdsPlugin(),
75 | // split vendor js into its own file
76 | new webpack.optimize.CommonsChunkPlugin({
77 | name: 'vendor',
78 | minChunks: function (module) {
79 | // any required modules inside node_modules are extracted to vendor
80 | return (
81 | module.resource &&
82 | /\.js$/.test(module.resource) &&
83 | module.resource.indexOf(
84 | path.join(__dirname, '../node_modules')
85 | ) === 0
86 | )
87 | }
88 | }),
89 | // extract webpack runtime and module manifest to its own file in order to
90 | // prevent vendor hash from being updated whenever app bundle is updated
91 | new webpack.optimize.CommonsChunkPlugin({
92 | name: 'manifest',
93 | chunks: ['vendor']
94 | }),
95 | // copy custom static assets
96 | new CopyWebpackPlugin([
97 | {
98 | from: path.resolve(__dirname, '../static'),
99 | to: config.build.assetsSubDirectory,
100 | ignore: ['.*']
101 | }
102 | ])
103 | ]
104 | })
105 |
106 | if (config.build.productionGzip) {
107 | const CompressionWebpackPlugin = require('compression-webpack-plugin')
108 |
109 | webpackConfig.plugins.push(
110 | new CompressionWebpackPlugin({
111 | asset: '[path].gz[query]',
112 | algorithm: 'gzip',
113 | test: new RegExp(
114 | '\\.(' +
115 | config.build.productionGzipExtensions.join('|') +
116 | ')$'
117 | ),
118 | threshold: 10240,
119 | minRatio: 0.8
120 | })
121 | )
122 | }
123 |
124 | if (config.build.bundleAnalyzerReport) {
125 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
126 | webpackConfig.plugins.push(new BundleAnalyzerPlugin())
127 | }
128 |
129 | module.exports = webpackConfig
130 |
--------------------------------------------------------------------------------
/build/webpack.test.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | // This is the webpack config used for unit tests.
3 |
4 | const utils = require('./utils')
5 | const webpack = require('webpack')
6 | const merge = require('webpack-merge')
7 | const baseWebpackConfig = require('./webpack.base.conf')
8 |
9 | const webpackConfig = merge(baseWebpackConfig, {
10 | // use inline sourcemap for karma-sourcemap-loader
11 | module: {
12 | rules: utils.styleLoaders()
13 | },
14 | devtool: '#inline-source-map',
15 | resolveLoader: {
16 | alias: {
17 | // necessary to to make lang="scss" work in test when using vue-loader's ?inject option
18 | // see discussion at https://github.com/vuejs/vue-loader/issues/724
19 | 'scss-loader': 'sass-loader'
20 | }
21 | },
22 | plugins: [
23 | new webpack.DefinePlugin({
24 | 'process.env': require('../config/test.env')
25 | })
26 | ]
27 | })
28 |
29 | // no need for app entry during tests
30 | delete webpackConfig.entry
31 |
32 | module.exports = webpackConfig
33 |
--------------------------------------------------------------------------------
/config/dev.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const merge = require('webpack-merge')
3 | const prodEnv = require('./prod.env')
4 |
5 | module.exports = merge(prodEnv, {
6 | NODE_ENV: '"development"'
7 | })
8 |
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | // Template version: 1.1.3
3 | // see http://vuejs-templates.github.io/webpack for documentation.
4 |
5 | const path = require('path')
6 |
7 | module.exports = {
8 | build: {
9 | env: require('./prod.env'),
10 | index: path.resolve(__dirname, '../dist/index.html'),
11 | assetsRoot: path.resolve(__dirname, '../dist'),
12 | assetsSubDirectory: 'static',
13 | assetsPublicPath: '/',
14 | productionSourceMap: true,
15 | // Gzip off by default as many popular static hosts such as
16 | // Surge or Netlify already gzip all static assets for you.
17 | // Before setting to `true`, make sure to:
18 | // npm install --save-dev compression-webpack-plugin
19 | productionGzip: false,
20 | productionGzipExtensions: ['js', 'css'],
21 | // Run the build command with an extra argument to
22 | // View the bundle analyzer report after build finishes:
23 | // `npm run build --report`
24 | // Set to `true` or `false` to always turn it on or off
25 | bundleAnalyzerReport: process.env.npm_config_report
26 | },
27 | dev: {
28 | env: require('./dev.env'),
29 | port: process.env.PORT || 8080,
30 | autoOpenBrowser: true,
31 | assetsSubDirectory: 'static',
32 | assetsPublicPath: '/',
33 | proxyTable: {},
34 | // CSS Sourcemaps off by default because relative paths are "buggy"
35 | // with this option, according to the CSS-Loader README
36 | // (https://github.com/webpack/css-loader#sourcemaps)
37 | // In our experience, they generally work as expected,
38 | // just be aware of this issue when enabling this option.
39 | cssSourceMap: false
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/config/prod.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | module.exports = {
3 | NODE_ENV: '"production"'
4 | }
5 |
--------------------------------------------------------------------------------
/config/test.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const merge = require('webpack-merge')
3 | const devEnv = require('./dev.env')
4 |
5 | module.exports = merge(devEnv, {
6 | NODE_ENV: '"testing"'
7 | })
8 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | awesome-charts
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/linechart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsguru-git/awesome-charts-vue/2378797f4c5979e958fa8d62c47a96bc0870911e/linechart.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "awesome-charts",
3 | "version": "1.0.0",
4 | "description": "A Vue.js project",
5 | "author": "",
6 | "private": true,
7 | "scripts": {
8 | "dev": "node build/dev-server.js",
9 | "start": "npm run dev",
10 | "build": "node build/build.js",
11 | "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
12 | "e2e": "node test/e2e/runner.js",
13 | "test": "npm run unit && npm run e2e",
14 | "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
15 | },
16 | "dependencies": {
17 | "axios": "^0.17.0",
18 | "chart.js": "^2.7.1",
19 | "vue": "^2.5.2",
20 | "vue-axios": "^2.0.2",
21 | "vue-chartjs": "^3.0.0",
22 | "vue-router": "^3.0.1"
23 | },
24 | "devDependencies": {
25 | "autoprefixer": "^7.1.2",
26 | "babel-core": "^6.22.1",
27 | "babel-eslint": "^7.1.1",
28 | "babel-loader": "^7.1.1",
29 | "babel-plugin-istanbul": "^4.1.1",
30 | "babel-plugin-transform-runtime": "^6.22.0",
31 | "babel-preset-env": "^1.3.2",
32 | "babel-preset-stage-2": "^6.22.0",
33 | "babel-register": "^6.22.0",
34 | "chai": "^4.1.2",
35 | "chalk": "^2.0.1",
36 | "chromedriver": "^2.27.2",
37 | "connect-history-api-fallback": "^1.3.0",
38 | "copy-webpack-plugin": "^4.0.1",
39 | "cross-env": "^5.0.1",
40 | "cross-spawn": "^5.0.1",
41 | "css-loader": "^0.28.0",
42 | "eslint": "^3.19.0",
43 | "eslint-config-standard": "^10.2.1",
44 | "eslint-friendly-formatter": "^3.0.0",
45 | "eslint-loader": "^1.7.1",
46 | "eslint-plugin-html": "^3.0.0",
47 | "eslint-plugin-import": "^2.7.0",
48 | "eslint-plugin-node": "^5.2.0",
49 | "eslint-plugin-promise": "^3.4.0",
50 | "eslint-plugin-standard": "^3.0.1",
51 | "eventsource-polyfill": "^0.9.6",
52 | "express": "^4.14.1",
53 | "extract-text-webpack-plugin": "^3.0.0",
54 | "file-loader": "^1.1.4",
55 | "friendly-errors-webpack-plugin": "^1.6.1",
56 | "html-webpack-plugin": "^2.30.1",
57 | "http-proxy-middleware": "^0.17.3",
58 | "inject-loader": "^3.0.0",
59 | "karma": "^1.4.1",
60 | "karma-coverage": "^1.1.1",
61 | "karma-mocha": "^1.3.0",
62 | "karma-phantomjs-launcher": "^1.0.2",
63 | "karma-phantomjs-shim": "^1.4.0",
64 | "karma-sinon-chai": "^1.3.1",
65 | "karma-sourcemap-loader": "^0.3.7",
66 | "karma-spec-reporter": "0.0.31",
67 | "karma-webpack": "^2.0.2",
68 | "mocha": "^3.2.0",
69 | "nightwatch": "^0.9.12",
70 | "opn": "^5.1.0",
71 | "optimize-css-assets-webpack-plugin": "^3.2.0",
72 | "ora": "^1.2.0",
73 | "phantomjs-prebuilt": "^2.1.14",
74 | "portfinder": "^1.0.13",
75 | "rimraf": "^2.6.0",
76 | "selenium-server": "^3.0.1",
77 | "semver": "^5.3.0",
78 | "shelljs": "^0.7.6",
79 | "sinon": "^4.0.0",
80 | "sinon-chai": "^2.8.0",
81 | "url-loader": "^0.5.8",
82 | "vue-loader": "^13.3.0",
83 | "vue-style-loader": "^3.0.1",
84 | "vue-template-compiler": "^2.5.2",
85 | "webpack": "^3.6.0",
86 | "webpack-bundle-analyzer": "^2.9.0",
87 | "webpack-dev-middleware": "^1.12.0",
88 | "webpack-hot-middleware": "^2.18.2",
89 | "webpack-merge": "^4.1.0"
90 | },
91 | "engines": {
92 | "node": ">= 4.0.0",
93 | "npm": ">= 3.0.0"
94 | },
95 | "browserslist": [
96 | "> 1%",
97 | "last 2 versions",
98 | "not ie <= 8"
99 | ]
100 | }
101 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Linechart
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
23 |
24 |
--------------------------------------------------------------------------------
/src/App_backup.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
6 |
7 |
8 |
13 |
14 |
24 |
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsguru-git/awesome-charts-vue/2378797f4c5979e958fa8d62c47a96bc0870911e/src/assets/logo.png
--------------------------------------------------------------------------------
/src/components/HelloWorld.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
Essential Links
5 |
13 |
Ecosystem
14 |
20 |
21 |
22 |
23 |
33 |
34 |
35 |
54 |
--------------------------------------------------------------------------------
/src/components/LineChart.js:
--------------------------------------------------------------------------------
1 | import { Line } from 'vue-chartjs'
2 | import Vue from 'vue'
3 | import axios from 'axios'
4 | import VueAxios from 'vue-axios'
5 | Vue.use(VueAxios, axios)
6 |
7 | export default {
8 | extends: Line,
9 | data () {
10 | return {
11 | gradient: null,
12 | options: null,
13 | temp: null
14 | }
15 | },
16 | mounted () {
17 | this.options = {responsive: true, maintainAspectRatio: false}
18 | this.axios.get('https://api.myjson.com/bins/8sqwr')
19 | .then(response => {
20 | this.temp = response.data
21 | this.gradient = []
22 | for (var i = 0; i < this.temp.length; i++) {
23 | var color = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
24 | var red = Math.floor((Math.random() * 254) + 1)
25 | var green = Math.floor((Math.random() * 254) + 1)
26 | var blue = Math.floor((Math.random() * 254) + 1)
27 | color.addColorStop(0, 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ', 1)')
28 | color.addColorStop(0.5, 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ', 0.5)')
29 | color.addColorStop(1, 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ', 0)')
30 | this.gradient[i] = color
31 | }
32 | var datasets = []
33 | var dataCollection = []
34 | var buffs = []
35 | var labels = []
36 | for (var j = 0; j < this.temp.length; j++) {
37 | for (var l = 1; l < Object.keys(this.temp[j]).length; l++) {
38 | labels[l - 1] = Object.keys(this.temp[j])[l]
39 | buffs[l - 1] = this.temp[j][Object.keys(this.temp[j])[l]]
40 | }
41 | datasets.push({
42 | label: this.temp[j]['category'],
43 | borderColor: '#' + Math.floor(Math.random() * 16777215).toString(16),
44 | pointBackgroundColor: 'white',
45 | borderWidth: 1,
46 | pointBorderColor: 'white',
47 | backgroundColor: this.gradient[j],
48 | data: buffs
49 | })
50 | }
51 | dataCollection.push({
52 | labels: labels,
53 | datasets: datasets
54 | })
55 | this.options = {responsive: true, maintainAspectRatio: false}
56 | this.renderChart(dataCollection[0], this.options)
57 | })
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/components/LineChart_backup.js:
--------------------------------------------------------------------------------
1 | import { Line } from 'vue-chartjs'
2 |
3 | // export default {
4 | // extends: Line,
5 | // name: 'LineExample',
6 | // data () {
7 | // return {
8 | // gradient: null,
9 | // gradient2: null
10 | // }
11 | // },
12 | // mounted () {
13 | // this.gradient = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
14 | // this.gradient2 = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
15 | // this.gradient.addColorStop(0, 'rgba(255, 0,0, 0.5)')
16 | // this.gradient.addColorStop(0.5, 'rgba(255, 0, 0, 0.25)')
17 | // this.gradient.addColorStop(1, 'rgba(255, 0, 0, 0)')
18 | // this.gradient2.addColorStop(0, 'rgba(0, 231, 255, 0.9)')
19 | // this.gradient2.addColorStop(0.5, 'rgba(0, 231, 255, 0.25)')
20 | // this.gradient2.addColorStop(1, 'rgba(0, 231, 255, 0)')
21 |
22 | // this.renderChart({
23 | // labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
24 | // datasets: [
25 | // {
26 | // label: 'Data One',
27 | // borderColor: '#FC2525',
28 | // pointBackgroundColor: 'white',
29 | // borderWidth: 1,
30 | // pointBorderColor: 'white',
31 | // backgroundColor: this.gradient,
32 | // data: [40, 39, 10, 40, 39, 80, 40]
33 | // }, {
34 | // label: 'Data Two',
35 | // borderColor: '#05CBE1',
36 | // pointBackgroundColor: 'white',
37 | // borderWidth: 1,
38 | // pointBorderColor: 'white',
39 | // backgroundColor: this.gradient2,
40 | // data: [60, 55, 32, 10, 2, 12, 53]
41 | // }
42 | // ]
43 | // }, {responsive: true, maintainAspectRatio: false})
44 | // }
45 | // }
46 | export default {
47 | extends: Line,
48 | data () {
49 | return {
50 | gradient: null,
51 | gradient2: null
52 | }
53 | },
54 | mounted () {
55 | this.gradient = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
56 | this.gradient2 = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
57 | this.gradient.addColorStop(0, 'rgba(255, 0,0, 0.5)')
58 | this.gradient.addColorStop(0.5, 'rgba(255, 0, 0, 0.25)')
59 | this.gradient.addColorStop(1, 'rgba(255, 0, 0, 0)')
60 | this.gradient2.addColorStop(0, 'rgba(0, 231, 255, 0.9)')
61 | this.gradient2.addColorStop(0.5, 'rgba(0, 231, 255, 0.25)')
62 | this.gradient2.addColorStop(1, 'rgba(0, 231, 255, 0)')
63 | this.renderChart({
64 | labels: ['Kwadraat A', 'Kwadraat B', 'Kwadraat C', 'Kwadraat D'],
65 | datasets: [
66 | {
67 | label: 'Week 37 2017',
68 | borderColor: '#FC2525',
69 | pointBackgroundColor: 'white',
70 | borderWidth: 1,
71 | pointBorderColor: 'white',
72 | backgroundColor: this.gradient,
73 | data: [0, 0, 0, 0]
74 | }, {
75 | label: 'Week 38 2017',
76 | borderColor: '#05CBE1',
77 | pointBackgroundColor: 'white',
78 | borderWidth: 1,
79 | pointBorderColor: 'white',
80 | backgroundColor: this.gradient2,
81 | data: [0, 2, 0, 3]
82 | }, {
83 | label: 'Week 39 2017',
84 | borderColor: '#FC0025',
85 | pointBackgroundColor: 'white',
86 | borderWidth: 1,
87 | pointBorderColor: 'white',
88 | backgroundColor: this.gradient,
89 | data: [19, 11, 0, 5]
90 | }, {
91 | label: 'Week 40 2017',
92 | borderColor: '#05CB00',
93 | pointBackgroundColor: 'white',
94 | borderWidth: 1,
95 | pointBorderColor: 'white',
96 | backgroundColor: this.gradient2,
97 | data: [0, 0, 0, 0]
98 | }, {
99 | label: 'Week 41 2017',
100 | borderColor: '#002525',
101 | pointBackgroundColor: 'white',
102 | borderWidth: 1,
103 | pointBorderColor: 'white',
104 | backgroundColor: this.gradient,
105 | data: [68, 0, 0, 6]
106 | }, {
107 | label: 'Week 42 2017',
108 | borderColor: '#0500E1',
109 | pointBackgroundColor: 'white',
110 | borderWidth: 1,
111 | pointBorderColor: 'white',
112 | backgroundColor: this.gradient2,
113 | data: [0, 4, 0, 23]
114 | }, {
115 | label: 'Week 43 2017',
116 | borderColor: '#FC2500',
117 | pointBackgroundColor: 'white',
118 | borderWidth: 1,
119 | pointBorderColor: 'white',
120 | backgroundColor: this.gradient,
121 | data: [0, 0, 0, 0]
122 | }, {
123 | label: 'Week 44 2017',
124 | borderColor: '#00CBE1',
125 | pointBackgroundColor: 'white',
126 | borderWidth: 1,
127 | pointBorderColor: 'white',
128 | backgroundColor: this.gradient2,
129 | data: [0, 0, 0, 0]
130 | }
131 | ]
132 | }, {responsive: true, maintainAspectRatio: false})
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/src/components/LineChart_backup2.js:
--------------------------------------------------------------------------------
1 | import { Line } from 'vue-chartjs'
2 | import Vue from 'vue'
3 | import axios from 'axios'
4 | import VueAxios from 'vue-axios'
5 | // path = path.sibstring(0,path.lastIndexOf('\\')+1);
6 | // alert(path);
7 | Vue.use(VueAxios, axios)
8 |
9 | // export default {
10 | // extends: Line,
11 | // name: 'LineExample',
12 | // data () {
13 | // return {
14 | // gradient: null,
15 | // gradient2: null
16 | // }
17 | // },
18 | // mounted () {
19 | // this.gradient = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
20 | // this.gradient2 = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
21 | // this.gradient.addColorStop(0, 'rgba(255, 0,0, 0.5)')
22 | // this.gradient.addColorStop(0.5, 'rgba(255, 0, 0, 0.25)')
23 | // this.gradient.addColorStop(1, 'rgba(255, 0, 0, 0)')
24 | // this.gradient2.addColorStop(0, 'rgba(0, 231, 255, 0.9)')
25 | // this.gradient2.addColorStop(0.5, 'rgba(0, 231, 255, 0.25)')
26 | // this.gradient2.addColorStop(1, 'rgba(0, 231, 255, 0)')
27 |
28 | // this.renderChart({
29 | // labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
30 | // datasets: [
31 | // {
32 | // label: 'Data One',
33 | // borderColor: '#FC2525',
34 | // pointBackgroundColor: 'white',
35 | // borderWidth: 1,
36 | // pointBorderColor: 'white',
37 | // backgroundColor: this.gradient,
38 | // data: [40, 39, 10, 40, 39, 80, 40]
39 | // }, {
40 | // label: 'Data Two',
41 | // borderColor: '#05CBE1',
42 | // pointBackgroundColor: 'white',
43 | // borderWidth: 1,
44 | // pointBorderColor: 'white',
45 | // backgroundColor: this.gradient2,
46 | // data: [60, 55, 32, 10, 2, 12, 53]
47 | // }
48 | // ]
49 | // }, {responsive: true, maintainAspectRatio: false})
50 | // }
51 | // }
52 | export default {
53 | extends: Line,
54 | data () {
55 | return {
56 | gradient: null,
57 | options: null,
58 | temp: null
59 | }
60 | },
61 | mounted () {
62 | this.options = {responsive: true, maintainAspectRatio: false}
63 | // this.axios.get('https://beheer.mijnbewijsstukken.nl/foobar?json=true&yolo=true', {headers: {'Access-Control-Allow-Origin': 'https://beheer.mijnbewijsstukken.nl', 'Access-Control-Request-Method': 'GET', 'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'}})
64 | // this.axios.get('https://beheer.mijnbewijsstukken.nl/foobar', {
65 | // params: {
66 | // json: true,
67 | // yolo: true
68 | // }
69 | // })
70 | // this.axios.post('https://beheer.mijnbewijsstukken.nl/foobar', {
71 | // json: true,
72 | // yolo: true
73 | // })
74 | this.axios.get('https://api.myjson.com/bins/8sqwr')
75 | // this.axios.get('http://127.0.0.1:8080/Json/test.json')
76 | .then(response => {
77 | // this.dataCollection = response.data
78 | // console.log(JSON.parse(response.data))
79 | // alert('JSON.parse(response.data)')
80 | // this.renderChart(this.dataCollection, this.options)
81 | this.temp = response.data
82 | this.gradient = []
83 | for (var i = 0; i < this.temp.length; i++) {
84 | var color = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
85 | var red = Math.floor((Math.random() * 254) + 1)
86 | var green = Math.floor((Math.random() * 254) + 1)
87 | var blue = Math.floor((Math.random() * 254) + 1)
88 | color.addColorStop(0, 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ', 1)')
89 | color.addColorStop(0.5, 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ', 0.5)')
90 | color.addColorStop(1, 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ', 0)')
91 | this.gradient[i] = color
92 | }
93 | var datasets = []
94 | var dataCollection = []
95 | var buffs = []
96 | var labels = []
97 | for (var j = 0; j < this.temp.length; j++) {
98 | for (var l = 1; l < Object.keys(this.temp[j]).length; l++) {
99 | labels[l - 1] = Object.keys(this.temp[j])[l]
100 | buffs[l - 1] = this.temp[j][Object.keys(this.temp[j])[l]]
101 | }
102 | datasets.push({
103 | label: this.temp[j]['category'],
104 | borderColor: '#' + Math.floor(Math.random() * 16777215).toString(16),
105 | pointBackgroundColor: 'white',
106 | borderWidth: 1,
107 | pointBorderColor: 'white',
108 | backgroundColor: this.gradient[j],
109 | data: buffs
110 | })
111 | }
112 | dataCollection.push({
113 | labels: labels,
114 | datasets: datasets
115 | })
116 | this.options = {responsive: true, maintainAspectRatio: false}
117 | this.renderChart(dataCollection[0], this.options)
118 | })
119 | // var gradient1 = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
120 | // var gradient2 = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
121 | // var gradient3 = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
122 | // var gradient4 = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
123 | // var gradient5 = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
124 | // var gradient6 = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
125 | // gradient1.addColorStop(0, 'rgba(255, 0, 0, 0.5)')
126 | // gradient1.addColorStop(0.5, 'rgba(255, 0, 0, 0.25)')
127 | // gradient1.addColorStop(1, 'rgba(255, 0, 0, 0)')
128 | // gradient2.addColorStop(0, 'rgba(0, 231, 255, 0.9)')
129 | // gradient2.addColorStop(0.5, 'rgba(0, 231, 255, 0.25)')
130 | // gradient2.addColorStop(1, 'rgba(0, 231, 255, 0)')
131 | // gradient3.addColorStop(0, 'rgba(0, 352, 50, 0.6)')
132 | // gradient3.addColorStop(0.5, 'rgba(0, 352, 50, 0.25)')
133 | // gradient3.addColorStop(1, 'rgba(0, 352, 50, 0)')
134 | // gradient4.addColorStop(0, 'rgba(0, 12, 150, 0.4)')
135 | // gradient4.addColorStop(0.5, 'rgba(0, 12, 150, 0.25)')
136 | // gradient4.addColorStop(1, 'rgba(0, 12, 150, 0)')
137 | // gradient5.addColorStop(0, 'rgba(120, 69, 150, 0.2)')
138 | // gradient5.addColorStop(0.5, 'rgba(120, 69, 50, 0.25)')
139 | // gradient5.addColorStop(1, 'rgba(120, 69, 50, 0)')
140 | // gradient6.addColorStop(0, 'rgba(255, 120, 0, 0.8)')
141 | // gradient6.addColorStop(0.5, 'rgba(255, 120, 0, 0.25)')
142 | // gradient6.addColorStop(1, 'rgba(255, 120, 0, 0)')
143 | // this.gradient = [gradient1, gradient2, gradient3, gradient4, gradient5, gradient6]
144 | /* this.temp = [
145 | {
146 | 'week': 'Week 37 2017',
147 | 'Kwadraat A': 0,
148 | 'Kwadraat B': 0,
149 | 'Kwadraat C': 0,
150 | 'Kwadraat D': 0
151 | },
152 | {
153 | 'week': 'Week 38 2017',
154 | 'Kwadraat A': 0,
155 | 'Kwadraat B': 2,
156 | 'Kwadraat C': 0,
157 | 'Kwadraat D': 3
158 | },
159 | {
160 | 'week': 'Week 39 2017',
161 | 'Kwadraat A': 19,
162 | 'Kwadraat B': 11,
163 | 'Kwadraat C': 0,
164 | 'Kwadraat D': 5
165 | },
166 | {
167 | 'week': 'Week 40 2017',
168 | 'Kwadraat A': 0,
169 | 'Kwadraat B': 0,
170 | 'Kwadraat C': 0,
171 | 'Kwadraat D': 0
172 | },
173 | {
174 | 'week': 'Week 41 2017',
175 | 'Kwadraat A': 68,
176 | 'Kwadraat B': 0,
177 | 'Kwadraat C': 0,
178 | 'Kwadraat D': 7
179 | },
180 | {
181 | 'week': 'Week 42 2017',
182 | 'Kwadraat A': 0,
183 | 'Kwadraat B': 4,
184 | 'Kwadraat C': 0,
185 | 'Kwadraat D': 23
186 | },
187 | {
188 | 'week': 'Week 43 2017',
189 | 'Kwadraat A': 0,
190 | 'Kwadraat B': 0,
191 | 'Kwadraat C': 0,
192 | 'Kwadraat D': 0
193 | },
194 | {
195 | 'week': 'Week 44 2017',
196 | 'Kwadraat A': 0,
197 | 'Kwadraat B': 0,
198 | 'Kwadraat C': 0,
199 | 'Kwadraat D': 0
200 | }
201 | ]
202 | this.gradient = []
203 | for (var i = 0; i < this.temp.length; i++) {
204 | var color = this.$refs.canvas.getContext('2d').createLinearGradient(0, 0, 0, 450)
205 | var red = Math.floor((Math.random() * 254) + 1)
206 | var green = Math.floor((Math.random() * 254) + 1)
207 | var blue = Math.floor((Math.random() * 254) + 1)
208 | color.addColorStop(0, 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ', 1)')
209 | color.addColorStop(0.5, 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ', 0.5)')
210 | color.addColorStop(1, 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ', 0)')
211 | this.gradient[i] = color
212 | }
213 | var datasets = []
214 | var dataCollection = []
215 | for (var j = 0; j < this.temp.length; j++) {
216 | datasets.push({
217 | label: this.temp[j]['week'],
218 | borderColor: '#' + Math.floor(Math.random() * 16777215).toString(16),
219 | pointBackgroundColor: 'white',
220 | borderWidth: 1,
221 | pointBorderColor: 'white',
222 | backgroundColor: this.gradient[j],
223 | data: [this.temp[j]['Kwadraat A'],
224 | this.temp[j]['Kwadraat B'],
225 | this.temp[j]['Kwadraat C'],
226 | this.temp[j]['Kwadraat D']
227 | ]
228 | })
229 | }
230 | dataCollection.push({
231 | labels: ['Kwadraat A', 'Kwadraat B', 'Kwadraat C', 'Kwadraat D'],
232 | datasets: datasets
233 | }) */
234 | // alert(JSON.parse(this.temp[0]))
235 | // this.dataCollection = {
236 | // labels: ['Kwadraat A', 'Kwadraat B', 'Kwadraat C', 'Kwadraat D'],
237 | // datasets: [
238 | // {
239 | // label: 'Week 37 2017',
240 | // // borderColor: '#FC2525',
241 | // // pointBackgroundColor: 'white',
242 | // // borderWidth: 1,
243 | // // pointBorderColor: 'white',
244 | // // backgroundColor: this.gradient,
245 | // data: [0, 0, 0, 0]
246 | // }, {
247 | // label: 'Week 38 2017',
248 | // // borderColor: '#05CBE1',
249 | // // pointBackgroundColor: 'white',
250 | // // borderWidth: 1,
251 | // // pointBorderColor: 'white',
252 | // // backgroundColor: this.gradient2,
253 | // data: [0, 2, 0, 3]
254 | // }, {
255 | // label: 'Week 39 2017',
256 | // // borderColor: '#FC0025',
257 | // // pointBackgroundColor: 'white',
258 | // // borderWidth: 1,
259 | // // pointBorderColor: 'white',
260 | // // backgroundColor: this.gradient,
261 | // data: [19, 11, 0, 5]
262 | // }, {
263 | // label: 'Week 40 2017',
264 | // // borderColor: '#05CB00',
265 | // // pointBackgroundColor: 'white',
266 | // // borderWidth: 1,
267 | // // pointBorderColor: 'white',
268 | // // backgroundColor: this.gradient2,
269 | // data: [0, 0, 0, 0]
270 | // }, {
271 | // label: 'Week 41 2017',
272 | // // borderColor: '#002525',
273 | // // pointBackgroundColor: 'white',
274 | // // borderWidth: 1,
275 | // // pointBorderColor: 'white',
276 | // // backgroundColor: this.gradient,
277 | // data: [68, 0, 0, 6]
278 | // }, {
279 | // label: 'Week 42 2017',
280 | // // borderColor: '#0500E1',
281 | // // pointBackgroundColor: 'white',
282 | // // borderWidth: 1,
283 | // // pointBorderColor: 'white',
284 | // // backgroundColor: this.gradient2,
285 | // data: [0, 4, 0, 23]
286 | // }, {
287 | // label: 'Week 43 2017',
288 | // // borderColor: '#FC2500',
289 | // // pointBackgroundColor: 'white',
290 | // // borderWidth: 1,
291 | // // pointBorderColor: 'white',
292 | // // backgroundColor: this.gradient,
293 | // data: [0, 0, 0, 0]
294 | // }, {
295 | // label: 'Week 44 2017',
296 | // // borderColor: '#00CBE1',
297 | // // pointBackgroundColor: 'white',
298 | // // borderWidth: 1,
299 | // // pointBorderColor: 'white',
300 | // // backgroundColor: this.gradient2,
301 | // data: [0, 0, 0, 0]
302 | // }
303 | // ]
304 | // }
305 | // this.options = {responsive: true, maintainAspectRatio: false}
306 | // this.renderChart(dataCollection[0], this.options)
307 | }
308 | }
309 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | // The Vue build version to load with the `import` command
2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 | import Vue from 'vue'
4 | import App from './App'
5 | // import router from './router'
6 |
7 | Vue.config.productionTip = false
8 |
9 | /* eslint-disable no-new */
10 | new Vue({
11 | el: '#app',
12 | // router,
13 | template: '',
14 | components: { App }
15 | })
16 |
--------------------------------------------------------------------------------
/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import HelloWorld from '@/components/HelloWorld'
4 |
5 | Vue.use(Router)
6 |
7 | export default new Router({
8 | routes: [
9 | {
10 | path: '/',
11 | name: 'Hello',
12 | component: HelloWorld
13 | }
14 | ]
15 | })
16 |
--------------------------------------------------------------------------------
/static/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsguru-git/awesome-charts-vue/2378797f4c5979e958fa8d62c47a96bc0870911e/static/.gitkeep
--------------------------------------------------------------------------------
/test/e2e/custom-assertions/elementCount.js:
--------------------------------------------------------------------------------
1 | // A custom Nightwatch assertion.
2 | // the name of the method is the filename.
3 | // can be used in tests like this:
4 | //
5 | // browser.assert.elementCount(selector, count)
6 | //
7 | // for how to write custom assertions see
8 | // http://nightwatchjs.org/guide#writing-custom-assertions
9 | exports.assertion = function (selector, count) {
10 | this.message = 'Testing if element <' + selector + '> has count: ' + count
11 | this.expected = count
12 | this.pass = function (val) {
13 | return val === this.expected
14 | }
15 | this.value = function (res) {
16 | return res.value
17 | }
18 | this.command = function (cb) {
19 | var self = this
20 | return this.api.execute(function (selector) {
21 | return document.querySelectorAll(selector).length
22 | }, [selector], function (res) {
23 | cb.call(self, res)
24 | })
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/test/e2e/nightwatch.conf.js:
--------------------------------------------------------------------------------
1 | require('babel-register')
2 | var config = require('../../config')
3 |
4 | // http://nightwatchjs.org/gettingstarted#settings-file
5 | module.exports = {
6 | src_folders: ['test/e2e/specs'],
7 | output_folder: 'test/e2e/reports',
8 | custom_assertions_path: ['test/e2e/custom-assertions'],
9 |
10 | selenium: {
11 | start_process: true,
12 | server_path: require('selenium-server').path,
13 | host: '127.0.0.1',
14 | port: 4444,
15 | cli_args: {
16 | 'webdriver.chrome.driver': require('chromedriver').path
17 | }
18 | },
19 |
20 | test_settings: {
21 | default: {
22 | selenium_port: 4444,
23 | selenium_host: 'localhost',
24 | silent: true,
25 | globals: {
26 | devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
27 | }
28 | },
29 |
30 | chrome: {
31 | desiredCapabilities: {
32 | browserName: 'chrome',
33 | javascriptEnabled: true,
34 | acceptSslCerts: true
35 | }
36 | },
37 |
38 | firefox: {
39 | desiredCapabilities: {
40 | browserName: 'firefox',
41 | javascriptEnabled: true,
42 | acceptSslCerts: true
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/test/e2e/runner.js:
--------------------------------------------------------------------------------
1 | // 1. start the dev server using production config
2 | process.env.NODE_ENV = 'testing'
3 | var server = require('../../build/dev-server.js')
4 |
5 | server.ready.then(() => {
6 | // 2. run the nightwatch test suite against it
7 | // to run in additional browsers:
8 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings"
9 | // 2. add it to the --env flag below
10 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
11 | // For more information on Nightwatch's config file, see
12 | // http://nightwatchjs.org/guide#settings-file
13 | var opts = process.argv.slice(2)
14 | if (opts.indexOf('--config') === -1) {
15 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
16 | }
17 | if (opts.indexOf('--env') === -1) {
18 | opts = opts.concat(['--env', 'chrome'])
19 | }
20 |
21 | var spawn = require('cross-spawn')
22 | var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
23 |
24 | runner.on('exit', function (code) {
25 | server.close()
26 | process.exit(code)
27 | })
28 |
29 | runner.on('error', function (err) {
30 | server.close()
31 | throw err
32 | })
33 | })
34 |
--------------------------------------------------------------------------------
/test/e2e/specs/test.js:
--------------------------------------------------------------------------------
1 | // For authoring Nightwatch tests, see
2 | // http://nightwatchjs.org/guide#usage
3 |
4 | module.exports = {
5 | 'default e2e tests': function (browser) {
6 | // automatically uses dev Server port from /config.index.js
7 | // default: http://localhost:8080
8 | // see nightwatch.conf.js
9 | const devServer = browser.globals.devServerURL
10 |
11 | browser
12 | .url(devServer)
13 | .waitForElementVisible('#app', 5000)
14 | .assert.elementPresent('.hello')
15 | .assert.containsText('h1', 'Welcome to Your Vue.js App')
16 | .assert.elementCount('img', 1)
17 | .end()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/test/unit/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "mocha": true
4 | },
5 | "globals": {
6 | "expect": true,
7 | "sinon": true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/test/unit/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 |
3 | Vue.config.productionTip = false
4 |
5 | // require all test files (files that ends with .spec.js)
6 | const testsContext = require.context('./specs', true, /\.spec$/)
7 | testsContext.keys().forEach(testsContext)
8 |
9 | // require all src files except main.js for coverage.
10 | // you can also change this to match only the subset of files that
11 | // you want coverage for.
12 | const srcContext = require.context('../../src', true, /^\.\/(?!main(\.js)?$)/)
13 | srcContext.keys().forEach(srcContext)
14 |
--------------------------------------------------------------------------------
/test/unit/karma.conf.js:
--------------------------------------------------------------------------------
1 | // This is a karma config file. For more details see
2 | // http://karma-runner.github.io/0.13/config/configuration-file.html
3 | // we are also using it with karma-webpack
4 | // https://github.com/webpack/karma-webpack
5 |
6 | var webpackConfig = require('../../build/webpack.test.conf')
7 |
8 | module.exports = function (config) {
9 | config.set({
10 | // to run in additional browsers:
11 | // 1. install corresponding karma launcher
12 | // http://karma-runner.github.io/0.13/config/browsers.html
13 | // 2. add it to the `browsers` array below.
14 | browsers: ['PhantomJS'],
15 | frameworks: ['mocha', 'sinon-chai', 'phantomjs-shim'],
16 | reporters: ['spec', 'coverage'],
17 | files: ['./index.js'],
18 | preprocessors: {
19 | './index.js': ['webpack', 'sourcemap']
20 | },
21 | webpack: webpackConfig,
22 | webpackMiddleware: {
23 | noInfo: true
24 | },
25 | coverageReporter: {
26 | dir: './coverage',
27 | reporters: [
28 | { type: 'lcov', subdir: '.' },
29 | { type: 'text-summary' }
30 | ]
31 | }
32 | })
33 | }
34 |
--------------------------------------------------------------------------------
/test/unit/specs/Hello.spec.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import HelloWorld from '@/components/HelloWorld'
3 |
4 | describe('HelloWorld.vue', () => {
5 | it('should render correct contents', () => {
6 | const Constructor = Vue.extend(HelloWorld)
7 | const vm = new Constructor().$mount()
8 | expect(vm.$el.querySelector('.hello h1').textContent)
9 | .to.equal('Welcome to Your Vue.js App')
10 | })
11 | })
12 |
--------------------------------------------------------------------------------