World\s largest cities per 2021

by owen_pengtao

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>

<figure class="highcharts-figure">
    <div id="container"></div>
</figure>

CSS

#container {
    height: 400px;
}

.highcharts-figure,
.highcharts-data-table table {
    min-width: 310px;
    max-width: 800px;
    margin: 1em auto;
}

.highcharts-data-table table {
    font-family: Verdana, sans-serif;
    border-collapse: collapse;
    border: 1px solid #ebebeb;
    margin: 10px auto;
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.highcharts-data-table caption {
    padding: 1em 0;
    font-size: 1.2em;
    color: #555;
}

.highcharts-data-table th {
    font-weight: 600;
    padding: 0.5em;
}

.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
    padding: 0.5em;
}

.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
    background: #f8f8f8;
}

.highcharts-data-table tr:hover {
    background: #f1f7ff;
}

JavaScript

Highcharts.chart('container', {
  chart: {
    type: 'column'
  },
  title: {
    text: 'Application Request duration'
  },
  xAxis: {
    type: 'category',
    labels: {
      autoRotation: [-45, -90],
      style: {
        fontSize: '13px',
        fontFamily: 'Verdana, sans-serif'
      }
    }
  },
  yAxis: {
    min: 0,
    title: {
      text: 'Request count'
    },
    labels: {
      format: '{value}%' // 在这里添加百分比符号
    }
  },
  exporting: {
    enabled: false
  },
  credits: {
    enabled: false
  },
  accessibility: {
    enabled: false
  },
  legend: {
    enabled: false
  },
  tooltip: {
    pointFormat: 'Request count: <b>{point.y:.1f}%</b>' // 也可以在这里添加百分比符号
  },
  series: [{
    name: 'Population',
    colorByPoint: true,
    groupPadding: 0,
    data: [
      ['0-50ms', 0],
      ['50-100ms', 15],
      ['100-250ms', 35],
      ['250-400ms', 0],
      ['400ms-1000ms', 45],
      ['1.0-2.0s', 5]
    ],
    dataLabels: {
      enabled: true,
      format: '{point.y:.1f}%', // 在数据标签上也添加百分比符号
      style: {
        fontSize: '13px',
        fontFamily: 'Verdana, sans-serif'
      }
    }
  }]
});