Пример #1
0
// load the Google jsapi
$document = JFactory::getDocument();
$document->addScript("https://www.google.com/jsapi");
// display the heading and top text
echo "\n<h2>" . $menu_params->get('page_hdr') . '</h2>';
echo "\n<div>" . $menu_params->get('top_text') . '</div>';
// get the model
jimport('joomla.application.component.model');
$model = new PlotalotModelChart();
// draw the charts
$chart_id_array = explode(",", $menu_params->get('chart_ids'));
if (count($chart_id_array) == 0) {
    echo "\n<div>No charts specified</div>";
    return;
}
$plotalot = new Plotalot();
foreach ($chart_id_array as $chart_id) {
    $plot_info = $model->getOne($chart_id);
    // load the chart definition from the table
    if ($plot_info === false) {
        echo "\n<div>Chart {$chart_id} not defined</div>";
        continue;
    }
    if (!$plot_info->published) {
        continue;
    }
    // skip if not published
    $chart = $plotalot->drawChart($plot_info);
    // have Plotalot create the script or html
    if ($chart == '') {
        echo "\n<div>Chart {$chart_id} : " . $plotalot->error . "</div>";
Пример #2
0
    function display($tpl = null)
    {
        global $chart_types;
        if ($this->chart_data->id == 0) {
            // creating a new record
            JToolBarHelper::title(LAP_COMPONENT_NAME . ': ' . JText::_('COM_PLOTALOT_NEW_ITEM'), 'plotalot.png');
        } else {
            JToolBarHelper::title(LAP_COMPONENT_NAME . ': ' . JText::_('COM_PLOTALOT_EDIT_ITEM') . ' ' . $this->chart_data->id, 'plotalot.png');
        }
        JToolBarHelper::apply();
        JToolBarHelper::save();
        if ($this->chart_data->id > 0) {
            JToolBarHelper::save2copy();
        }
        JToolBarHelper::cancel('cancel', 'JTOOLBAR_CLOSE');
        JToolBarHelper::preferences(LAP_COMPONENT, 350, 450);
        JToolBarHelper::custom('help', 'help.png', 'help_f2.png', 'JHELP', false);
        // load our front end css, if it exists
        LAP_view::load_styles();
        // get component parameters
        $params = JComponentHelper::getParams(LAP_COMPONENT);
        $this->tooltips = $params->get('tooltips', 1);
        if ($params->get('autocomplete', 1)) {
            $autocomplete = 'autocomplete="off"';
            if (empty($this->chart_data->db_user)) {
                // some browsers don't respect autocomplete="off"
                $this->chart_data->db_user = '******';
            }
            // the model will intercept this and remove it
        } else {
            $autocomplete = '';
        }
        ?>
	<form action="index.php" method="post" name="adminForm" id="adminForm" <?php 
        echo $autocomplete;
        ?>
 >

	<input type="hidden" name="option" value="<?php 
        echo LAP_COMPONENT;
        ?>
" />
	<input type="hidden" name="id" value="<?php 
        echo $this->chart_data->id;
        ?>
" />
	<input type="hidden" name="chart_type" value="<?php 
        echo $this->chart_data->chart_type;
        ?>
" />
	<input type="hidden" name="y_size" value="1" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="controller" value="" />
	<input type="hidden" name="plot_enable_0" value="1" />
	<?php 
        echo JHTML::_('form.token');
        ?>

	<table class="plot_table">
	<tr>
		<td class="pright">
			<?php 
        echo $this->make_prompt('COM_PLOTALOT_NAME', 'COM_PLOTALOT_TOOLTIP_CHART_NAME');
        ?>
		</td>
		<td>
			<?php 
        echo '<input type="text" class="p_short" name="chart_name" id="chart_name" size="80" 
			maxlength="250" value="' . htmlspecialchars($this->chart_data->chart_name) . '" />';
        ?>
		</td>
	</tr>

	<tr>
		<td class="pright">
			<?php 
        echo $this->make_prompt('COM_PLOTALOT_DATABASE', 'COM_PLOTALOT_TOOLTIP_DB_NAME');
        ?>
		</td>
		<td>
				<?php 
        echo '<input type="text" class="p_short" name="db_name" size="18" maxlength="250" value="' . htmlspecialchars($this->chart_data->db_name) . '" />';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_HOST', 'COM_PLOTALOT_TOOLTIP_DB_HOST');
        echo '<input type="text" class="p_short" name="db_host" size="10" maxlength="250" value="' . htmlspecialchars($this->chart_data->db_host) . '" />';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_USER', 'COM_PLOTALOT_TOOLTIP_DB_USER');
        echo '<input type="text" class="p_short" name="db_user" size="10" maxlength="250" value="' . htmlspecialchars($this->chart_data->db_user) . '" ' . $autocomplete . ' />';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_PASSWORD', 'COM_PLOTALOT_TOOLTIP_DB_USER');
        echo '<input type="password" class="p_short" name="db_pass" size="9" maxlength="250" value="' . $this->chart_data->db_pass . '" ' . $autocomplete . ' />';
        ?>
		</td>
	</tr>

	<tr>
		<td class="pright" style="vertical-align: top;">
			<?php 
        echo $this->make_prompt('COM_PLOTALOT_QUERY', 'COM_PLOTALOT_TOOLTIP_TABLE_QUERY');
        ?>
		</td>
		<td>
			<?php 
        if (isset($this->chart_data->plot_array[0]['query'])) {
            $query = $this->chart_data->plot_array[0]['query'];
        } else {
            $query = '';
        }
        echo '<textarea class="p_short" name="query[0]" rows="6" cols="100">' . htmlspecialchars($query) . '</textarea>';
        ?>
		</td>
	</tr>
	</table>

	</form>
	<?php 
        // if new, don't try to draw the chart
        if ($this->chart_data->id == 0) {
            return;
        }
        // create the item text
        $plotalot = new Plotalot();
        if ($this->chart_data->db_user == '-') {
            $this->chart_data->db_user = '';
        }
        $chart_html = $plotalot->drawChart($this->chart_data);
        // Show any errors
        if ($plotalot->error != '') {
            echo '<div class="plotalot_error">' . JText::_('COM_PLOTALOT_ERROR') . ': ' . $plotalot->error . '</div>';
        }
        if ($plotalot->warning != '') {
            echo '<div class="plotalot_error">' . JText::_('COM_PLOTALOT_WARNING') . ': ' . $plotalot->warning . '</div>';
        }
        // Output the text
        echo '<div style="float:left; margin-left:35px; padding:5px; border:2px solid black; background-color: white;">' . $chart_html . '</div>';
    }
Пример #3
0
    function display($tpl = null)
    {
        // the controller has already populated the data into $this->chart_data
        if ($this->chart_data->id == 0) {
            // creating a new record
            JToolBarHelper::title(LAP_COMPONENT_NAME . ': ' . JText::_('COM_PLOTALOT_NEW_CHART'), 'plotalot.png');
        } else {
            JToolBarHelper::title(LAP_COMPONENT_NAME . ': ' . JText::_('COM_PLOTALOT_EDIT_CHART') . ' ' . $this->chart_data->id, 'plotalot.png');
        }
        JToolBarHelper::apply();
        JToolBarHelper::save();
        if ($this->chart_data->id > 0) {
            JToolBarHelper::save2copy();
        }
        JToolBarHelper::cancel('cancel', 'JTOOLBAR_CLOSE');
        JToolBarHelper::preferences(LAP_COMPONENT, 350, 450);
        JToolBarHelper::custom('help', 'help.png', 'help_f2.png', 'JHELP', false);
        // load our front end css, if it exists
        LAP_view::load_styles();
        // are we coming back with a validation failure?
        if (isset($this->stored) and $this->stored === false) {
            $validation_failed = true;
        } else {
            $validation_failed = false;
        }
        // if we came back here as a result of the extra save button, scroll down so we can see the chart
        // - unless it was a validation failure, in which case we should stay at the top
        $document = JFactory::getDocument();
        $jinput = JFactory::getApplication()->input;
        $task = $jinput->get('task', '', 'STRING');
        // 'save' or 'apply'
        if ($task == 'apply2' and !$validation_failed) {
            $js = "\n window.addEvent('domready', function() {document.getElementById('chart_area').scrollIntoView();});";
            $document->addScriptDeclaration($js);
        }
        // get component parameters
        $params = JComponentHelper::getParams(LAP_COMPONENT);
        $this->tooltips = $params->get('tooltips', 1);
        $background = $params->get('background', 'FFFFFF');
        if (strcasecmp($background, 'transparent') != 0 and $background[0] != '#') {
            $background = '#' . $background;
        }
        if ($params->get('autocomplete', 1)) {
            $autocomplete = 'autocomplete="off"';
            if (empty($this->chart_data->db_user)) {
                // some browsers don't respect autocomplete="off"
                $this->chart_data->db_user = '******';
            }
            // the model will intercept this and remove it
        } else {
            $autocomplete = '';
        }
        // load the Javascript that hides and enables the chart type dependent fields
        // it is called by the 'domready' function and the 'onchange' function of the chart type list selector
        $document->addScript(JURI::base(true) . '/components/com_plotalot/assets/chart_edit.js?2');
        $dom_ready = "\nwindow.addEvent('domready', function() {plotalot_fields(" . $this->chart_data->chart_type . ");});\n";
        $document->addScriptDeclaration($dom_ready);
        // make objects
        $plotalot = new Plotalot();
        $plotutil = new Plotalot_Utility();
        // make the chart type list
        $chart_type_list = LAP_view::make_list('chart_type', $this->chart_data->chart_type, $plotutil->chart_types, CHART_TYPE_LINE, 'onchange="plotalot_fields(this.value)"');
        // build the form
        ?>
	<form action="index.php" method="post" name="adminForm" id="adminForm" <?php 
        echo $autocomplete;
        ?>
 >

	<input type="hidden" name="option" value="<?php 
        echo LAP_COMPONENT;
        ?>
" />
	<input type="hidden" name="id" value="<?php 
        echo $this->chart_data->id;
        ?>
" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="controller" value="" />

	<table class="plot_table">
	<tr>
	<td width="50%" class="ptop">
		<fieldset class="adminform plotalot_form"><legend><?php 
        echo JText::_('COM_PLOTALOT_CHART');
        ?>
</legend>
		<table class="plot_table">
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_NAME', 'COM_PLOTALOT_TOOLTIP_CHART_NAME');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long" name="chart_name" maxlength="250" value="' . htmlspecialchars($this->chart_data->chart_name) . '" />';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_TYPE');
        ?>
			</td>
			<td>
				<?php 
        echo $chart_type_list;
        echo '<span class="pjh_all pjh_legend_type" >';
        echo ' ' . JText::_('COM_PLOTALOT_LEGEND');
        echo LAP_view::make_list('legend_type', $this->chart_data->legend_type, $plotutil->legendTypes);
        echo '</span>';
        echo '<span class="pjh_all pjh_chart_option_pie" >';
        echo ' ' . JText::_('COM_PLOTALOT_PIE_TEXT_TYPE');
        echo LAP_view::make_list('pie_chart_option', $this->chart_data->chart_option, $plotutil->pieTextTypes);
        echo '</span>';
        echo '<span class="pjh_all pjh_chart_option_bar" >';
        echo ' ' . LAP_view::make_checkbox('bar_chart_option', $this->chart_data->chart_option, JText::_('COM_PLOTALOT_ORDERED'));
        echo '</span>';
        ?>
			</td>
		</tr>
		
		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_SIZE');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_short" name="x_size" size="8" 
					value="' . $this->chart_data->x_size . '" />';
        echo ' x ';
        echo '<input type="text" class="p_short" name="y_size" size="8" 
					value="' . $this->chart_data->y_size . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_TITLE', 'COM_PLOTALOT_TOOLTIP_TITLE');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_short pjd_all pjd_chart_title" name="chart_title" size="60" maxlength="2000" value="';
        echo htmlspecialchars($this->chart_data->chart_title) . '" />';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_COLOUR', 'COM_PLOTALOT_TOOLTIP_COLOUR') . ' ';
        echo '<input type="text" class="p_short pjd_all pjd_chart_title color {required:false}" name="chart_title_colour" size="6" value="' . $this->chart_data->chart_title_colour . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_BACKGROUND', 'COM_PLOTALOT_TOOLTIP_COLOUR');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_short color {required:false}" name="back_colour" size="6" value="' . $this->chart_data->back_colour . '" />';
        echo '<span class="pjh_all pjh_show_grid" >';
        echo ' ' . LAP_view::make_checkbox('show_grid', $this->chart_data->show_grid, $this->make_prompt('COM_PLOTALOT_GRID', 'COM_PLOTALOT_TOOLTIP_GRID'));
        echo '</span>';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_DATABASE', 'COM_PLOTALOT_TOOLTIP_DB_NAME');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_short" name="db_name" size="18" maxlength="250" value="' . htmlspecialchars($this->chart_data->db_name) . '" />';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_HOST', 'COM_PLOTALOT_TOOLTIP_DB_HOST');
        echo '<input type="text" class="p_short" name="db_host" size="10" maxlength="250" value="' . htmlspecialchars($this->chart_data->db_host) . '" />';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_USER', 'COM_PLOTALOT_TOOLTIP_DB_USER');
        echo '<input type="text" class="p_short" name="db_user" size="10" maxlength="250" value="' . htmlspecialchars($this->chart_data->db_user) . '" ' . $autocomplete . ' />';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_PASSWORD', 'COM_PLOTALOT_TOOLTIP_DB_USER');
        echo '<input type="password" class="p_short" name="db_pass" size="9" maxlength="250" value="' . $this->chart_data->db_pass . '" ' . $autocomplete . ' />';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright ptop">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_EXTRA_PARAMS', 'COM_PLOTALOT_TOOLTIP_EXTRA_PARAMS');
        ?>
			</td>
			<td>
				<?php 
        echo '<textarea class="p_long" name="extra_parms" rows="1">' . htmlspecialchars($this->chart_data->extra_parms) . '</textarea>';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright ptop">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_EXTRA_COLUMNS', 'COM_PLOTALOT_TOOLTIP_EXTRA_COLUMNS');
        ?>
			</td>
			<td>
				<?php 
        echo '<textarea class="p_long" name="extra_columns" rows="1">' . htmlspecialchars($this->chart_data->extra_columns) . '</textarea>';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_NUM_PLOTS', 'COM_PLOTALOT_TOOLTIP_NUM_PLOTS');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_short pjd_all pjd_num_plots" size="5" name="num_plots" value = "' . $this->chart_data->num_plots . '" />';
        echo ' ' . LAP_view::make_checkbox('sort_plots', false, $this->make_prompt('COM_PLOTALOT_SORT_PLOTS', 'COM_PLOTALOT_TOOLTIP_SORT_PLOTS'));
        echo ' ' . LAP_view::make_checkbox('show_raw_data', $this->chart_data->show_raw_data, $this->make_prompt('COM_PLOTALOT_SHOW_RAW', 'COM_PLOTALOT_TOOLTIP_SHOW_RAW'));
        echo ' ' . LAP_view::make_checkbox('show_script', $this->chart_data->show_script, $this->make_prompt('COM_PLOTALOT_SHOW_SCRIPT', 'COM_PLOTALOT_TOOLTIP_SHOW_SCRIPT'));
        ?>
			</td>
		</tr>
		</table>
		</fieldset>
	</td>
	<td width="50%" class="ptop">
		<fieldset class="adminform plotalot_form"><legend><?php 
        echo JText::_('COM_PLOTALOT_AXES');
        ?>
</legend>
		<table class="plot_table">
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_X_TITLE', 'COM_PLOTALOT_TOOLTIP_X_TITLE');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long pjd_all pjd_xy_titles" name="x_title" maxlength="2000" value="';
        echo htmlspecialchars($this->chart_data->x_title) . '" />';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_X_START', 'COM_PLOTALOT_TOOLTIP_X_START');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long pjd_all pjd_x_params" name="x_start" maxlength="2000" value="';
        echo htmlspecialchars($this->chart_data->x_start) . '" />';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_X_END', 'COM_PLOTALOT_TOOLTIP_X_END');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long pjd_all pjd_x_params" name="x_end" maxlength="2000" value="';
        echo htmlspecialchars($this->chart_data->x_end) . '" />';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_X_NUM_LABELS', 'COM_PLOTALOT_TOOLTIP_X_NUM_LABELS');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_short pjd_all pjd_x_params" size="5" name="x_labels" value = "' . $this->chart_data->x_labels . '" />';
        echo '<span class="pjh_all pjh_x_format" >';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_X_LABEL_FORMAT', 'COM_PLOTALOT_TOOLTIP_X_FORMAT') . ' ';
        echo LAP_view::make_list('x_format', $this->chart_data->x_format, $plotutil->xDataFormats, FORMAT_NONE);
        echo '</span>';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_Y_TITLE', 'COM_PLOTALOT_TOOLTIP_Y_TITLE');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long pjd_all pjd_xy_titles" name="y_title" maxlength="2000" value="';
        echo htmlspecialchars($this->chart_data->y_title) . '" />';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_Y_START', 'COM_PLOTALOT_TOOLTIP_Y_START');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long pjd_all pjd_y_params" name="y_start" maxlength="2000" value="';
        echo htmlspecialchars($this->chart_data->y_start) . '" />';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_Y_END', 'COM_PLOTALOT_TOOLTIP_Y_END');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long pjd_all pjd_y_params" name="y_end" maxlength="2000" value="';
        echo htmlspecialchars($this->chart_data->y_end) . '" />';
        ?>
			</td>
		</tr>
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_Y_NUM_LABELS', 'COM_PLOTALOT_TOOLTIP_Y_NUM_LABELS');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_short pjd_all pjd_y_labels" size="5" name="y_labels" value = "' . $this->chart_data->y_labels . '" />';
        echo '<span class="pjh_all pjh_y_format" >';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_Y_LABEL_FORMAT', 'COM_PLOTALOT_TOOLTIP_Y_FORMAT') . ' ';
        echo LAP_view::make_list('y_format', $this->chart_data->y_format, $plotutil->yDataFormats, FORMAT_NONE);
        echo '</span>';
        ?>
			</td>
		</tr>
		</table>
		</fieldset>
	</td>
	</tr>
	</table>

	<?php 
        // the plots array
        for ($i = 0; $i < $this->chart_data->num_plots; $i++) {
            if (!isset($this->chart_data->plot_array[$i]['legend'])) {
                $this->chart_data->plot_array[$i]['legend'] = '';
            }
            if (!isset($this->chart_data->plot_array[$i]['colour'])) {
                $this->chart_data->plot_array[$i]['colour'] = '';
            }
            if (!isset($this->chart_data->plot_array[$i]['style'])) {
                $this->chart_data->plot_array[$i]['style'] = 0;
            }
            $this->chart_data->plot_array[$i]['style'] = $plotalot->checkPlotStyle($this->chart_data->chart_type, $this->chart_data->plot_array[$i]['style']);
            if (!isset($this->chart_data->plot_array[$i]['query'])) {
                $this->chart_data->plot_array[$i]['query'] = '';
            }
            if (!isset($this->chart_data->plot_array[$i]['enable'])) {
                // if not present ..
                $this->chart_data->plot_array[$i]['enable'] = false;
            }
            // .. plot is disabled
            if ($this->chart_data->plot_array[$i]['legend'] == '' and $this->chart_data->plot_array[$i]['query'] == '') {
                $this->chart_data->plot_array[$i]['enable'] = true;
            }
            // make new plots enabled
            echo "\n\n" . '<div><fieldset class="adminform plotalot_form"><legend>' . JText::_('COM_PLOTALOT_PLOT') . ' ' . ($i + 1) . '</legend>';
            echo '<table width="100%"><tr>';
            echo '<td style="width:20%; vertical-align:top;">';
            echo "\n" . '<table>';
            echo "\n" . '<tr><td>' . $this->make_prompt('COM_PLOTALOT_NAME', 'COM_PLOTALOT_TOOLTIP_PLOT_NAME') . '</td>';
            echo '<td><input type="text" class="p_short" size="25" name="legend[' . $i . ']" value = "' . htmlspecialchars($this->chart_data->plot_array[$i]['legend']) . '" /></td>';
            echo '</tr>';
            echo "\n" . '<tr><td>' . $this->make_prompt('COM_PLOTALOT_COLOUR', 'COM_PLOTALOT_TOOLTIP_COLOUR') . '</td>';
            echo '<td><input type="text" class="p_short color {required:false}" name="colour[' . $i . ']" size="6" value="' . $this->chart_data->plot_array[$i]['colour'] . '" /></td>';
            echo '</tr>';
            echo "\n" . '<tr class="pjh_all pjh_plot_style_pie"><td>' . $this->make_prompt('COM_PLOTALOT_STYLE', 'COM_PLOTALOT_TOOLTIP_PLOT_STYLE') . '</td>';
            echo '<td>' . LAP_view::make_list("pie_style[{$i}]", $this->chart_data->plot_array[$i]['style'], $plotutil->lineStylesPie) . '</td>';
            echo '</tr>';
            echo "\n" . '<tr class="pjh_all pjh_plot_style_line"><td>' . $this->make_prompt('COM_PLOTALOT_STYLE', 'COM_PLOTALOT_TOOLTIP_PLOT_STYLE') . '</td>';
            echo '<td>' . LAP_view::make_list("line_style[{$i}]", $this->chart_data->plot_array[$i]['style'], $plotutil->lineStylesLine) . '</td>';
            echo '</tr>';
            echo "\n" . '<tr class="pjh_all pjh_plot_type"><td>' . JText::_('COM_PLOTALOT_TYPE') . '</td>';
            echo '<td>' . LAP_view::make_list("plot_type[{$i}]", $this->chart_data->plot_array[$i]['style'], $plotutil->comboPlotTypes) . '</td>';
            echo '</tr>';
            echo "\n" . '<tr><td>' . $this->make_prompt('COM_PLOTALOT_ENABLE', 'COM_PLOTALOT_TOOLTIP_PLOT_ENABLE') . '</td>';
            echo '<td>' . LAP_view::make_checkbox("enable[{$i}]", $this->chart_data->plot_array[$i]['enable']) . '</td>';
            echo '</tr>';
            echo "\n" . '</table>';
            echo '</td>';
            // width:20%
            echo "\n<td>";
            echo LAP_view::make_info(JText::_('COM_PLOTALOT_TOOLTIP_PLOT_QUERY'), '', 'style="float:left";');
            echo '<textarea class="p_long" name="query[' . $i . ']" rows="5" style="white-space:normal !important; word-wrap:normal !important;">' . htmlspecialchars($this->chart_data->plot_array[$i]['query']) . '</textarea>';
            echo '</td>';
            echo '</tr></table>';
            echo '</fieldset></div>';
        }
        ?>

	</form>
	<?php 
        // if new, don't try to draw the chart
        if ($this->chart_data->id == 0) {
            return;
        }
        // if validation failed in the model, don't try to draw the chart
        if ($validation_failed) {
            return;
        }
        // create the chart	script
        if ($this->chart_data->db_user == '-') {
            $this->chart_data->db_user = '';
        }
        $chart_script = $plotalot->drawChart($this->chart_data);
        // Show any errors
        echo '<div id="error_msg" class="plotalot_error" style="margin-bottom:5px;"></div>';
        // place for any Javascript errors
        if ($plotalot->error != '') {
            echo '<div class="plotalot_error">' . JText::_('COM_PLOTALOT_ERROR') . ': ' . $plotalot->error . '</div>';
        }
        if ($plotalot->warning != '') {
            echo '<div class="plotalot_error">' . JText::_('COM_PLOTALOT_WARNING') . ': ' . $plotalot->warning . '</div>';
        }
        // add an error handler to catch any Javascript errors
        $error_handler = "\n window.onerror = function(message, url, linenumber) {\n\t    setTimeout(function() {document.getElementById('error_msg').innerHTML = '" . JText::_('COM_PLOTALOT_JAVASCRIPT_ERROR') . "'+': '+message;}, 200); };";
        $document->addScriptDeclaration($error_handler);
        // put the chart script into the document header
        $document->addScript("https://www.google.com/jsapi");
        $document->addCustomTag($chart_script);
        // the place for the Google javascript to draw in, and an extra save button
        // if the chart is responsive, make the chart container an arbitrary 640 x 480
        // if not, let the chart define the size of the container
        if (empty($this->chart_data->x_size)) {
            $styles = 'width:500px; height:300px; ';
        } else {
            $styles = 'height:' . $this->chart_data->y_size . 'px; width:' . $this->chart_data->x_size . 'px; ';
        }
        echo "\n" . '<div>';
        echo "\n" . '<div id="chart_area" style="' . $styles . 'float:left; border:1px solid lightgray;">';
        $chart_id = $this->chart_data->id;
        echo '<span id="chart_' . $chart_id . '" style="' . $styles . 'float:left; background-color:' . $background . '"></span>';
        echo '</div>';
        echo self::save_button();
        echo '</div>';
        // if show raw data was selected, show each plot as a table of up to 20 rows
        if ($this->chart_data->show_raw_data) {
            echo '<div style="clear:left;"></div>';
            echo '<h3>' . JText::_('COM_PLOTALOT_SHOW_RAW') . '</h3>';
            $this->chart_data->chart_type = CHART_TYPE_PL_TABLE;
            $this->chart_data->chart_css_style = 'border="1" cellspacing="0" cellpadding="2"';
            $this->chart_data->y_labels = 20;
            for ($p = 0; $p < $this->chart_data->num_plots; $p++) {
                echo '<div style="float:left; margin:5px;">';
                if (empty($this->chart_data->plot_array[$p]['enable'])) {
                    continue;
                }
                if (!$this->chart_data->plot_array[$p]['enable']) {
                    // plot is disabled
                    continue;
                }
                if ($this->chart_data->plot_array[$p]['query'] == '') {
                    // no query
                    continue;
                }
                $this->chart_data->plot_array[0]['query'] = $this->chart_data->plot_array[$p]['query'];
                // table query is always plot zero
                $this->chart_data->chart_title = JText::_('COM_PLOTALOT_RAW_DATA') . ', ' . JText::_('COM_PLOTALOT_PLOT') . ' ' . ($p + 1) . " (" . $this->chart_data->plot_array[$p]['legend'] . ")";
                $chart_html = $plotalot->drawChart($this->chart_data, true);
                // draw table but do not overwrite chart trace
                echo $chart_html;
                echo '';
            }
        }
        // if show script was selected, show it
        if ($this->chart_data->show_script) {
            $viewable_script = str_replace("\n<script type=\"text/javascript\">\n", '', $chart_script);
            $viewable_script = str_replace('</script>', '', $viewable_script);
            echo '<div style="clear:left;"></div>';
            echo '<h3>' . JText::_('COM_PLOTALOT_SHOW_SCRIPT') . '</h3>';
            echo '<pre>';
            echo $viewable_script;
            echo '</pre>';
        }
    }
Пример #4
0
 function &getLogChart(&$title)
 {
     // get the filter states
     $filter_date = $this->_app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_date', 'filter_date', LAFC_LOG_ALL, 'int');
     if (!in_array($filter_date, array(LAFC_LOG_ALL, LAFC_LOG_LAST_12_MONTHS))) {
         $filter_date = LAFC_LOG_ALL;
     }
     switch ($filter_date) {
         case LAFC_LOG_ALL:
             $query_where = " ";
             $title = JText::_('COM_FLEXICONTACT_LOG_ALL');
             break;
         case LAFC_LOG_LAST_12_MONTHS:
             $query_where = "WHERE datetime >= DATE_SUB(CURRENT_DATE(), INTERVAL 12 MONTH)";
             $title = JText::_('COM_FLEXICONTACT_LOG_LAST_12_MONTHS');
             break;
     }
     // Set up the overall chart information
     require_once JPATH_COMPONENT . '/helpers/plotalot.php';
     $chart_info = new stdclass();
     $chart_info->chart_type = CHART_TYPE_AREA;
     $chart_info->x_size = 0;
     // size of container
     $chart_info->y_size = 350;
     $chart_info->num_plots = 1;
     $chart_info->legend_type = LEGEND_NONE;
     $chart_info->extra_parms = ",chartArea:{left:'10%',top:20,width:'90%',height:'75%'}";
     $chart_info->x_format = FORMAT_DATE_MONY;
     $chart_info->x_labels = 12;
     $chart_info->y_title = JText::_('COM_FLEXICONTACT_ENQS_PER_DAY');
     $chart_info->plot_array = array();
     $chart_info->plot_array[0]['enable'] = 1;
     $chart_info->plot_array[0]['colour'] = '146295';
     $chart_info->plot_array[0]['style'] = LINE_THICK_SOLID;
     $chart_info->plot_array[0]['legend'] = $chart_info->y_title;
     $query = "SELECT UNIX_TIMESTAMP(DATE_FORMAT(`datetime`,'%Y-%m-01')) AS unixtime, \n\t\tROUND(COUNT(`id`)\n\t\t/ (IF (MONTH(`datetime`) = MONTH(CURRENT_DATE()) AND YEAR(`datetime`) = YEAR(CURRENT_DATE()), \n\t\t\tDAY(CURRENT_DATE()), DAY(LAST_DAY(`datetime`)))),1) AS avg_per_day\n\t\tFROM `#__flexicontact_plus_log`\n\t\t{$query_where}\n\t\tGROUP BY year(`datetime`), month(`datetime`) order by year(`datetime`), month(`datetime`)";
     $chart_info->plot_array[0]['query'] = $query;
     $plotalot = new Plotalot();
     $chart = $plotalot->drawChart($chart_info);
     // if there was no data to chart, return an empty string
     if ($plotalot->error != '') {
         $chart = '';
         return $chart;
     }
     if ($plotalot->datasets[0]['num_rows'] == 0) {
         $chart = '';
         return $chart;
     }
     // a single data point doesn't look good
     // show the month and year of the UNIX_TIMESTAMP returned for the first and only row, followed by the average enquiries per day for that month
     if ($plotalot->datasets[0]['num_rows'] == 1) {
         $chart = '<h4>' . strftime("%B %Y", $plotalot->datasets[0]['data'][0][0]) . '<br />' . $chart_info->y_title . ' = ' . $plotalot->datasets[0]['data'][0][1] . '</h4>';
         return $chart;
     }
     return $chart;
 }
Пример #5
0
    function display($tpl = null)
    {
        global $chart_types;
        if ($this->chart_data->id == 0) {
            // creating a new record
            JToolBarHelper::title(LAP_COMPONENT_NAME . ': ' . JText::_('COM_PLOTALOT_NEW_TABLE'), 'plotalot.png');
        } else {
            JToolBarHelper::title(LAP_COMPONENT_NAME . ': ' . JText::_('COM_PLOTALOT_EDIT_TABLE') . ' ' . $this->chart_data->id, 'plotalot.png');
        }
        JToolBarHelper::apply();
        JToolBarHelper::save();
        if ($this->chart_data->id > 0) {
            JToolBarHelper::save2copy();
        }
        JToolBarHelper::cancel('cancel', 'JTOOLBAR_CLOSE');
        JToolBarHelper::preferences(LAP_COMPONENT, 350, 450);
        JToolBarHelper::custom('help', 'help.png', 'help_f2.png', 'JHELP', false);
        // load our front end css, if it exists
        LAP_view::load_styles();
        // get component parameters
        $params = JComponentHelper::getParams(LAP_COMPONENT);
        $this->tooltips = $params->get('tooltips', 1);
        $background = $params->get('background', 'FFFFFF');
        if (strcasecmp($background, 'transparent') != 0 and $background[0] != '#') {
            $background = '#' . $background;
        }
        if ($params->get('autocomplete', 1)) {
            $autocomplete = 'autocomplete="off"';
            if (empty($this->chart_data->db_user)) {
                // some browsers don't respect autocomplete="off"
                $this->chart_data->db_user = '******';
            }
            // the model will intercept this and remove it
        } else {
            $autocomplete = '';
        }
        $this->default_styles();
        // make the Javascript that hides and enables the chart type dependent fields
        // it is called by the 'domready' function and the 'onchange' function of the chart type list selector
        $js = self::javascript();
        $document = JFactory::getDocument();
        $document->addScriptDeclaration($js);
        $dom_ready = "\nwindow.addEvent('domready', function() {plotalot_fields(" . $this->chart_data->chart_type . ");});\n";
        $document->addScriptDeclaration($dom_ready);
        // make the chart type list
        $plotutil = new Plotalot_Utility();
        $chart_type_list = LAP_view::make_list('chart_type', $this->chart_data->chart_type, $plotutil->table_types, 0, 'onchange="plotalot_fields(this.value)"');
        ?>
	<form action="index.php" method="post" name="adminForm" id="adminForm" <?php 
        echo $autocomplete;
        ?>
 >

	<input type="hidden" name="option" value="<?php 
        echo LAP_COMPONENT;
        ?>
" />
	<input type="hidden" name="id" value="<?php 
        echo $this->chart_data->id;
        ?>
" />
	<input type="hidden" name="chart_type" value="<?php 
        echo $this->chart_data->chart_type;
        ?>
" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="controller" value="" />
	<input type="hidden" name="plot_enable_0" value="1" />
	<?php 
        echo JHTML::_('form.token');
        ?>

	<table class="plot_table">
	<tr>
	<td width="50%" class="ptop">
		<fieldset class="adminform plotalot_form"><legend><?php 
        echo JText::_('COM_PLOTALOT_CHART_TYPE_TABLE');
        ?>
</legend>
		<table cellspacing="0" width="100%">
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_NAME', 'COM_PLOTALOT_TOOLTIP_CHART_NAME');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_short" name="chart_name" size="40" 
					maxlength="250" value="' . htmlspecialchars($this->chart_data->chart_name) . '" />';
        echo ' ' . JText::_('COM_PLOTALOT_TYPE') . ' ';
        echo $chart_type_list;
        echo '<span id="pl_col_heads">';
        echo ' ';
        echo LAP_view::make_checkbox('legend_type', $this->chart_data->legend_type, $this->make_prompt('COM_PLOTALOT_COL_HEADINGS', 'COM_PLOTALOT_TOOLTIP_TABLE_HEADINGS'));
        echo '</span>';
        ?>
			</td>
		</tr>

		<tr id="gv_sizes">
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_SIZE');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_short" name="x_size" size="8" 
					value="' . $this->chart_data->x_size . '" />';
        echo ' x ';
        echo '<input type="text" class="p_short" name="y_size" size="8" 
					value="' . $this->chart_data->y_size . '" />';
        echo ' ';
        echo LAP_view::make_checkbox('chart_option', $this->chart_data->chart_option, JText::_('COM_PLOTALOT_ROW_NUMBERS'));
        ?>
			</td>
		</tr>

		<tr id="pl_title">
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_TITLE', 'COM_PLOTALOT_TOOLTIP_TITLE');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long" name="chart_title" maxlength="2000" value="';
        echo htmlspecialchars($this->chart_data->chart_title) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_DATABASE', 'COM_PLOTALOT_TOOLTIP_DB_NAME');
        ?>
			</td>
			<td>
					<?php 
        echo '<input type="text" class="p_short" name="db_name" size="18" maxlength="250" value="' . htmlspecialchars($this->chart_data->db_name) . '" />';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_HOST', 'COM_PLOTALOT_TOOLTIP_DB_HOST');
        echo '<input type="text" class="p_short" name="db_host" size="10" maxlength="250" value="' . htmlspecialchars($this->chart_data->db_host) . '" />';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_USER', 'COM_PLOTALOT_TOOLTIP_DB_USER');
        echo '<input type="text" class="p_short" name="db_user" size="10" maxlength="250" value="' . htmlspecialchars($this->chart_data->db_user) . '" ' . $autocomplete . ' />';
        echo ' ' . $this->make_prompt('COM_PLOTALOT_PASSWORD', 'COM_PLOTALOT_TOOLTIP_DB_USER');
        echo '<input type="password" class="p_short" name="db_pass" size="9" maxlength="250" value="' . $this->chart_data->db_pass . '" ' . $autocomplete . ' />';
        ?>
			</td>
		</tr>
		
		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_MAX_ROWS', 'COM_PLOTALOT_TOOLTIP_TABLE_MAX_ROWS');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_short" name="y_labels" size="10" 
				maxlength="10" value="' . $this->chart_data->y_labels . '" />';
        ?>
			</td>
		</tr>
		
		<tr id="gv_extra_params">
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_EXTRA_PARAMS', 'COM_PLOTALOT_TOOLTIP_EXTRA_PARAMS');
        ?>
			</td>
			<td>
				<?php 
        echo '<textarea name="extra_parms" rows="1" style="width:97% !important;">' . htmlspecialchars($this->chart_data->extra_parms) . '</textarea>';
        ?>
			</td>
		</tr>

		</table>
		</fieldset>
	</td>
	<td width="50%" class="ptop">
		<fieldset class="adminform plotalot_form"><legend><?php 
        echo JText::_('COM_PLOTALOT_CLASSES');
        ?>
</legend>
		<table width="100%" id="pl_styles">

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_TABLE_STYLE');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long" name="style_pl_table" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['pl_table']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_TITLE_ROW_STYLE');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long" name="style_pl_title" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['pl_title']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_HEADING_ROW_STYLE');
        ?>
			</td>
			<td>
				<?php 
        echo ' <input type="text" class="p_long" name="style_pl_head" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['pl_head']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_TABLE_ODD_STYLE', 'COM_PLOTALOT_TOOLTIP_TABLE_ODD');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long" name="style_pl_odd" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['pl_odd']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo $this->make_prompt('COM_PLOTALOT_TABLE_EVEN_STYLE', 'COM_PLOTALOT_TOOLTIP_TABLE_EVEN');
        ?>
			</td>
			<td>
				<?php 
        echo ' <input type="text" class="p_long" name="style_pl_even" 
				maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['pl_even']) . '" />';
        ?>
			</td>
		</tr>

		</table>

		<table width="100%" id="gv_styles">

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_HEADING_ROW_STYLE');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long" name="style_gv_head" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['gv_head']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_TABLE_ODD_STYLE');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long" name="style_gv_odd" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['gv_odd']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_TABLE_ROW');
        ?>
			</td>
			<td>
				<?php 
        echo ' <input type="text" class="p_long" name="style_gv_row" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['gv_row']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_SELECTED_ROW');
        ?>
			</td>
			<td>
				<?php 
        echo '<input type="text" class="p_long" name="style_gv_selected" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['gv_selected']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_HOVER_ROW');
        ?>
			</td>
			<td>
				<?php 
        echo ' <input type="text" class="p_long" name="style_gv_hover" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['gv_hover']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_HEADER_CELL');
        ?>
			</td>
			<td>
				<?php 
        echo ' <input type="text" class="p_long" name="style_gv_hcell" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['gv_hcell']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_TABLE_CELL');
        ?>
			</td>
			<td>
				<?php 
        echo ' <input type="text" class="p_long" name="style_gv_tcell" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['gv_tcell']) . '" />';
        ?>
			</td>
		</tr>

		<tr>
			<td class="pright">
				<?php 
        echo JText::_('COM_PLOTALOT_NUMBER_CELL');
        ?>
			</td>
			<td>
				<?php 
        echo ' <input type="text" class="p_long" name="style_gv_numcell" 
					maxlength="255" value="' . htmlspecialchars($this->chart_data->style_array['gv_numcell']) . '" />';
        ?>
			</td>
		</tr>

		</table>

		</fieldset>
	</td>
	</tr>
	</table>
	
	<div><fieldset class="adminform plotalot_form">
	<table cellspacing="0" width="100%">
	<tr>
		<td class="pright" style="vertical-align: top; width:8%;">
			<?php 
        echo $this->make_prompt('COM_PLOTALOT_QUERY', 'COM_PLOTALOT_TOOLTIP_TABLE_QUERY');
        ?>
		</td>
		<td>
			<?php 
        if (isset($this->chart_data->plot_array[0]['query'])) {
            $query = $this->chart_data->plot_array[0]['query'];
        } else {
            $query = '';
        }
        echo '<textarea name="query[0]" rows="8" style="width:97% !important;">' . htmlspecialchars($query) . '</textarea>';
        ?>
		</td>
	</tr>
	</table>
	</fieldset></div>

	
	<div class="clr"></div>

	</form>
	<?php 
        // if new, don't try to draw the chart
        if ($this->chart_data->id == 0) {
            return;
        }
        // create the table	script or html
        $plotalot = new Plotalot();
        if ($this->chart_data->db_user == '-') {
            $this->chart_data->db_user = '';
        }
        $chart_text = $plotalot->drawChart($this->chart_data);
        // Show any errors
        echo '<div id="error_msg" class="plotalot_error"></div>';
        // place for any Javascript errors
        if ($plotalot->error != '') {
            echo '<div class="plotalot_error">' . JText::_('COM_PLOTALOT_ERROR') . ': ' . $plotalot->error . '</div>';
        }
        if ($plotalot->warning != '') {
            echo '<div class="plotalot_error">' . JText::_('COM_PLOTALOT_WARNING') . ': ' . $plotalot->warning . '</div>';
        }
        // add an error handler to catch any Javascript errors
        $error_handler = "window.onerror = function(message, url, linenumber) {\n\t    setTimeout(function() {document.getElementById('error_msg').innerHTML = '" . JText::_('COM_PLOTALOT_JAVASCRIPT_ERROR') . "'+': '+message;}, 200); };";
        $document = JFactory::getDocument();
        $document->addScriptDeclaration($error_handler);
        // for Plotalot tables, draw the image html
        if ($this->chart_data->chart_type == CHART_TYPE_PL_TABLE) {
            echo '<div>';
            $chart_id = $this->chart_data->id;
            echo '<span style="float:left; background-color:' . $background . '">' . $chart_text . '</span>';
            echo '</div>';
            // echo '<div style="background-color:'.$background.'"></div>';
            return;
        }
        // for Google tables, load the scripts
        if ($this->chart_data->chart_type == CHART_TYPE_GV_TABLE) {
            $document = JFactory::getDocument();
            $document->addScript("https://www.google.com/jsapi");
            $document->addCustomTag($chart_text);
            $chart_id = $this->chart_data->id;
            echo '<div>';
            $chart_id = $this->chart_data->id;
            echo '<span id="chart_' . $chart_id . '" style="float:left; background-color:' . $background . '"></span>';
            echo '</div>';
        }
    }