Skip to content

Instantly share code, notes, and snippets.

@bzz0217
Created June 5, 2016 05:11
Show Gist options
  • Save bzz0217/555054d5f19b8a22b24ba2c49557bd19 to your computer and use it in GitHub Desktop.
Save bzz0217/555054d5f19b8a22b24ba2c49557bd19 to your computer and use it in GitHub Desktop.
Qiita - 言語別投稿数推移
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title>言語別推移</title>
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script>
$(function () {
var ymd = [<?php
foreach($ym as $key => $val){
if ($key>0){
echo ",";
}
echo "'" . $val . "'";
}
?>];
var data = [<?php
$count = 0;
foreach($data as $lang => $val){
if ($lang!='その他'){
if ($count>0){
echo ",";
}
echo "{";
echo "name: " . "'" . $lang . "',";
echo "data:[";
$count = 0;
foreach($val as $d => $cnt){
if ($count>0){
echo ",";
}
echo $cnt;
$count++;
}
echo "]";
echo "}";
$count++;
}
}
?>];
$('#container').highcharts({
title: {
text: 'Qiita - 言語別投稿数推移',
x: -20 //center
},
subtitle: {
text: '',
x: -20
},
xAxis: {
categories: ymd
},
yAxis: {
title: {
text: '投稿数'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '件'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: data
});
});
</script>
</head>
<body>
<div id="container"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment