У меня есть таблица под названием «дорожки», она выглядит так:
- ID
- имя
- 1008 * URL *
- 1010 * хитов *
У меня круговые диаграммы, из старших, код выглядит так:
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'chart',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Where users came from, total'
},
tooltip: {
formatter: function() {
return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
credits: {
enabled: false
},
series: [{
type: 'pie',
name: 'Browser share',
data: [
['Firefox.com', 45.0],
['Default.com', 26.8],
['MSN', 12.8],
['Google.com', 8.5],
['Yahoo.com', 6.2],
['Others', 0.7]
]
}]
});
});
У меня вопрос, как я могу получить данные из таблицы «дорожки» (попадания) и (имя) и вывести их на круговую диаграмму, как:
'имя', 'хиты'
И, наконец, преобразовать число попаданий в%.