/dev/adei/adei-asec-setup

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/adei/adei-asec-setup

« back to all changes in this revision

Viewing changes to classes/draw.php

  • Committer: Artur Reymers
  • Date: 2014-07-26 19:21:51 UTC
  • Revision ID: remoart@gmail.com-20140726192151-4dr2sijp40wccibw
Add: Links to wiki pages and files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1120
1120
    
1121
1121
    if ($this->ready) return;
1122
1122
 
 
1123
//// by Arthur ////////////////////////////////////////////////////////////////////////////////////////////////////
 
1124
 
 
1125
    if (isset($this->req->props['font_size'])) $axis_font['font_size'] = $this->req->props['font_size'];
 
1126
    else $axis_font['font_size'] = 16;
 
1127
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
1128
 
1123
1129
    list($axes, $data, $spec) = $this->PrepareData($this->reader, $mask, $iv);
1124
1130
 
1125
1131
    $draw_modes = array();
1161
1167
    if ($xaxis['label_interval']) {
1162
1168
        $this->graph->xaxis->SetTextLabelInterval($xaxis['label_interval']);
1163
1169
    }
1164
 
        $this->graph->xaxis->title->SetFont(FF_ARIAL, FS_NORMAL, 8);
 
1170
        $this->graph->xaxis->title->SetFont(FF_ARIAL, FS_NORMAL, $axis_font['font_size']);        //it is needed to change by Arthur
1165
1171
        $this->graph->xaxis->SetTitlemargin(11);
1166
1172
    $this->graph->xaxis->SetTitle("UT", "high");
1167
1173
    if ($this->hide_axes) {
1174
1180
    }
1175
1181
 
1176
1182
    $this->graph_margin = array();
1177
 
    
 
1183
 
 
1184
/// by Arthur   ////////////////////////////////////////////////////////////////////////////////////////////
 
1185
 
 
1186
    $GRAPH_MARGINS['axis'] = (73 * $axis_font['font_size'] + 207)/11; // - (5 * $this->width - 3810)/762;
 
1187
 
 
1188
///////////////////////////////////////////////////////////////////////////////////////////////
 
1189
 
1178
1190
    if ($hide_y) {
1179
1191
        $this->graph_yaxis_size = 0;
1180
1192
        if ($hide_x) {
1202
1214
 
1203
1215
        $title = $this->GenerateTitle($data, $spec);
1204
1216
        $this->graph->title->Set($title);
 
1217
        $this->graph->title->SetFont(FF_ARIAL, FS_NORMAL, $axis_font['font_size']+1);                  //it is needed to change by Arthur
1205
1218
 
1206
1219
        $this->graph->xaxis->SetPos("min");
1207
1220
        //$this->graph->xaxis->SetLabelAngle(0);
1208
 
        $this->graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
 
1221
        $this->graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, $axis_font['font_size']);                   //it is needed to change by Arthur
1209
1222
        //$this->graph->xaxis->scale->SetTimeAlign(MINADJ_15);
1210
1223
 
1211
1224
        // We can use SetLabelFormatCallback for higher control
1312
1325
    }
1313
1326
        if((int)intval($this->plot_mode) === DRAW::PLOT_STANDARD)
1314
1327
        {
 
1328
            $graph_ynaxis_DigitsNumber = 0;   // by Arthur
1315
1329
            foreach ($axis as $i => $plot_data) {
1316
1330
                $plot = new LinePlot($plot_data[1], $plot_data[0]);
1317
 
            
 
1331
 
 
1332
                if(strlen(strval(max($plot_data[1]))) > $graph_ynaxis_DigitsNumber) $graph_ynaxis_DigitsNumber = strlen(strval(max($plot_data[1])));  // by Arthur
 
1333
 
1318
1334
                $color = $axis->GetChannelColor($i);
1319
1335
                if ($color) $plot->SetColor($color);
1320
1336
 
1344
1360
                $items = $info['items'];
1345
1361
                $time = $info['time'];
1346
1362
                $values = $info['values'];
1347
 
            
 
1363
 
 
1364
                $graph_ynaxis_DigitsNumber = 0;     // by Arthur
1348
1365
                foreach ($axis as $i => $plot_data) {
1349
1366
                    $plot = new LinePlot($plot_data[1], $plot_data[0]);
1350
1367
 
 
1368
                    if(strlen(strval(max($plot_data[1]))) > $graph_ynaxis_DigitsNumber) $graph_ynaxis_DigitsNumber = strlen(strval(max($plot_data[1])));    // by Arthur
 
1369
 
1351
1370
                    $color = $axis->GetChannelColor($i);
1352
1371
                    if ($color) $plot->SetColor($color);
1353
1372
 
1393
1412
    else if((int)intval($this->plot_mode) ===  DRAW::PLOT_PERCENTS)//Constraint in Percents
1394
1413
    {
1395
1414
        $this->plot_mode_mean = $this->FindPlotMode($this->req->props['plot_mode_mean']);
 
1415
        $graph_ynaxis_DigitsNumber = 0;         // by Arthur
1396
1416
        foreach ($axis as $i => $plot_data) {
1397
1417
        if($this->plot_mode_mean != 10)
1398
1418
        {
1416
1436
            }
1417
1437
        }
1418
1438
        $plot = new LinePlot($plot_data[1], $plot_data[0]);
1419
 
        
 
1439
 
 
1440
        if(strlen(strval(max($plot_data[1]))) > $graph_ynaxis_DigitsNumber) $graph_ynaxis_DigitsNumber = strlen(strval(max($plot_data[1])));         // by Arthur
 
1441
 
1420
1442
        $color = $axis->GetChannelColor($i);
1421
1443
        if ($color) $plot->SetColor($color);
1422
1444
 
1438
1460
    }
1439
1461
    else if((int)intval($this->plot_mode) ===  DRAW::PLOT_STDDEV)//Constraint in StdDev.
1440
1462
    {
 
1463
        $graph_ynaxis_DigitsNumber = 0;          // by Arthur
1441
1464
        foreach ($axis as $i => $plot_data) {
1442
1465
             $iCnt = 0;
1443
1466
             $tmp = array();
1460
1483
                unset($tmp);
1461
1484
                foreach ($plot_data[1] as $r => $plot_data_point)
1462
1485
                {
1463
 
            
1464
1486
                    if($plot_data_point!=NULL) {$plot_data[1][$r] = $sigma2?(($plot_data_point - $meanVal)/(sqrt($sigma2))):0;}
1465
1487
                }
1466
1488
            }
1467
 
            
 
1489
 
1468
1490
        $plot = new LinePlot($plot_data[1], $plot_data[0]);
1469
 
        
 
1491
 
 
1492
        if(strlen(strval(max($plot_data[1]))) > $graph_ynaxis_DigitsNumber) $graph_ynaxis_DigitsNumber = strlen(strval(max($plot_data[1])));       // by Arthur
 
1493
 
1470
1494
        $color = $axis->GetChannelColor($i);
1471
1495
        if ($color) $plot->SetColor($color);
1472
1496
 
1473
1497
        $weight = $axis->GetChannelProperty($i, "weight");
1474
1498
        if ($weight) $plot->SetWeight($weight);
1475
 
        
 
1499
 
1476
1500
        if ($spec['marks']) {
1477
1501
            $prop = $axis->GetChannelProperty($i, "mark_type");
1478
1502
            if ($prop) $plot->mark->SetType($prop);
1486
1510
        $empty_axis = false;
1487
1511
        }
1488
1512
    }
1489
 
        
 
1513
 
1490
1514
        if ($empty_axis) {
1491
1515
            $plot = new LinePlot(array(0), array($spec['from']));
1492
1516
            $this->graph->AddY($axis_i, $plot);
1507
1531
        $this->graph->ynaxis[$axis_i]->SetTickSide(SIDE_RIGHT);
1508
1532
        $this->graph->ynaxis[$axis_i]->SetLabelSide(SIDE_LEFT);
1509
1533
        $this->graph->ynaxis[$axis_i]->SetPosAbsDelta(-$axis_i * $this->graph_yaxis_size - 2);
 
1534
        $this->graph->ynaxis[$axis_i]->SetFont(FF_ARIAL, FS_NORMAL, $axis_font['font_size']);                           // by Arthur
 
1535
        $this->graph->ynaxis[$axis_i]->title->SetFont(FF_ARIAL, FS_NORMAL, $axis_font['font_size']);                    // by Arthur
1510
1536
 
1511
1537
        if (!$range) $this->graph->ynaxis[$axis_i]->scale->SetGrace(0.1,0.1);
1512
1538
 
1524
1550
        }
1525
1551
        $this->graph->ynaxis[$axis_i]->SetTitle($title, "high");
1526
1552
        $this->graph->ynaxis[$axis_i]->SetTitleSide(SIDE_LEFT);
 
1553
 
 
1554
// This is by Arthur   ////////////////////////////////////////////////////////////////
 
1555
        $graph_ynaxis_TitleMarginShift = 0;
 
1556
        if ($graph_ynaxis_DigitsNumber == 4) $graph_ynaxis_TitleMarginShift = $graph_ynaxis_DigitsNumber * (2 * ($axis_font['font_size']) + 4)/5;
 
1557
        if ($graph_ynaxis_DigitsNumber == 3) $graph_ynaxis_TitleMarginShift = $graph_ynaxis_DigitsNumber * (7 * ($axis_font['font_size']) + 14)/10;
 
1558
        if ($graph_ynaxis_DigitsNumber == 2) $graph_ynaxis_TitleMarginShift = $graph_ynaxis_DigitsNumber * ($axis_font['font_size'] + 2);
 
1559
        if ($graph_ynaxis_DigitsNumber == 1) $graph_ynaxis_TitleMarginShift = $graph_ynaxis_DigitsNumber * (17 * ($axis_font['font_size']) + 114)/10;
 
1560
///////////////////////////////////////////////////////////////////////////////////////
 
1561
//        $this->graph->ynaxis[$axis_i]->SetTitle($graph_ynaxis_TitleMarginShift, "high");
 
1562
 
1527
1563
        if ($JPGRAPH_VERSION > 2) {
1528
 
            $this->graph->ynaxis[$axis_i]->SetTitleMargin(15 - $this->graph_yaxis_size);
 
1564
            $this->graph->ynaxis[$axis_i]->SetTitleMargin((23 * ($axis_font['font_size']) + 106)/13 + $graph_ynaxis_TitleMarginShift - $this->graph_yaxis_size);    // This is by Arthur 
 
1565
//            $this->graph->ynaxis[$axis_i]->SetTitleMargin(15 - $this->graph_yaxis_size);
1529
1566
        } else {
1530
1567
            $this->graph->ynaxis[$axis_i]->SetTitleMargin($this->graph_yaxis_size-20);
1531
1568
        }