🎉 Initial commit

This commit is contained in:
Jakub Juszczak
2016-06-26 15:24:29 +02:00
commit 0820ba63b3
36 changed files with 964 additions and 0 deletions

20
src/App.vue Normal file
View File

@@ -0,0 +1,20 @@
<template>
<div class="container">
<test-chart :width="100" :height="200" :player={wins:'12'} :opponent={wins:'23'}></test-chart>
</div>
</template>
<script>
import TestChart from './components/TestChart'
export default {
components: { TestChart }
}
</script>
<style>
.container {
max-width: 800px;
margin: 0 auto;
}
</style>

BIN
src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,58 @@
import Vue from 'vue'
import Chart from 'chart.js'
export default Vue.extend({
template: `
<div>
<canvas id="bar-chart" width=width height=height v-el:canvas></canvas>
</div>
`,
props: {
width: {
default: 400,
type: Number
},
height: {
default: 400,
type: Number
}
},
data () {
return {
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
},
gridLines: {
display: false
}
}],
xAxes: [ {
gridLines: {
display: false
},
categoryPercentage: 0.5,
barPercentage: 0.2
}]
}
}
}
},
methods: {
render (data, options = this.options) {
const chart = new Chart(
this.$els.canvas.getContext('2d'), {
type: 'bar',
data: data,
options: options
}
)
chart.generateLegend()
}
}
})

View File

View File

@@ -0,0 +1,56 @@
import Vue from 'vue'
import Chart from 'chart.js'
export default Vue.extend({
template: `
<div>
<canvas id="line-chart" width=width height=height v-el:canvas></canvas>
</div>
`,
props: {
width: {
default: 400,
type: Number
},
height: {
default: 400,
type: Number
}
},
data () {
return {
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
},
gridLines: {
display: false
}
}],
xAxes: [ {
gridLines: {
display: false
}
}]
}
}
}
},
methods: {
render (data, options = this.options) {
const chart = new Chart(
this.$els.canvas.getContext('2d'), {
type: 'line',
data: data,
options: options
}
)
chart.generateLegend()
}
}
})

View File

View File

View File

@@ -0,0 +1,24 @@
// import BarChart from './BaseCharts/Bar'
import BarChart from './BaseCharts/Line'
export default BarChart.extend({
props: ['player', 'opponent'],
ready () {
this.render({
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'Data One',
backgroundColor: '#f87979',
data: [40, 39, 10, 40, 39, 80, 40]
},
{
label: 'Data Two',
backgroundColor: '#f87979',
data: [0, 0, 0, 39.30, 39.30, 39.30]
}
]
})
}
})

8
src/main.js Normal file
View File

@@ -0,0 +1,8 @@
import Vue from 'vue'
import App from './App'
/* eslint-disable no-new */
new Vue({
el: 'body',
components: { App }
})