This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>graphvisifire</name>
|
||||
<displayName>Visifire</displayName>
|
||||
<version>1</version>
|
||||
<description>Visifire is a set of open source data visualization components - powered by Microsoft Silverlight 2 beta 2.</description>
|
||||
<author>PrestaShop</author>
|
||||
<tab>administration</tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
</module>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{graphvisifire}prestashop>graphvisifire_46495d329b07c973daa82a7a9c084d6b'] = 'Visifire';
|
||||
$_MODULE['<{graphvisifire}prestashop>graphvisifire_9c3adc09754ac25e4ed1da6176c0e74c'] = 'Visifire ist eine Reihe von Open-Source-Komponenten zur Datenvisualisierung - powered by Microsoft Silverlight 2 Beta 2.';
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{graphvisifire}prestashop>graphvisifire_46495d329b07c973daa82a7a9c084d6b'] = 'Visifire';
|
||||
$_MODULE['<{graphvisifire}prestashop>graphvisifire_9c3adc09754ac25e4ed1da6176c0e74c'] = 'Visifire es un conjunto de datos de código abierto componentes de visualización - Powered by Microsoft Silverlight 2 beta 2.';
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{graphvisifire}prestashop>graphvisifire_46495d329b07c973daa82a7a9c084d6b'] = 'Visifire';
|
||||
$_MODULE['<{graphvisifire}prestashop>graphvisifire_9c3adc09754ac25e4ed1da6176c0e74c'] = 'Visifire est un pack de composants permettant de visualiser graphiquement des données. Il utilise la technologie Microsoft Silverlight 2 beta 2.';
|
||||
@@ -1,186 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 1.4 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_CAN_LOAD_FILES_'))
|
||||
exit;
|
||||
|
||||
class GraphVisifire extends ModuleGraphEngine
|
||||
{
|
||||
private $_xml;
|
||||
private $_values = NULL;
|
||||
private $_legend = NULL;
|
||||
private $_titles = NULL;
|
||||
|
||||
function __construct($type = null)
|
||||
{
|
||||
if ($type != null)
|
||||
{
|
||||
$this->_xml = '<vc:Chart xmlns:vc="clr-namespace:Visifire.Charts;assembly=Visifire.Charts" BorderThickness="0" AnimationEnabled="True" AnimationType="Type5"';
|
||||
if ($type == 'pie' || $type == 'line')
|
||||
$this->_xml .= ' Theme="Theme1" View3D="True"';
|
||||
else
|
||||
$this->_xml .= ' Theme="Theme2" ColorSet="Visifire2" UniqueColors="True"';
|
||||
$this->_xml .= '>';
|
||||
parent::__construct($type);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->name = 'graphvisifire';
|
||||
$this->tab = 'administration';
|
||||
$this->version = 1.0;
|
||||
$this->author = 'PrestaShop';
|
||||
|
||||
Module::__construct();
|
||||
|
||||
$this->displayName = $this->l('Visifire');
|
||||
$this->description = $this->l('Visifire is a set of open source data visualization components - powered by Microsoft Silverlight 2 beta 2.');
|
||||
}
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
return (parent::install() AND $this->registerHook('GraphEngine'));
|
||||
}
|
||||
|
||||
public static function hookGraphEngine($params, $drawer)
|
||||
{
|
||||
static $divid = 1;
|
||||
return '<script type="text/javascript" src="../modules/graphvisifire/visifire/Visifire.js"></script>
|
||||
<div id="VisifireChart'.$divid.'">
|
||||
<script language="javascript" type="text/javascript">
|
||||
var vChart = new Visifire("../modules/graphvisifire/visifire/Visifire.xap", '.$params['width'].', '.$params['height'].');
|
||||
vChart.setLogLevel(0);
|
||||
vChart.setDataUri(\''.$drawer.'\');
|
||||
vChart.render("VisifireChart'.$divid++.'");
|
||||
</script>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function createValues($values)
|
||||
{
|
||||
$this->_values = array();
|
||||
if (!is_array($values[array_rand($values)]))
|
||||
foreach ($values as $value)
|
||||
$this->_values[] = $value;
|
||||
else
|
||||
{
|
||||
foreach ($values as $i => $layerValue)
|
||||
{
|
||||
$this->_values[$i] = array();
|
||||
foreach ($layerValue as $value)
|
||||
$this->_values[$i][] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setSize($width, $height)
|
||||
{
|
||||
// Unavailable
|
||||
}
|
||||
|
||||
public function setLegend($legend)
|
||||
{
|
||||
$this->_legend = array();
|
||||
if (!is_array($legend[array_rand($legend)]))
|
||||
foreach ($legend as $label)
|
||||
$this->_legend[] = $label;
|
||||
else
|
||||
{
|
||||
foreach ($legend as $i => $layerlabel)
|
||||
{
|
||||
$this->_legend[$i] = array();
|
||||
foreach ($layerlabel as $label)
|
||||
$this->_legend[$i][] = $label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setTitles($titles)
|
||||
{
|
||||
$this->_titles = $titles;
|
||||
if (isset($titles['main']) && !is_array($titles['main']))
|
||||
$this->_xml .= '<vc:Title Text="'.$titles['main'].'"/>';
|
||||
if (is_array($titles['main']) && isset($titles['main'][0]))
|
||||
$this->_xml .= '<vc:Title Text="'.$titles['main'][0].'"/>';
|
||||
if (isset($titles['x']))
|
||||
$this->_xml .= '<vc:AxisX Title="'.$titles['x'].'" />';
|
||||
if (isset($titles['y']))
|
||||
$this->_xml .= '<vc:AxisY Title="'.$titles['y'].'" />';
|
||||
}
|
||||
|
||||
public function draw()
|
||||
{
|
||||
header('content-type: text/xml');
|
||||
if ($this->_values != NULL && $this->_legend != NULL)
|
||||
{
|
||||
if (!isset($this->_values[0]) || !is_array($this->_values[0]))
|
||||
$size = sizeof($this->_values);
|
||||
else
|
||||
$size = sizeof($this->_values[0]);
|
||||
if ($size == sizeof($this->_legend))
|
||||
{
|
||||
if (!is_array($this->_values[array_rand($this->_values)]))
|
||||
{
|
||||
$this->_xml .= '<vc:DataSeries RenderAs="'.$this->_type.'">';
|
||||
for ($i = 0; $i < $size; $i++)
|
||||
{
|
||||
$this->_xml .= '<vc:DataPoint ';
|
||||
$this->_xml .= 'AxisLabel=" '.str_replace('<', '<', str_replace('>', '>', str_replace('&', '&', str_replace('"', "'", $this->_legend[$i])))).'" ';
|
||||
$this->_xml .= 'YValue="'.$this->_values[$i].'"';
|
||||
if ($this->_type == 'pie')
|
||||
$this->_xml .= ' ExplodeOffset="0.2"';
|
||||
$this->_xml .= '/>';
|
||||
}
|
||||
$this->_xml .= '</vc:DataSeries>';
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($this->_values as $layer => $values)
|
||||
{
|
||||
$this->_xml .= '<vc:DataSeries Name="'.(isset($this->_titles['main'][$layer+1]) ? $this->_titles['main'][$layer+1] : '').'" RenderAs="'.$this->_type.'">';
|
||||
foreach ($values as $i => $value)
|
||||
{
|
||||
$this->_xml .= '<vc:DataPoint ';
|
||||
if ($layer == 0)
|
||||
$this->_xml .= 'AxisLabel=" '.str_replace('<', '<', str_replace('>', '>', str_replace('&', '&', str_replace('"', "'", $this->_legend[$i])))).'" ';
|
||||
$this->_xml .= 'YValue="'.$value.'"';
|
||||
if ($this->_type == 'pie')
|
||||
$this->_xml .= ' ExplodeOffset="0.2"';
|
||||
$this->_xml .= '/>';
|
||||
}
|
||||
$this->_xml .= '</vc:DataSeries>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_xml .= '</vc:Chart>';
|
||||
echo $this->_xml;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{graphvisifire}prestashop>graphvisifire_46495d329b07c973daa82a7a9c084d6b'] = 'Visifire';
|
||||
$_MODULE['<{graphvisifire}prestashop>graphvisifire_9c3adc09754ac25e4ed1da6176c0e74c'] = 'Visifire è un insieme di componenti di visualizzazione dei dati open source powered by Microsoft Silverlight 2 beta 2.';
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1012 B |
@@ -1,353 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2008 Webyog Softworks Private Limited
|
||||
|
||||
This file is a part of Visifire Charts.
|
||||
|
||||
Visifire is a free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Visifire Charts. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
If GPL is not suitable for your products or company, Webyog provides Visifire
|
||||
under a flexible commercial license designed to meet your specific usage and
|
||||
distribution requirements. If you have already obtained a commercial license
|
||||
from Webyog, you can use this file under those license terms.
|
||||
*/
|
||||
|
||||
if(!window.Visifire)
|
||||
{
|
||||
// Visifire class
|
||||
window.Visifire = function(pXapPath, pId, pWidth, pHeight, pBackground)
|
||||
{
|
||||
this.id = null;
|
||||
this.logLevel = 1; // Determines whether to log or not.
|
||||
this.xapPath = "Visifire.xap"; // Default is taken as Visifire.xap in the same directory.
|
||||
this.targetElement = null;
|
||||
this.dataXml = null;
|
||||
this.dataUri = null;
|
||||
this.listeners = null;
|
||||
this.elements = new Array("Chart", "DataPoint", "Title", "AxisX", "AxisY", "Legend");
|
||||
this.events = new Array("MouseLeftButtonDown", "MouseLeftButtonUp", "MouseMove", "MouseEnter", "MouseLeave");
|
||||
this.windowless = false;
|
||||
this.width = null;
|
||||
this.height = null;
|
||||
this.background = null;
|
||||
|
||||
// pId not present
|
||||
if(Number(pId))
|
||||
{
|
||||
if(pHeight)
|
||||
this.background = pHeight;
|
||||
|
||||
pHeight = pWidth;
|
||||
pWidth = pId;
|
||||
}
|
||||
else // pId present
|
||||
{
|
||||
this.id = pId;
|
||||
|
||||
if(pBackground)
|
||||
this.background = pBackground;
|
||||
}
|
||||
|
||||
if(pXapPath)
|
||||
this.xapPath = pXapPath;
|
||||
|
||||
if(pWidth)
|
||||
this.width = pWidth;
|
||||
|
||||
if(pHeight)
|
||||
this.height = pHeight;
|
||||
|
||||
this._uThisObject = this;
|
||||
|
||||
this.index = ++Visifire._slCount;
|
||||
}
|
||||
|
||||
window.Visifire._slCount = 0;
|
||||
|
||||
Visifire.prototype.setWindowlessState = function(pWindowless)
|
||||
{
|
||||
if(pWindowless != null)
|
||||
{
|
||||
this.windowless = Boolean(pWindowless);
|
||||
}
|
||||
}
|
||||
|
||||
Visifire.prototype._getSlControl = function ()
|
||||
{
|
||||
var _uThisObject = this;
|
||||
if(_uThisObject.id != null)
|
||||
{
|
||||
var slControl = document.getElementById(_uThisObject.id);
|
||||
return slControl;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Visifire.prototype.isLoaded = function()
|
||||
{
|
||||
var slControl = this._getSlControl();
|
||||
try
|
||||
{
|
||||
if(slControl.Content.wrapper != null)
|
||||
return true;
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Visifire.prototype.isDataLoaded = function()
|
||||
{
|
||||
var slControl = this._getSlControl();
|
||||
|
||||
return slControl.Content.wrapper.IsDataLoaded;
|
||||
}
|
||||
Visifire.prototype.setSize = function(pWidth,pHeight)
|
||||
{
|
||||
var slControl = this._getSlControl();
|
||||
if(slControl != null)
|
||||
{
|
||||
slControl.width = pWidth;
|
||||
slControl.height = pHeight;
|
||||
slControl.Content.wrapper.Resize(pWidth,pHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.width = pWidth;
|
||||
this.height = pHeight;
|
||||
}
|
||||
}
|
||||
|
||||
Visifire.prototype.setDataXml = function(pDataXml)
|
||||
{
|
||||
var slControl = this._getSlControl();
|
||||
|
||||
if(slControl != null && this.dataXml != null)
|
||||
{
|
||||
slControl.Content.wrapper.AddDataXML(pDataXml);
|
||||
}
|
||||
|
||||
this.dataXml = pDataXml;
|
||||
}
|
||||
|
||||
|
||||
Visifire.prototype.setDataUri = function(pDataUri)
|
||||
{
|
||||
var slControl = this._getSlControl();
|
||||
|
||||
if(slControl != null && this.dataUri != null)
|
||||
{
|
||||
slControl.Content.wrapper.AddDataUri(pDataUri);
|
||||
}
|
||||
|
||||
this.dataUri = pDataUri;
|
||||
}
|
||||
|
||||
Visifire.prototype.setLogLevel = function(level)
|
||||
{
|
||||
if(level != null)
|
||||
{
|
||||
this.logLevel = level;
|
||||
}
|
||||
}
|
||||
|
||||
Visifire.prototype._isString = function()
|
||||
{
|
||||
if (typeof arguments[0] == 'string') return true;
|
||||
|
||||
if (typeof arguments[0] == 'object')
|
||||
{
|
||||
var criterion = arguments[0].constructor.toString().match(/string/i);
|
||||
return (criterion != null);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Visifire.prototype._validateChartElement = function(pElement)
|
||||
{
|
||||
if(this.logLevel != 0)
|
||||
{
|
||||
for(var i = 0; i < this.elements.length; i++)
|
||||
if(this.elements[i] == pElement)
|
||||
return;
|
||||
|
||||
alert('Error occurred while attaching event.\nUnknown element "' + pElement + '".');
|
||||
}
|
||||
}
|
||||
|
||||
Visifire.prototype._validateEvent = function(pEvent)
|
||||
{
|
||||
if(this.logLevel != 0)
|
||||
{
|
||||
for(var i = 0; i < this.events.length; i++)
|
||||
if(this.events[i] == pEvent)
|
||||
return;
|
||||
|
||||
alert('Error occurred while attaching event.\nUnsupported event type "' + pEvent + '".');
|
||||
}
|
||||
}
|
||||
|
||||
Visifire.prototype.attachEvent = function(pElement, pEvent, pCallBack)
|
||||
{
|
||||
var _uThisObject = this;
|
||||
|
||||
_uThisObject._validateChartElement(pElement);
|
||||
_uThisObject._validateEvent(pEvent);
|
||||
|
||||
if(pEvent && pElement && pCallBack)
|
||||
{
|
||||
if(_uThisObject.listeners == null)
|
||||
_uThisObject.listeners = {};
|
||||
|
||||
if(_uThisObject.listeners[pEvent] == null)
|
||||
_uThisObject.listeners[pEvent] = new Array();
|
||||
|
||||
if(!window["dispatchEvent" + _uThisObject.index])
|
||||
window["dispatchEvent" + _uThisObject.index] = function(args)
|
||||
{
|
||||
if(_uThisObject.listeners[args.Event] != null)
|
||||
{
|
||||
var listener = _uThisObject.listeners[args.Event];
|
||||
if(listener.length != 0)
|
||||
{
|
||||
for (var i = 0; i < listener.length; i++)
|
||||
{
|
||||
if ((listener[i].event == args.Event) && (listener[i].element == args.Element))
|
||||
{
|
||||
args.ControlId = _uThisObject.id;
|
||||
|
||||
if(_uThisObject._isString(listener[i].fire))
|
||||
eval(listener[i].fire + "(args)");
|
||||
else
|
||||
listener[i].fire(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_uThisObject.listeners[pEvent].push({element: pElement, event: pEvent, fire: pCallBack});
|
||||
}
|
||||
}
|
||||
|
||||
Visifire.prototype._render = function(pTargetElement)
|
||||
{
|
||||
var _uThisObject = this;
|
||||
var width;
|
||||
var height;
|
||||
|
||||
_uThisObject.targerElement = (typeof(pTargetElement) == "string")?document.getElementById(pTargetElement):pTargetElement;
|
||||
|
||||
if(_uThisObject.width != null)
|
||||
width = _uThisObject.width;
|
||||
else if(_uThisObject.targerElement.offsetWidth != 0)
|
||||
width = _uThisObject.targerElement.offsetWidth;
|
||||
else
|
||||
width = 500;
|
||||
|
||||
if(_uThisObject.height != null)
|
||||
height = _uThisObject.height;
|
||||
else if(_uThisObject.targerElement.offsetHeight != 0)
|
||||
height = _uThisObject.targerElement.offsetHeight;
|
||||
else
|
||||
height = 300;
|
||||
|
||||
if(!_uThisObject.id)
|
||||
{
|
||||
_uThisObject.id = 'VisifireControl' + _uThisObject.index;
|
||||
}
|
||||
|
||||
var html = '<object id="' + _uThisObject.id + '" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="' + width + '" height="' + height + '">';
|
||||
|
||||
html += '<param name="source" value="' + _uThisObject.xapPath +'"/>'
|
||||
+ '<param name="onLoad" value="slLoaded' + _uThisObject.index +'"/>'
|
||||
+ '<param name="onResize" value="slResized' + _uThisObject.index +'"/>';
|
||||
html += '<param name="initParams" value="';
|
||||
|
||||
html += "logLevel=" + _uThisObject.logLevel + ",";
|
||||
|
||||
if(_uThisObject.dataXml != null)
|
||||
{
|
||||
window["getDataXml"+_uThisObject.index] = function(sender, args)
|
||||
{
|
||||
var _uThisObj = _uThisObject;
|
||||
return _uThisObj.dataXml;
|
||||
};
|
||||
|
||||
html += 'dataXml=getDataXml'+ _uThisObject.index +',';
|
||||
}
|
||||
else if(_uThisObject.dataUri != null)
|
||||
{
|
||||
html += 'dataUri='+ _uThisObject.dataUri +',';
|
||||
}
|
||||
|
||||
if(_uThisObject.listeners != null)
|
||||
{
|
||||
html += 'EventDispatcher=dispatchEvent' + _uThisObject.index + ',';
|
||||
|
||||
html += 'jsEvents=';
|
||||
|
||||
var events = _uThisObject.events;
|
||||
|
||||
for(var i=0; i< events.length; i++)
|
||||
{
|
||||
var listener = _uThisObject.listeners[events[i]];
|
||||
|
||||
if(listener != null)
|
||||
{
|
||||
for (var j = 0; j < listener.length; j++)
|
||||
{
|
||||
html += listener[j].element + ' ' + listener[j].event + ';';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
html += ','
|
||||
}
|
||||
|
||||
|
||||
if(_uThisObject.background == null)
|
||||
_uThisObject.background = "White";
|
||||
|
||||
html += 'width=' + width + ',' + 'height=' + height + '';
|
||||
html += "\"/>";
|
||||
html += '<param name="enableHtmlAccess" value="true" />'
|
||||
+ '<param name="background" value="' + _uThisObject.background + '" />'
|
||||
+ '<param name="windowless" value="' + this.windowless + '" />'
|
||||
+ '<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">'
|
||||
+ '<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>'
|
||||
+ '<br/>You need Microsoft Silverlight to view Visifire Charts.'
|
||||
+ '<br/> You can install it by clicking on this link.'
|
||||
+ '<br/>Please restart the browser after installation.'
|
||||
+ '</a>'
|
||||
+ '</object>';
|
||||
|
||||
this.targerElement.innerHTML = html;
|
||||
}
|
||||
|
||||
Visifire.prototype._reRender = function(pSlControl)
|
||||
{
|
||||
pSlControl.Content.wrapper.ReRenderChart();
|
||||
}
|
||||
|
||||
Visifire.prototype.render = function(pTargetElement)
|
||||
{
|
||||
var slControl = this._getSlControl();
|
||||
|
||||
if(slControl == null)
|
||||
{
|
||||
this._render(pTargetElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._reRender(slControl);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user