Skip to content

Commit 46b6d57

Browse files
Improve handling of graphs in plugin
The selection of which graphs to show now follows the ones that are activated in the global settingsof com_jtg
1 parent 24c0ec7 commit 46b6d57

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

components/com_jtg/helpers/maphelper.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,9 @@ static public function parseGraphSeriesJS($seriesData, $label, $units, $linecolo
465465
* @param object $cfg jtg configuration object
466466
* @param object $params jtg parameters object
467467
* @param boolean $usepace use pace instead of speed
468-
* @param boolean $showgraph show graph even if the settings in the params are off (used in plugin)
469468
* @param string $elementid id of element on the page where the graph is shown
470469
**/
471-
static public function parseGraphJS($gpsTrack, $cfg, $params, $usepace, $showgraph=false, $elementid='elevation') {
470+
static public function parseGraphJS($gpsTrack, $cfg, $params, $usepace, $elementid='elevation') {
472471
$defaultlinecolor = "#000000";
473472
$bgColor = $cfg->charts_bg? '#' . $cfg->charts_bg :"#ffffff";
474473

@@ -477,15 +476,15 @@ static public function parseGraphJS($gpsTrack, $cfg, $params, $usepace, $showgra
477476

478477
$axisnumber = 0;
479478

480-
if ( ($showgraph OR $params->get("jtg_param_show_heightchart")) AND $gpsTrack->elevationDataExists)
479+
if ( $params->get("jtg_param_show_heightchart") AND $gpsTrack->elevationDataExists)
481480
{
482481
$charts_linec = $cfg->charts_linec? '#' . $cfg->charts_linec: $defaultlinecolor;
483482
$axesJS[] = JtgMapHelper::parseGraphAxisJS(JText::_('COM_JTG_ELEVATION'), JText::_('COM_JTG_ELEVATION_UNIT'), $charts_linec,'false');
484483
$seriesJS[] = JtgMapHelper::parseGraphSeriesJS($gpsTrack->elevationData, JText::_('COM_JTG_ELEVATION'), JText::_('COM_JTG_ELEVATION_UNIT'), $charts_linec, $axisnumber);
485484
$axisnumber ++;
486485
}
487486

488-
if ( ($showgraph OR $params->get("jtg_param_show_speedchart")) AND $gpsTrack->speedDataExists )
487+
if ( $params->get("jtg_param_show_speedchart") AND $gpsTrack->speedDataExists )
489488
{
490489
$speedcharthide = 0;
491490
if ($usepace)
@@ -508,7 +507,7 @@ static public function parseGraphJS($gpsTrack, $cfg, $params, $usepace, $showgra
508507
$axisnumber ++;
509508
}
510509

511-
if (($showgraph OR $params->get("jtg_param_show_speedchart")) AND $gpsTrack->beatDataExists )
510+
if ($params->get("jtg_param_show_speedchart") AND $gpsTrack->beatDataExists )
512511
{
513512
// Beatchart is on left (first) axis or on right axis when there is a heighchart or a speed chart
514513
$beatchartaxis = $axisnumber + 1;
@@ -540,7 +539,7 @@ static public function parseGraphJS($gpsTrack, $cfg, $params, $usepace, $showgra
540539
$autocenter = (bool) $params->get("jtg_param_use_map_autocentering", true) ? 'true':'false';
541540
if (! (bool) $params->get("jtg_param_disable_map_animated_cursor", false)) $animatedCursor = 'true, animatedCursorLayer, animatedCursorIcon, allpoints'; else $animatedCursor='false';
542541
$graphJS .= '<script type="text/javascript">'."\n".
543-
"makeGraph('$elementid',jtgAxes, jtgSeries, '".JText::_('COM_JTG_DISTANCE')."', '".JText::_('COM_JTG_DISTANCE_UNIT_'.strtoupper($cfg->unit))."', '$clicktohide', '$bgColor', '$autocenter', $animatedCursor); \n".
542+
"makeGraph('$elementid',jtgAxes, jtgSeries, '".JText::_('COM_JTG_DISTANCE')."', '".JText::_('COM_JTG_DISTANCE_UNIT_'.strtoupper($cfg->unit))."', '$clicktohide', '$bgColor', $autocenter, $animatedCursor); \n".
544543
"</script>\n";
545544
}
546545
return $graphJS;

plugins/content/jtrackgallery_maps/jtrackgallery_maps.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private function rendermap($plgParams, $plg_call_params)
304304
{
305305
$usepace = false;
306306
$graphid = "elevation_".$this->map_count;
307-
$graphJS = JtgMapHelper::parseGraphJS($gpsData, $cfg, $params, $usepace, true, $graphid);
307+
$graphJS = JtgMapHelper::parseGraphJS($gpsData, $cfg, $params, $usepace, $graphid);
308308
if (!empty($graphJS))
309309
{
310310
$map .= '<div id="profile" style="width: '.$map_width.';" >'."\n".

0 commit comments

Comments
 (0)