Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions API.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
use Piwik\Plugins\TreemapVisualization\Visualizations\Treemap;

/**
* Class API
* Provides public API methods for treemap visualization data.
*
* @method static \Piwik\Plugins\TreemapVisualization\API getInstance()
*/
class API extends \Piwik\Plugin\API
Expand All @@ -29,18 +30,24 @@ class API extends \Piwik\Plugin\API
* Gets report data and converts it into data that can be used with the JavaScript Infovis
* Toolkit's treemap visualization.
*
* @param string $apiMethod The API module & action to call. The result of this method is converted
* to data usable by the treemap visualization. E.g.
* @param string $apiMethod The API module and action to call. The result of this method is
* converted to data usable by the treemap visualization. Example:
* 'Actions.getPageUrls'.
* @param string $column The column to generate metric data for. If more than one column is
* supplied, the first is used and the rest discarded.
* @param string $period
* @param string $date
* @param bool $availableWidth Available screen width in pixels.
* @param bool $availableHeight Available screen height in pixels.
* @param int|bool $show_evolution_values Whether to calculate evolution values for each row or not.
* @param string $column The metric column to generate treemap data for. If more than one
* column is supplied, only the first is used.
* @param string $period The period to process, processes data for the period containing the
* specified date. Allowed values: "day", "week", "month", "year",
* "range".
* @param string $date The date or date range to process.
* 'YYYY-MM-DD', magic keywords (today, yesterday, lastWeek, lastMonth,
* lastYear), or date range ('YYYY-MM-DD,YYYY-MM-DD', lastX, previousX).
* @param int|false $availableWidth Available screen width in pixels.
* @param int|false $availableHeight Available screen height in pixels.
* @param int|bool $show_evolution_values Whether to calculate evolution values for each row.
*
* @return array<string, mixed> Treemap root node data. Returns an empty array when no DataTable is available.
*
* @return array
* @throws BadRequestException If the requested API action is not a supported get* method.
*/
public function getTreemapData(
$apiMethod,
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog

# 5.0.6 - 2026-03-02
- Updated API documentation

# 5.0.5 - 2026-02-16
- Added validation rules for ApiAction

Expand Down
18 changes: 18 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
parameters:
level: 1
phpVersion: 70200
tmpDir: /tmp/phpstan/TreemapVisualization/main
paths:
- .
excludePaths:
- tests/*
- vendor/
- github-action-tests/
bootstrapFiles:
- ../../bootstrap-phpstan.php
universalObjectCratesClasses:
- Piwik\Config
- Piwik\View
- Piwik\ViewDataTable\Config
scanDirectories:
- ../../
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "TreemapVisualization",
"version": "5.0.5",
"version": "5.0.6",
"description": "Visualise any report in Matomo as a Treemap. Click on the Treemap icon in each report to load the visualisation.",
"keywords": ["treemap", "graph", "visualization", "infovis", "jit"],
"license": "GPL v3+",
Expand Down