1import Highcharts from 'highcharts' 2 3import 'stats/highcharts-defaults' 4 5import userDecorator from 'stats/decorators/user' 6 7const chartId = 'friends-chart' 8 9fetch(location.href + '.json') 10 .then((response) => response.json()) 11 .then((stats) => { 12 const getData = (type) => { 13 return Object.keys(stats).map((year) => { 14 const users = stats[year][type] 15 const value = { x: parseInt(year), y: users.length, users } 16 return value 17 }) 18 } 19 20 const series = [ 21 { name: 'SpoluhráÄi', data: getData('old') }, 22 { name: 'NovÃ', data: getData('new') } 23 ] 24 25 Highcharts.chart(chartId, { 26 chart: { type: 'column' }, 27 plotOptions: { 28 column: { 29 stacking: 'normal' 30 } 31 }, 32 title: { 33 text: 'PoÄet spoluhráÄů v kalendáÅnÃm roce' 34 }, 35 xAxis: { 36 tickInterval: 1 37 }, 38 tooltip: { 39 shared: true, 40 formatter () { 41 let text = '<strong>' + this.x + '</strong><br/>' 42 const nameformat = (user) => userDecorator(user).toString() 43 text += this.points 44 .filter((point) => point.point.users.length > 0) 45 .map((point) => { 46 text = '<strong>' + point.series.name + ':' + '</strong>' 47 text += point.point.users.map(nameformat).join(', ') 48 return text 49 }) 50 .join('<br><br>') 51 52 text += '<br>' 53 text += '<br>' 54 text += '<em>Celkem: ' + this.y + '</em>' 55 console.log(this) 56 return text 57 } 58 }, 59 series 60 }) 61 })
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.