# Magic quadrant

const config = {
  type: 'scatter',
  data,
  options: {
    layout: {
      padding: {
        top: 12
      }
    },
    elements: {
      boxAnnotation: {
        borderWidth: 0,
        label: {
          drawTime: 'beforeDatasetsDraw',
          display: true,
          font: {
            size: 20
          }
        }
      }
    },
    scales: {
      x: {
        beginAtZero: true,
        max: 10,
        min: 0,
        grid: {
          drawTicks: false,
          color: gridColor
        },
        ticks: {
          display: false
        },
        title: {
          display: true,
          text: 'Completeness of vision',
          padding: 10,
          font: {
            size: 20,
            weight: 'bold'
          }
        }
      },
      y: {
        display: true,
        beginAtZero: true,
        max: 10,
        min: 0,
        grid: {
          drawTicks: false,
          color: gridColor
        },
        ticks: {
          display: false
        },
        title: {
          display: true,
          text: 'Ability to execute',
          padding: 10,
          font: {
            size: 20,
            weight: 'bold'
          }
        }
      }
    },
    plugins: {
      annotation: {
        common: {
          drawTime: 'beforeDraw'
        },
        annotations: {
          annotation1,
          annotation2,
          annotation3,
          annotation4
        }
      },
      tooltip: {
        mode: 'nearest',
        intersect: true,
        usePointStyle: true,
        footerAlign: 'right',
        footerColor: 'lightGray',
        footerMarginTop: 10,
        callbacks: {
          title: (items) => items[0].raw.co,
          labelColor({raw}) {
            const x = raw.x > 5 ? 1 : 0;
            const y = raw.y > 5 ? 1 : 0;
            return {
              borderColor: META[y][x].color,
              backgroundColor: META[y][x].backgroundColor,
              borderWidth: 3
            };
          },
          label({raw}) {
            const x = raw.x > 5 ? 1 : 0;
            const y = raw.y > 5 ? 1 : 0;
            return META[y][x].label;
          },
          footer(items) {
            const {raw} = items[0];
            return ['Completeness of vision: ' + raw.x.toFixed(2), 'Ability to execute: ' + raw.y.toFixed(2)];
          }
        }
      }
    }
  }
};
Last Updated: 5/15/2023, 12:03:46 PM