GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Treemap visualization when the Treemap Visualization plugin is active… · openmost/DataExplorer@e38da02

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • API.php
  • CHANGELOG.md
  • Configuration.php
  • DataExplorer.php
  • Model
    • ReportDefinition.php
  • Reports
    • GetSavedReport.php
  • Widgets
    • ExplorerWidget.php
  • lang
    • ar.json
    • de.json
    • en.json
    • es.json
    • fr.json
    • it.json
    • ja.json
    • nl.json
    • pl.json
    • pt.json
    • zh-cn.json
    • zh-tw.json
  • plugin.json
  • stylesheets
    • explorer.less
  • tests
    • Integration
      • VisualizationTest.php
    • Unit
      • ReportDefinitionTest.php
      • TranslationsTest.php
  • vue
    • dist
      • DataExplorer.umd.min.js
    • src
      • Explorer
        • Explorer.vue
        • TabSettings.vue
        • explorationState.spec.ts
        • explorationState.ts
      • RawSql
        • RawSqlEditor.vue
      • SaveDialog
        • SaveDialog.vue
      • types.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎API.php‎

Copy file name to clipboardExpand all lines: API.php
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Piwik\NoAccessException;
2525
use Piwik\Period;
2626
use Piwik\Period\Factory as PeriodFactory;
27+
use Piwik\Period\Range;
2728
use Piwik\Piwik;
2829
use Piwik\Plugin\Manager as PluginManager;
2930
use Piwik\Plugins\DataExplorer\Access\ReportPermissions;
@@ -147,6 +148,20 @@ public function runVisual(int $idSite, string $period, string $date, string $def
147148
return (new VisualQueryRunner())->runEvolution($validated, $idSite, $period, $date, $segment);
148149
}
149150

151+
// a table over several periods, such as the previous and current period of a treemap's evolution colors
152+
if (Period::isMultiplePeriod($date, $period)) {
153+
$site = new Site($idSite);
154+
$subPeriods = (new Range($period, $date, $site->getTimezone()))->getSubperiods();
155+
$map = new DataTable\Map();
156+
$map->setKeyName('date');
157+
foreach (array_slice($subPeriods, -Configuration::getRawSqlMaxPoints()) as $subPeriod) {
158+
$table = $this->runVisual($idSite, $subPeriod->getLabel(), $subPeriod->getDateStart()->toString(), $definition, $segment, $idSubtable, $flat);
159+
$map->addTable($table, $subPeriod->getPrettyString());
160+
}
161+
162+
return $map;
163+
}
164+
150165
// the native data table of the canvas asks again on every sort, page or opened row: one run serves them
151166
$cache = Cache::getLazyCache();
152167
$cacheId = 'DataExplorer_preview_' . md5(implode('|', [$idSite, $period, $date, $segment, json_encode($validated->toArray())]));
Collapse file

‎CHANGELOG.md‎

Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## Changelog
22

3+
## 6.3.0
4+
5+
- Treemap visualization when the Treemap Visualization plugin is active, for explorations, raw SQL results and saved reports. On a day, week, month or year its rectangles are colored by their evolution against the previous period.
6+
- New icons for the treemap and the line chart.
7+
38
## 6.2.1
49

510
- A filter on a dimension stored as a code (country, device type, browser...) also matches the English name, so a report filtered by one user keeps its rows for a user reading Matomo in another language.
Collapse file

‎Configuration.php‎

Copy file name to clipboardExpand all lines: Configuration.php
+16-3Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,25 @@ class Configuration
4747
* as one of its reports. Activated alone only reads the config, which keeps a plugin whose files were removed.
4848
*/
4949
public static function isCustomReportsAvailable(): bool
50+
{
51+
return self::isPluginAvailable('CustomReports');
52+
}
53+
54+
/**
55+
* The Treemap Visualization plugin is available: explorations and reports can be drawn as a treemap.
56+
*/
57+
public static function isTreemapAvailable(): bool
58+
{
59+
return self::isPluginAvailable('TreemapVisualization');
60+
}
61+
62+
private static function isPluginAvailable(string $plugin): bool
5063
{
5164
$manager = \Piwik\Plugin\Manager::getInstance();
5265

53-
return $manager->isPluginInstalled('CustomReports', true)
54-
&& $manager->isPluginActivated('CustomReports')
55-
&& $manager->isPluginLoaded('CustomReports');
66+
return $manager->isPluginInstalled($plugin, true)
67+
&& $manager->isPluginActivated($plugin)
68+
&& $manager->isPluginLoaded($plugin);
5669
}
5770

5871
/**
Collapse file

‎DataExplorer.php‎

Copy file name to clipboardExpand all lines: DataExplorer.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class DataExplorer extends \Piwik\Plugin
9494
'DataExplorer_Visualization_pie',
9595
'DataExplorer_Visualization_line',
9696
'DataExplorer_Visualization_kpicard',
97+
'DataExplorer_Visualization_treemap',
9798
'DataExplorer_SegmentComparison',
9899
'DataExplorer_Rows',
99100
'DataExplorer_Columns',
@@ -109,6 +110,7 @@ class DataExplorer extends \Piwik\Plugin
109110
'DataExplorer_RowsNotUsedByVisualization',
110111
'DataExplorer_KpiFirstMetricOnly',
111112
'DataExplorer_PieFirstMetricOnly',
113+
'DataExplorer_TreemapFirstMetricOnly',
112114
'DataExplorer_PanelNoSegments',
113115
'DataExplorer_FilterOperatorLabel',
114116
'DataExplorer_FilterOperator_equals',
Collapse file

‎Model/ReportDefinition.php‎

Copy file name to clipboardExpand all lines: Model/ReportDefinition.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ReportDefinition
3232
public const REPORT_TYPE_KPICARD = 'kpicard';
3333

3434
// how a table report opens, its footer still offers the other views
35-
public const CHARTS = ['', 'bar', 'pie'];
35+
public const CHARTS = ['', 'bar', 'pie', 'treemap'];
3636

3737
// definitions saved before filter groups: every filter applies (AND) or any of them is enough (OR)
3838
public const FILTER_MATCH_ALL = 'all';
Collapse file

‎Reports/GetSavedReport.php‎

Copy file name to clipboardExpand all lines: Reports/GetSavedReport.php
+13-2Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Piwik\ViewDataTable\Manager as ViewDataTableManager;
2929
use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable;
3030
use Piwik\Plugins\DataExplorer\Catalog\SiteContext;
31+
use Piwik\Plugins\DataExplorer\Configuration;
3132
use Piwik\Plugins\DataExplorer\Categories\ExploreSubcategory;
3233
use Piwik\Plugins\DataExplorer\Categories\ManageSubcategory;
3334
use Piwik\Plugins\DataExplorer\Dao\ReportsDao;
@@ -61,6 +62,9 @@ class GetSavedReport extends Report
6162
/** rows of a bar or pie chart of a metric that does not add up across rows, which gets no "Others" slice */
6263
public const GRAPH_ROWS = 6;
6364

65+
/** id of the visualization of the Treemap Visualization plugin, which may not be installed */
66+
public const TREEMAP_VIEW = 'infoviz-treemap';
67+
6468
/** page id prefix of a report shown on a page of its own outside the Data Explorer category */
6569
public const OWN_PAGE_PREFIX = 'dataexplorer-report-';
6670

@@ -292,6 +296,8 @@ public function getDefaultTypeViewDataTable()
292296
return Bar::ID;
293297
case 'pie':
294298
return Pie::ID;
299+
case 'treemap':
300+
return Configuration::isTreemapAvailable() ? self::TREEMAP_VIEW : HtmlTable::ID;
295301
default:
296302
return HtmlTable::ID;
297303
}
@@ -440,15 +446,20 @@ public function configureView(ViewDataTable $view)
440446
$view->config->show_goals = false;
441447
$view->config->show_insights = false;
442448
$view->config->show_table_all_columns = false;
443-
$view->config->footer_icons = $this->allowedFooterIcons($view, [HtmlTable::ID, Bar::ID, Pie::ID]);
449+
$views = [HtmlTable::ID, Bar::ID, Pie::ID];
450+
if (Configuration::isTreemapAvailable()) {
451+
$views[] = self::TREEMAP_VIEW;
452+
}
453+
$view->config->footer_icons = $this->allowedFooterIcons($view, $views);
444454

445455
if ($this->isSql()) {
446456
// the rows keep the order of the query
447457
$view->config->enable_sort = false;
448458
}
449459

450460
$definition = is_array($this->row['definition'] ?? null) ? $this->row['definition'] : [];
451-
if (!$this->isSql() && count((array) ($definition['rows'] ?? [])) > 1) {
461+
// the treemap draws the first level and opens a rectangle into the next one, a flat table has no levels
462+
if (!$this->isSql() && count((array) ($definition['rows'] ?? [])) > 1 && $view::getViewDataTableId() !== self::TREEMAP_VIEW) {
452463
$view->config->show_flatten_table = true;
453464
// the view the report was saved with, unless the URL asks for the other one
454465
$request = Request::fromRequest();
Collapse file

‎Widgets/ExplorerWidget.php‎

Copy file name to clipboardExpand all lines: Widgets/ExplorerWidget.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function render()
6060
'writable-sites' => $writableSites,
6161
'custom-reports' => Piwik::isUserHasWriteAccess($idSite)
6262
&& Configuration::isCustomReportsAvailable(),
63+
'treemap' => Configuration::isTreemapAvailable(),
6364
'setup-url' => $isSuperUser ? 'index.php?' . Url::getQueryStringFromParameters([
6465
'module' => 'DataExplorer',
6566
'action' => 'setup',
Collapse file

‎lang/ar.json‎

Copy file name to clipboardExpand all lines: lang/ar.json
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
"Visualization_table": "جدول",
8686
"Visualization_bar": "مخطط أعمدة",
8787
"Visualization_pie": "مخطط دائري",
88+
"Visualization_treemap": "مخطط شجري",
8889
"Visualization_line": "مخطط خطي عبر الزمن",
8990
"Visualization_kpicard": "بطاقة مؤشر أداء",
9091
"SegmentComparison": "الشريحة",
@@ -191,6 +192,7 @@
191192
"Export": "تصدير البيانات",
192193
"EditReport": "تعديل التقرير",
193194
"PieFirstMetricOnly": "يعرض المخطط الدائري المقياس الأول فقط.",
195+
"TreemapFirstMetricOnly": "يعرض المخطط الشجري المقياس الأول فقط.",
194196
"PanelNoSegments": "لا يوجد مقطع محفوظ بعد. أنشئ واحدًا باستخدام محرر المقاطع في Matomo.",
195197
"FilterOperator_ends_with": "ينتهي بـ",
196198
"FilterConditions": "الشرط",
Collapse file

‎lang/de.json‎

Copy file name to clipboardExpand all lines: lang/de.json
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
"Visualization_table": "Tabelle",
8686
"Visualization_bar": "Balkendiagramm",
8787
"Visualization_pie": "Kreisdiagramm",
88+
"Visualization_treemap": "Treemap",
8889
"Visualization_line": "Liniendiagramm über die Zeit",
8990
"Visualization_kpicard": "KPI-Karte",
9091
"SegmentComparison": "Segment",
@@ -191,6 +192,7 @@
191192
"Export": "Daten exportieren",
192193
"EditReport": "Bericht bearbeiten",
193194
"PieFirstMetricOnly": "Das Kreisdiagramm zeigt nur die erste Metrik.",
195+
"TreemapFirstMetricOnly": "Die Treemap zeigt nur die erste Metrik.",
194196
"PanelNoSegments": "Noch kein gespeichertes Segment. Erstellen Sie eines mit dem Segment-Editor von Matomo.",
195197
"FilterOperator_ends_with": "endet mit",
196198
"FilterConditions": "Bedingung",
Collapse file

‎lang/en.json‎

Copy file name to clipboardExpand all lines: lang/en.json
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
"Visualization_table": "Table",
8686
"Visualization_bar": "Bar chart",
8787
"Visualization_pie": "Pie chart",
88+
"Visualization_treemap": "Treemap",
8889
"Visualization_line": "Line chart over time",
8990
"Visualization_kpicard": "KPI card",
9091
"SegmentComparison": "Segment",
@@ -191,6 +192,7 @@
191192
"Export": "Export data",
192193
"EditReport": "Edit report",
193194
"PieFirstMetricOnly": "The pie chart shows the first metric only.",
195+
"TreemapFirstMetricOnly": "The treemap shows the first metric only.",
194196
"PanelNoSegments": "No saved segment yet. Create one with the Matomo segment editor.",
195197
"FilterOperator_ends_with": "ends with",
196198
"FilterConditions": "Condition",

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.