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

Bibliothèques et frameworks PHP Discussion :

[JpGraph] Réaliser un odomètre


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    412
    Détails du profil
    Informations personnelles :
    Âge : 52
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Décembre 2008
    Messages : 412
    Points : 79
    Points
    79
    Par défaut [JpGraph] Réaliser un odomètre
    Bonjour,

    J'essai d'utiliser jpgraph afin d'avoir au final un odomètre, dont voici le 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
    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
    <?php
    include ("../jpgraph.php");
    include ("../jpgraph_odo.php");
     
    //------------------------------------------------ ---------------------
    // Création d'un graphique à l'odomètre de nouvelles (width = 250, height = 200 pixels)
    //------------------------------------------------ ---------------------
    $graph = new OdoGraph (250,200);
     
    //------------------------------------------------ ---------------------
    // Spécifiez le titre et le sous-utilisation des polices par défaut
    // * Notez chaque titre mai être multilignes en utilisant un '\ n' comme une ligne
    // Diviseur.
    //------------------------------------------------ ---------------------
    $graph-> titre-> set ( "niveau"); // title Odomètre
    $graph-> titre-> SetColor ( "blanc"); //blanc
    $graph-> subtitle-> Set ( "2002-02-13");
    $graph-> Sous_titre-> SetColor ( "blanc");
     
    //------------------------------------------------ ---------------------
    // Specify légende.
    // * (Ceci est le texte au bas du graphique.) Les marges seront
    // Ajuste automatiquement pour s'adapter à la hauteur du texte. Une légende
    // Mai ont des lignes multiples en incluant un '\ n' caractère dans la
    // Chaîne.
    //------------------------------------------------ ---------------------
    $graph-> caption-> Set ( "Première ligne caption \ n. .. deuxième ligne");
    $graph-> caption-> SetColor ( "blanc");
     
    //------------------------------------------------ ---------------------
    // Maintenant nous devons créer un compteur kilométrique pour les ajouter à la représentation graphique.
    // Par défaut, l'échelle sera de 0 à 100
    //------------------------------------------------ ---------------------
    $odo = new Compteur kilométrique (0, "100");
     
    //------------------------------------------------ ---------------------
    // Définir la couleur à l'indication des valeurs entre 80 et 100 en rouge
    //------------------------------------------------ ---------------------
    $odo-> AddIndication (80100, "rouge");
     
    //------------------------------------------------ ---------------------
    // Affichage de la valeur Set pour le compteur kilométrique
    //------------------------------------------------ ---------------------
    $odo-> aiguille> Set (30);
     
    //------------------------------------------------ ---------------------
    // Ajouter l'odomètre à la courbe
    //------------------------------------------------ ---------------------
    $graph-> Add ($ ODO);
     
    //------------------------------------------------ ---------------------
    // ... et, enfin, l'AVC et le flux de l'image sur le navigateur
    //------------------------------------------------ ---------------------
    $graph-> Stroke ();?>

    J'ai le message d'erreur suivant :
    Parse error: syntax error, unexpected T_STRING in L:\Program files 2\wamp\www\maison\jpgraph-3.0.7\src\odometre.php on line 34
    La lignne 34 est :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $odo = new Compteur kilométrique (0, "100");
    J'ai donc ajouté au debut du code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    include ("../jpgraph.php");
    include ("../jpgraph_odo.php");
    jpgraph_odo.php
    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
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
     
    <?php
    /*=======================================================================
    // File:	JPGRAPH_ODO.PHP
    // Description:	JpGraph Odometer Plot extension
    // Created: 	2002-02-14
    // Author:	Johan Persson (johanp@aditus.nu)
    // Ver:		$Id$
    //
    // License:	This code is released under QPL
    //
    // Copyright (C) 2002 Johan Persson. All rights reserved.
    //========================================================================
    */
    //----------------------------------------------------------------
    // The first set of defines specifies some default behavioiur
    // of the odometer. You may change these values as you like.
    //----------------------------------------------------------------
     
    // Default size if no size is give
    DEFINE("ODO_DEFAULT_WIDTH",300);
    DEFINE("ODO_DEFAULT_HEIGHT",200);
     
    //----------------------------------------------------------------
    // You should NOT, I repeat, NOT  change any of the following 
    // constants
    //----------------------------------------------------------------
     
    // Style of odometer
    DEFINE("ODO_FULL",1); // Full circle
    DEFINE("ODO_HALF",2); // Half circle
     
     
    // Types of needles
    DEFINE("NEEDLE_STYLE_SIMPLE",0);  // Straight
    DEFINE("NEEDLE_STYLE_STRAIGHT",1);  // Straight
    DEFINE("NEEDLE_STYLE_ENDARROW",2);  // Arrowhead
    DEFINE("NEEDLE_STYLE_SMALL_TRIANGLE",3);  // Triangle small base
    DEFINE("NEEDLE_STYLE_MEDIUM_TRIANGLE",4);  // Triangle wide base
    DEFINE("NEEDLE_STYLE_LARGE_TRIANGLE",5);  // Triangle wide base
    DEFINE("NEEDLE_STYLE_HUGE_TRIANGLE",6);  // Triangle wide base
     
    // Arrow head styles
    // NEEDLE_ARROW_<WIDTH><LENGTH>
    // S = Small
    // M = Medium
    // L = Large
    DEFINE("NEEDLE_ARROW_SS",1);  
    DEFINE("NEEDLE_ARROW_SM",2);
    DEFINE("NEEDLE_ARROW_SL",3);
    DEFINE("NEEDLE_ARROW_MS",4);
    DEFINE("NEEDLE_ARROW_MM",5);
    DEFINE("NEEDLE_ARROW_ML",6);
    DEFINE("NEEDLE_ARROW_LS",7);
    DEFINE("NEEDLE_ARROW_LM",8);
    DEFINE("NEEDLE_ARROW_LL",9);
     
     
    //===================================================
    // CLASS OdoGraph
    // Description: Main class to handle odometer graphs
    //===================================================
    class OdoGraph extends Graph {
        var $iObj=array();
        var $iOdoColor = "lightblue";
        var $caption;
     
        function OdoGraph($aWidth=-1,$aHeight=-1,$aCachedName="",$aTimeOut=0,$aInline=true) {
    	Graph::Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);		
    	$this->SetColor($this->iOdoColor);
    	$this->img->SetMargin(5,5,5,5);
    	$this->SetMarginColor("steelblue");
    	$this->caption = new Text();
    	$this->caption->ParagraphAlign("center");
    	$this->subcaption = new Text();
    	$this->subcaption->ParagraphAlign("center");
    	$this->title->SetFont(FF_FONT1,FS_BOLD);
        }
     
        // Add a new Odometer to the graph
        function Add($aObject) {
    	if( is_array($aObject) ) {
    	    for($i=0; $i<count($aObject); ++$i)
    		$this->iObj[] = $aObject[$i];
    	}
    	else
    	    $this->iObj[] = $aObject;
        }
     
        function Stroke($aStrokeFileName="") {
    	if( $this->img->img == NULL ) {
    	    // If the user didn't specify an image size no
    	    // image will yet have been created so we need
    	    // to find out a suitable size and create an 
    	    // image.
    	    $lm=5;$rm=5;$tm=5;$bm=5;			
     
    	    $width = ODO_DEFAULT_WIDTH;
    	    $height = ODO_DEFAULT_HEIGHT;
    	    $this->img->CreateImgCanvas($width,$height);			
    	}
    	else {
    	    $lm=$this->img->left_margin;
    	    $rm=$this->img->right_margin;
    	    $tm=$this->img->top_margin;
    	    $bm=$this->img->bottom_margin;			
    	}
     
    	if( BRAND_TIMING ) $bm += 15;
     
    	if( $this->doshadow ) $rm += $this->shadow_width;
    	if( $this->doshadow ) $bm += $this->shadow_width;
     
    	// Calculate the top margin needed for title and subtitle
    	if( $this->title->t != "" ) {
    	    $tm += 1.2 * $this->title->GetFontHeight($this->img);
    	}
    	if( $this->subtitle->t != "" ) {
    	    $tm += 1.2* $this->subtitle->GetFontHeight($this->img);
    	}
     
    	// Calculate the top margin needed for caption
    	if( $this->caption->t != "" ) {
    	    $bm += 1.2 * $this->caption->GetTextHeight($this->img);
    	}
     
    	$this->img->SetMargin($lm,$rm+1,$tm,$bm+1);
    	$this->StrokePlotArea();
    	$this->StrokeTitles();
     
    	$captiony = $this->img->height - 
    	            ($this->doshadow ? $this->shadow_width : 0) - 5;
    	$this->caption->Align("center","bottom");
    	$this->caption->Center($this->img->left_margin,
    	                       $this->img->width-$this->img->right_margin,
                                   $captiony);
    	$this->caption->Stroke($this->img);
     
    	$this->img->SetMargin(0,0,0,0);
    	//Stroke all meters
    	$this->img->SetTranslation($lm,$tm);
    	$w = $this->img->plotwidth;
    	$h = $this->img->plotheight;
    	$n = count($this->iObj);
    	for($i=0; $i<$n; ++$i) {
    	    $this->img->plotheight = $h - $bm - $tm ;
    	    $this->img->plotwidth  = $w - $lm - $rm;
    	    $this->iObj[$i]->Stroke($this);
    	}
    	$this->cache->PutAndStream($this->img,$this->cache_name,$this->inline,$aStrokeFileName);
        }
    }
     
     
    //===================================================
    // CLASS OdoNeedle
    // Description: The needle in the odometer
    //===================================================
     
    class OdoNeedle extends LineProperty {
        var $iFillColor="lightblue";
        var $iVal=0;
        var $iLength = 0.6; // Fraction of radius
        var $iStyleParameter1 = -1, $iStyleParameter2 = -1; 
        var $iShow=false;
        var $iLineWeight=1;
        var $iShadowColor="gray:0.7",$iShadow=false, $idxShadow=4, $idyShadow=4;
     
        function OdoNeedle() {
    	$this->iArrowSize = array(
    	    3,5, 3,8, 3,15,    // SS, SM, SL
    	    4,7, 4,12, 5,20,    // MS, MM, ML
    	    8,7, 8,14, 8,24 ); // LS, LM, LL
    	$this->iWeight = 4;
    	$this->iColor = "navy";
    	$this->iStyle = NEEDLE_STYLE_ENDARROW;
    	$this->iStyleParameter1 = NEEDLE_ARROW_MM;
     
        }
     
        function Set($aVal) {
    	$this->iVal = $aVal;
        }
     
        function SetLineWeight($aWeight) {
    	$this->iLineWeight = $aWeight;
        }
     
        function SetFillColor($aColor) {
    	$this->iFillColor = $aColor;
        }
     
        function SetLength($aLen) {
    	$this->iLength = $aLen;
        }
     
        function SetStyle($aStyle, $aStyleParameter1=-1, $aStyleParameter2=-1) {
    	$this->iStyle = $aStyle;
    	if( $aStyle==NEEDLE_STYLE_ENDARROW && $aStyleParameter1==-1 )
    	    $this->iStyleParameter1 = NEEDLE_ARROW_MM;
    	else
    	    $this->iStyleParameter1 = $aStyleParameter1;
    	$this->iStyleParameter2 = $aStyleParameter2;
        }
     
        function SetShadow($aShadow=true,$aColor="gray:0.7",$aDx=4,$aDy=4) {
    	$this->iShadow = $aShadow;
    	$this->iShadowColor = $aColor;
    	$this->idxShadow = $aDx;
    	$this->idyShadow = $aDy;
        }
     
        function Stroke($img,$aOdometer) {
    	if( !$this->iShow ) return; 
     
    	$a = $aOdometer->scale->Translate($this->iVal);
    	$r = $aOdometer->iRadius*$this->iLength;
    	$xc = $aOdometer->xc ;
    	$yc = $aOdometer->yc ;
     
    	// Note: The $yadj parameter in the definiton of the needle shapes below
    	// is needed in order for the point of rotation to be in the middle of the
    	// needle. Basicall the image class always rotates around (0,0) by
    	// calling SetCenter() you can specify where the (0,0) point should 
    	// be. 
    	switch( $this->iStyle ) {
    	    case NEEDLE_STYLE_SIMPLE: // Simple, just a rectangle
    		$yadj = $this->iWeight/2;
    	        $p = array($xc,$yc-$yadj,$xc+$r,$yc-$yadj,
    		           $xc+$r,$yc+$this->iWeight-$yadj,$xc,$yc+$this->iWeight-$yadj);
    		break;
    	    case NEEDLE_STYLE_STRAIGHT: // Straight - two widths
    		// Check if we should use default values?
    		if( $this->iStyleParameter1 == -1 )
    		    $this->iStyleParameter1 = 0.6;
    		if( $this->iStyleParameter2 == -1 )
    		    $this->iStyleParameter2 = 0.3;
     
    		$yadj = $this->iWeight/2;
    	        $ind = floor($this->iWeight*$this->iStyleParameter2) ;
    		$p = array($xc,$yc-$yadj,
    		$xc+$r*$this->iStyleParameter1,$yc-$yadj,
    		$xc+$r*$this->iStyleParameter1,$yc+$ind-$yadj, $xc+$r,$yc+$ind-$yadj,
    		$xc+$r,$yc+$ind+($this->iWeight-2*$ind)-$yadj,
    		$xc+$r*$this->iStyleParameter1,$yc+$ind+($this->iWeight-2*$ind)-$yadj,
    		$xc+$r*$this->iStyleParameter1,$yc+$this->iWeight-$yadj,
    		$xc,$yc+$this->iWeight-$yadj);
    	        break;
     
    	    case NEEDLE_STYLE_ENDARROW: // With end arrow
    		$arrow_width  = $this->iArrowSize[($this->iStyleParameter1-1)*2];
    		$arrow_length = $this->iArrowSize[($this->iStyleParameter1-1)*2+1];
    		$yadj = $arrow_width + $this->iWeight/2;
     
    	    $r -= $arrow_length;
    		$p = array($xc,$yc+$arrow_width-$yadj,$xc+$r,$yc+$arrow_width-$yadj,
    		           $xc+$r,$yc-$yadj,
    		           $xc+$r+$arrow_length,$yc+$arrow_width+$this->iWeight/2-$yadj,
    		           $xc+$r,$yc+2*$arrow_width+$this->iWeight-$yadj,
    		           $xc+$r,$yc+$arrow_width+$this->iWeight-$yadj,
    		           $xc,$yc+$arrow_width+$this->iWeight-$yadj);
     
    		break;
    	    case NEEDLE_STYLE_SMALL_TRIANGLE: // Triangle small width base
    		$base_width = 8;
    	    case NEEDLE_STYLE_MEDIUM_TRIANGLE: // Triangle medium width base
    		$base_width = isset($base_width)  ? $base_width : 15 ;
    	    case NEEDLE_STYLE_LARGE_TRIANGLE: // Triangle medium width base
    		$base_width = isset($base_width)  ? $base_width : 25 ;
    	    case NEEDLE_STYLE_HUGE_TRIANGLE: // Triangle medium width base
    		$base_width = isset($base_width)  ? $base_width : 50 ;
    		$yadj = $base_width/2;
    	        $p = array($xc,$yc-$yadj,$xc+$r,$yc+$base_width/2-$yadj,$xc,$yc+$base_width-$yadj);
    		break;
     
    	    default:
    		JpGraphError::Raise("<b>JpGraph Error:</b> Unknown needle style.");
    		break;
    	}
     
    	// Move the (0,0) point ti where we want the rotation point
     
    	$old_origin = $img->SetCenter($xc,$yc);
    	$a = - $a * 180 / M_PI;
    	$old_a = $img->SetAngle($a);
     
    	if( $this->iShadow ) {
    	    $img->PushColor($this->iShadowColor);
    	    $oldt = array($img->transx,$img->transy);
    	    $img->SetTranslation($oldt[0]+$this->idxShadow, $oldt[1]+$this->idyShadow);
    	    $img->FilledPolygon($p);
    	    $img->PopColor();
    	    $img->SetTranslation($oldt[0], $oldt[1]);
    	}
     
    	$img->PushColor($this->iFillColor);
    	$img->FilledPolygon($p);
    	$img->PopColor();
    	$img->PushColor($this->iColor);
    	$img->SetLineWeight($this->iLineWeight);
    	$img->Polygon($p);
    	$img->PopColor();
     
    	$img->SetCenter($old_origin[0],$old_origin[1]);
    	$img->SetAngle($old_a);
        }
    }
     
    //===================================================
    // CLASS OdoScale
    // Description: The scale for odometer
    //===================================================
     
    class OdoScale {
        var $label=null;
        var $iMin=0,$iMax=100;
        var $iStartAngle,$iEndAngle;
        var $iMinTick=25,$iLabelInterval=1;
        var $iTickLength=0.05;  // Fraction of radius
        var $iColor = "black"; // Tickmark color
        var $iTickWeight=1;
        var $iShow=true;
        var $iFormatStr = "%d";
        var $iLabelPosition=0.8; 
     
        function OdoScale($aStartAngle,$aEndAngle) {
    	$this->label = new Text();
    	$this->iStartAngle = $aStartAngle * M_PI/180;
    	$this->iEndAngle = $aEndAngle * M_PI/180;
        }
     
        function SetAngle($aStart,$aEnd) {
    	$this->iStartAngle = $aStart * M_PI/180;
    	$this->iEndAngle = $aEnd * M_PI/180;
        }
     
        function SetLabelFormat($aFormat) {
    	$this->iFormatStr = $aFormat;
        }
     
        function SetTickWeight($aWeight) {
    	$this->iTickWeight = $aWeight;
        }
     
        function SetTickColor($aColor) {
    	$this->iColor = $aColor;
        }
     
        function SetTickLength($aLength) {
    	$this->iTickLength = $aLength;
        }
     
        function Set($aMin,$aMax) {
    	$this->iMin = $aMin;
    	$this->iMax = $aMax;
        }
     
        function SetTicks($aMinTick,$aLabelInterval=1) {
    	$this->iLabelInterval = $aLabelInterval;
    	$this->iMinTick = $aMinTick;
        }
     
        function SetLabelPos($aPos) {
    	$this->iLabelPostion = $aPos;
        }
     
        function Translate($aVal) {
    	if( $aVal > $this->iMax || $aVal < $this->iMin )
    	    JpGraphError::Raise("<b>JpGraph Error:</b> Value for odometer is outside specified scale.");
    	$a = $this->iStartAngle + 
    	    ($aVal-$this->iMin)/($this->iMax-$this->iMin)*($this->iEndAngle-$this->iStartAngle);
    	$a = 3/2*M_PI - $a ;
    	return $a < 0 ?  $a + 2*M_PI : $a ;
        }
     
        function Show($aShow=true) {
    	$this->iShow = $aShow;
        }
     
        function Stroke(&$img,&$aOdometer) {
    	if( !$this->iShow ) return;
    	$n = ($this->iMax - $this->iMin)/$this->iMinTick;
    	$r = $aOdometer->iRadius - $aOdometer->iBorderWidth;
    	$tick = $this->iMin;
    	$img->SetLineWeight($this->iTickWeight);
    	$img->PushColor($this->iColor);
    	for($i=0; $i<=$n; ++$i) {
    	    $a = $this->Translate($tick);
    	    if( $i % $this->iLabelInterval == 0 ) {
    		$p = array($aOdometer->xc + round($r*cos($a)*0.99),
    		    $aOdometer->yc - round($r*sin($a)),
    		    $aOdometer->xc + round($r*(1-$this->iTickLength*1.5)*cos($a)),
    		    $aOdometer->yc - round($r*(1-$this->iTickLength*1.5)*sin($a)));
     
    		$lx = $aOdometer->xc + round($r*$this->iLabelPosition*cos($a));
    		$ly = $aOdometer->yc - round($r*$this->iLabelPosition*sin($a));
     
    		$s = sprintf($this->iFormatStr,$tick);
    		$this->label->Set($s);
    		if( ($i==0 || $i==$n) && $aOdometer->iStyle==ODO_HALF ) {
    		    $this->label->Pos($lx,$ly-2,"center","bottom");
    		}
    		else
    		    $this->label->Pos($lx,$ly,"center","center");
    		$this->label->Stroke($img);		    
    	    }
    	    else {
    		$p = array($aOdometer->xc + round($aOdometer->iRadius*cos($a)),
    		    $aOdometer->yc - round($r*sin($a)),
    		    $aOdometer->xc + round($r*(1-$this->iTickLength)*cos($a)),
    		    $aOdometer->yc - round($r*(1-$this->iTickLength)*sin($a)));
    	    }
    	    $img->Line($p[0],$p[1],$p[2],$p[3]);
    	    $tick += $this->iMinTick;
    	}
    	$img->PopColor();
        }
    } 
     
    //===================================================
    // CLASS OdometerLabel
    // Description: Text on odometer
    //===================================================
     
    class OdometerLabel extends Text {
        var $iVPos=0.2;
        function SetVPos($aPos) {
    	$this->iVPos = $aPos;
        }
    }
     
    //===================================================
    // CLASS Odometer
    // Description: Main class to draw a odometer
    //===================================================
    class Odometer {
        var $scale;
        var $needle,$needle2,$needle3,$needle4;
        var $iStyle;
        var $iRadius=0.3;
        var $xc,$yc;
        var $iFillColor = "lightgray:1.15", $iColor = "navy";
        var $iBorderWidth=1;
        var $iInd, $iIndIdx=0;
        var $iCenterAreaWidth = 0;
        var $label;
        var $iBase = true, $iBaseWidth=0.12;
        var $iBaseColor1="navy",$iBaseColor2="steelblue",$iBaseColor3="white";
        var $iMargin=5;
        var $caption,$iCaptionMargin=0;
     
        function Odometer($aStyle=ODO_HALF) {
    	// Set default position
    	$this->xc = 0.5;
    	if( $aStyle == ODO_FULL ) {
    	    $this->scale = new OdoScale(40,320);
    	    $this->yc = 0.5;
    	    $this->iRadius = 0.5;
    	}
    	else {
    	    $this->scale = new OdoScale(90,270);
    	    $this->yc = 0;
    	    $this->iRadius = 1;
    	}
    	$this->iStyle = $aStyle;
     
    	// Only the first needle is shown by default
    	$this->needle = new OdoNeedle();
    	$this->needle->Show(true);
     
    	$this->needle2 = new OdoNeedle();
    	$this->needle3 = new OdoNeedle();
    	$this->needle4 = new OdoNeedle();
    	$this->iInd = null;
    	$this->label = new OdometerLabel();
    	$this->caption = new Text();
    	$this->caption->ParagraphAlign("center");
    	$this->caption->SetFont(FF_FONT2,FS_NORMAL);
        }
     
        function SetMargin($aMargin) {
    	$this->iMargin = $aMargin;
        }
     
        function SetBase($aShowBase,$aWidth=0.1,$aColor1="navy",$aColor2="steelblue",$aColor3="white") {
    	$this->iBase = $aShowBase;
    	$this->iBaseColor1 = $aColor1;
    	$this->iBaseColor2 = $aColor2;
    	$this->iBaseColor3 = $aColor3;
    	$this->iBaseWidth = $aWidth;
        }
     
        // Dummy method to make odometers have the same signature as the
        // layout classes since odometer is "leaf" classes in the hierarchy
        function LayoutSize() {
    	return 1;
        }
     
        function SetCenterAreaWidth($aWidth) {
    	$this->iCenterAreaWidth = $aWidth;
        }
     
        function SetPos($aXc,$aYc) {
    	$this->xc = $aXc;
    	$this->yc = $aYc;
        }
     
        // Set size. A value in the range 0 to 1 is interpretated as 
        // fraction of min(width,heigth) while a value > 1 is interpretated
        // as absolute size
        function SetSize($aRadius) {
    	$this->iRadius = $aRadius;
        }
     
        function AddIndication($aStart,$aEnd,$aColor) {
    	$this->iInd[$this->iIndIdx++] = array($aStart,$aEnd,$aColor);
        }
     
        function SetColor($aColor) {
    	$this->iFillColor = $aColor;
        }
     
        function SetBorder($aColor,$aWidth=1) {
    	$this->iColor = $aColor;
    	$this->iBorderWidth = $aWidth;
        }
     
        function FilledCircle(&$img,$aXc,$aYc,$aRadius,$aFillColor) {
     	if( $this->iStyle == ODO_FULL ) {
    	    $s = 0; $e = 360;
    	}
    	else {
    	    $s = 180; $e = 360;
    	}
    	$img->PushColor($aFillColor);
    	$img->FilledArc($aXc,$aYc,$aRadius*2,$aRadius*2,$s,$e);
    	$img->PopColor();	
        }
     
        // Stroke the outline of the odometer
        function StrokeFascia($img) {
    	$r = $this->iRadius;
     
    	// If the border width > 1 we have no choice but to
    	// draw to filled circles since GD 1.x at does not support
    	// a width for a circle. For the special case with a border
    	// of width==1 it looks aestethically better to just draw a 
    	// normal circle.
    	if( $this->iBorderWidth > 1 ) {
    	    $this->FilledCircle($img,
    	    $this->xc,$this->yc,$r,
    	    $this->iColor);
    	    $this->FilledCircle($img,
    	    $this->xc,$this->yc,$r-$this->iBorderWidth,
    	    $this->iFillColor);
    	}
    	else {
    	    $this->FilledCircle($img,$this->xc,$this->yc,$r,$this->iFillColor);
    	}
    	$doarcborder = $this->iBorderWidth == 1 ;
     
    	// Stroke colored indicator band
    	$n = count($this->iInd);
    	$r = $this->iRadius - ($this->iBorderWidth == 1 ? 0 : $this->iBorderWidth);
    	for( $i=0; $i<$n; ++$i) {
    	    $ind = $this->iInd[$i];
    	    $as = 360-$this->scale->Translate($ind[0])*180/M_PI;
    	    $ae = 360-$this->scale->Translate($ind[1])*180/M_PI;
    	    $img->PushColor($ind[2]);
    	    $img->FilledArc($this->xc,$this->yc,$r*2,$r*2,$as,$ae);
    	    $img->PopColor();	
    	}
            $this->FilledCircle($img,
    	                    $this->xc,$this->yc,$this->iCenterAreaWidth*$this->iRadius,
    	                    $this->iFillColor); 
    	if( $doarcborder ) 
    	    $img->Arc($this->xc,$this->yc, 2*$r, 2*$r, $this->iStyle==ODO_HALF ? 180 : 0 , 360);
     
    	// Finally draw bottom line if ODO_HALF
    	if( $this->iStyle == ODO_HALF && $this->iBorderWidth > 0 ) {
    	    $img->SetLineWeight($this->iBorderWidth);
    	    $img->PushColor($this->iColor);
    	    $img->Line($this->xc-$this->iRadius,$this->yc,$this->xc+$this->iRadius,$this->yc);
    	    $img->PopColor();
    	}
        }
     
        function Stroke($graph) {
    	$img = $graph->img;
    	// Adjust center position if it's specified as fraction of plot height/width
    	$adj = 0; //$graph->doshadow ? $graph->shadow_width : 0;
    	$boxadj = 0; //$graph->doframe ? $graph->frame_weight : 0 ;
    	$this->xc = $this->xc <= 1 ? floor($img->plotwidth * $this->xc) : 
    	    $this->xc ;
     
    	// We only do automatic adjust of the Y-coordinate if the position
    	// is given as fractions
    	$doautoadjust = ($this->yc < 1) ? 1 : 0 ;
     
    	$this->yc = $this->yc <= 1 ? floor($img->plotheight * (1-$this->yc)) : 
    	    $this->yc ;
    	if( $this->iStyle == ODO_HALF ) {
    	    $this->yc -= $this->iBorderWidth + $this->iMargin;
    	    $this->iRadius = $this->iRadius <= 1 ? 
    		 min(floor($this->iRadius*($img->plotwidth/2)),
    		     floor($this->iRadius*$img->plotheight)) - 2*$this->iMargin : 
    	         $this->iRadius;
    	    $this->iRadius -= $this->iBorderWidth ; 
    	}	
    	else {
    	    $this->iRadius = $this->iRadius <= 1 ? 
    	                 floor($this->iRadius*min($img->plotwidth,$img->plotheight)) - $this->iMargin :  
    	                 $this->iRadius;
    	}
     
    	// Adjust position and size for a potential odometer caption
    	$capmarg = 0;	
    	if( $this->caption->t != "" )
    	    $capmarg = 0.8 * $this->caption->GetTextHeight($img);
    	$this->yc -= $doautoadjust * $capmarg ;
    	$this->iRadius -= $doautoadjust * $capmarg;
    	$this->caption->Align("center","top");
    	$this->caption->Stroke($img,$this->xc,$this->yc+$this->iCaptionMargin);
     
    	$this->StrokeFascia($img);
    	$this->scale->Stroke($img,$this);
     
    	// Display the label (legend) in the middle of the plot
    	if( $this->iStyle == ODO_FULL ) 
    	    $this->label->Pos($this->xc, $this->yc + $this->iRadius*$this->label->iVPos,
    	                      "center","bottom");
    	else
    	    $this->label->Pos($this->xc, $this->yc - $this->iRadius*$this->label->iVPos,
                                  "center","bottom");
    	$this->label->Stroke($img);
     
    	// Stroke all needles. An odometer may have up to 4 indicator 
    	// needles.
    	$this->needle->Stroke($img,$this);
    	$this->needle2->Stroke($img,$this);
    	$this->needle3->Stroke($img,$this);
    	$this->needle4->Stroke($img,$this);
     
    	// Should the circular base of the indicator needle be displayed
    	if( $this->iBase ) {
    	    $r = $this->iRadius*$this->iBaseWidth;
    	    $r = $r < 4 ? 4 : $r;
    	    $r2 = $r > 10 ? 2 : 1 ;
    	    $this->FilledCircle($img,$this->xc,$this->yc,$r,$this->iBaseColor1);
    	    $this->FilledCircle($img,$this->xc,$this->yc,$r-2,$this->iBaseColor2);
    	    $this->FilledCircle($img,$this->xc,$this->yc,$r2,$this->iBaseColor3);
    	}
        }
    }
     
    //===================================================
    // CLASS LayoutVert
    // Description: Layout class which orders its objects
    // vertically
    //===================================================
    class LayoutVert {
        var $iObj;
     
        function LayoutVert($aObjArr) {
    	if( !is_array($aObjArr) )
    	    $aObjArr = array($aObjArr);
    	$this->iObj = $aObjArr;
        }
     
        function LayoutSize() {
    	return count($this->iObj);
        }
     
        function Stroke($graph) {
    	$img = $graph->img;
    	$n = count($this->iObj);
     
    	$s = 0;
    	for($i=0; $i<$n; ++$i) {
    	    $s += 1/$this->iObj[$i]->LayoutSize();
    	}
    	$d = 1/$s * $graph->img->plotheight ;
     
    	$otx = $graph->img->transx;
    	$oty = $graph->img->transy;
    	$h = $graph->img->plotheight;
    	$w = $graph->img->plotwidth;
    	$accheight = 0;
    	for($i=0; $i<$n; ++$i ) {
    	    $graph->img->SetTranslation($otx,$oty+$accheight);
    	    $accheight += $d / $this->iObj[$i]->LayoutSize();
    	    $graph->img->plotheight = $d / $this->iObj[$i]->LayoutSize();
    	    $this->iObj[$i]->Stroke($graph);
    	    $graph->img->plotheight = $h;
    	    $graph->img->plotwidth = $w;
    	}
        }
    }
     
    //===================================================
    // CLASS LayoutHor
    // Description: Layout class which orders its objects
    // horizontally
    //===================================================
    class LayoutHor {
        var $iObj;
     
        function LayoutHor($aObjArr) {
    	if( !is_array($aObjArr) )
    	    $aObjArr = array($aObjArr);
    	$this->iObj = $aObjArr;
        }
     
        function LayoutSize() {
    	return count($this->iObj);
        }
     
        function Stroke($graph) {
    	$img = $graph->img;
    	$n = count($this->iObj);
     
     
    	$s = 0;
    	for($i=0; $i<$n; ++$i) {
    	    $s += 1/$this->iObj[$i]->LayoutSize();
    	}
    	$d = 1/$s * $graph->img->plotwidth ;
     
    	$otx = $graph->img->transx;
    	$oty = $graph->img->transy;
    	$h = $graph->img->plotheight;
    	$w = $graph->img->plotwidth;
    	$accwidth = 0;
    	for($i=0; $i<$n; ++$i ) {
    	    $graph->img->SetTranslation($otx+$accwidth,$oty);
    	    $accwidth += $d / $this->iObj[$i]->LayoutSize();
    	    $graph->img->plotwidth = $d / $this->iObj[$i]->LayoutSize();
    	    $this->iObj[$i]->Stroke($graph);
    	    $graph->img->plotheight = $h;
    	    $graph->img->plotwidth = $w;
    	}
        }
    }
     
    // <EOF>
    ?>
    Ma version de Jpgraph est la 3.0.7

    Merci d'avance.
    Intel I7 960 | 6 Go Ram | 5 HDD au total 3636 Go | Windows 7 Edition intégral x64 | WampServer 2.0c | Apache 2.2.8 | Php 5.2.6 | MySQL 5.0.51b
    DreamPlug | 512 mo ram | SSD 16 GO | Linux debian 2.6.39.4 | armv5tel | Lamp | PHP 5.3.3-7 | Apache 2.2.16 | Mysql 14.14

  2. #2
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 726
    Points
    10 726
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $odo = new Compteur kilométrique (0, "100");
    y'a un espace ...

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    412
    Détails du profil
    Informations personnelles :
    Âge : 52
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Décembre 2008
    Messages : 412
    Points : 79
    Points
    79
    Par défaut
    bonsoir,

    Ou y a t'il un espace dans l'ancien code ? , bref.

    Voici deux nouveau code qui ont la même message d'erreur :
    Donc je ne pense pas que cela vient de moi.

    Test1
    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
     
    <?Php   // content="text/plain; charset=utf-8" 
     require_once   ( "jpgraph.php " ) ;  
     require_once   ( "jpgraph_odo.php " ) ; 
     
     // Create a new odometer graph (width=250, height=200 pixels) / / Création d'un graphique nouvel odomètre (largeur = 250, height = 200 pixels) 
     $graph  = new OdoGraph ( 250 , 140 ) ;
     
     // Now we need to create an odometer to add to the graph. / / Maintenant nous devons créer un compteur kilométrique pour ajouter au graphique. 
     // By default the scale will be 0 to 100 / / Par défaut, l'échelle sera de 0 à 100 
     $odo  = new Odometer ( ) ; 
     
     // Set display value for the odometer / / Valeur d'affichage pour le compteur kilométrique 
     $odo -> needle -> Set ( 30 ) ;  
     
     // Add the odometer to the graph / / Ajouter l'odomètre à la courbe 
     $graph -> Add ( $odo ) ; 
     
     // ... / / ... and finally stroke and stream the image back to the client et, enfin, accident vasculaire cérébral et flux de l'image vers le client 
     $graph -> Stroke ( ) ; 
     
     ?>
    Test2
    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
    <?Php   // content="text/plain; charset=utf-8" / / Content = "text / plain; charset = utf-8" 
     require_once  ( "jpgraph.php " ) ;  
     require_once  ( "jpgraph_odo.php " ) ; 
     
     // Create a new odometer graph (width=250, height=200 pixels) / / Création d'un graphique nouvel odomètre (largeur = 250, height = 200 pixels) 
     $graph  = new   OdoGraph ( 250 , 150 ) ; 
     
     $graph -> title -> Set (' Example with scale indicators - Exemple avec des indicateurs de l\'échelle' ) ;  
     
     // Add drop shadow for graph / / Ajouter une ombre portée pour le graphique 
     $graph -> SetShadow ( ) ;  
     
     // Now we need to create an odometer to add to the graph. / / Maintenant nous devons créer un compteur kilométrique pour ajouter au graphique. 
     // By default the scale will be 0 to 100 / / Par défaut, l'échelle sera de 0 à 100 
     $odo  = new Odometer ( ODO_HALF ) ; 
     
     // Add color indications // Ajouter les indications de couleur 
     $odo -> AddIndication ( 0 , 20 , " green:0.7 " ) ;  
     $odo -> AddIndication ( 20 , 30 , " green:0.9 " ) ;  
     $odo -> AddIndication ( 30 , 60 , " yellow " ) ; 
     $odo -> AddIndication ( 60 , 80 , " orange " ) ;  
     $odo -> AddIndication ( 80 , 100 , " red " ) ;  
     
     // Set display value for the odometer / / Valeur d'affichage pour le compteur kilométrique aiguille
     $odo -> needle -> Set ( 90 ) ; 
     
     // Set the size of the non-colored base area to 40% of the radius / / Définit la taille de la couleur de base par zone non à 40% du rayon 
     $odo -> SetCenterAreaWidth ( 0.45 ) ; 
     
     // Add drop shadow for needle / / Ajouter une ombre portée de l'aiguille 
     $odo -> needle -> SetShadow ( ) ; 
     
     // Add the odometer to the graph / / Ajouter l'odomètre à la courbe 
     $graph -> Add ( $odo ) ;
     
     // ... and finally stroke and stream the image back to the browser et, enfin, accident vasculaire cérébral et flux de l'image pour revenir au navigateur 
     $graph -> Stroke ( ) ;  
     
     // EOF 
     ?>
    Avec c'est deux codes j'ai le même message d'erreur suivant :
    Fatal error: Call to undefined method Graph::graph() in L:\Program files 2\wamp\www\maison\jpgraph-3.0.7\src\jpgraph_odo.php on line 68
    La ligne 68 de jpgraph_odo.php est :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Graph::Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);
    jpgraph_odo.php en entier
    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
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    <?php
    /*=======================================================================
    // File:	JPGRAPH_ODO.PHP
    // Description:	JpGraph Odometer Plot extension
    // Created: 	2002-02-14
    // Author:	Johan Persson (johanp@aditus.nu)
    // Ver:		$Id$
    //
    // License:	This code is released under QPL
    //
    // Copyright (C) 2002 Johan Persson. All rights reserved.
    //========================================================================
    */
    //----------------------------------------------------------------
    // The first set of defines specifies some default behavioiur
    // of the odometer. You may change these values as you like.
    //----------------------------------------------------------------
     
    // Default size if no size is give
    DEFINE("ODO_DEFAULT_WIDTH",300);
    DEFINE("ODO_DEFAULT_HEIGHT",200);
     
    //----------------------------------------------------------------
    // You should NOT, I repeat, NOT  change any of the following 
    // constants
    //----------------------------------------------------------------
     
    // Style of odometer
    DEFINE("ODO_FULL",1); // Full circle
    DEFINE("ODO_HALF",2); // Half circle
     
     
    // Types of needles
    DEFINE("NEEDLE_STYLE_SIMPLE",0);  // Straight
    DEFINE("NEEDLE_STYLE_STRAIGHT",1);  // Straight
    DEFINE("NEEDLE_STYLE_ENDARROW",2);  // Arrowhead
    DEFINE("NEEDLE_STYLE_SMALL_TRIANGLE",3);  // Triangle small base
    DEFINE("NEEDLE_STYLE_MEDIUM_TRIANGLE",4);  // Triangle wide base
    DEFINE("NEEDLE_STYLE_LARGE_TRIANGLE",5);  // Triangle wide base
    DEFINE("NEEDLE_STYLE_HUGE_TRIANGLE",6);  // Triangle wide base
     
    // Arrow head styles
    // NEEDLE_ARROW_<WIDTH><LENGTH>
    // S = Small
    // M = Medium
    // L = Large
    DEFINE("NEEDLE_ARROW_SS",1);  
    DEFINE("NEEDLE_ARROW_SM",2);
    DEFINE("NEEDLE_ARROW_SL",3);
    DEFINE("NEEDLE_ARROW_MS",4);
    DEFINE("NEEDLE_ARROW_MM",5);
    DEFINE("NEEDLE_ARROW_ML",6);
    DEFINE("NEEDLE_ARROW_LS",7);
    DEFINE("NEEDLE_ARROW_LM",8);
    DEFINE("NEEDLE_ARROW_LL",9);
     
     
    //===================================================
    // CLASS OdoGraph
    // Description: Main class to handle odometer graphs
    //===================================================
    class OdoGraph extends Graph {
        var $iObj=array();
        var $iOdoColor = "lightblue";
        var $caption;
     
        function OdoGraph($aWidth=-1,$aHeight=-1,$aCachedName="",$aTimeOut=0,$aInline=true) {
    	Graph::Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);		
    	$this->SetColor($this->iOdoColor);
    	$this->img->SetMargin(5,5,5,5);
    	$this->SetMarginColor("steelblue");
    	$this->caption = new Text();
    	$this->caption->ParagraphAlign("center");
    	$this->subcaption = new Text();
    	$this->subcaption->ParagraphAlign("center");
    	$this->title->SetFont(FF_FONT1,FS_BOLD);
        }
     
        // Add a new Odometer to the graph
        function Add($aObject) {
    	if( is_array($aObject) ) {
    	    for($i=0; $i<count($aObject); ++$i)
    		$this->iObj[] = $aObject[$i];
    	}
    	else
    	    $this->iObj[] = $aObject;
        }
     
        function Stroke($aStrokeFileName="") {
    	if( $this->img->img == NULL ) {
    	    // If the user didn't specify an image size no
    	    // image will yet have been created so we need
    	    // to find out a suitable size and create an 
    	    // image.
    	    $lm=5;$rm=5;$tm=5;$bm=5;			
     
    	    $width = ODO_DEFAULT_WIDTH;
    	    $height = ODO_DEFAULT_HEIGHT;
    	    $this->img->CreateImgCanvas($width,$height);			
    	}
    	else {
    	    $lm=$this->img->left_margin;
    	    $rm=$this->img->right_margin;
    	    $tm=$this->img->top_margin;
    	    $bm=$this->img->bottom_margin;			
    	}
     
    	if( BRAND_TIMING ) $bm += 15;
     
    	if( $this->doshadow ) $rm += $this->shadow_width;
    	if( $this->doshadow ) $bm += $this->shadow_width;
     
    	// Calculate the top margin needed for title and subtitle
    	if( $this->title->t != "" ) {
    	    $tm += 1.2 * $this->title->GetFontHeight($this->img);
    	}
    	if( $this->subtitle->t != "" ) {
    	    $tm += 1.2* $this->subtitle->GetFontHeight($this->img);
    	}
     
    	// Calculate the top margin needed for caption
    	if( $this->caption->t != "" ) {
    	    $bm += 1.2 * $this->caption->GetTextHeight($this->img);
    	}
     
    	$this->img->SetMargin($lm,$rm+1,$tm,$bm+1);
    	$this->StrokePlotArea();
    	$this->StrokeTitles();
     
    	$captiony = $this->img->height - 
    	            ($this->doshadow ? $this->shadow_width : 0) - 5;
    	$this->caption->Align("center","bottom");
    	$this->caption->Center($this->img->left_margin,
    	                       $this->img->width-$this->img->right_margin,
                                   $captiony);
    	$this->caption->Stroke($this->img);
     
    	$this->img->SetMargin(0,0,0,0);
    	//Stroke all meters
    	$this->img->SetTranslation($lm,$tm);
    	$w = $this->img->plotwidth;
    	$h = $this->img->plotheight;
    	$n = count($this->iObj);
    	for($i=0; $i<$n; ++$i) {
    	    $this->img->plotheight = $h - $bm - $tm ;
    	    $this->img->plotwidth  = $w - $lm - $rm;
    	    $this->iObj[$i]->Stroke($this);
    	}
    	$this->cache->PutAndStream($this->img,$this->cache_name,$this->inline,$aStrokeFileName);
        }
    }
     
     
    //===================================================
    // CLASS OdoNeedle
    // Description: The needle in the odometer
    //===================================================
     
    class OdoNeedle extends LineProperty {
        var $iFillColor="lightblue";
        var $iVal=0;
        var $iLength = 0.6; // Fraction of radius
        var $iStyleParameter1 = -1, $iStyleParameter2 = -1; 
        var $iShow=false;
        var $iLineWeight=1;
        var $iShadowColor="gray:0.7",$iShadow=false, $idxShadow=4, $idyShadow=4;
     
        function OdoNeedle() {
    	$this->iArrowSize = array(
    	    3,5, 3,8, 3,15,    // SS, SM, SL
    	    4,7, 4,12, 5,20,    // MS, MM, ML
    	    8,7, 8,14, 8,24 ); // LS, LM, LL
    	$this->iWeight = 4;
    	$this->iColor = "navy";
    	$this->iStyle = NEEDLE_STYLE_ENDARROW;
    	$this->iStyleParameter1 = NEEDLE_ARROW_MM;
     
        }
     
        function Set($aVal) {
    	$this->iVal = $aVal;
        }
     
        function SetLineWeight($aWeight) {
    	$this->iLineWeight = $aWeight;
        }
     
        function SetFillColor($aColor) {
    	$this->iFillColor = $aColor;
        }
     
        function SetLength($aLen) {
    	$this->iLength = $aLen;
        }
     
        function SetStyle($aStyle, $aStyleParameter1=-1, $aStyleParameter2=-1) {
    	$this->iStyle = $aStyle;
    	if( $aStyle==NEEDLE_STYLE_ENDARROW && $aStyleParameter1==-1 )
    	    $this->iStyleParameter1 = NEEDLE_ARROW_MM;
    	else
    	    $this->iStyleParameter1 = $aStyleParameter1;
    	$this->iStyleParameter2 = $aStyleParameter2;
        }
     
        function SetShadow($aShadow=true,$aColor="gray:0.7",$aDx=4,$aDy=4) {
    	$this->iShadow = $aShadow;
    	$this->iShadowColor = $aColor;
    	$this->idxShadow = $aDx;
    	$this->idyShadow = $aDy;
        }
     
        function Stroke($img,$aOdometer) {
    	if( !$this->iShow ) return; 
     
    	$a = $aOdometer->scale->Translate($this->iVal);
    	$r = $aOdometer->iRadius*$this->iLength;
    	$xc = $aOdometer->xc ;
    	$yc = $aOdometer->yc ;
     
    	// Note: The $yadj parameter in the definiton of the needle shapes below
    	// is needed in order for the point of rotation to be in the middle of the
    	// needle. Basicall the image class always rotates around (0,0) by
    	// calling SetCenter() you can specify where the (0,0) point should 
    	// be. 
    	switch( $this->iStyle ) {
    	    case NEEDLE_STYLE_SIMPLE: // Simple, just a rectangle
    		$yadj = $this->iWeight/2;
    	        $p = array($xc,$yc-$yadj,$xc+$r,$yc-$yadj,
    		           $xc+$r,$yc+$this->iWeight-$yadj,$xc,$yc+$this->iWeight-$yadj);
    		break;
    	    case NEEDLE_STYLE_STRAIGHT: // Straight - two widths
    		// Check if we should use default values?
    		if( $this->iStyleParameter1 == -1 )
    		    $this->iStyleParameter1 = 0.6;
    		if( $this->iStyleParameter2 == -1 )
    		    $this->iStyleParameter2 = 0.3;
     
    		$yadj = $this->iWeight/2;
    	        $ind = floor($this->iWeight*$this->iStyleParameter2) ;
    		$p = array($xc,$yc-$yadj,
    		$xc+$r*$this->iStyleParameter1,$yc-$yadj,
    		$xc+$r*$this->iStyleParameter1,$yc+$ind-$yadj, $xc+$r,$yc+$ind-$yadj,
    		$xc+$r,$yc+$ind+($this->iWeight-2*$ind)-$yadj,
    		$xc+$r*$this->iStyleParameter1,$yc+$ind+($this->iWeight-2*$ind)-$yadj,
    		$xc+$r*$this->iStyleParameter1,$yc+$this->iWeight-$yadj,
    		$xc,$yc+$this->iWeight-$yadj);
    	        break;
     
    	    case NEEDLE_STYLE_ENDARROW: // With end arrow
    		$arrow_width  = $this->iArrowSize[($this->iStyleParameter1-1)*2];
    		$arrow_length = $this->iArrowSize[($this->iStyleParameter1-1)*2+1];
    		$yadj = $arrow_width + $this->iWeight/2;
     
    	    $r -= $arrow_length;
    		$p = array($xc,$yc+$arrow_width-$yadj,$xc+$r,$yc+$arrow_width-$yadj,
    		           $xc+$r,$yc-$yadj,
    		           $xc+$r+$arrow_length,$yc+$arrow_width+$this->iWeight/2-$yadj,
    		           $xc+$r,$yc+2*$arrow_width+$this->iWeight-$yadj,
    		           $xc+$r,$yc+$arrow_width+$this->iWeight-$yadj,
    		           $xc,$yc+$arrow_width+$this->iWeight-$yadj);
     
    		break;
    	    case NEEDLE_STYLE_SMALL_TRIANGLE: // Triangle small width base
    		$base_width = 8;
    	    case NEEDLE_STYLE_MEDIUM_TRIANGLE: // Triangle medium width base
    		$base_width = isset($base_width)  ? $base_width : 15 ;
    	    case NEEDLE_STYLE_LARGE_TRIANGLE: // Triangle medium width base
    		$base_width = isset($base_width)  ? $base_width : 25 ;
    	    case NEEDLE_STYLE_HUGE_TRIANGLE: // Triangle medium width base
    		$base_width = isset($base_width)  ? $base_width : 50 ;
    		$yadj = $base_width/2;
    	        $p = array($xc,$yc-$yadj,$xc+$r,$yc+$base_width/2-$yadj,$xc,$yc+$base_width-$yadj);
    		break;
     
    	    default:
    		JpGraphError::Raise("<b>JpGraph Error:</b> Unknown needle style.");
    		break;
    	}
     
    	// Move the (0,0) point ti where we want the rotation point
     
    	$old_origin = $img->SetCenter($xc,$yc);
    	$a = - $a * 180 / M_PI;
    	$old_a = $img->SetAngle($a);
     
    	if( $this->iShadow ) {
    	    $img->PushColor($this->iShadowColor);
    	    $oldt = array($img->transx,$img->transy);
    	    $img->SetTranslation($oldt[0]+$this->idxShadow, $oldt[1]+$this->idyShadow);
    	    $img->FilledPolygon($p);
    	    $img->PopColor();
    	    $img->SetTranslation($oldt[0], $oldt[1]);
    	}
     
    	$img->PushColor($this->iFillColor);
    	$img->FilledPolygon($p);
    	$img->PopColor();
    	$img->PushColor($this->iColor);
    	$img->SetLineWeight($this->iLineWeight);
    	$img->Polygon($p);
    	$img->PopColor();
     
    	$img->SetCenter($old_origin[0],$old_origin[1]);
    	$img->SetAngle($old_a);
        }
    }
     
    //===================================================
    // CLASS OdoScale
    // Description: The scale for odometer
    //===================================================
     
    class OdoScale {
        var $label=null;
        var $iMin=0,$iMax=100;
        var $iStartAngle,$iEndAngle;
        var $iMinTick=25,$iLabelInterval=1;
        var $iTickLength=0.05;  // Fraction of radius
        var $iColor = "black"; // Tickmark color
        var $iTickWeight=1;
        var $iShow=true;
        var $iFormatStr = "%d";
        var $iLabelPosition=0.8; 
     
        function OdoScale($aStartAngle,$aEndAngle) {
    	$this->label = new Text();
    	$this->iStartAngle = $aStartAngle * M_PI/180;
    	$this->iEndAngle = $aEndAngle * M_PI/180;
        }
     
        function SetAngle($aStart,$aEnd) {
    	$this->iStartAngle = $aStart * M_PI/180;
    	$this->iEndAngle = $aEnd * M_PI/180;
        }
     
        function SetLabelFormat($aFormat) {
    	$this->iFormatStr = $aFormat;
        }
     
        function SetTickWeight($aWeight) {
    	$this->iTickWeight = $aWeight;
        }
     
        function SetTickColor($aColor) {
    	$this->iColor = $aColor;
        }
     
        function SetTickLength($aLength) {
    	$this->iTickLength = $aLength;
        }
     
        function Set($aMin,$aMax) {
    	$this->iMin = $aMin;
    	$this->iMax = $aMax;
        }
     
        function SetTicks($aMinTick,$aLabelInterval=1) {
    	$this->iLabelInterval = $aLabelInterval;
    	$this->iMinTick = $aMinTick;
        }
     
        function SetLabelPos($aPos) {
    	$this->iLabelPostion = $aPos;
        }
     
        function Translate($aVal) {
    	if( $aVal > $this->iMax || $aVal < $this->iMin )
    	    JpGraphError::Raise("<b>JpGraph Error:</b> Value for odometer is outside specified scale.");
    	$a = $this->iStartAngle + 
    	    ($aVal-$this->iMin)/($this->iMax-$this->iMin)*($this->iEndAngle-$this->iStartAngle);
    	$a = 3/2*M_PI - $a ;
    	return $a < 0 ?  $a + 2*M_PI : $a ;
        }
     
        function Show($aShow=true) {
    	$this->iShow = $aShow;
        }
     
        function Stroke(&$img,&$aOdometer) {
    	if( !$this->iShow ) return;
    	$n = ($this->iMax - $this->iMin)/$this->iMinTick;
    	$r = $aOdometer->iRadius - $aOdometer->iBorderWidth;
    	$tick = $this->iMin;
    	$img->SetLineWeight($this->iTickWeight);
    	$img->PushColor($this->iColor);
    	for($i=0; $i<=$n; ++$i) {
    	    $a = $this->Translate($tick);
    	    if( $i % $this->iLabelInterval == 0 ) {
    		$p = array($aOdometer->xc + round($r*cos($a)*0.99),
    		    $aOdometer->yc - round($r*sin($a)),
    		    $aOdometer->xc + round($r*(1-$this->iTickLength*1.5)*cos($a)),
    		    $aOdometer->yc - round($r*(1-$this->iTickLength*1.5)*sin($a)));
     
    		$lx = $aOdometer->xc + round($r*$this->iLabelPosition*cos($a));
    		$ly = $aOdometer->yc - round($r*$this->iLabelPosition*sin($a));
     
    		$s = sprintf($this->iFormatStr,$tick);
    		$this->label->Set($s);
    		if( ($i==0 || $i==$n) && $aOdometer->iStyle==ODO_HALF ) {
    		    $this->label->Pos($lx,$ly-2,"center","bottom");
    		}
    		else
    		    $this->label->Pos($lx,$ly,"center","center");
    		$this->label->Stroke($img);		    
    	    }
    	    else {
    		$p = array($aOdometer->xc + round($aOdometer->iRadius*cos($a)),
    		    $aOdometer->yc - round($r*sin($a)),
    		    $aOdometer->xc + round($r*(1-$this->iTickLength)*cos($a)),
    		    $aOdometer->yc - round($r*(1-$this->iTickLength)*sin($a)));
    	    }
    	    $img->Line($p[0],$p[1],$p[2],$p[3]);
    	    $tick += $this->iMinTick;
    	}
    	$img->PopColor();
        }
    } 
     
    //===================================================
    // CLASS OdometerLabel
    // Description: Text on odometer
    //===================================================
     
    class OdometerLabel extends Text {
        var $iVPos=0.2;
        function SetVPos($aPos) {
    	$this->iVPos = $aPos;
        }
    }
     
    //===================================================
    // CLASS Odometer
    // Description: Main class to draw a odometer
    //===================================================
    class Odometer {
        var $scale;
        var $needle,$needle2,$needle3,$needle4;
        var $iStyle;
        var $iRadius=0.3;
        var $xc,$yc;
        var $iFillColor = "lightgray:1.15", $iColor = "navy";
        var $iBorderWidth=1;
        var $iInd, $iIndIdx=0;
        var $iCenterAreaWidth = 0;
        var $label;
        var $iBase = true, $iBaseWidth=0.12;
        var $iBaseColor1="navy",$iBaseColor2="steelblue",$iBaseColor3="white";
        var $iMargin=5;
        var $caption,$iCaptionMargin=0;
     
        function Odometer($aStyle=ODO_HALF) {
    	// Set default position
    	$this->xc = 0.5;
    	if( $aStyle == ODO_FULL ) {
    	    $this->scale = new OdoScale(40,320);
    	    $this->yc = 0.5;
    	    $this->iRadius = 0.5;
    	}
    	else {
    	    $this->scale = new OdoScale(90,270);
    	    $this->yc = 0;
    	    $this->iRadius = 1;
    	}
    	$this->iStyle = $aStyle;
     
    	// Only the first needle is shown by default
    	$this->needle = new OdoNeedle();
    	$this->needle->Show(true);
     
    	$this->needle2 = new OdoNeedle();
    	$this->needle3 = new OdoNeedle();
    	$this->needle4 = new OdoNeedle();
    	$this->iInd = null;
    	$this->label = new OdometerLabel();
    	$this->caption = new Text();
    	$this->caption->ParagraphAlign("center");
    	$this->caption->SetFont(FF_FONT2,FS_NORMAL);
        }
     
        function SetMargin($aMargin) {
    	$this->iMargin = $aMargin;
        }
     
        function SetBase($aShowBase,$aWidth=0.1,$aColor1="navy",$aColor2="steelblue",$aColor3="white") {
    	$this->iBase = $aShowBase;
    	$this->iBaseColor1 = $aColor1;
    	$this->iBaseColor2 = $aColor2;
    	$this->iBaseColor3 = $aColor3;
    	$this->iBaseWidth = $aWidth;
        }
     
        // Dummy method to make odometers have the same signature as the
        // layout classes since odometer is "leaf" classes in the hierarchy
        function LayoutSize() {
    	return 1;
        }
     
        function SetCenterAreaWidth($aWidth) {
    	$this->iCenterAreaWidth = $aWidth;
        }
     
        function SetPos($aXc,$aYc) {
    	$this->xc = $aXc;
    	$this->yc = $aYc;
        }
     
        // Set size. A value in the range 0 to 1 is interpretated as 
        // fraction of min(width,heigth) while a value > 1 is interpretated
        // as absolute size
        function SetSize($aRadius) {
    	$this->iRadius = $aRadius;
        }
     
        function AddIndication($aStart,$aEnd,$aColor) {
    	$this->iInd[$this->iIndIdx++] = array($aStart,$aEnd,$aColor);
        }
     
        function SetColor($aColor) {
    	$this->iFillColor = $aColor;
        }
     
        function SetBorder($aColor,$aWidth=1) {
    	$this->iColor = $aColor;
    	$this->iBorderWidth = $aWidth;
        }
     
        function FilledCircle(&$img,$aXc,$aYc,$aRadius,$aFillColor) {
     	if( $this->iStyle == ODO_FULL ) {
    	    $s = 0; $e = 360;
    	}
    	else {
    	    $s = 180; $e = 360;
    	}
    	$img->PushColor($aFillColor);
    	$img->FilledArc($aXc,$aYc,$aRadius*2,$aRadius*2,$s,$e);
    	$img->PopColor();	
        }
     
        // Stroke the outline of the odometer
        function StrokeFascia($img) {
    	$r = $this->iRadius;
     
    	// If the border width > 1 we have no choice but to
    	// draw to filled circles since GD 1.x at does not support
    	// a width for a circle. For the special case with a border
    	// of width==1 it looks aestethically better to just draw a 
    	// normal circle.
    	if( $this->iBorderWidth > 1 ) {
    	    $this->FilledCircle($img,
    	    $this->xc,$this->yc,$r,
    	    $this->iColor);
    	    $this->FilledCircle($img,
    	    $this->xc,$this->yc,$r-$this->iBorderWidth,
    	    $this->iFillColor);
    	}
    	else {
    	    $this->FilledCircle($img,$this->xc,$this->yc,$r,$this->iFillColor);
    	}
    	$doarcborder = $this->iBorderWidth == 1 ;
     
    	// Stroke colored indicator band
    	$n = count($this->iInd);
    	$r = $this->iRadius - ($this->iBorderWidth == 1 ? 0 : $this->iBorderWidth);
    	for( $i=0; $i<$n; ++$i) {
    	    $ind = $this->iInd[$i];
    	    $as = 360-$this->scale->Translate($ind[0])*180/M_PI;
    	    $ae = 360-$this->scale->Translate($ind[1])*180/M_PI;
    	    $img->PushColor($ind[2]);
    	    $img->FilledArc($this->xc,$this->yc,$r*2,$r*2,$as,$ae);
    	    $img->PopColor();	
    	}
            $this->FilledCircle($img,
    	                    $this->xc,$this->yc,$this->iCenterAreaWidth*$this->iRadius,
    	                    $this->iFillColor); 
    	if( $doarcborder ) 
    	    $img->Arc($this->xc,$this->yc, 2*$r, 2*$r, $this->iStyle==ODO_HALF ? 180 : 0 , 360);
     
    	// Finally draw bottom line if ODO_HALF
    	if( $this->iStyle == ODO_HALF && $this->iBorderWidth > 0 ) {
    	    $img->SetLineWeight($this->iBorderWidth);
    	    $img->PushColor($this->iColor);
    	    $img->Line($this->xc-$this->iRadius,$this->yc,$this->xc+$this->iRadius,$this->yc);
    	    $img->PopColor();
    	}
        }
     
        function Stroke($graph) {
    	$img = $graph->img;
    	// Adjust center position if it's specified as fraction of plot height/width
    	$adj = 0; //$graph->doshadow ? $graph->shadow_width : 0;
    	$boxadj = 0; //$graph->doframe ? $graph->frame_weight : 0 ;
    	$this->xc = $this->xc <= 1 ? floor($img->plotwidth * $this->xc) : 
    	    $this->xc ;
     
    	// We only do automatic adjust of the Y-coordinate if the position
    	// is given as fractions
    	$doautoadjust = ($this->yc < 1) ? 1 : 0 ;
     
    	$this->yc = $this->yc <= 1 ? floor($img->plotheight * (1-$this->yc)) : 
    	    $this->yc ;
    	if( $this->iStyle == ODO_HALF ) {
    	    $this->yc -= $this->iBorderWidth + $this->iMargin;
    	    $this->iRadius = $this->iRadius <= 1 ? 
    		 min(floor($this->iRadius*($img->plotwidth/2)),
    		     floor($this->iRadius*$img->plotheight)) - 2*$this->iMargin : 
    	         $this->iRadius;
    	    $this->iRadius -= $this->iBorderWidth ; 
    	}	
    	else {
    	    $this->iRadius = $this->iRadius <= 1 ? 
    	                 floor($this->iRadius*min($img->plotwidth,$img->plotheight)) - $this->iMargin :  
    	                 $this->iRadius;
    	}
     
    	// Adjust position and size for a potential odometer caption
    	$capmarg = 0;	
    	if( $this->caption->t != "" )
    	    $capmarg = 0.8 * $this->caption->GetTextHeight($img);
    	$this->yc -= $doautoadjust * $capmarg ;
    	$this->iRadius -= $doautoadjust * $capmarg;
    	$this->caption->Align("center","top");
    	$this->caption->Stroke($img,$this->xc,$this->yc+$this->iCaptionMargin);
     
    	$this->StrokeFascia($img);
    	$this->scale->Stroke($img,$this);
     
    	// Display the label (legend) in the middle of the plot
    	if( $this->iStyle == ODO_FULL ) 
    	    $this->label->Pos($this->xc, $this->yc + $this->iRadius*$this->label->iVPos,
    	                      "center","bottom");
    	else
    	    $this->label->Pos($this->xc, $this->yc - $this->iRadius*$this->label->iVPos,
                                  "center","bottom");
    	$this->label->Stroke($img);
     
    	// Stroke all needles. An odometer may have up to 4 indicator 
    	// needles.
    	$this->needle->Stroke($img,$this);
    	$this->needle2->Stroke($img,$this);
    	$this->needle3->Stroke($img,$this);
    	$this->needle4->Stroke($img,$this);
     
    	// Should the circular base of the indicator needle be displayed
    	if( $this->iBase ) {
    	    $r = $this->iRadius*$this->iBaseWidth;
    	    $r = $r < 4 ? 4 : $r;
    	    $r2 = $r > 10 ? 2 : 1 ;
    	    $this->FilledCircle($img,$this->xc,$this->yc,$r,$this->iBaseColor1);
    	    $this->FilledCircle($img,$this->xc,$this->yc,$r-2,$this->iBaseColor2);
    	    $this->FilledCircle($img,$this->xc,$this->yc,$r2,$this->iBaseColor3);
    	}
        }
    }
     
    //===================================================
    // CLASS LayoutVert
    // Description: Layout class which orders its objects
    // vertically
    //===================================================
    class LayoutVert {
        var $iObj;
     
        function LayoutVert($aObjArr) {
    	if( !is_array($aObjArr) )
    	    $aObjArr = array($aObjArr);
    	$this->iObj = $aObjArr;
        }
     
        function LayoutSize() {
    	return count($this->iObj);
        }
     
        function Stroke($graph) {
    	$img = $graph->img;
    	$n = count($this->iObj);
     
    	$s = 0;
    	for($i=0; $i<$n; ++$i) {
    	    $s += 1/$this->iObj[$i]->LayoutSize();
    	}
    	$d = 1/$s * $graph->img->plotheight ;
     
    	$otx = $graph->img->transx;
    	$oty = $graph->img->transy;
    	$h = $graph->img->plotheight;
    	$w = $graph->img->plotwidth;
    	$accheight = 0;
    	for($i=0; $i<$n; ++$i ) {
    	    $graph->img->SetTranslation($otx,$oty+$accheight);
    	    $accheight += $d / $this->iObj[$i]->LayoutSize();
    	    $graph->img->plotheight = $d / $this->iObj[$i]->LayoutSize();
    	    $this->iObj[$i]->Stroke($graph);
    	    $graph->img->plotheight = $h;
    	    $graph->img->plotwidth = $w;
    	}
        }
    }
     
    //===================================================
    // CLASS LayoutHor
    // Description: Layout class which orders its objects
    // horizontally
    //===================================================
    class LayoutHor {
        var $iObj;
     
        function LayoutHor($aObjArr) {
    	if( !is_array($aObjArr) )
    	    $aObjArr = array($aObjArr);
    	$this->iObj = $aObjArr;
        }
     
        function LayoutSize() {
    	return count($this->iObj);
        }
     
        function Stroke($graph) {
    	$img = $graph->img;
    	$n = count($this->iObj);
     
     
    	$s = 0;
    	for($i=0; $i<$n; ++$i) {
    	    $s += 1/$this->iObj[$i]->LayoutSize();
    	}
    	$d = 1/$s * $graph->img->plotwidth ;
     
    	$otx = $graph->img->transx;
    	$oty = $graph->img->transy;
    	$h = $graph->img->plotheight;
    	$w = $graph->img->plotwidth;
    	$accwidth = 0;
    	for($i=0; $i<$n; ++$i ) {
    	    $graph->img->SetTranslation($otx+$accwidth,$oty);
    	    $accwidth += $d / $this->iObj[$i]->LayoutSize();
    	    $graph->img->plotwidth = $d / $this->iObj[$i]->LayoutSize();
    	    $this->iObj[$i]->Stroke($graph);
    	    $graph->img->plotheight = $h;
    	    $graph->img->plotwidth = $w;
    	}
        }
    }
     
    // <EOF>
    ?>
    Merci d'avance, cordialement.
    Intel I7 960 | 6 Go Ram | 5 HDD au total 3636 Go | Windows 7 Edition intégral x64 | WampServer 2.0c | Apache 2.2.8 | Php 5.2.6 | MySQL 5.0.51b
    DreamPlug | 512 mo ram | SSD 16 GO | Linux debian 2.6.39.4 | armv5tel | Lamp | PHP 5.3.3-7 | Apache 2.2.16 | Mysql 14.14

  4. #4
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    412
    Détails du profil
    Informations personnelles :
    Âge : 52
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Décembre 2008
    Messages : 412
    Points : 79
    Points
    79
    Par défaut
    re bonsoir,

    J'ai trouve l'erreur precedente de l'ancien code .

    Faut ce n'ai pas un problême d'espace, j'ai donc rectifié le code

    A la ligne 34
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $odo= new OdoGraph (0, "100");
    A la ligne 49
    Et a la ligne 16, 18, 28 j'ai mis après SetColor "white"
    A la ligne 39 j'ai remplacé rouge par red.

    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
    <?php
    include ("jpgraph.php");
    include ("jpgraph_odo.php");
     
    //------------------------------------------------ ---------------------
    // Création d'un graphique à l'odomètre de nouvelles (width = 250, height = 200 pixels)
    //------------------------------------------------ ---------------------
    $graph = new OdoGraph (250,200);
     
    //------------------------------------------------ ---------------------
    // Spécifiez le titre et le sous-utilisation des polices par défaut
    // * Notez chaque titre mai être multilignes en utilisant un '\ n' comme une ligne
    // Diviseur.
    //------------------------------------------------ ---------------------
    $graph-> titre-> set ( "niveau"); // title Odomètre
    $graph-> titre-> SetColor ( "white"); //blanc
    $graph-> subtitle-> Set ( "2002-02-13");
    $graph-> Sous_titre-> SetColor ( "white");
     
    //------------------------------------------------ ---------------------
    // Specify légende.
    // * (Ceci est le texte au bas du graphique.) Les marges seront
    // Ajuste automatiquement pour s'adapter à la hauteur du texte. Une légende
    // Mai ont des lignes multiples en incluant un '\ n' caractère dans la
    // Chaîne.
    //------------------------------------------------ ---------------------
    $graph-> caption-> Set ( "Première ligne caption \ n. .. deuxième ligne");
    $graph-> caption-> SetColor ( "white");
     
    //------------------------------------------------ ---------------------
    // Maintenant nous devons créer un compteur kilométrique pour les ajouter à la représentation graphique.
    // Par défaut, l'échelle sera de 0 à 100
    //------------------------------------------------ ---------------------
    $odo= new OdoGraph (0, "100");
     
    //------------------------------------------------ ---------------------
    // Définir la couleur à l'indication des valeurs entre 80 et 100 en rouge
    //------------------------------------------------ ---------------------
    $odo-> AddIndication (80100, "red");
     
    //------------------------------------------------ ---------------------
    // Affichage de la valeur Set pour le compteur kilométrique
    //------------------------------------------------ ---------------------
    $odo-> aiguille> Set (30);
     
    //------------------------------------------------ ---------------------
    // Ajouter l'odomètre à la courbe
    //------------------------------------------------ ---------------------
    $graph-> Add ($ODO);
     
    //------------------------------------------------ ---------------------
    // ... et, enfin, l'AVC et le flux de l'image sur le navigateur
    //------------------------------------------------ ---------------------
    $graph-> Stroke ();?>
    PS : Moralité il faut faire attention au traducteur quand ont fait un copier coller.

    Au final j'ai encore le même message d'erreur
    Fatal error: Call to undefined method Graph::graph() in L:\Program files 2\wamp\www\maison\jpgraph-3.0.7\src\jpgraph_odo.php on line 68
    Merci d'avance.
    Intel I7 960 | 6 Go Ram | 5 HDD au total 3636 Go | Windows 7 Edition intégral x64 | WampServer 2.0c | Apache 2.2.8 | Php 5.2.6 | MySQL 5.0.51b
    DreamPlug | 512 mo ram | SSD 16 GO | Linux debian 2.6.39.4 | armv5tel | Lamp | PHP 5.3.3-7 | Apache 2.2.16 | Mysql 14.14

  5. #5
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 726
    Points
    10 726
    Par défaut
    pourquoi tu mets des espaces partout ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $graph-> titre-> set ( "niveau");
    et ca c'est quoi ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $odo-> aiguille> Set (30);
    t'as vraiment une méthode qui s'appelle "aiguille>"
    vérifie ta syntaxe...

  6. #6
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    412
    Détails du profil
    Informations personnelles :
    Âge : 52
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Décembre 2008
    Messages : 412
    Points : 79
    Points
    79
    Par défaut
    bonjour,

    j'ai reduit le nombre d'espaces, mais cela ne change rien

    J'ai toujour le même message :
    Fatal error: Call to undefined method Graph::graph() in L:\Program files 2\wamp\www\maison\jpgraph-3.0.7\src\jpgraph_odo.php on line 68
    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
     
    <?php
    include("jpgraph.php");
    include("jpgraph_odo.php");
     
    //------------------------------------------------ ---------------------
    // Création d'un graphique à l'odomètre de nouvelles (width = 250, height = 200 pixels)
    //------------------------------------------------ ---------------------
    $graph = new OdoGraph(250,200);
     
    //------------------------------------------------ ---------------------
    // Spécifiez le titre et le sous-utilisation des polices par défaut
    // * Notez chaque titre mai être multilignes en utilisant un '\ n' comme une ligne
    // Diviseur.
    //------------------------------------------------ ---------------------
    $graph-> titre-> set("niveau"); // title Odomètre
    $graph-> titre-> SetColor("white"); //blanc
    $graph-> subtitle-> Set("2002-02-13");
    $graph-> Sous_titre-> SetColor("white");
     
    //------------------------------------------------ ---------------------
    // Specify légende.
    // * (Ceci est le texte au bas du graphique.) Les marges seront
    // Ajuste automatiquement pour s'adapter à la hauteur du texte. Une légende
    // Mai ont des lignes multiples en incluant un '\ n' caractère dans la
    // Chaîne.
    //------------------------------------------------ ---------------------
    $graph-> caption-> Set("Première ligne caption \ n. .. deuxième ligne");
    $graph-> caption-> SetColor("white");
     
    //------------------------------------------------ ---------------------
    // Maintenant nous devons créer un compteur kilométrique pour les ajouter à la représentation graphique.
    // Par défaut, l'échelle sera de 0 à 100
    //------------------------------------------------ ---------------------
    $odo= new OdoGraph(0, "100");
     
    //------------------------------------------------ ---------------------
    // Définir la couleur à l'indication des valeurs entre 80 et 100 en rouge
    //------------------------------------------------ ---------------------
    $odo-> AddIndication(80100, "red");
     
    //------------------------------------------------ ---------------------
    // Affichage de la valeur Set pour le compteur kilométrique
    //------------------------------------------------ ---------------------
    $odo-> needle> Set(30);
     
    //------------------------------------------------ ---------------------
    // Ajouter l'odomètre à la courbe
    //------------------------------------------------ ---------------------
    $graph-> Add($ODO);
     
    //------------------------------------------------ ---------------------
    // ... et, enfin, l'AVC et le flux de l'image sur le navigateur
    //------------------------------------------------ ---------------------
    $graph-> Stroke();?>
    Merci.
    Intel I7 960 | 6 Go Ram | 5 HDD au total 3636 Go | Windows 7 Edition intégral x64 | WampServer 2.0c | Apache 2.2.8 | Php 5.2.6 | MySQL 5.0.51b
    DreamPlug | 512 mo ram | SSD 16 GO | Linux debian 2.6.39.4 | armv5tel | Lamp | PHP 5.3.3-7 | Apache 2.2.16 | Mysql 14.14

  7. #7
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 726
    Points
    10 726
    Par défaut
    le probleme vient de jpgraph_odo.php pas de ton code, il dis juste quel a methode "graph" n'existe pas pour la class "Graph", t'as lib odo est obsolète "2002-02-14" par rapport a la lib jpgraph '2010-01-11'

    au lieu de :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Graph::Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);
    essayes avec
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    parent::__construct($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);

  8. #8
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    412
    Détails du profil
    Informations personnelles :
    Âge : 52
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Décembre 2008
    Messages : 412
    Points : 79
    Points
    79
    Par défaut
    Bonsoir,

    J'ai donc remplacer la ligne avec ceci
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    parent::__construct($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);
    j'ai maintenant le message d'erreur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Fatal error: Call to a member function set() on a non-object in L:\Program files 2\wamp\www\maison\jpgraph-3.0.7\src\odometre.php on line 15
    La ligne 15 est :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $graph-> titre-> set("niveau"); // title Odomètre
    le probleme vient de jpgraph_odo.php pas de ton code, il dis juste quel a methode "graph" n'existe pas pour la class "Graph", t'as lib odo est obsolète "2002-02-14" par rapport a la lib jpgraph '2010-01-11'
    De quel version de JPGraph est la 2002-02-14 ?

    Merci.
    Intel I7 960 | 6 Go Ram | 5 HDD au total 3636 Go | Windows 7 Edition intégral x64 | WampServer 2.0c | Apache 2.2.8 | Php 5.2.6 | MySQL 5.0.51b
    DreamPlug | 512 mo ram | SSD 16 GO | Linux debian 2.6.39.4 | armv5tel | Lamp | PHP 5.3.3-7 | Apache 2.2.16 | Mysql 14.14

  9. #9
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 726
    Points
    10 726
    Par défaut
    prend la version php4

  10. #10
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    412
    Détails du profil
    Informations personnelles :
    Âge : 52
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Décembre 2008
    Messages : 412
    Points : 79
    Points
    79
    Par défaut
    Bonsoir,

    Je vient de faire un test avec la version 1.27 cela fonctionne a merveille sur le nouveau code donc test1 et test2 .

    Sur l'ancien code j'ai toujour le même problême a la ligne 15 ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Fatal error: Call to a member function set() on a non-object in L:\Program files 2\wamp\www\maison\jpgraph-1.27\jpgraph-1.27\src\odometre.php on line 15
    Ligne 15
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $graph-> titre-> set("niveau"); // title Odomètre

    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
    <?php
    include("jpgraph.php");
    include("jpgraph_odo.php");
     
    //------------------------------------------------ ---------------------
    // Création d'un graphique à l'odomètre de nouvelles (width = 250, height = 200 pixels)
    //------------------------------------------------ ---------------------
    $graph = new OdoGraph(250,200);
     
    //------------------------------------------------ ---------------------
    // Spécifiez le titre et le sous-utilisation des polices par défaut
    // * Notez chaque titre mai être multilignes en utilisant un '\ n' comme une ligne
    // Diviseur.
    //------------------------------------------------ ---------------------
    $graph-> titre-> set("niveau"); // title Odomètre
    $graph-> titre-> SetColor("white"); //blanc
    $graph-> subtitle-> Set("2002-02-13");
    $graph-> Sous_titre-> SetColor("white");
     
    //------------------------------------------------ ---------------------
    // Specify légende.
    // * (Ceci est le texte au bas du graphique.) Les marges seront
    // Ajuste automatiquement pour s'adapter à la hauteur du texte. Une légende
    // Mai ont des lignes multiples en incluant un '\ n' caractère dans la
    // Chaîne.
    //------------------------------------------------ ---------------------
    $graph-> caption-> Set("Première ligne caption \ n. .. deuxième ligne");
    $graph-> caption-> SetColor("white");
     
    //------------------------------------------------ ---------------------
    // Maintenant nous devons créer un compteur kilométrique pour les ajouter à la représentation graphique.
    // Par défaut, l'échelle sera de 0 à 100
    //------------------------------------------------ ---------------------
    $odo= new OdoGraph(0, "100");
     
    //------------------------------------------------ ---------------------
    // Définir la couleur à l'indication des valeurs entre 80 et 100 en rouge
    //------------------------------------------------ ---------------------
    $odo-> AddIndication(80100, "red");
     
    //------------------------------------------------ ---------------------
    // Affichage de la valeur Set pour le compteur kilométrique
    //------------------------------------------------ ---------------------
    $odo-> needle> Set(30);
     
    //------------------------------------------------ ---------------------
    // Ajouter l'odomètre à la courbe
    //------------------------------------------------ ---------------------
    $graph-> Add($ODO);
     
    //------------------------------------------------ ---------------------
    // ... et, enfin, l'AVC et le flux de l'image sur le navigateur
    //------------------------------------------------ ---------------------
    $graph-> Stroke();?>
    Merci.
    Intel I7 960 | 6 Go Ram | 5 HDD au total 3636 Go | Windows 7 Edition intégral x64 | WampServer 2.0c | Apache 2.2.8 | Php 5.2.6 | MySQL 5.0.51b
    DreamPlug | 512 mo ram | SSD 16 GO | Linux debian 2.6.39.4 | armv5tel | Lamp | PHP 5.3.3-7 | Apache 2.2.16 | Mysql 14.14

  11. #11
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 726
    Points
    10 726
    Par défaut
    en gardant le jpgraph_odo.php d'origine ?

  12. #12
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    412
    Détails du profil
    Informations personnelles :
    Âge : 52
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Décembre 2008
    Messages : 412
    Points : 79
    Points
    79
    Par défaut
    j'ai trois questions avant dans terminer.

    Tout d'abord merci de votre aide et reponses.

    1/ J'ai ma page php qui fait un calcul, est qui me donnes le resultat

    Exemple
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    echo $Resultat =  $x - $y
    comment je doit faire pour envoyer le resultat dans odometre.php sur la ligne concerné
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $odo -> needle -> Set(50);
    car ont ne peut pas inserer directement en dur le code de l'odometre dans la page php, je l'ai donc inseré comme etant une image
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <img src="odometre8-test.php" width="250" height="150" />
    donc si je veut afficher le resultat du calcul dans l'odometre a la ligne de l'aiguille
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $odo -> needle -> Set($Resultat);
    comment dois je m'y prendre ?

    2/ j'ai aussi une basse de données mysql qui enregistre toutes les données, la encore comment je doit faire pour y afficher depuis la bdd ?

    3/ c'est pour un projet domotique une jauge electronique envoi tout les jours le resultat du niveau du fuel dans une basse de donné qui est inscript automatiquement sur une ligne dans le champs volume, et il possible dans l'odometre de replacer les chiffres 25 par 3/4, le chiffre 50 par 1/2, le chiffre 75 par 1/4 et 100 par la lettre F. Le but étant de créer le plus réaliste possible une jauge a fuel.

    Merci d'avance, cordialement.
    Intel I7 960 | 6 Go Ram | 5 HDD au total 3636 Go | Windows 7 Edition intégral x64 | WampServer 2.0c | Apache 2.2.8 | Php 5.2.6 | MySQL 5.0.51b
    DreamPlug | 512 mo ram | SSD 16 GO | Linux debian 2.6.39.4 | armv5tel | Lamp | PHP 5.3.3-7 | Apache 2.2.16 | Mysql 14.14

Discussions similaires

  1. [JpGraph] Odomètre
    Par xunil2003 dans le forum Bibliothèques et frameworks
    Réponses: 3
    Dernier message: 06/03/2010, 11h49
  2. msi ou comment réaliser un installeur?
    Par herzleid dans le forum Delphi
    Réponses: 11
    Dernier message: 09/04/2007, 19h27
  3. Réaliser un Chat avec support IP
    Par Sub0 dans le forum Développement
    Réponses: 12
    Dernier message: 14/07/2006, 10h59
  4. [Radio fréquence] réalisation d'une application
    Par WriteLN dans le forum Développement
    Réponses: 14
    Dernier message: 05/06/2003, 14h36
  5. [imprecis]Réaliser a^n avec seulement l'opérateur d'addition
    Par Amon dans le forum Algorithmes et structures de données
    Réponses: 18
    Dernier message: 08/11/2002, 22h22

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