DSD - Darts Stats

DSD - Darts Stats

by Dumine Stefan Daniel

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>


<div id="container" style="height: 400px; width: auto"></div>

JavaScript

$(function() {
  $('#container').highcharts({
    chart: {},
    title: {
      text: 'Stats',
      x: -20 //center
    },
    xAxis: {
      title: {
        text: 'Număr joc'
      },
      categories: []
    },
    plotOptions: {
        series: {
            cursor: 'pointer',
            point: {
                events: {
                    click: function() {
                       // alert(this.y);
                    }
                }
            }
        }
    },
   
    yAxis: [{ // Primary yAxis
                    min: 0, max: 5, tickInterval: 1,
                    title: {

                        text: 'Puncte'
                    },
                    plotLines: [{
                        value: 0,
                        width: 1,
                        color: '#808080'
                    }]
                }],
                
                  tooltip: {
            shared: true,
            useHTML: true,
                pointFormat: "{series.name}: <b>{point.y}</b> puncte<br />",
                headerFormat: "<b>Jocul numărul {point.key} </b><br><br>",
        },
    legend: {
      layout: 'vertical',
      align: 'right',
      verticalAlign: 'middle',
      borderWidth: 0
    },
    series: [{
        name: 'Irina',
        type: 'spline',
        yAxis: 0,
        data: [1, 3, 4]
    }, {
        name: 'Daniel',
        type: 'spline',
        yAxis: 0,
        data: [2, 2, 2]
    },
    {
        name: 'Alex',
        type: 'spline',
        yAxis: 0,
        data: [1, 1, 1]
    },
    {
        name: 'Săvescu',
        type: 'spline',
        yAxis: 0,
        data: [0, 1, 0]
    },
    {
        name: 'Dănuț',
        type: 'spline',
        yAxis: 0,
        data: [2, 3, 4]
    }]
  });
  
 var irina = [0, 0, 0];
 var daniel  = [0, 4, 4];
 var alex  = [0, 3, 2];
 var savescu  = [0, 2, 4];
  var danut = [0, 5, 5];

var chart = $('#container').highcharts();

    chart.series[0].setData(eval(irina), false, true);
   ...