Bonjour,


Je crée un graphe avec des informations de ma base de données
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<html>
  <head>
 
 
<html><link rel="stylesheet" href="style.css" />
 
        <link rel="stylesheet" href="stylemenu.css" />
<?php include("menu.php");
 include("connexionbdd.php");?>
 
 
 
 
 <?php
 $sql_inc="SELECT id_Evt,name_Evt FROM threat";
     $res_inc=mysql_query($sql_inc);
 
$num=mysql_num_rows($res_inc);
 
 
 
 
$data_set = "";
 
 
$i=0;
   while($rows_pro=mysql_fetch_assoc($res_inc)){
 
       $data_set .= "["; $data_set .= "'";
         $data_set .= $rows_pro['name_Evt']; $data_set .= "'";$data_set .= ","; $data_set .= $rows_pro['id_Evt'];
 
		  if($i!=$num-1){
 
          $data_set .= "],";$i++;
          }
		  else{
		  $data_set .= "]";
 
 
		  }
 
}
$data_set .= "]";
 
 
 
	 echo $data_set;
 
	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
 
        <?php echo  $data_set; ?>);
 
        var options = {
          title: 'Threat Event:Perform perimeter network reconnaissance/scanning.',
          hAxis: {title: 'Source name', titleTextStyle: {color: 'red'}},
		  vAxis: {title: 'Capacity', titleTextStyle: {color: 'red'}},colors: ['#F07777']
        };
 
        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
 
    <div id="chart_div" style="height: 1500px;"></div>
 
 
</html>
  ?>

J'ai fais un écho de data_set qui me donne bien ce que je souhaite :
['Perform ',2],['ccc',3],['ng',4]] mais sur le graphique , ça m'affiche uniquement ccc et Perform...

J'en rajoute et ça m'affiche tout sauf le premier.... Savez vous pourquoi?alors que dans le le premier s'affiche bien
Donc j'ai crée un seul élement et voici l'erreur
Data column(s) for axis #0 cannot be of type string