IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Graphique avec tableau


Sujet :

JavaScript

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    324
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2006
    Messages : 324
    Points : 114
    Points
    114
    Par défaut Graphique avec tableau
    Bonjour,

    Voici mon problème :

    Je crée des tableaux en php que je transforme en suite en javascript (voir le code ci-dessous) pour les utiliser avec jquery et flot. tab_temp_java represente les abscisses et tab_point_java les ordonné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
    <script language="Javascript">
    var tab_point_java = new Array;
    var tab_temp_java = new Array;
    <?php
     
                                    $tab_point_php= array();
                                    $temp_php= array();
                                    $tab_point_php=$total;
                                    $temp_php=$peak_time1;
     
     
    $a=0;
    $b=0;
     
    foreach($temp_php as $var_temp){
     echo "tab_temp_java[$a] = '$var_temp';";
    $a++;
    }
     
    foreach($tab_point_php as $var_point){
     echo "tab_point_java[$b] = '$var_point';";
    $b++;
    }
     
     
    ?>
    </script>
    Mon problème et que je ne sais pas integrer mes tableaux d'abscisse et d'ordonnées dans le code javascript donné ci-dessous en exemple par JQUERY pour afficher mon graphique.


    Merci

    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
    <div id="monGraphique" style="width:600px;height:300px;"></div>
     
     
       <script language="javascript" type="text/javascript">
        $(  function () 
            {
                 var d1 = [];
                 for (var i = -10; i < 10; i += 0.1){
                     d1.push([i, Math.sin(i)]);
                 }
     
                var data = [
                {
                  label: "Fonction Sinus",
                  data: d1
                 }
                ];
     
     
               var options = {
                   legend: {
                           show: true,
                           margin: 10,
                           backgroundOpacity: 0.5
                   }
               };
     
               var plotarea = $("#monGraphique");
               $.plot( plotarea , data, options );
            }
        );
        </script>

  2. #2
    Rédacteur
    Avatar de marcha
    Homme Profil pro
    Développeur Web
    Inscrit en
    Décembre 2003
    Messages
    1 571
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Décembre 2003
    Messages : 1 571
    Points : 2 351
    Points
    2 351
    Par défaut
    Salut,

    peux tu donner le code javascript généré stp ?

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    324
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2006
    Messages : 324
    Points : 114
    Points
    114
    Par défaut
    Je n'ai encore rien généré !

  4. #4
    Rédacteur
    Avatar de marcha
    Homme Profil pro
    Développeur Web
    Inscrit en
    Décembre 2003
    Messages
    1 571
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Décembre 2003
    Messages : 1 571
    Points : 2 351
    Points
    2 351
    Par défaut
    ok, essaie de produire un code du genre:

    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
     
    <script language="javascript" type="text/javascript">
        $(  function () 
            { 
    <?php
      $js[] = "var points = [];";
      for(...) {
        $js[] = "points.push([ $abs, $ord ]);";
      }
      echo implode("\n", $js);
    ?>
     
     
                var data = [
                {
                  label: "Ma Fonction",
                  data: points
                 }
                ];
     
     
               var options = {
                   legend: {
                           show: true,
                           margin: 10,
                           backgroundOpacity: 0.5
                   }
               };
     
               var plotarea = $("#monGraphique");
               $.plot( plotarea , data, options );
            }
        );
    </script>

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    324
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2006
    Messages : 324
    Points : 114
    Points
    114
    Par défaut
    Je mets quoi dans la boucle for ?

  6. #6
    Rédacteur
    Avatar de marcha
    Homme Profil pro
    Développeur Web
    Inscrit en
    Décembre 2003
    Messages
    1 571
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Décembre 2003
    Messages : 1 571
    Points : 2 351
    Points
    2 351
    Par défaut
    qulque chose dans le genre de ce que tu as déjà fait, il faut itérer ton tableau
    de points.

  7. #7
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    324
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2006
    Messages : 324
    Points : 114
    Points
    114
    Par défaut
    ben je suis désolé mais je sais pas faire avec 2 tableaux
    mes 2 tableaux sont les suivants :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    tab_temp_java[$a] (les abscisses)
    tab_point_java[$b] (les ordonnées)
    je sais que je t'en demandes beaucoup mais je suis largué complet


    merci

  8. #8
    Rédacteur
    Avatar de marcha
    Homme Profil pro
    Développeur Web
    Inscrit en
    Décembre 2003
    Messages
    1 571
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Décembre 2003
    Messages : 1 571
    Points : 2 351
    Points
    2 351
    Par défaut
    ok, alors je suppose que les deux tableaux ont la même longueur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
      $js[] = "var points = [];";
      $n = count($tab_temp_java);
      for($i=0;$i<$n;$i++) {
        $abs = tab_temp_java[$i];
        $ord = tab_point_java[$i];
        $js[] = "points.push([ $abs, $ord ]);";
      }
      echo implode("\n", $js);

  9. #9
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    324
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2006
    Messages : 324
    Points : 114
    Points
    114
    Par défaut
    j'ai une "Parse error: parse error in C:\wamp\www\analyses\indexPHP.php on line 2043" à la ligne
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
        $abs = tab_temp_java[$i];


    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
    <script language="javascript" type="text/javascript">
        $(  function () 
            { 
    <?php
      $js[] = "var points = [];";
      $n = count($tab_temp_java);
      for($i=0;$i<$n;$i++) {
        $abs = tab_temp_java[$i];
        $ord = tab_point_java[$i];
        $js[] = "points.push([ $abs, $ord ]);";
      }
      echo implode("\n", $js);
    ?>
     
     
                var data = [
                {
                  label: "Ma Fonction",
                  data: points
                 }
                ];
     
     
               var options = {
                   legend: {
                           show: true,
                           margin: 10,
                           backgroundOpacity: 0.5
                   }
               };
     
               var plotarea = $("#monGraphique");
               $.plot( plotarea , data, options );
            }
        );
    </script>

  10. #10
    Rédacteur
    Avatar de marcha
    Homme Profil pro
    Développeur Web
    Inscrit en
    Décembre 2003
    Messages
    1 571
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Décembre 2003
    Messages : 1 571
    Points : 2 351
    Points
    2 351
    Par défaut
    Crise économique oblige, il manque des $

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
        $abs = $tab_temp_java[$i];
        $ord = $tab_point_java[$i];

  11. #11
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    324
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2006
    Messages : 324
    Points : 114
    Points
    114
    Par défaut
    à quand un langage avec des € ?

  12. #12
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    324
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2006
    Messages : 324
    Points : 114
    Points
    114
    Par défaut
    J'ai plus d'erreur "direct mais j'ai toujours rien qui s'affiche et la console javascript m'indique l'erreur suivante
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Erreur : invalid flag after regular expression
    Fichier source : http://localhost/analyses/indexPHP.php#
    Ligne : 732, Colonne : 10
    Code source :
    <b>Notice</b>:  Undefined variable: tab_temp_java in <b>C:\wamp\www\analyses\indexPHP.php</b> on line <b>2041</b><br />
    La ligne 2041 correspond à
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $n = count($tab_temp_java);

  13. #13
    Rédacteur
    Avatar de marcha
    Homme Profil pro
    Développeur Web
    Inscrit en
    Décembre 2003
    Messages
    1 571
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Décembre 2003
    Messages : 1 571
    Points : 2 351
    Points
    2 351
    Par défaut
    Peux-tu poster la copie du javascript géné stp

  14. #14
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    324
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2006
    Messages : 324
    Points : 114
    Points
    114
    Par défaut
    Le debut (j'ai pas tout mis car il y a plus de 3000 caracteres

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <script language="Javascript">
    var tab_point_java = new Array;
    var tab_temp_java = new Array;
    tab_temp_java[0] = '0';tab_temp_java[1] = '0.03';tab_temp_java[2] = '0.05';tab_temp_java[3] = '0.08';tab_temp_java[4] = '0.11';tab_temp_java[5] = '0.14';tab_temp_java[6] = '0.16';tab_temp_java[7] = '0.19';tab_temp_java[8] = '0.22';tab_temp_java[9] = '0.24';tab_temp_java[10] = '0.27';tab_temp_java[11] = '0.3';tab_temp_java[12] = '0.33';tab_temp_java[13] = '0.35';tab_temp_java[14] = '0.38';tab_temp_java[15] = '0.41';tab_temp_java[16] = '0.43';tab_temp_java[17] = '0.46';tab_temp_java[18] = '0.49';tab_temp_java[19] = '0.52';tab_temp_java[20] = '0.54';tab_temp_java[21] = '0.57';tab_temp_java[22] = '0.6';tab_temp_java[23] = '0.62';tab_temp_java[24] = '0.65';tab_temp_java[25] = '0.68';tab_temp_java[26] = '0.71';tab_temp_java[27] = '0.73';tab_temp_java[28] = '0.76';tab_temp_java[29] = '0.79';tab_temp_java[30] = '0.81';tab_temp_java[31] = '0.84';tab_temp_java[32] = '0.87';tab_temp_java[33] = '0.9';tab_temp_java[34] = '0.92';tab_temp_java[35] = '0.95';tab_temp_java[36] = '0.98';tab_temp_java[37] = '1';tab_temp_java[38] = '1.03';tab_temp_java[39] = '1.06';tab_temp_java[40] = '1.09';tab_temp_java[41] = '1.11';tab_temp_java[42] = '1.14';tab_temp_java[43] = '1.17';tab_temp_java[44] = '1.19';tab_temp_java[45] = '1.22';tab_temp_java[46] = '1.25';tab_temp_java[47] = '1.28';tab_temp_java[48] = '1.3';tab_temp_java[49] = '1.33';tab_temp_java[50] = '1.36';tab_temp_java[51] = '1.38';tab_temp_java[52] = '1.41';tab_temp_java[53] = '1.44';tab_temp_java[54] = '1.47';tab_temp_java[55] = '1.49';tab_temp_java[56] = '1.52';tab_temp_java[57] = '1.55';tab_temp_java[58] = '1.57'

    Un peu plus loin

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ;tab_point_java[916] = '1.0108494873011E-11';tab_point_java[917] = '1.776372672188E-13';tab_point_java[918] = '2.1874118715875E-15';tab_point_java[919] = '1.8874521028989E-17';tab_point_java[920] = '1.1412221900126E-19';tab_point_java[921] = '4.835188044104E-22';tab_point_java[922] = '1.4355073593637E-24';tab_point_java[923] = '2.9863889578594E-27';tab_point_java[924] = '4.3534765772493E-30';tab_point_java[925] = '4.4470800445022E-33';tab_point_java[926] = '3.1831900904368E-36';tab_point_java[927] = '1.5966109189809E-39';tab_point_java[928] = '5.6115716072636E-43';tab_point_java[929] = '1.3820342837005E-46';tab_point_java[930] = '2.3850748739388E-50';tab_point_java[931] = '2.8842580353529E-54';tab_point_java[932] = '2.4440782061455E-58';tab_point_java[933] = '1.4512591767595E-62';tab_point_java[934] = '6.0384260589221E-67';tab_point_java[935] = '1.7605623888473E-71';tab_point_java[936] = '3.5968968210323E-76';tab_point_java[937] = '5.1493621161685E-81';tab_point_java[938] = '5.1656833438719E-86';tab_point_java[939] = '3.6312071136158E-91';tab_point_java[940] = '1.7886408858609E-96';tab_point_java[941] = '6.1736809321901E-102';tab_point_java[942] = '1.4931866570214E-107';tab_point_java[943] = '2.5306548315371E-113';tab_point_java[944] = '3.0053884987558E-119';tab_point_java[945] = '2.5010203174311E-125';tab_point_java[946] = '1.4584203405789E-131';tab_point_java[947] = '5.9593253859818E-138';tab_point_java[948] = '1.7063195966691E-144';tab_point_java[949] = '3.4235174934873E-151';tab_point_java[950] = '4.8131967793415E-158';tab_point_java[951] = '4.7418037607178E-165';tab_point_java[952] = '3.273425259666E-172';tab_point_java[953] = '1.5834712231608E-179';tab_point_java[954] = '5.3674352541707E-187';tab_point_java[955] = '1.2748889202133E-194';tab_point_java[956] = '2.1219090860109E-202';tab_point_java[957] = '2.4747429254016E-210';tab_point_java[958] = '2.0224710027384E-218';</script>



    La fin du code :

    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
     
    <script language="javascript" type="text/javascript">
        $(  function () 
            { 
    <br />
    <b>Notice</b>:  Undefined variable: tab_temp_java in <b>C:\wamp\www\analyses\indexPHP.php</b> on line <b>2041</b><br />
    var points = []; 
     
                var data = [
                {
                  label: "Ma Fonction",
                  data: points
                 }
                ];
     
     
               var options = {
                   legend: {
                           show: true,
                           margin: 10,
                           backgroundOpacity: 0.5
                   }
               };
     
               var plotarea = $("#monGraphique");
               $.plot( plotarea , data, options );
            }
        );
    </script>

  15. #15
    Rédacteur
    Avatar de marcha
    Homme Profil pro
    Développeur Web
    Inscrit en
    Décembre 2003
    Messages
    1 571
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Décembre 2003
    Messages : 1 571
    Points : 2 351
    Points
    2 351
    Par défaut
    ça semble pas correspondre à ce qui devrait être produit.
    tu devrais avoir:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    points.push([ ..., ... ]);
    points.push([ ..., ... ]);
    points.push([ ..., ... ]);
    points.push([ ..., ... ]);
    ...
    Peux tu reposter le code PHP que tu as utilisé pour produire le résultat javascript
    précédent stp

  16. #16
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    324
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2006
    Messages : 324
    Points : 114
    Points
    114
    Par défaut
    Attention usine à gaz !

    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
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    //	peak1
     
    				$u_peak_time1 = array();
    				$peak_time1 = array();
    				$peak_time2 = array();
    				$peak_time3 = array();
    				$peak_time4 = array();
    				$peak_time5 = array();
    				$peak_time6 = array();
    				$peak_time7 = array();
    				$peak_time8 = array();
    				$peak_time9 = array();
    				$peak_time10 = array();
    				$peak_time11= array();
    				$peak_time12= array();
    				$peak_time13= array();
    				$peak_time14= array();
    				$peak_time15= array();
    				$peak_time16= array();
    				$peak_time17= array();
    				$peak_time18= array();
    				$peak_time19= array();
    				$total= array();
     
     
    				$j_peak_time1=-1;
    				$i_peak_time1;
     
    				for ($i_peak_time1=0; $i_peak_time1<=26; $i_peak_time1+=1/($frequence*60))
    				//958 enregistrements
    				{   $j_peak_time1++;
    					$u_peak_time1[$j_peak_time1]= array();
     
    					$u_peak_time1[$j_peak_time1][0]=$i_peak_time1;
    					$peak_time1[] = round($u_peak_time1[$j_peak_time1][0],4);
     
    					$u_peak_time1[$j_peak_time1][1]=$peak_area[0]/$st_reel[0]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[0]),2)/2/pow($st_reel[0],2));
    					$peak_time2[] = round($u_peak_time1[$j_peak_time1][1],4);
     
    					$u_peak_time1[$j_peak_time1][2]=$peak_area[1]/$st_reel[1]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[1]),2)/2/pow($st_reel[1],2));
    					$peak_time3[] = round($u_peak_time1[$j_peak_time1][2],4);
     
    					$u_peak_time1[$j_peak_time1][3]=$peak_area[2]/$st_reel[2]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[2]),2)/2/pow($st_reel[2],2));
    					$peak_time4[] = round($u_peak_time1[$j_peak_time1][3],4);
     
    					$u_peak_time1[$j_peak_time1][4]=$peak_area[3]/$st_reel[3]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[3]),2)/2/pow($st_reel[3],2));
    					$peak_time5[] = round($u_peak_time1[$j_peak_time1][4],4);
     
    					$u_peak_time1[$j_peak_time1][5]=$peak_area[4]/$st_reel[4]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[4]),2)/2/pow($st_reel[4],2));
    					$peak_time6[] = round($u_peak_time1[$j_peak_time1][5],4);
     
     
    					$u_peak_time1[$j_peak_time1][6]=$peak_area[5]/$st_reel[5]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[5]),2)/2/pow($st_reel[5],2));
    					$peak_time7[] = round($u_peak_time1[$j_peak_time1][6],4);
     
    					$u_peak_time1[$j_peak_time1][7]=$peak_area[6]/$st_reel[6]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[6]),2)/2/pow($st_reel[6],2));
    					$peak_time8[] = round($u_peak_time1[$j_peak_time1][7],4);
     
    					$u_peak_time1[$j_peak_time1][8]=$peak_area[7]/$st_reel[7]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[7]),2)/2/pow($st_reel[7],2));
    					$peak_time9[] = round($u_peak_time1[$j_peak_time1][8],4);
     
    					$u_peak_time1[$j_peak_time1][9]=$peak_area[8]/$st_reel[8]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[8]),2)/2/pow($st_reel[8],2));
    					$peak_time10[] = round($u_peak_time1[$j_peak_time1][9],4);
     
    					$u_peak_time1[$j_peak_time1][10]=$peak_area[9]/$st_reel[9]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[9]),2)/2/pow($st_reel[9],2));
    					$peak_time11[] = round($u_peak_time1[$j_peak_time1][10],4);
     
    					$u_peak_time1[$j_peak_time1][11]=$peak_area[10]/$st_reel[10]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[10]),2)/2/pow($st_reel[10],2));
    					$peak_time12[] = round($u_peak_time1[$j_peak_time1][11],4);
     
    					$u_peak_time1[$j_peak_time1][12]=$peak_area[11]/$st_reel[11]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[11]),2)/2/pow($st_reel[11],2));
    					$peak_time13[] =round($u_peak_time1[$j_peak_time1][12],4);
     
    					$u_peak_time1[$j_peak_time1][13]=$peak_area[12]/$st_reel[12]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[12]),2)/2/pow($st_reel[12],2));
    					$peak_time14[] =round($u_peak_time1[$j_peak_time1][13],4);
     
    					$u_peak_time1[$j_peak_time1][14]=$peak_area[13]/$st_reel[13]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[13]),2)/2/pow($st_reel[13],2));
    					$peak_time15[] =round($u_peak_time1[$j_peak_time1][14],4);
     
    					$u_peak_time1[$j_peak_time1][15]=$peak_area[14]/$st_reel[14]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[14]),2)/2/pow($st_reel[14],2));
    					$peak_time16[] =round($u_peak_time1[$j_peak_time1][15],4);
     
    					$u_peak_time1[$j_peak_time1][16]=$peak_area[15]/$st_reel[15]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[15]),2)/2/pow($st_reel[15],2));
    					$peak_time17[] =round($u_peak_time1[$j_peak_time1][16],4);
     
    					$u_peak_time1[$j_peak_time1][17]=$peak_area[16]/$st_reel[16]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[16]),2)/2/pow($st_reel[16],2));
    					$peak_time18[] =round($u_peak_time1[$j_peak_time1][17],4);
     
    					$u_peak_time1[$j_peak_time1][18]=$peak_area[17]/$st_reel[17]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[17]),2)/2/pow($st_reel[17],2));
    					$peak_time19[] =round($u_peak_time1[$j_peak_time1][18],4);
     
    					$u_peak_time1[$j_peak_time1][19]=$peak_area[18]/$st_reel[18]/sqrt(6.28)*exp(-pow(($u_peak_time1[$j_peak_time1][0]-$tg_min[18]),2)/2/pow($st_reel[18],2));
    					$peak_time20[] =round($u_peak_time1[$j_peak_time1][19],4);
     
    					$peak_time21[] = mt_rand(0 * pow(10, 7), 1 * pow(10, 7)) / pow(10, 7)*$noise;
     
     
    $total[]=round($u_peak_time1[$j_peak_time1][19]+$u_peak_time1[$j_peak_time1][18]+$u_peak_time1[$j_peak_time1][17]+$u_peak_time1[$j_peak_time1][16]+$u_peak_time1[$j_peak_time1][15]+$u_peak_time1[$j_peak_time1][14]+$u_peak_time1[$j_peak_time1][13]+$u_peak_time1[$j_peak_time1][12]+$u_peak_time1[$j_peak_time1][11]+$u_peak_time1[$j_peak_time1][10]+$u_peak_time1[$j_peak_time1][9]+$u_peak_time1[$j_peak_time1][8]+$u_peak_time1[$j_peak_time1][7]+$u_peak_time1[$j_peak_time1][6]+$u_peak_time1[$j_peak_time1][5]+$u_peak_time1[$j_peak_time1][4]+$u_peak_time1[$j_peak_time1][3]+$u_peak_time1[$j_peak_time1][2]+$u_peak_time1[$j_peak_time1][1],3);
     
     
     
     
     
    				} 
     
    ?>			
    <script language="Javascript">
    var tab_point_java = new Array;
    var tab_temp_java = new Array;
    <?php
     
                                    $tab_point_php= array();
                                    $temp_php= array();
                                    $tab_point_php=$total;
                                    $temp_php=$peak_time1;
     
    $a=0;
    $b=0;
     
    foreach($temp_php as $var_temp){
     echo "tab_temp_java[$a] = '$var_temp';";
    $a++;
    }
     
    foreach($tab_point_php as $var_point){
     echo "tab_point_java[$b] = '$var_point';";
    $b++;
    }
     
    ?>
    </script>
    <?php   
    }
                            
    ?>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    .................................................................
     
     
    <div id="monGraphique" style="width:600px;height:300px;"></div>
     
     
     
    <script language="javascript" type="text/javascript">
        $(  function () 
            { 
    <?php
      $js[] = "var points = [];";
      $n = count($tab_temp_java);
      for($i=0;$i<$n;$i++) {
        $abs = $tab_temp_java[$i];
        $ord = $tab_point_java[$i];
        $js[] = "points.push([ $abs, $ord ]);";
            
      }
      echo implode("\n", $js);
    ?>
     
     
                var data = [
                {
                  label: "Ma Fonction",
                  data: points
                 }
                ];
     
     
               var options = {
                   legend: {
                           show: true,
                           margin: 10,
                           backgroundOpacity: 0.5
                   }
               };
     
               var plotarea = $("#monGraphique");
               $.plot( plotarea , data, options );
            }
        );
    </script>
     
     
     
     
     
     
     
     
     
     
     
     
    <a href="#" onClick="javascript: alert(tab_temp_java[144]),alert(tab_point_java[144]);">test</a>	
     
     
     
     
     
     
     
     
    </body>
    </html>

Discussions similaires

  1. Afficher graphique avec tableau de données
    Par Specifik dans le forum Windows Forms
    Réponses: 0
    Dernier message: 30/01/2014, 14h10
  2. Tableau graphique avec NetBeans
    Par khadi8 dans le forum NetBeans Platform
    Réponses: 5
    Dernier message: 11/04/2012, 10h07
  3. Graphique avec un tableau multi-multi-colonne
    Par koolway dans le forum Excel
    Réponses: 7
    Dernier message: 12/06/2009, 08h01
  4. Creer un tableau graphique avec la commande tbl et troff
    Par sedawk dans le forum Shell et commandes GNU
    Réponses: 4
    Dernier message: 16/09/2008, 18h04
  5. Réponses: 3
    Dernier message: 29/04/2007, 17h17

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo