Dziękuję za odpowiedzi.
Czy to ma prawo zadziałać jeżeli po prostu połączę się z bazą ( w ramach jednego pliku) przez php i pozniej wstawię to co mi wypluje php czyli np pint_r ($wyniki); do skryptu JS? Poniżej przyklad. Na tę chwilę całość wygląda tak http://iwaniuk.stronazen.pl/bat/test.html
Tzn w Php otrzymuję dane których potrzebuję, ale jak próbuję wstawić to do skryptu JS to stronka pada, więc zapewne nie jest to zgodne z zasadami. Jak to zatem obejść?
$(function () {
chartype = ‘bar’;
chartTitle = ‘Password Registration Attempts’;
chartCategories = [‘Week 37’, ‘Week 38’, ‘Week 38’, ‘Week 40’, ‘Week 41’];
chartData = [{name: ‘Success’,data: [20, 18, 741, 942, 516]}, {name: ‘Fail’,data: [18, 13, 378, 512, 299]}];
setDynamicChart(chartype, chartTitle, chartCategories, chartData);
setDynamicChart(chartype, chartTitle, chartCategories, chartData);
$(’.option’).click(function(){
var chartype = $(this).attr(‘id’);
if(chartype == ‘data1’){
chartype = ‘bar’;
chartTitle = ‘Password Registration Attempts’;
chartCategories = [‘Week 37’, ‘Week 38’, ‘Week 38’, ‘Week 40’, ‘Week 41’]; // Probowalem to zamienic na chartCategories. ale nie dziala = [<?php pint_r ($wyniki); ',') ?>];
chartData = [{name: ‘Success’,data: [20, 18, 741, 942, 516]}, {name: ‘Fail’,data: [18, 13, 378, 512, 299]}];
setDynamicChart(chartype, chartTitle, chartCategories, chartData);
}else if(chartype == ‘data2’){
chartype = ‘line’;
chartTitle = ‘Password Registration Fail Reasons’;
chartCategories = [‘Week 37’, ‘Week 38’, ‘Week 38’, ‘Week 40’, ‘Week 41’];
chartData = [{name: ‘Failed: System error’, data: [null, null, 1, 2, null]}, {name: ‘Failed: User abandoned the process’, data: [16, 13, 263, 377, 236]}, {name: ‘Failed: User provided incorrect answers’, data: [null, null, 114, 133, 63]}];
setDynamicChart(chartype, chartTitle, chartCategories, chartData);
}else if(chartype == ‘data3’){
chartype = ‘column’;
chartTitle = ‘Password Reset Attempts’;
chartCategories = [‘Week 33’, ‘Week 34’, ‘Week 35’, ‘Week 36’, ‘Week 37’, ‘Week 38’, ‘Week 39’, ‘Week 40’, ‘Week 41’];
chartData = [{name: ‘Yes’,data: [0, 0, 0, 0, 1, 8, 9, 18, 19]}, {name: ‘No’,data: [1, 13, 35, 4, 22, 51, 78, 124, 144]}];
setDynamicChart(chartype, chartTitle, chartCategories, chartData);
}else if(chartype == ‘data4’){
chartype = ‘line’;
chartTitle = ‘Password Reset Attempts’;
chartCategories = [‘Week 33’, ‘Week 34’, ‘Week 35’, ‘Week 36’, ‘Week 37’, ‘Week 38’, ‘Week 39’, ‘Week 40’, ‘Week 41’];
chartData = [{name: ‘Failed: System error’, data: [null, 2, null, null, 2, 6, 8, 16, 22]}, {name: ‘Failed: User had to many retries’, data: [null, null, null, null, 3, 12, 8, 31, 13]}, {name: ‘Failed: User provided incorrect answers’, data: [null, null, null, null, 4, 13, 15, 19, 17]}, {name: ‘Failed: User abandoned the process’, data: [1, 11, 6, 4, 8, 18, 17, 28, 47]}, {name: ‘Failed: User is not registered or entitled to use the system’, data: [null, null, null, null, 1, 2, 26, 28, 43]}];
setDynamicChart(chartype, chartTitle, chartCategories, chartData);
}
});
function setDynamicChart(chartype, chartTitle, chartCategories, chartData){
$(’#container’).highcharts({
chart: {
type: chartype
},
title: {
text: chartTitle
},
xAxis: {
categories: chartCategories
},
yAxis: {
min: 0,
title: {
text: ‘Value’
}
},
plotOptions: {
//this need only for pie chart
pie: {
allowPointSelect: true,
cursor: ‘pointer’
}
},
series: chartData
});
}
});