victorgarciaesgi / vue-chart-3

📊 A simple wrapper around Chart.js 3 for Vue 2 & 3

Home Page:https://vue-chart-3.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chartjs-chart-matrix issue

NeroN7F opened this issue · comments

commented

Hi. Tried to use library Chartjs-chart-matrix, but didn't managed to make it work along with vue chart 3.

<Matrix :chartData="salesData" />
import {MatrixController, MatrixElement} from chartjs-chart-matrix;

Chart.register(MatrixController, MatrixElement, DoughnutController, ArcElement, Tooltip);

const Matrix = defineChartComponent("MatrixChart", "matrix");
  setup() {
    const salesData = {
      type: 'matrix',
      datasets: [
        {
          label: 'Basic matrix',
          data: [{x: 1, y: 1}, {x: 2, y: 1}, {x: 1, y: 2}, {x: 2, y: 2}],
          borderWidth: 1,
          borderColor: 'rgba(0,0,0,0.5)',
          backgroundColor: 'rgba(200,200,0,0.3)',
          width: ({chart}) => (chart.chartArea || {}).width / 2 - 1,
          height: ({chart}) => (chart.chartArea || {}).height / 2 - 1,
        },
      ],
      options: {
        scales: {
          x: {
            display: false,
            min: 0.5,
            max: 2.5,
            offset: false
          },
          y: {
            display: false,
            min: 0.5,
            max: 2.5
          }
        }
      }
    };
    return {salesData};

  }

Hi i'm going to need more info on the error you are getting, and you can make a reproduction link based on https://codesandbox.io/s/demo-vue-chart-3-ugynm

Just by your exemple it seems like you are putting options in the wrong place