feat: new widget charts
This commit is contained in:
@@ -0,0 +1,54 @@
|
|||||||
|
import { deepObjectsMerge } from '@coreui/coreui/dist/js/coreui-utilities'
|
||||||
|
import getColor from '@coreui/coreui/js/src/utilities/get-color'
|
||||||
|
|
||||||
|
const generatedLabels = {
|
||||||
|
computed:{
|
||||||
|
generatedLabels() {
|
||||||
|
if(this.labels !== undefined)
|
||||||
|
return this.labels
|
||||||
|
let labels = [];
|
||||||
|
for(let i=1; i<=this.data.length; i++)
|
||||||
|
labels.push('')
|
||||||
|
return labels
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const generatedBackgroundColor = {
|
||||||
|
computed:{
|
||||||
|
generatedBackgroundColor(){
|
||||||
|
return getColor(this.backgroundColor)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const generatedBorderColor = {
|
||||||
|
computed:{
|
||||||
|
generatedBorderColor(){
|
||||||
|
return getColor(this.borderColor)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const generatedPointHoverBackgroundColor = {
|
||||||
|
computed:{
|
||||||
|
generatedPointHoverBackgroundColor () {
|
||||||
|
if(this.$options.propsData.pointHoverBackgroundColor === undefined)
|
||||||
|
return this.generatedBorderColor
|
||||||
|
return getColor(this.pointHoverBackgroundColor)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const generatedOptions = {
|
||||||
|
computed:{
|
||||||
|
generatedOptions () {
|
||||||
|
if(this.$options.propsData.options !== undefined)
|
||||||
|
deepObjectsMerge(this.finalOptions, this.options)
|
||||||
|
return this.finalOptions
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
export{
|
||||||
|
generatedLabels,
|
||||||
|
generatedBackgroundColor,
|
||||||
|
generatedBorderColor,
|
||||||
|
generatedPointHoverBackgroundColor,
|
||||||
|
generatedOptions
|
||||||
|
}
|
||||||
@@ -155,6 +155,7 @@
|
|||||||
</widget04>
|
</widget04>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row><!--/.row-->
|
</b-row><!--/.row-->
|
||||||
|
<b-row>
|
||||||
<b-col md="12">
|
<b-col md="12">
|
||||||
<b-card header="Traffic & Sales">
|
<b-card header="Traffic & Sales">
|
||||||
<b-row>
|
<b-row>
|
||||||
|
|||||||
+30
-19
@@ -107,25 +107,29 @@
|
|||||||
<b-row>
|
<b-row>
|
||||||
<b-col md="3" sm="6">
|
<b-col md="3" sm="6">
|
||||||
<widget04 type="facebook" rightHeader="89k" rightFooter="friends" leftHeader="459" leftFooter="feeds">
|
<widget04 type="facebook" rightHeader="89k" rightFooter="friends" leftHeader="459" leftFooter="feeds">
|
||||||
<line-chart1 chartId="facebook" :data='[0, 22, 34, 46, 58, 70, 68, 58, 52, 60, 64, 70]' label='Friends'
|
<line-chart1 chartId="facebook" :data='[65, 59, 84, 84, 51, 55, 40]' label='Friends'
|
||||||
|
:labels="['January', 'February', 'March', 'April', 'May', 'June', 'July']"
|
||||||
style='height:100px' backgroundColor='rgba(255,255,255,.1)'/>
|
style='height:100px' backgroundColor='rgba(255,255,255,.1)'/>
|
||||||
</widget04>
|
</widget04>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col md="3" sm="6">
|
<b-col md="3" sm="6">
|
||||||
<widget04 type="twitter" rightHeader="973k" rightFooter="followers" leftHeader="1.792" leftFooter="tweets">
|
<widget04 type="twitter" rightHeader="973k" rightFooter="followers" leftHeader="1.792" leftFooter="tweets">
|
||||||
<line-chart1 chartId="twitter" :data='[5, 22, 34, 46, 58, 70, 68, 58, 52, 60, 64, 72]' label='Followers'
|
<line-chart1 chartId="twitter" :data='[1, 13, 9, 17, 34, 41, 38]' label='Followers'
|
||||||
|
:labels="['January', 'February', 'March', 'April', 'May', 'June', 'July']"
|
||||||
style='height:100px' backgroundColor='rgba(255,255,255,.1)'/>
|
style='height:100px' backgroundColor='rgba(255,255,255,.1)'/>
|
||||||
</widget04>
|
</widget04>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col md="3" sm="6">
|
<b-col md="3" sm="6">
|
||||||
<widget04 type="linkedin" rightHeader="500+" rightFooter="contracts" leftHeader="292" leftFooter="feeds">
|
<widget04 type="linkedin" rightHeader="500+" rightFooter="contracts" leftHeader="292" leftFooter="feeds">
|
||||||
<line-chart1 chartId="linkedIn" :data='[15, 22, 34, 46, 58, 70, 68, 58, 52, 60, 64, 71]' label='Contracts'
|
<line-chart1 chartId="linkedIn" :data='[78, 81, 80, 45, 34, 12, 40]' label='Contracts'
|
||||||
|
:labels="['January', 'February', 'March', 'April', 'May', 'June', 'July']"
|
||||||
style='height:100px' backgroundColor='rgba(255,255,255,.1)'/>
|
style='height:100px' backgroundColor='rgba(255,255,255,.1)'/>
|
||||||
</widget04>
|
</widget04>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col md="3" sm="6">
|
<b-col md="3" sm="6">
|
||||||
<widget04 type='google-plus' rightHeader='894' rightFooter='followers' leftHeader='92' leftFooter='circles'>
|
<widget04 type='google-plus' rightHeader='894' rightFooter='followers' leftHeader='92' leftFooter='circles'>
|
||||||
<line-chart1 chartId="google-plus" :data='[10, 22, 34, 46, 58, 70, 68, 58, 52, 60, 64, 74]' label='Followers'
|
<line-chart1 chartId="google-plus" :data='[35, 23, 56, 22, 97, 23, 64]' label='Followers'
|
||||||
|
:labels="['January', 'February', 'March', 'April', 'May', 'June', 'July']"
|
||||||
style='height:100px' backgroundColor='rgba(255,255,255,.1)'/>
|
style='height:100px' backgroundColor='rgba(255,255,255,.1)'/>
|
||||||
</widget04>
|
</widget04>
|
||||||
</b-col>
|
</b-col>
|
||||||
@@ -194,7 +198,7 @@
|
|||||||
<template slot='chart'>
|
<template slot='chart'>
|
||||||
<line-chart2 chartId="widget06_1" slot='chart' class='px-3' :data='[65, 59, 84, 84, 51, 55, 40]'
|
<line-chart2 chartId="widget06_1" slot='chart' class='px-3' :data='[65, 59, 84, 84, 51, 55, 40]'
|
||||||
:labels="['January', 'February', 'March', 'April', 'May', 'June', 'July']"
|
:labels="['January', 'February', 'March', 'April', 'May', 'June', 'July']"
|
||||||
style='height:70px' label='Members'/>
|
style='height:70px' label='Members' pointHoverBackgroundColor='primary'/>
|
||||||
</template>
|
</template>
|
||||||
</widget06>
|
</widget06>
|
||||||
</b-col>
|
</b-col>
|
||||||
@@ -212,9 +216,10 @@
|
|||||||
</b-dropdown>
|
</b-dropdown>
|
||||||
</template>
|
</template>
|
||||||
<template slot='chart'>
|
<template slot='chart'>
|
||||||
<line-chart2 chartId="widget06_2" slot='chart' class='px-3' :data='[1, 18, 9, 17, 34, 22, 11]'
|
<line-chart2 chartId='widget06_2' slot='chart' class='px-3' :data='[1, 18, 9, 17, 34, 22, 11]'
|
||||||
:labels="['January', 'February', 'March', 'April', 'May', 'June', 'July']"
|
:labels="['January', 'February', 'March', 'April', 'May', 'June', 'July']"
|
||||||
style='height:70px' label='Members'/>
|
style='height:70px' label='Members' :options='{elements: {line: {tension: 0.00001}}}'
|
||||||
|
pointHoverBackgroundColor='info'/>
|
||||||
</template>
|
</template>
|
||||||
</widget06>
|
</widget06>
|
||||||
</b-col>
|
</b-col>
|
||||||
@@ -234,7 +239,8 @@
|
|||||||
<template slot='chart'>
|
<template slot='chart'>
|
||||||
<line-chart1 chartId="widget06_3" slot='chart' :data='[78, 81, 80, 45, 34, 12, 40]'
|
<line-chart1 chartId="widget06_3" slot='chart' :data='[78, 81, 80, 45, 34, 12, 40]'
|
||||||
:labels="['January', 'February', 'March', 'April', 'May', 'June', 'July']"
|
:labels="['January', 'February', 'March', 'April', 'May', 'June', 'July']"
|
||||||
style='height:70px' backgroundColor ='rgba(255,255,255,.2)' label='Members'/>
|
style='height:70px' backgroundColor ='rgba(255,255,255,.2)' label='Members'
|
||||||
|
:options="{elements: {line: {borderWidth: 2.5}}}" pointHoverBackgroundColor='warning'/>
|
||||||
</template>
|
</template>
|
||||||
</widget06>
|
</widget06>
|
||||||
</b-col>
|
</b-col>
|
||||||
@@ -262,58 +268,63 @@
|
|||||||
<b-col sm="6" lg="3">
|
<b-col sm="6" lg="3">
|
||||||
<widget07 rightHeader='SALE' rightFooter='Today 6:43 AM' leftHeader='$1.890,65' leftFooter='+432,50 (15,78%)'>
|
<widget07 rightHeader='SALE' rightFooter='Today 6:43 AM' leftHeader='$1.890,65' leftFooter='+432,50 (15,78%)'>
|
||||||
<line-chart1 style="height:40px" chartId="widget07_line1" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
<line-chart1 style="height:40px" chartId="widget07_line1" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
||||||
<bar-chart1 style="height:40px" chartId="widget07_bar1" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales' backgroundColor='rgba(0,0,0,.2)'/>
|
<bar-chart1 style="height:40px" chartId="widget07_bar1" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
||||||
</widget07>
|
</widget07>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col sm="6" lg="3">
|
<b-col sm="6" lg="3">
|
||||||
<widget07 cardClasses='bg-success' rightHeader='SALE' rightFooter='Today 6:43 AM' leftHeader='$1.890,65' leftFooter='+432,50 (15,78%)'>
|
<widget07 cardClasses='bg-success' rightHeader='SALE' rightFooter='Today 6:43 AM' leftHeader='$1.890,65' leftFooter='+432,50 (15,78%)'>
|
||||||
<line-chart1 style="height:40px" chartId="widget07_line2" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
<line-chart1 style="height:40px" chartId="widget07_line2" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
||||||
<bar-chart1 style="height:40px" chartId="widget07_bar2" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales' backgroundColor='rgba(0,0,0,.2)'/>
|
<bar-chart1 style="height:40px" chartId="widget07_bar2" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
||||||
</widget07>
|
</widget07>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col sm="6" lg="3">
|
<b-col sm="6" lg="3">
|
||||||
<widget07 cardClasses='bg-danger' rightHeader='SALE' rightFooter='Today 6:43 AM' leftHeader='$1.890,65' leftFooter='+432,50 (15,78%)'>
|
<widget07 cardClasses='bg-danger' rightHeader='SALE' rightFooter='Today 6:43 AM' leftHeader='$1.890,65' leftFooter='+432,50 (15,78%)'>
|
||||||
<line-chart1 style="height:40px" chartId="widget07_line3" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
<line-chart1 style="height:40px" chartId="widget07_line3" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
||||||
<bar-chart1 style="height:40px" chartId="widget07_bar3" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales' backgroundColor='rgba(0,0,0,.2)'/>
|
<bar-chart1 style="height:40px" chartId="widget07_bar3" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
||||||
</widget07>
|
</widget07>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col sm="6" lg="3">
|
<b-col sm="6" lg="3">
|
||||||
<widget07 cardClasses='bg-warning' rightHeader='SALE' rightFooter='Today 6:43 AM' leftHeader='$1.890,65' leftFooter='+432,50 (15,78%)'>
|
<widget07 cardClasses='bg-warning' rightHeader='SALE' rightFooter='Today 6:43 AM' leftHeader='$1.890,65' leftFooter='+432,50 (15,78%)'>
|
||||||
<line-chart1 style="height:40px" chartId="widget07_line4" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
<line-chart1 style="height:40px" chartId="widget07_line4" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
||||||
<bar-chart1 style="height:40px" chartId="widget07_bar4" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales' backgroundColor='rgba(0,0,0,.2)'
|
<bar-chart1 style="height:40px" chartId="widget07_bar4" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales'/>
|
||||||
pointHoverBackgroundColor='#FFC107'/>
|
|
||||||
</widget07>
|
</widget07>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col sm="4" lg="2">
|
<b-col sm="4" lg="2">
|
||||||
<widget08 header='title' text='1,123'>
|
<widget08 header='title' text='1,123'>
|
||||||
<line-chart1 style="height:40px" chartId="widget08_1" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales' borderColor='rgb(248, 108, 107, 1)'/>
|
<line-chart1 style="height:40px" chartId="widget08_1" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]'
|
||||||
|
label='Sales' borderColor='danger'/>
|
||||||
</widget08>
|
</widget08>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col sm="4" lg="2">
|
<b-col sm="4" lg="2">
|
||||||
<widget08 header='title' text='1,123'>
|
<widget08 header='title' text='1,123'>
|
||||||
<line-chart1 style="height:40px" chartId="widget08_2" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales' borderColor='rgb(32, 168, 216, 1)'/>
|
<line-chart1 style="height:40px" chartId="widget08_2" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]'
|
||||||
|
label='Sales' borderColor='primary'/>
|
||||||
</widget08>
|
</widget08>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col sm="4" lg="2">
|
<b-col sm="4" lg="2">
|
||||||
<widget08 header='title' text='1,123'>
|
<widget08 header='title' text='1,123'>
|
||||||
<line-chart1 style="height:40px" chartId="widget08_3" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales' borderColor='rgb(77, 189, 116)'/>
|
<line-chart1 style="height:40px" chartId="widget08_3" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]'
|
||||||
|
label='Sales' borderColor='success'/>
|
||||||
</widget08>
|
</widget08>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col sm="4" lg="2">
|
<b-col sm="4" lg="2">
|
||||||
<widget08 header='title' text='1,123'>
|
<widget08 header='title' text='1,123'>
|
||||||
<bar-chart1 style="height:40px" chartId="widget08_4" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales' backgroundColor='rgb(248, 108, 107, 1)'/>
|
<bar-chart1 style="height:40px" chartId="widget08_4" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]'
|
||||||
|
label='Sales' backgroundColor='danger'/>
|
||||||
</widget08>
|
</widget08>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col sm="4" lg="2">
|
<b-col sm="4" lg="2">
|
||||||
<widget08 header='title' text='1,123'>
|
<widget08 header='title' text='1,123'>
|
||||||
<bar-chart1 style="height:40px" chartId="widget08_5" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales' backgroundColor='rgb(32, 168, 216, 1)'/>
|
<bar-chart1 style="height:40px" chartId="widget08_5" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]'
|
||||||
|
label='Sales' backgroundColor='primary'/>
|
||||||
</widget08>
|
</widget08>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col sm="4" lg="2">
|
<b-col sm="4" lg="2">
|
||||||
<widget08 header='title' text='1,123'>
|
<widget08 header='title' text='1,123'>
|
||||||
<bar-chart1 style="height:40px" chartId="widget08_6" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]' label='Sales' backgroundColor='rgb(77, 189, 116)'/>
|
<bar-chart1 style="height:40px" chartId="widget08_6" :data='[10, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12]'
|
||||||
|
label='Sales' backgroundColor='success'/>
|
||||||
</widget08>
|
</widget08>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { Bar } from 'vue-chartjs'
|
|||||||
import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips'
|
import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
// name: 'BarExample',
|
||||||
extends: Bar,
|
extends: Bar,
|
||||||
mounted () {
|
mounted () {
|
||||||
// Overwriting base render method with actual data.
|
// Overwriting base render method with actual data.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { Doughnut } from 'vue-chartjs'
|
import { Doughnut } from 'vue-chartjs'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
name: 'DoughnutExample',
|
||||||
extends: Doughnut,
|
extends: Doughnut,
|
||||||
mounted () {
|
mounted () {
|
||||||
this.renderChart({
|
this.renderChart({
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Bar } from 'vue-chartjs'
|
import { Bar } from 'vue-chartjs'
|
||||||
import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips'
|
import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips'
|
||||||
|
import { generatedLabels, generatedBackgroundColor,generatedBorderColor, generatedOptions } from '@/mixins/charts/chartMixins'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
name: 'BarChart',
|
||||||
extends: Bar,
|
extends: Bar,
|
||||||
|
mixins: [generatedLabels, generatedBackgroundColor, generatedBorderColor, generatedOptions],
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -17,33 +20,19 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'label|string'
|
default: 'label|string'
|
||||||
},
|
},
|
||||||
labels:{
|
borderColor:{
|
||||||
type: Array,
|
type: String,
|
||||||
default () {
|
default: 'rgba(255,255,255,.55)'
|
||||||
return(['January', 'February', 'March', 'April', 'May', 'June', 'July','August','September','October','November','December'])
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
backgroundColor:{
|
backgroundColor:{
|
||||||
type: String,
|
type: String,
|
||||||
default: 'rgba(255,255,255,.3)'
|
default: 'rgba(0,0,0,.2)'
|
||||||
},
|
},
|
||||||
pointHoverBackgroundColor: String,
|
labels: Array,
|
||||||
},
|
options:Object,
|
||||||
mounted () {
|
finalOptions:{
|
||||||
const dataset = [
|
type: Object,
|
||||||
{
|
default: () => ({
|
||||||
label: this.label,
|
|
||||||
backgroundColor: this.backgroundColor,
|
|
||||||
borderColor: 'transparent',
|
|
||||||
data: this.data
|
|
||||||
}
|
|
||||||
]
|
|
||||||
this.renderChart(
|
|
||||||
{
|
|
||||||
labels: this.labels,
|
|
||||||
datasets: dataset
|
|
||||||
},
|
|
||||||
{
|
|
||||||
tooltips: {
|
tooltips: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
custom: CustomTooltips
|
custom: CustomTooltips
|
||||||
@@ -62,7 +51,24 @@ export default {
|
|||||||
display: false
|
display: false
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
const dataset = [
|
||||||
|
{
|
||||||
|
label: this.label,
|
||||||
|
backgroundColor: this.generatedBackgroundColor,
|
||||||
|
borderColor: this.generatedBorderColor,
|
||||||
|
data: this.data
|
||||||
|
}
|
||||||
|
]
|
||||||
|
this.renderChart(
|
||||||
|
{
|
||||||
|
labels: this.generatedLabels,
|
||||||
|
datasets: dataset
|
||||||
|
},
|
||||||
|
this.generatedOptions
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Line } from 'vue-chartjs'
|
import { Line } from 'vue-chartjs'
|
||||||
import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips'
|
import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips'
|
||||||
import { getStyle } from '@coreui/coreui/dist/js/coreui-utilities'
|
import { generatedLabels, generatedBackgroundColor, generatedBorderColor, generatedPointHoverBackgroundColor, generatedOptions } from '@/mixins/charts/chartMixins'
|
||||||
const defaultBorderColor = 'rgba(255,255,255,.55)'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
name: 'LineChart1',
|
||||||
extends: Line,
|
extends: Line,
|
||||||
|
mixins: [generatedLabels, generatedBackgroundColor, generatedBorderColor, generatedPointHoverBackgroundColor, generatedOptions],
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -19,53 +20,28 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'label|string'
|
default: 'label|string'
|
||||||
},
|
},
|
||||||
labels:{
|
|
||||||
type: Array,
|
|
||||||
default () {
|
|
||||||
return(['January', 'February', 'March', 'April', 'May', 'June', 'July','August','September','October','November','December'])
|
|
||||||
}
|
|
||||||
},
|
|
||||||
borderColor:{
|
borderColor:{
|
||||||
type: String,
|
type: String,
|
||||||
default: defaultBorderColor
|
default: 'rgba(255,255,255,.55)'
|
||||||
},
|
},
|
||||||
|
labels: Array,
|
||||||
backgroundColor:{
|
backgroundColor:{
|
||||||
type: String,
|
type: String,
|
||||||
default: 'transparent'
|
default: 'transparent'
|
||||||
},
|
},
|
||||||
pointHoverBackgroundColor: String,
|
pointHoverBackgroundColor:{
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
},
|
},
|
||||||
computed:{
|
options:Object,
|
||||||
hoverBackgroundColor () {
|
finalOptions:{
|
||||||
if(this.pointHoverBackgroundColor !== undefined)
|
type: Object,
|
||||||
return this.pointHoverBackgroundColor
|
default: () => ({
|
||||||
if(this.borderColor !== defaultBorderColor)
|
|
||||||
return this.borderColor
|
|
||||||
return 'transparent'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
const datasets1 = [
|
|
||||||
{
|
|
||||||
label: this.label,
|
|
||||||
borderColor: this.borderColor,
|
|
||||||
backgroundColor: this.backgroundColor,
|
|
||||||
pointHoverBackgroundColor: this.hoverBackgroundColor,
|
|
||||||
data: this.data
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
this.renderChart(
|
|
||||||
{
|
|
||||||
labels: this.labels,
|
|
||||||
datasets: datasets1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
tooltips: {
|
tooltips: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
custom: CustomTooltips
|
custom: CustomTooltips
|
||||||
},
|
},
|
||||||
// responsive: true,
|
responsive: true,
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
legend: {
|
legend: {
|
||||||
display: false
|
display: false
|
||||||
@@ -88,8 +64,26 @@ export default {
|
|||||||
hoverRadius: 4
|
hoverRadius: 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
const datasets = [
|
||||||
|
{
|
||||||
|
label: this.label,
|
||||||
|
borderColor: this.generatedBorderColor,
|
||||||
|
backgroundColor: this.generatedBackgroundColor,
|
||||||
|
pointHoverBackgroundColor: this.generatedPointHoverBackgroundColor,
|
||||||
|
data: this.data
|
||||||
|
}
|
||||||
|
]
|
||||||
|
this.renderChart(
|
||||||
|
{
|
||||||
|
labels: this.generatedLabels,
|
||||||
|
datasets: datasets
|
||||||
|
},
|
||||||
|
this.generatedOptions
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Line } from 'vue-chartjs'
|
import { Line } from 'vue-chartjs'
|
||||||
import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips'
|
import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips'
|
||||||
import { getStyle } from '@coreui/coreui/dist/js/coreui-utilities'
|
import { generatedLabels, generatedBackgroundColor, generatedBorderColor, generatedPointHoverBackgroundColor, generatedOptions } from '@/mixins/charts/chartMixins'
|
||||||
const defaultBorderColor = 'rgba(255,255,255,.55)'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
name: 'LineChart2',
|
||||||
extends: Line,
|
extends: Line,
|
||||||
|
mixins: [generatedLabels, generatedBackgroundColor, generatedBorderColor, generatedPointHoverBackgroundColor, generatedOptions],
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -19,48 +20,24 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'label|string'
|
default: 'label|string'
|
||||||
},
|
},
|
||||||
labels:{
|
|
||||||
type: Array,
|
|
||||||
default () {
|
|
||||||
return(['January', 'February', 'March', 'April', 'May', 'June', 'July','August','September','October','November','December'])
|
|
||||||
}
|
|
||||||
},
|
|
||||||
borderColor:{
|
borderColor:{
|
||||||
type: String,
|
type: String,
|
||||||
default: defaultBorderColor
|
default: 'rgba(255,255,255,.55)'
|
||||||
},
|
},
|
||||||
|
labels: Array,
|
||||||
backgroundColor:{
|
backgroundColor:{
|
||||||
type: String,
|
type: String,
|
||||||
default: 'transparent'
|
default: 'transparent'
|
||||||
},
|
},
|
||||||
pointHoverBackgroundColor: String,
|
pointHoverBackgroundColor:{
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
|
},
|
||||||
|
options:Object,
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
hoverBackgroundColor () {
|
finalOptions () {
|
||||||
if(this.pointHoverBackgroundColor !== undefined)
|
return{
|
||||||
return this.pointHoverBackgroundColor
|
|
||||||
if(this.borderColor !== defaultBorderColor)
|
|
||||||
return this.borderColor
|
|
||||||
return 'transparent'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
const datasets1 = [
|
|
||||||
{
|
|
||||||
label: this.label,
|
|
||||||
borderColor: this.borderColor,
|
|
||||||
backgroundColor: this.backgroundColor,
|
|
||||||
pointHoverBackgroundColor: this.hoverBackgroundColor,
|
|
||||||
data: this.data
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
this.renderChart(
|
|
||||||
{
|
|
||||||
labels: this.labels,
|
|
||||||
datasets: datasets1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
tooltips: {
|
tooltips: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
custom: CustomTooltips
|
custom: CustomTooltips
|
||||||
@@ -87,15 +64,14 @@ export default {
|
|||||||
display: false,
|
display: false,
|
||||||
ticks: {
|
ticks: {
|
||||||
display: false,
|
display: false,
|
||||||
min: Math.min.apply(Math, datasets1[0].data) - 5,
|
min: Math.min.apply(Math, this.data) - 5,
|
||||||
max: Math.max.apply(Math, datasets1[0].data) + 5
|
max: Math.max.apply(Math, this.data) + 5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
elements: {
|
elements: {
|
||||||
line: {
|
line: {
|
||||||
tension: 0.00001,
|
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
},
|
},
|
||||||
point: {
|
point: {
|
||||||
@@ -105,6 +81,24 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
const datasets1 = [
|
||||||
|
{
|
||||||
|
label: this.label,
|
||||||
|
borderColor: this.generatedBorderColor,
|
||||||
|
backgroundColor: this.generatedBackgroundColor,
|
||||||
|
pointHoverBackgroundColor: this.generatedPointHoverBackgroundColor,
|
||||||
|
data: this.data
|
||||||
|
}
|
||||||
|
]
|
||||||
|
this.renderChart(
|
||||||
|
{
|
||||||
|
labels: this.generatedLabels,
|
||||||
|
datasets: datasets1
|
||||||
|
},
|
||||||
|
this.generatedOptions
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'Widget07',
|
name: 'Widget08',
|
||||||
props: {
|
props: {
|
||||||
cardClasses: {
|
cardClasses: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { shallowMount, mount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
import BootstrapVue from 'bootstrap-vue'
|
import BootstrapVue from 'bootstrap-vue'
|
||||||
import Component from '@/views/theme/ColorTheme'
|
import Component from '@/views/theme/ColorTheme'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { shallowMount, mount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
import BootstrapVue from 'bootstrap-vue'
|
import BootstrapVue from 'bootstrap-vue'
|
||||||
import Component from '@/views/theme/ColorView'
|
import Component from '@/views/theme/ColorView'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user