How to use the vue-chartjs.Line.extend function in vue-chartjs

To help you get started, we’ve selected a few vue-chartjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fnproject / ui / client / components / LineChart.js View on Github external
import { Line, mixins } from 'vue-chartjs';
const { reactiveProp } = mixins;

export default Line.extend({
  mixins: [reactiveProp],
  props: ['options'],
  mounted () {
    // this.chartData is created in the mixin.
    // If you want to pass options please create a local options object
    this.renderChart(this.chartData, this.options);
  }
});
github JerryC8080 / Memeye / client / src / components / charts / OSCPUSUsedLine.js View on Github external
borderColor: colorPool[index],
            backgroundColor: colorPool[index],
            data: dynamicData.cpus[index],
        });
    });

    return data;
}

function computedUsed(value) {
    var total = value.user + value.nice + value.sys + value.idle + value.irq;
    var cpu = ((total - value.idle) / total) * 100;
    return cpu;
}

let line = Line.extend({
    mixins: [reactiveProp],
    props: ['options'],
    mounted() {
        this.renderChart(this.chartData, {
            title: {
                display: true,
                text: 'CPUs Used',
            },
            tooltips: {
                callbacks: {
                    label: (item, data) => {
                        let label = data.datasets[item.datasetIndex].label;
                        return label + ': ' + Math.floor(item.yLabel * 100) / 100 + ' %';
                    }
                }
            },
github JerryC8080 / Memeye / client / src / components / charts / OSMemoryLine.js View on Github external
borderColor: "rgba(54, 162, 235, 1)",
                backgroundColor: 'rgba(54, 162, 235, 0.4)',
                data: dynamicData.freeMemData,
            },
            {
                label: 'usedMem',
                pointStyle: 'line',
                borderColor: "rgba(255, 99, 132, 1)",
                backgroundColor: 'rgba(255, 99, 132, 0.4)',
                data: dynamicData.usedMemData,
            }
        ]
    };
}

let line = Line.extend({
    mixins: [reactiveProp],
    props: ['options'],
    mounted() {
        this.renderChart(this.chartData, {
            title: {
                display: true,
                text: 'OS Memory Stat',
            },
            tooltips: {
                callbacks: {
                    label: (item) => (Math.floor(item.yLabel * 100) / 100 + ' MB')
                }
            },
            animation: false
        })
    }
github coreui / coreui-free-bootstrap-admin-template / Vue_Full_Project / src / views / dashboard / MainChartExample.vue View on Github external
function convertHex (hex, opacity) {
  hex = hex.replace('#', '')
  const r = parseInt(hex.substring(0, 2), 16)
  const g = parseInt(hex.substring(2, 4), 16)
  const b = parseInt(hex.substring(4, 6), 16)

  const result = 'rgba(' + r + ',' + g + ',' + b + ',' + opacity / 100 + ')'
  return result
}

function random (min, max) {
  return Math.floor(Math.random() * (max - min + 1) + min)
}

export default Line.extend({
  props: ['height'],
  mounted () {
    var elements = 27
    var data1 = []
    var data2 = []
    var data3 = []

    for (var i = 0; i <= elements; i++) {
      data1.push(random(50, 200))
      data2.push(random(80, 100))
      data3.push(65)
    }
    this.renderChart({
      labels: ['M', 'T', 'W', 'T', 'F', 'S', 'S', 'M', 'T', 'W', 'T', 'F', 'S', 'S', 'M', 'T', 'W', 'T', 'F', 'S', 'S', 'M', 'T', 'W', 'T', 'F', 'S', 'S'],
      datasets: [
        {