【发布时间】:2014-06-22 12:09:30
【问题描述】:
在开始使用 Joomla 之前,我开发了一个使用 jqplot 的 html 页面,并且该页面运行良好。
现在我想在我正在开发的自定义 joomla (3.3) 组件中包含 jqplot,但是在调用组件时(通过主菜单项)没有显示图表。
更新 DEFAULT.PHP (JOOMLA) 代码以进一步评论:
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();
//add jqplot libraries
JHtml::_('jquery.framework');
$document->addScript(JPATH_ROOT.'/media/system/js/jquery.jqplot.min.js');
$document->addStyleSheet(JPATH_ROOT.'/media/system/js/jquery.jqplot.min.css');
$document->addScript(JPATH_ROOT.'/media/system/js/jqplot.barRenderer.min.js');
$document->addScript(JPATH_ROOT.'/media/system/js/jqplot.categoryAxisRenderer.min.js');
$document->addScript(JPATH_ROOT.'/media/system/js/jqplot.pointLabels.min.js');
$document->addScript(JPATH_ROOT.'/media/system/js/jqplot.enhancedLegendRenderer.js');
$document->addScript(JPATH_ROOT.'/media/system/js/weqlib.js');
?>
<head>
<script type="text/javascript">
jQuery(document).ready(function(){
var plot1 = jQuery.jqplot ('chart1', [[3,7,9,1,4,6,8,2,5]]); //copied from example at http://www.jqplot.com/tests/line-charts.php
}); //$(document).ready
</script>
</head>
<!--<h1><?php echo $this->msg; ?></h1>-->
<h1>Prosumer Dashboard </h1>
<div id="chart1" style="width:600px; height:250px;"> </div>
我认为我调用 libabries 的方式是错误的(我确定 jqplot 函数调用没问题,因为我也从旧的 html 文件中复制了它)。
知道我做错了什么以及如何解决这个问题吗?
【问题讨论】: