refactor: chart examples
- add: getStyle() - minor fixes
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<title>CoreUI - Open Source Bootstrap Admin Template</title>
|
<title>CoreUI - Open Source Bootstrap Admin Template</title>
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="./favicon.ico">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<!-- BODY options, add following classes to body to change options
|
<!-- BODY options, add following classes to body to change options
|
||||||
|
|||||||
Vendored
+5
-5
@@ -1,7 +1,7 @@
|
|||||||
// Override Boostrap variables
|
// Override Boostrap variables
|
||||||
@import "../variables";
|
@import "../variables";
|
||||||
@import "node_modules/@coreui/coreui/scss/bootstrap-variables";
|
@import "~@coreui/coreui/scss/bootstrap-variables";
|
||||||
@import "node_modules/bootstrap/scss/mixins";
|
@import "~bootstrap/scss/mixins";
|
||||||
@import "node_modules/bootstrap/scss/functions";
|
@import "~bootstrap/scss/functions";
|
||||||
@import "node_modules/bootstrap/scss/variables";
|
@import "~bootstrap/scss/variables";
|
||||||
@import "node_modules/@coreui/coreui/scss/variables";
|
@import "~@coreui/coreui/scss/variables";
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
<div class="brand-card-header bg-facebook">
|
<div class="brand-card-header bg-facebook">
|
||||||
<i class="fa fa-facebook"></i>
|
<i class="fa fa-facebook"></i>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<social-box-chart-example :data="[65, 59, 84, 84, 51, 55, 40]" height="100"/>
|
<social-box-chart-example :data="[65, 59, 84, 84, 51, 55, 40]" height="90"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand-card-body">
|
<div class="brand-card-body">
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
<div class="brand-card-header bg-twitter">
|
<div class="brand-card-header bg-twitter">
|
||||||
<i class="fa fa-twitter"></i>
|
<i class="fa fa-twitter"></i>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<social-box-chart-example :data="[1, 13, 9, 17, 34, 41, 38]" height="100"/>
|
<social-box-chart-example :data="[1, 13, 9, 17, 34, 41, 38]" height="90"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand-card-body">
|
<div class="brand-card-body">
|
||||||
@@ -169,7 +169,7 @@
|
|||||||
<div class="brand-card-header bg-linkedin">
|
<div class="brand-card-header bg-linkedin">
|
||||||
<i class="fa fa-linkedin"></i>
|
<i class="fa fa-linkedin"></i>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<social-box-chart-example :data="[78, 81, 80, 45, 34, 12, 40]" height="100"/>
|
<social-box-chart-example :data="[78, 81, 80, 45, 34, 12, 40]" height="90"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand-card-body">
|
<div class="brand-card-body">
|
||||||
@@ -189,7 +189,7 @@
|
|||||||
<div class="brand-card-header bg-google-plus">
|
<div class="brand-card-header bg-google-plus">
|
||||||
<i class="fa fa-google-plus"></i>
|
<i class="fa fa-google-plus"></i>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<social-box-chart-example :data="[35, 23, 56, 22, 97, 23, 64]" height="100"/>
|
<social-box-chart-example :data="[35, 23, 56, 22, 97, 23, 64]" height="90"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand-card-body">
|
<div class="brand-card-body">
|
||||||
@@ -216,7 +216,8 @@
|
|||||||
<small class="text-muted">New Clients</small><br>
|
<small class="text-muted">New Clients</small><br>
|
||||||
<strong class="h4">9,123</strong>
|
<strong class="h4">9,123</strong>
|
||||||
<div class="chart-wrapper" :style="{ top: '-10px'}">
|
<div class="chart-wrapper" :style="{ top: '-10px'}">
|
||||||
<callout-chart-example :data="[35, 23, 56, 22, 97, 23, 64]" variant="#20a8d8" width="80" height="30" />
|
<!--<callout-chart-example :data="[35, 23, 56, 22, 97, 23, 64]" variant="#20a8d8" width="80" height="30" />-->
|
||||||
|
<callout-chart-example :data="[35, 23, 56, 22, 97, 23, 64]" variant="info" width="80" height="30" />
|
||||||
</div>
|
</div>
|
||||||
</Callout>
|
</Callout>
|
||||||
</b-col>
|
</b-col>
|
||||||
@@ -225,7 +226,7 @@
|
|||||||
<small class="text-muted">Recurring Clients</small><br>
|
<small class="text-muted">Recurring Clients</small><br>
|
||||||
<strong class="h4">22,643</strong>
|
<strong class="h4">22,643</strong>
|
||||||
<div class="chart-wrapper" :style="{ top: '-10px'}">
|
<div class="chart-wrapper" :style="{ top: '-10px'}">
|
||||||
<callout-chart-example :data="[65, 59, 84, 84, 51, 55, 40]" variant="#f86c6b" width="80" height="30" />
|
<callout-chart-example :data="[65, 59, 84, 84, 51, 55, 40]" variant="danger" width="80" height="30" />
|
||||||
</div>
|
</div>
|
||||||
</Callout>
|
</Callout>
|
||||||
</b-col>
|
</b-col>
|
||||||
|
|||||||
@@ -234,7 +234,7 @@
|
|||||||
<div class="brand-card-header bg-facebook">
|
<div class="brand-card-header bg-facebook">
|
||||||
<i class="fa fa-facebook"></i>
|
<i class="fa fa-facebook"></i>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<social-box-chart-example :data="[65, 59, 84, 84, 51, 55, 40]" height="100"/>
|
<social-box-chart-example :data="[65, 59, 84, 84, 51, 55, 40]" height="90"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand-card-body">
|
<div class="brand-card-body">
|
||||||
@@ -254,7 +254,7 @@
|
|||||||
<div class="brand-card-header bg-twitter">
|
<div class="brand-card-header bg-twitter">
|
||||||
<i class="fa fa-twitter"></i>
|
<i class="fa fa-twitter"></i>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<social-box-chart-example :data="[1, 13, 9, 17, 34, 41, 38]" height="100"/>
|
<social-box-chart-example :data="[1, 13, 9, 17, 34, 41, 38]" height="90"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand-card-body">
|
<div class="brand-card-body">
|
||||||
@@ -274,7 +274,7 @@
|
|||||||
<div class="brand-card-header bg-linkedin">
|
<div class="brand-card-header bg-linkedin">
|
||||||
<i class="fa fa-linkedin"></i>
|
<i class="fa fa-linkedin"></i>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<social-box-chart-example :data="[78, 81, 80, 45, 34, 12, 40]" height="100"/>
|
<social-box-chart-example :data="[78, 81, 80, 45, 34, 12, 40]" height="90"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand-card-body">
|
<div class="brand-card-body">
|
||||||
@@ -294,7 +294,7 @@
|
|||||||
<div class="brand-card-header bg-google-plus">
|
<div class="brand-card-header bg-google-plus">
|
||||||
<i class="fa fa-google-plus"></i>
|
<i class="fa fa-google-plus"></i>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<social-box-chart-example :data="[35, 23, 56, 22, 97, 23, 64]" height="100"/>
|
<social-box-chart-example :data="[35, 23, 56, 22, 97, 23, 64]" height="90"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand-card-body">
|
<div class="brand-card-body">
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Line } from 'vue-chartjs'
|
import { Line } from 'vue-chartjs'
|
||||||
|
import { getStyle } from '@coreui/coreui/js/src/utilities'
|
||||||
|
|
||||||
// const brandPrimary = '#20a8d8'
|
// const brandPrimary = '#20a8d8'
|
||||||
// const brandSuccess = '#4dbd74'
|
// const brandSuccess = '#4dbd74'
|
||||||
@@ -8,6 +9,9 @@ import { Line } from 'vue-chartjs'
|
|||||||
// const brandDanger = '#f86c6b'
|
// const brandDanger = '#f86c6b'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
getStyle
|
||||||
|
},
|
||||||
extends: Line,
|
extends: Line,
|
||||||
props: ['data', 'height', 'width', 'variant'],
|
props: ['data', 'height', 'width', 'variant'],
|
||||||
mounted () {
|
mounted () {
|
||||||
@@ -16,7 +20,7 @@ export default {
|
|||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
borderColor: this.variant ? this.variant : '#c2cfd6',
|
borderColor: this.getVariant(this.variant) || '#c2cfd6',
|
||||||
data: this.data
|
data: this.data
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -46,6 +50,11 @@ export default {
|
|||||||
display: false
|
display: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getVariant (val, el) {
|
||||||
|
return val[0] === '#' ? val : getStyle(`--${val}`, el)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Line } from 'vue-chartjs'
|
import { Line } from 'vue-chartjs'
|
||||||
|
// import { getStyle } from '@coreui/coreui/js/src/utilities'
|
||||||
|
|
||||||
const brandPrimary = '#20a8d8'
|
const brandPrimary = '#20a8d8'
|
||||||
const datasets = [
|
// const brandPrimary = getStyle('--primary')
|
||||||
|
|
||||||
|
const datasets1 = [
|
||||||
{
|
{
|
||||||
label: 'My First dataset',
|
label: 'My First dataset',
|
||||||
backgroundColor: brandPrimary,
|
backgroundColor: brandPrimary,
|
||||||
@@ -13,11 +16,11 @@ const datasets = [
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
extends: Line,
|
extends: Line,
|
||||||
props: ['height'],
|
props: ['height', 'width'],
|
||||||
mounted () {
|
mounted () {
|
||||||
this.renderChart({
|
this.renderChart({
|
||||||
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||||
datasets: datasets
|
datasets: datasets1
|
||||||
}, {
|
}, {
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
legend: {
|
legend: {
|
||||||
@@ -38,8 +41,8 @@ export default {
|
|||||||
display: false,
|
display: false,
|
||||||
ticks: {
|
ticks: {
|
||||||
display: false,
|
display: false,
|
||||||
min: Math.min.apply(Math, datasets[0].data) - 5,
|
min: Math.min.apply(Math, datasets1[0].data) - 5,
|
||||||
max: Math.max.apply(Math, datasets[0].data) + 5
|
max: Math.max.apply(Math, datasets1[0].data) + 5
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Line } from 'vue-chartjs'
|
import { Line } from 'vue-chartjs'
|
||||||
|
// import { getStyle } from '@coreui/coreui/js/src/utilities'
|
||||||
|
|
||||||
const brandInfo = '#63c2de'
|
const brandInfo = '#63c2de'
|
||||||
const datasets = [
|
// const brandInfo = getStyle('--light-blue')
|
||||||
|
|
||||||
|
const datasets2 = [
|
||||||
{
|
{
|
||||||
label: 'My First dataset',
|
label: 'My First dataset',
|
||||||
backgroundColor: brandInfo,
|
backgroundColor: brandInfo,
|
||||||
@@ -13,11 +16,11 @@ const datasets = [
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
extends: Line,
|
extends: Line,
|
||||||
props: ['height'],
|
props: ['height', 'width'],
|
||||||
mounted () {
|
mounted () {
|
||||||
this.renderChart({
|
this.renderChart({
|
||||||
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||||
datasets: datasets
|
datasets: datasets2
|
||||||
}, {
|
}, {
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
legend: {
|
legend: {
|
||||||
@@ -39,8 +42,8 @@ export default {
|
|||||||
display: false,
|
display: false,
|
||||||
ticks: {
|
ticks: {
|
||||||
display: false,
|
display: false,
|
||||||
min: Math.min.apply(Math, datasets[0].data) - 5,
|
min: Math.min.apply(Math, datasets2[0].data) - 5,
|
||||||
max: Math.max.apply(Math, datasets[0].data) + 5
|
max: Math.max.apply(Math, datasets2[0].data) + 5
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const datasets = [
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
extends: Line,
|
extends: Line,
|
||||||
props: ['height'],
|
props: ['height', 'width'],
|
||||||
mounted () {
|
mounted () {
|
||||||
this.renderChart({
|
this.renderChart({
|
||||||
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Line } from 'vue-chartjs'
|
import { Line } from 'vue-chartjs'
|
||||||
|
import { getStyle } from '@coreui/coreui/js/src/utilities'
|
||||||
|
|
||||||
// const brandPrimary = '#20a8d8'
|
// const brandPrimary = '#20a8d8'
|
||||||
const brandSuccess = '#4dbd74'
|
// const brandSuccess = '#4dbd74'
|
||||||
const brandInfo = '#63c2de'
|
// const brandInfo = '#63c2de'
|
||||||
const brandDanger = '#f86c6b'
|
// const brandDanger = '#f86c6b'
|
||||||
|
|
||||||
function convertHex (hex, opacity) {
|
function convertHex (hex, opacity) {
|
||||||
hex = hex.replace('#', '')
|
hex = hex.replace('#', '')
|
||||||
@@ -12,8 +13,8 @@ function convertHex (hex, opacity) {
|
|||||||
const g = parseInt(hex.substring(2, 4), 16)
|
const g = parseInt(hex.substring(2, 4), 16)
|
||||||
const b = parseInt(hex.substring(4, 6), 16)
|
const b = parseInt(hex.substring(4, 6), 16)
|
||||||
|
|
||||||
const result = 'rgba(' + r + ',' + g + ',' + b + ',' + opacity / 100 + ')'
|
// const result = 'rgba(' + r + ',' + g + ',' + b + ',' + opacity / 100 + ')'
|
||||||
return result
|
return `rgba(${r}, ${g}, ${b}, ${opacity / 100})`
|
||||||
}
|
}
|
||||||
|
|
||||||
function random (min, max) {
|
function random (min, max) {
|
||||||
@@ -24,12 +25,12 @@ export default {
|
|||||||
extends: Line,
|
extends: Line,
|
||||||
props: ['height'],
|
props: ['height'],
|
||||||
mounted () {
|
mounted () {
|
||||||
var elements = 27
|
let elements = 27
|
||||||
var data1 = []
|
const data1 = []
|
||||||
var data2 = []
|
const data2 = []
|
||||||
var data3 = []
|
const data3 = []
|
||||||
|
|
||||||
for (var i = 0; i <= elements; i++) {
|
for (let i = 0; i <= elements; i++) {
|
||||||
data1.push(random(50, 200))
|
data1.push(random(50, 200))
|
||||||
data2.push(random(80, 100))
|
data2.push(random(80, 100))
|
||||||
data3.push(65)
|
data3.push(65)
|
||||||
@@ -39,8 +40,8 @@ export default {
|
|||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: 'My First dataset',
|
label: 'My First dataset',
|
||||||
backgroundColor: convertHex(brandInfo, 10),
|
backgroundColor: convertHex(getStyle('--info'), 10),
|
||||||
borderColor: brandInfo,
|
borderColor: getStyle('--info'),
|
||||||
pointHoverBackgroundColor: '#fff',
|
pointHoverBackgroundColor: '#fff',
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
data: data1
|
data: data1
|
||||||
@@ -48,7 +49,7 @@ export default {
|
|||||||
{
|
{
|
||||||
label: 'My Second dataset',
|
label: 'My Second dataset',
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
borderColor: brandSuccess,
|
borderColor: getStyle('--success'),
|
||||||
pointHoverBackgroundColor: '#fff',
|
pointHoverBackgroundColor: '#fff',
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
data: data2
|
data: data2
|
||||||
@@ -56,7 +57,7 @@ export default {
|
|||||||
{
|
{
|
||||||
label: 'My Third dataset',
|
label: 'My Third dataset',
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
borderColor: brandDanger,
|
borderColor: getStyle('--danger'),
|
||||||
pointHoverBackgroundColor: '#fff',
|
pointHoverBackgroundColor: '#fff',
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderDash: [8, 5],
|
borderDash: [8, 5],
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user