Canvas JS Pie Chart Labels Issue

by alexbfree

HTML

<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<button id="button" type="button">Full Screen</button>
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet">
<div id='main' style="text-align:center !important;">
  <h2 id="question-title" class="font-Mont"><span id="title">Risk Question</span><span id="hider-question-id">[<span id="question-id">R2</span>]</span>
  </h2>
  <div class="lottery-grid">
    <div id="left-lottery" class="lottery-column">
      <div class="chart-centraliser">
        <h3 id="left-lottery-title" class="font-Mont">Left Lottery</h3>
      </div>
      <div class="chart-centraliser">
        <div id="chart-container-left" class="chart-container-risk chart-container-risk-pie">
          <div class="canvasjs-chart-container" style="position: relative; text-align: left; cursor: auto;"><canvas class="canvasjs-chart-canvas" width="1160" height="940" style="width: 580px; height: 470px; position: absolute; user-select: none;"></canvas><canvas class="canvasjs-chart-canvas" width="1160" height="940" style="width: 580px; height: 470px; position: absolute; -webkit-tap-highlight-color: transparent; user-select: none; cursor: default;"></canvas>
            <div class="canvasjs-chart-toolbar" style="position: absolute; right: 1px; top: 1px; border: 1px solid transparent;"></div>
            <div class="canvasjs-chart-tooltip" style="position: absolute; height: auto; box-shadow: rgba(0, 0, 0, 0.1) 1px 1px 2px 2px; z-index: 1000; pointer-events: none; display: none; border-radius: 0px; left: 29px; bottom: -57px; transition: left 0.1s ease-out 0s, bottom 0.1s ease-out 0s;">
              <div style="width: auto; height: auto; min-width: 50px; margin: 0px; padding: 5px; font-family: &quot;Trebuchet MS&quot;, Helvetica, sans-serif; font-weight: normal; font-style: normal; font-size: 14px; color: black; text-shadow: rgba(0, 0, 0, 0.1) 1px 1px 1px; text-align: left; border: 1px solid rgb(255, 0,...

CSS

#elem {
  background: green;
}
#elem:-webkit-full-screen {
  width: 100%;
  height: 100%;
}
#elem2 {
  background: red;
}

@font-face {
    font-family: Montserrat;
    src: url('../fonts/Montserrat-Regular.ttf');
}

button {
    cursor: pointer;
}

.font-Mont {
    font-family: "Montserrat", sans-serif;
}

.font-Cour {
    font-family: "Courier New", sans-serif;
    white-space: pre;
}

.uncentred {
    text-align: left;
}

.font-Gara {
    font-family: "Garamond", serif;
}

.font-Time {
    font-family: "Times New Roman", serif;
}

:disabled {
    cursor: not-allowed;
}

p.top-text-lines {
    margin-top: 20px !important;
    margin-bottom: 20px !important;
    display: inline-block;
    line-height: 18px;
    min-height: 5em;
    max-height: 5em;
}

ul {
    box-sizing: border-box;
}

div.lottery-grid {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

h3.lottery-title {
    margin: 0px;
}

body {
    padding: 20px;
    font-size: 16px;
}

ul {
    overflow: scroll;
    margin: 0;
    padding: 0;
    border: 2px solid #ccc;
    font-size: 16px;
    -webkit-overflow-scrolling: touch;
}

ul.event-log {
    max-height: 150px;
}

li {
    padding: 5px 10px;
    border-bottom: 1px solid #ccc;
}

li:last-child {
    border-bottom: none;
}

li:nth-child(even) {
    background: #f8f8f8;
}

li.warning-ok {
    color: green;
}

li.warning-error {
    color: red;
}

/*
div.bins-list {
    display: grid;
    grid-column-gap: 5px;
    grid-row-gap: 15px;
    align-content: center;
    justify-content: center;
}
*/

div.bin-allocation-textbox-cell input {
    text-align: center;
    width: 50px;
}

div.bins-allocation-row {
    margin: 0 auto;
}

div#chart-container-pareto {
    margin: 0 auto;
    display: block;
}

div.bins-allocation-row {
    display: flex;
    flex-direction: row;
    align-content: center;
    justify-content: space-evenly;
    margin-bottom: 20px;
    width: 1200px;
}

div.bins-allocation-row-2-bins {
   ...

JavaScript

const elem = document.getElementById("main");
const button = document.getElementById("button");

button.addEventListener('click', () => {
  if (elem.webkitRequestFullScreen) {
    elem.webkitRequestFullScreen();
  }
});

let options = {
  "animationEnabled": true,
  "theme": "light2",
  "legend": {
    "fontFamily": "Montserrat"
  },
  "data": [{
    "type": "pie",
    "dataPoints": [{
        "y": 50,
        "indexLabel": " 24 kr. (50%) ",
        "toolTipContent": "Chance of winning 24 kr. is 50%.",
        "color": "#0000FF",
        "indexLabelFontColor": "#000000",
        "indexLabelFontSize": 12,
        "indexLabelFontFamily": "Montserrat"
      },
      {
        "y": 40,
        "indexLabel": " 42 kr. (40%) ",
        "toolTipContent": "Chance of winning 42 kr. is 40%.",
        "color": "#FF0000",
        "indexLabelFontColor": "#000000",
        "indexLabelFontSize": 12,
        "indexLabelFontFamily": "Montserrat"
      },
      {
        "y": 10,
        "indexLabel": " 12 kr. (10%) ",
        "toolTipContent": "Chance of winning 12 kr. is 10%.",
        "color": "#008000",
        "indexLabelFontColor": "#000000",
        "indexLabelFontSize": 12,
        "indexLabelFontFamily": "Montserrat"
      }
    ]
  }]
};
let chartContainerSelector = `chart-container-left`;
window['myPie'] = new CanvasJS.Chart(chartContainerSelector, options);
window['myPie'].render();