Commit ff2da3b9 authored by Tomas Norre Mikkelsen's avatar Tomas Norre Mikkelsen
Browse files

Merge branch '86-integrate-new-chart-for-extension-detail-page' into 'develop'

Resolve "Integrate new chart for extension detail page"

Closes #86

See merge request !101
parents dc6d24bf 4fc4053c
Pipeline #1532 passed with stages
in 4 minutes and 9 seconds
......@@ -664,4 +664,30 @@ class Extension extends \T3o\TerFe2\Domain\Model\AbstractEntity
* @param int $versionCount
* @return string
public function getDownloadsByVersionsAsJson($versionCount = 6)
if (empty($this->versions)) {
return '';
$versions = [];
foreach ($this->versions as $version) {
/** @var \T3o\TerFe2\Domain\Model\Version $version */
$versions['release'][$version->getUploadDate()] = date('d-m-Y', $version->getUploadDate());
$versions['versions'][] = $version->getVersionString();
$versions['downloads'][] = $version->getAllDownloads();
$versions['release'] = array_splice($versions['release'], $versionCount * -1);
$versions['versions'] = array_splice($versions['versions'], $versionCount * -1);
$versions['downloads'] = array_splice($versions['downloads'], $versionCount * -1);
return json_encode($versions);
......@@ -134,14 +134,6 @@ plugin.tx_terfe2 {
# cat=TER Frontend/view/7020; type=string; label=Layout root path: Path to template layouts
layoutRootPath = EXT:ter_fe2/Resources/Private/Layouts/
libraries {
# cat=TER Frontend/libraries/8000; type=string; label=Load jQuery: Load jQuery libraray into footer
jquery.load = 1
# cat=TER Frontend/libraries/8010; type=string; label=Load jqPlot: Load jqPlot libraray into footer
jqplot.load = 1
} = 1
......@@ -104,22 +104,11 @@ config.tx_extbase.persistence.classes {
# ======================================================================
# Page object configuration of the extension "ter_fe2"
# ======================================================================
## jQuery
[globalVar = LIT:1 = {$plugin.tx_terfe2.libraries.jquery.load}]
page.includeJSFooterlibs.jquery = EXT:ter_fe2/Resources/Public/Javascript/jquery-1.6.2.min.js
## jqPlot
#[globalVar = LIT:1 = {$plugin.tx_terfe2.libraries.jqplot.load}]
page.includeCSS.jqplot = EXT:ter_fe2/Resources/Public/Javascript/jqPlot/jquery.jqplot.min.css
page.includeJSFooterlibs.jqplot1 = EXT:ter_fe2/Resources/Public/Javascript/jqPlot/jquery.jqplot.js
page.includeJSFooterlibs.jqplot2 = EXT:ter_fe2/Resources/Public/Javascript/jqPlot/plugins/jqplot.highlighter.min.js
page.includeJSFooterlibs.jqplot3 = EXT:ter_fe2/Resources/Public/Javascript/jqPlot/plugins/jqplot.cursor.min.js
page.includeJSFooterlibs.jqplot4 = EXT:ter_fe2/Resources/Public/Javascript/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js
## Default files
page.includeJSFooterlibs.tx_terfe2 = EXT:ter_fe2/Resources/Public/Javascript/Default.js
page.includeJSFooterlibs.highcharts =
page.includeJSFooterlibs.highcharts.external = 1
page.includeJSFooter.tx_terfe2 = EXT:ter_fe2/Resources/Public/Javascript/Default.js
# ======================================================================
# Show review form only for allowed usergroup
......@@ -65,9 +65,12 @@
<f:translate key="downloads_by_version" />
<terfe2:chart object="{extension}" method="downloadsByVersion" height="220" width="375" pointCount="{settings.defaultPointCount}" renderOnLoad="1" />
<script type="text/javascript">
var versionChartData = {extension.downloadsByVersionsAsJson -> f:format.raw()};
<div id="versionChart">
<div class="col-md-4">
* Returns default chart options
* @return object Chart options
function getDefaultChartOptions() {
return {
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer
jQuery(document).ready(function($) {
if (versionChartData) {
Highcharts.chart( 'versionChart', {
chart: {
type: 'line'
yaxis: {
min: 0,
numberTicks: 5,
tickOptions: {
formatString: '%d'
title: {
text: 'Downloads by version'
xAxis: [
{categories: versionChartData.versions},
{categories: versionChartData.release, linkedTo: 0}
yAxis: {
title: {
text: 'Downloads'
grid: {
drawGridLines: true,
gridLineColor: '#cccccc',
background: '#ffffff',
borderColor: '#4D4D4D',
borderWidth: 1.0,
shadow: false
highlighter: {
show: true,
sizeAdjust: 5,
tooltipLocation: 'n',
tooltipOffset: 6,
tooltipAxes: 'y'
cursor: {
show: false
(function($) {
* Render chart
* @param boolean renderShy Render shy charts
* @return void
$.fn.renderChart = function(renderShy) {
var containerId = $(this).attr('id');
if (!containerId || typeof(charts) === 'undefined' || typeof(charts[containerId]) === 'undefined') {
var chart = charts[containerId];
if ((!renderShy && chart.isShy) || chart.isRendered) {
var options = getDefaultChartOptions();
options.title = chart.options.title;
options.series = chart.options.series;
$.jqplot(containerId, chart.lines, options);
charts[containerId].isRendered = true;
* Toggle extension row details
* @param mixed element Object or selector
* @return void
$.fn.toggleExtensionDetails = function() {
var $element = $(this);
// Stop here without correct element
if (typeof($element) === 'undefined') {
// Toggle elements
$toggleElement = $element.closest('.ter-toggle-from-here');
// Render chart
var $chart = $toggleElement.find('.chart-container');
if (typeof($chart) !== 'undefined') {
plotOptions: {
line: {
dataLabels: {
enabled: true
enableMouseTracking: false
series: [ {
name: 'Downloads',
data: versionChartData.downloads
} ]
} );
jQuery(document).ready(function($) {
* Process all charts
* Add click event handler to all toggle elements
$('.ter-toggle').click(function(event) {
* Submit form after selecting selectbox option
\ No newline at end of file
Title: MIT License
Copyright (c) 2009-2011 Chris Leonello
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
\ No newline at end of file
Title: jqPlot Readme
Pure JavaScript plotting plugin for jQuery.
To learn how to use jqPlot, start with the Basic Unsage Instructions below. Then read the
usage.txt and jqPlotOptions.txt files included with the distribution.
The jqPlot home page is at <>.
Downloads can be found at <>.
The mailing list is at <>.
Examples and unit tests are at <>.
Documentation is at <>.
The project page and source code are at <>.
Bugs, issues, feature requests: <>.
Basic Usage Instructions:
jqPlot requires jQuery (1.4+ required for certain features). jQuery 1.4.4 is included in
the distribution. To use jqPlot include jQuery, the jqPlot jQuery plugin, the jqPlot css file and
optionally the excanvas script to support IE version prior to IE 9 in your web page:
> <!--[if lt IE 9]><script language="javascript" type="text/javascript" src="excanvas.js"></script><![endif]-->
> <script language="javascript" type="text/javascript" src="jquery-1.4.4.min.js"></script>
> <script language="javascript" type="text/javascript" src="jquery.jqplot.min.js"></script>
> <link rel="stylesheet" type="text/css" href="jquery.jqplot.css" />
For usage instructions, see <jqPlot Usage> in usage.txt. For available options, see
<jqPlot Options> in jqPlotOptions.txt.
Building from source:
If you've cloned the repository, you can build a distribution from source.
You need to have ant <> installed. You can simply
type "ant" from the jqplot directory to build the default "all" target.
There are 6 pertinent targets: clean, dist, min, docs, compress and all. Use:
> ant -p
to get a description of the various build targets.
Legal Notices:
Copyright (c) 2009-2010 Chris Leonello
jqPlot is currently available for use in all personal or commercial projects
under both the MIT and GPL version 2.0 licenses. This means that you can
choose the license that best suits your project and use it accordingly.
Although not required, the author would appreciate an email letting him
know of any substantial use of jqPlot. You can reach the author at:
chris at jqplot or see .
If you are feeling kind and generous, consider supporting the project by
making a donation at: .
jqPlot includes date instance methods and printf/sprintf functions by other authors:
Date instance methods:
author Ken Snyder (ken d snyder at gmail dot com)
date 2008-09-10
version 2.0.2 (
license Creative Commons Attribution License 3.0 (
JavaScript printf/sprintf functions.
version 2007.04.27
author Ash Searle
The author (Ash Searle) has placed this code in the public domain:
"This code is unrestricted: you are free to use it however you like."
Title: Change Log
* Major improvements in memory usage:
** Merged in changes from Timo Besenruether to reuse canvas elements and improve
memory performance.
** Fixed all identifiable DOM leaks.
** Mergged in changes from cguillot for memory improvements in IE < 9.
* Added vertical and dashed vertical line support for canvas overlay.
* Fixed bug where initially hidden plots would not display.
* Fixed bug with point labels and null data points.
* Updated to jQuery 1.6.1.
* Improved pie slice margin calculation and fixed slice margin and pie positioning
with small slices.
* Improved bar renderer so bars always start at 0 if:
** The axis is a linear axis (not log/date).
** There are no other line types besides bars attached to the axis.
** The data on the axis is all >= 0.
** The user has not specified a pad, padMin or forceTickAt0 = true option.
* Modified tick prefix behavious so prefix no added to all ticks, even if format
string is specified.
* Fix to ensure original tick formats are applied when zooming and resetting
* Updated auto tick format string so format adjusted when zooming.
* Modified auto tick computation to put less ticks on small plots and more
ticks on large plots.
* Update bubble render to support gradients in IE 9.
* Much improved tick generation algorithm to get precise rounded
tick values (Thanks Scott Prahl!).
* Auto compute tick format string if none is provided.
* Much better "slicing" of pie charts when using "sliceMargin" option to set
a gap between the slices.
* Expanded canvasOverlay plugin to create arbitrary dashed and solid
horizontal and vertical lines on top of plot.
* Added defaultColors and defaultNegativeColors options to $.jqplot.config.
* Fixed issue #318, highlighter & bar renderer incompatability.
* Improve highlighter tooltip positioning with negative bars.
* Fixed #305, mispelling of jqlotDragStart and jqlotDragStop. MUST NOW BIND
TO jqplotDragStart and jqplotDragStop.
* Fixed #290, some variables left in global scope.
* Fixed #289, OHLC line widths hard coded at 1.5. Now set by lineWidth option.
* Fixed #296 for determining databounds on log axes.
* Updated to jQuery 1.5.1
* Fixed waterfall plot to ensure first and last bars always fill to zero.
* Added lineJoin and lineCap option to series lines.
* Bar widths now based on width of grid, not plot target for better scaling.
* Added looseZoom option to cursor so zooming can produce well rounded ticks.
* Added forceTickAt0 and forceTickAt100 options to ensure there will always
be a tick at 0 or 100 in the plot.
* Fixed bug where cursor legend didn't honor series showLabel option.
* Series can now be moved forward or backward in stack to e.g. bring a line
forward when mousing over a point.
* Can now move outside of grid area while zooming. Can have zoom
constrained to grid area or allow zooming outside.
* Fixed issue #142 with tooltip drawn on top of event canvas, hiding
mouse events.
* Fixed #147 where pie slices with 0 value not rendering properly in IE.
* Fixed #130 where stack data not sorted properly.
* Fixed bug with null values not handled properly in category axes.
* Fixed #156 where pie charts not rendering on QTWebKit.
* Now using feature detection for canvas and canvas text capability
rather than browser version.
* Added enahncedLegendRenderer plugin to allow multi row/column legends
and clickable labels to show/hide series.
* Added fillToValue option to allow filled line plot to fill to an
arbitrary value.
* Added block plot plugin.
* Added funnel type charts.
* Added meter gauge type charts.
* Added plot theming support.
* $.jqplot.config.enablePlugins now false by default.
* Implemented highlighting on bar, pie, donut, funnel, etc. charts.
* Fix to pointlabels plugin to align labels properly on multi series plots.
* Added custom error handling to display error message in plot area.
* Fixed issue where would call to draw grid border of 0 width would
result in a default border being drawn.
* Added options to place legend outside of grid and shrink grid so everything
stays within plot div.
* Fixed bug in color generator so now calls to get() continually cycle
through colors just like next().
* Added defaultAxisStart option.
* Added gradient fills to bubbles.
* Added bubble charts.
* Added showLabels option to bubble charts.
* Pass bubble radius to event callback in bubble charts.
* Fixed #207, typo in docs.
* Fixed #206 where "value" pie slice data labels were displaying wrong
* Fixed #147 with 0 value slices in IE6.
* Fixed issue #241, disabled varyBarColor option in stacked charts.
* Added dataRenderer option to allow custom processors for JSON, AJAX
and anywhere else you might want to get data.
* Fixed null value handling so plot now properly skip or join over nulls.
* Fixed showTicks and showTickMarks option conflicts.
* Fixed issue #185 where pointLabels plugin incompatibility could crash
pie, donut and other plots.
* Fixed #23 and #143 to obey gridPadding option.
* Fixed #233 with highlighter tooltip separator.
* Fixed #224 where type checking failing on GWT.
* Fixed #272 with pie highlighting not working on replot.
* Memory performance improvements.
* Changes to build script so everything should build when pulled from repo.
* Fixed issue #275, IE 6/7 don't support array indexing of strings.
* Added event listener hooks for mouseUp, mouseDown, etc. to all line plots.
* Fixed bug with highlighter not working when null in data.
* Updated to jQuery 1.4.4
* Fixed bug where donut plots showed value of radians of slice instead
of actual data.
* Reverted to excanvas r3 so IE8 no longer has to emulate IE7.
* Added tooltipContentEditor option to highlighter, allowing callback
to manipulate tooltip content at run time (thanks Tim Bunce!).
* Fixed bug where axes scale not resetting.
* Fixed bug with date axes where data bounds not properly set.
* Fixed issue where tick marks disappear if grid lines turned off.
* Updated replot method to allow passing in axes options for more control.
* Added experimental support for "broken" axes.
* Fixed bug with pies where pies with 0 valued slices did not draw correctly.
* Added canvasOverlay plugin to allow drawing of arbitrary shapes on a canvas
over the plot.
* Added option to display arbitrary text/html (message, animated gif, etc.) if
plot is constructed without data. Allow a "data loading" indicator to be shown.
* Added resetAxisValues method to manually update axis ticks without
redrawing the plot.
* Fix to labels on negative bars so label postiion of 'n' will be below a negative bar,
just as it is above a positive bar (thanks guigod!).
* Added thousands separator character (') to sprintf formatting (thanks yuichi1004!).
* Re-factored date parsing/formatting to use new jsDate module which does not
extend the Date prototype.
* Added Mekko chart plot type with enhanced legend and axes support.
* Implemented vertical waterfall charts. Can create waterfall plot as
option to bar chart. See examples folder of distribution.
* Enhanced plot labels for waterfall style.
* Enhanced bar plots so you can now color each bar of a series
independently with the "varyBarColor" option.
* Re-factored series drawing so that each series and series shadow drawn
on it's own canvas. Allows series to be redrawn independently of each other.
* Added additional default series colors.
* Added useNegativeColors option to turn off negative color array and use
only seriesColors array to define all bar/filled line colors.
* Fix css for cursor legend.
* Modified shape renderer so rectangles can be stroked and filled.
* Re-factored date methods out of dateAxisRenderer so that date formatter
and methods can be accesses outside of dateAxisRenderer plugin.
* Fixed #132, now trigger series change event on plot target instead of drag canvas.
* Fixes issue #116 where some source files had mix of tabs and spaces
for indentation. Should have been all spaces.
* Fixed issue #126, some links broken in docs section of web site.
* Fixed issue #90, trendline plugin incompatibility with pie renderer.
* Updated samples in examples folder of distribution to include navigation
links if web server is set up to process .html files with php.
* New, easier to use, replot() method for placing plots in tabs, accordions,
resizable containers or for changing plot parameters programmatically.
* Updated legend renderer for pie charts to draw swatches which will
print correctly.
* Fixed issue #118 with patch from taum so autoscale option will
honor tickInterval and numberTicks options
* Fix to plot diameter calculation for initially hidden plots.
* Added examples for making plots in jQuery UI tabs and accordions.
* Fixed issue #120 where pie chart with single slice not displaying
correctly in IE and Chrome
* Fixed #102 where double clicking on plot that has zoom enabled, but
has not been zoomed resulted in error.
* Fixed bug where candlestick coloring options not working.
* Added option to turn individual series labels off in the legend.
* Fixed bug where tooltip not working with OHLC and candlestick charts.
* Added additional marker styles: plus, X and dash.
* Implemented "zoomProxy". zoomProxy allows zooming one plot from another
such as an overview plot.
* Zooming can now be constrained to just x or y axis.
* Enhanced cursor plugin with vertical "dataTracking" line. This is a line
at the cursor location with a readout of data points at the line location
which are displayed in the chart legend.
* Changed cursor tooltip format string. Now one format string is used for
entire tooltip.
* Added mechanisms to specify plot size when plot target is hidden or plot
height/width otherwise cannot be determined from markup.
* Added $.jqplot.config object to specify jqplot wide configuration options.
These include enablePlugins to globally set the default plugin state on/off
and defaultHeight/defaultWidth to specify default plot height/width.
* Added fillToZero option which forces filled charts to fill to zero as opposed
to axis minimum. Thus negative filled bar/line values will fill upwards to
zero axis value.
* Added option to disable stacking on individual lines.
* Changed targetId property of the plot object so it now includes a "#" before
the id string.
* Improved tick and body sizing of Open Hi Low Close and candlestick charts.
* Removed lots of web site related files from the repository. This means that,
if working from the sources, user's won't be able to build the jqplot web
site and the docs/tests that are hosted on that site. The minified and
compressed distribution packages will build fine.
* Lots of examples were added to a separate examples directory to better show
functionality of jqPlot for local testing with the distribution.
* Many various bug fixes and other minor enhancements.
* Implemented axis labels. Labels can be rendered in div tags or as canvas
elements supporting rotated text.
* Improved rotated axis label positioning so labels will start or end at a
tick position.
* Fixed bug where an empty data series would hang plot rendering.
* completed issue #66 for misc. improvements to documentation.
* Fixed issue #64 where the same ID's were assigned to cursor and highlighter
* Added option to legend to encode special HTML characters.
* Fixed undesirable behavior where point labels for points off the plot
were being rendered.
* Added edgeTolerance option to point label renderer to control rendering of
labels near plot edges.
* Preliminary support for axis labels. Currently rendered into DIV tags,
so no rotated label support. This feature is currently experimental.