How to use vue-chartjs - 10 common examples

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 ArkEcosystem / desktop-wallet / src / renderer / components / utils / LineChart.js View on Github external
import Chart from 'chart.js'
import { Line, mixins } from 'vue-chartjs'
import tailwindConfig from '@tailwind'

Chart.defaults.global.defaultFontFamily = tailwindConfig.fonts.sans.join(',')
// TODO: Add theme colors

export default {
  extends: Line,

  mixins: [mixins.reactiveProp],

  props: {
    chartData: {
      type: Object,
      required: true
    },
    options: {
      type: Object,
      required: true
    }
  },

  mounted () {
    this.$once('chart:render', () => {
      this.$emit('ready')
    })
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 epicmaxco / vuestic-admin / src / vuestic-theme / vuestic-components / va-chart / chart-types / chartMixin.js View on Github external
import { mixins } from 'vue-chartjs'
import { defaultConfig } from '../VaChartConfigs'

export const chartMixin = {
  mixins: [mixins.reactiveProp],
  props: ['data', 'chartOptions'],
  mounted () {
    this.refresh()
  },
  methods: {
    refresh () {
      this.renderChart(this.chartData, this.options)
    },
  },
  computed: {
    // `this.options` is used by vue-chartjs mixin on refresh.
    options () {
      return Object.assign({}, defaultConfig, this.chartOptions)
    },
  },
}
github harryho / vue2crm / src / components / chart / Bar.js View on Github external
// import 'chart.js'
import {Bar} from 'vue-chartjs'

export default Bar.extend({
  mounted () {
    this.renderChart({
      labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
      datasets: [
        {
          label: 'Data One',
          backgroundColor: '#f87979',
          data: [40, 20, 12, 39, 10, 40, 39, 80, 40, 20, 12, 11]
        }
      ]
    }, {responsive: true, maintainAspectRatio: false})
  }
})
github mubaidr / SPA-asp.net-api-vuejs- / MBO / src / components / _charts / tasks.js View on Github external
import {
  Bar
} from 'vue-chartjs'

export default Bar.extend({
  mounted () {
    // Overwriting base render method with actual data.
    this.renderChart({
      labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
      datasets: [{
        label: 'GitHub Commits',
        backgroundColor: '#e91e63',
        data: [40, 20, 12, 39, 10, 40, 39, 80, 40, 20, 12, 11]
      }]
    })
  }
})
github coreui / coreui-vue / dist / coreui-vue.common.js View on Github external
if (functional) component.functional = true;
  }

  component._scopeId = scope;

  return component;
}
/* style inject */

/* style inject SSR */

var CuiWidget08 = __vue_normalize__$s({ render: __vue_render__$s, staticRenderFns: __vue_staticRenderFns__$s }, __vue_inject_styles__$s, __vue_script__$s, __vue_scope_id__$s, __vue_is_functional_template__$s, __vue_module_identifier__$s, undefined, undefined);

var script$t = {
  name: 'CuiSimpleBarChart',
  extends: vueChartjs.Bar,
  mixins: [chartMixins.generatedLabels, chartMixins.generatedBackgroundColor, chartMixins.generatedBorderColor, chartMixins.generatedOptions],
  props: {
    data: {
      type: Array,
      default: function _default() {
        return [0, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12];
      }
    },
    height: {
      type: Number,
      default: 40
    },
    label: {
      type: String,
      default: 'label|string'
    },
github harryho / vue2crm / src / components / chart / Doughnut.js View on Github external
// import 'chart.js'
import {Doughnut} from 'vue-chartjs'

export default Doughnut.extend({
  mounted () {
    this.renderChart({
      labels: ['VueJs', 'EmberJs', 'ReactJs', 'AngularJs'],
      datasets: [
        {
          backgroundColor: [
            '#41B883',
            '#E46651',
            '#00D8FF',
            '#DD1B16'
          ],
          data: [40, 20, 80, 10]
        }
      ]
    }, {responsive: true, maintainAspectRatio: false})
  }
github coreui / coreui-vue / dist / coreui-vue.common.js View on Github external
if (functional) component.functional = true;
  }

  component._scopeId = scope;

  return component;
}
/* style inject */

/* style inject SSR */

var CuiSimpleBarChart = __vue_normalize__$t({}, __vue_inject_styles__$t, __vue_script__$t, __vue_scope_id__$t, __vue_is_functional_template__$t, __vue_module_identifier__$t, undefined, undefined);

var script$u = {
  name: 'CuiSimpleLineChart',
  extends: vueChartjs.Line,
  mixins: [chartMixins.generatedLabels, chartMixins.generatedBackgroundColor, chartMixins.generatedBorderColor, chartMixins.generatedPointHoverBackgroundColor, chartMixins.generatedOptions],
  props: {
    data: {
      type: Array,
      default: function _default() {
        return [0, 22, 34, 46, 58, 70, 46, 23, 45, 78, 34, 12];
      }
    },
    height: {
      type: Number,
      default: 40
    },
    label: {
      type: String,
      default: 'label|string'
    },