├── API.php
├── CHANGELOG.md
├── LICENSE
├── README.md
├── TreemapConfig.php
├── TreemapDataGenerator.php
├── TreemapVisualization.php
├── Visualizations
└── Treemap.php
├── images
└── treemap-icon.png
├── javascripts
└── treemapViz.js
├── lang
├── am.json
├── ar.json
├── az.json
├── be.json
├── bg.json
├── bn.json
├── bs.json
├── ca.json
├── cs.json
├── cy.json
├── da.json
├── de.json
├── dv.json
├── el.json
├── en.json
├── eo.json
├── es-ar.json
├── es.json
├── et.json
├── eu.json
├── fa.json
├── fi.json
├── fr.json
├── ga.json
├── gl.json
├── gu.json
├── he.json
├── hi.json
├── hr.json
├── hu.json
├── hy.json
├── id.json
├── is.json
├── it.json
├── ja.json
├── ka.json
├── ko.json
├── ku.json
├── lb.json
├── lt.json
├── lv.json
├── ms.json
├── nb.json
├── nl.json
├── nn.json
├── pl.json
├── pt-br.json
├── pt.json
├── ro.json
├── ru.json
├── si.json
├── sk.json
├── sl.json
├── sq.json
├── sr.json
├── sv.json
├── ta.json
├── te.json
├── th.json
├── tl.json
├── tr.json
├── tzm.json
├── uk.json
├── ur.json
├── vi.json
├── zh-cn.json
└── zh-tw.json
├── libs
└── Jit
│ └── jit-2.0.1-yc.js
├── phpcs.xml
├── plugin.json
├── pull_request_template.md
├── screenshots
├── Screen_Resolution_Treemap.png
├── Social_Network_Treemap.png
└── Treemap.png
├── stylesheets
├── treemap.less
└── treemapColors.less
└── templates
└── _dataTableViz_treemap.twig
/API.php:
--------------------------------------------------------------------------------
1 | setInitialRowOffset(Common::getRequestVar('filter_offset', 0, 'int'));
86 | $generator->setAvailableDimensions($availableWidth, $availableHeight);
87 | if ($show_evolution_values) {
88 | $generator->showEvolutionValues();
89 | }
90 |
91 | $generator->truncateBasedOnAvailableSpace($dataTable);
92 | $dataTable->applyQueuedFilters();
93 |
94 | list($module, $method) = explode('.', $apiMethod);
95 | if ($module == 'Actions') {
96 | Treemap::configureGeneratorIfActionsUrlReport($generator, $method);
97 | }
98 |
99 | return $generator->generate($dataTable);
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## Changelog
2 |
3 | # 5.0.3 - 2025-01-20
4 | - Added code to allow calling Treemap API only directly
5 |
6 | # 5.0.2 - 2025-01-10
7 | - Avoids recursion in API calls
8 |
9 | # 5.0.1
10 | - Added plugin category for Marketplace
11 |
12 | # 5.0.0
13 | - Compatibility with Matomo 5
14 |
15 | # 4.0.2
16 | - Translation changes and made plugin translatable
17 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/matomo-org/plugin-TreemapVisualization/actions/workflows/matomo-tests.yml)
2 |
3 | ## Description
4 |
5 | TreemapVisualization contains a new report visualization that will display your reports as tiles of different sizes and will show you how each metric has changed from the last period.
6 |
7 | The treemap visualization displays rows of data as squares whose size corresponds to a metric in each row.
8 |
9 | If you're looking at the visits in a report, the row with the most visits will take up the most space. Just like other graph visualizations, **you can use it to easily see which rows have the largest values**. The treemap differs from other graphs though, in that **it can show many more rows**.
10 |
11 | #### Treemap colors for comparison with previous period
12 |
13 | The treemap visualization will also show you one thing that no other visualization included with Matomo does: the **evolution** of each row. Hovering over a treemap square will show you how much the row changed from the last period (ie, the last day, week, etc.).
14 |
15 | Each treemap square is colored based on the evolution value **so you can easily see how your data is changing**. A red square means the change is negative; a green square means the change is positive. The more green the bigger the change; the more red the smaller the change.
16 |
17 | #### Known limitations
18 |
19 | * Treemaps will not work with flattened tables. Currently, if a table is flattened, the treemap icon will be removed.
20 | * Evolution values cannot be calculated for subtables (reports that are displayed when you click on a row or node).
21 |
22 | #### Feedback, bug report or requests
23 | [github.com/matono-org/plugin-TreemapVisualization/issues](https://github.com/matomo-org/plugin-TreemapVisualization/issues)
24 |
--------------------------------------------------------------------------------
/TreemapConfig.php:
--------------------------------------------------------------------------------
1 | columns_to_display)) {
34 | $this->setDefaultColumnsToDisplay(array('nb_visits'), false, false);
35 | }
36 |
37 | $this->allow_multi_select_series_picker = false;
38 |
39 | $this->addPropertiesThatShouldBeAvailableClientSide(array(
40 | 'filter_offset',
41 | 'max_graph_elements',
42 | 'show_evolution_values',
43 | 'subtable_controller_action'
44 | ));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/TreemapDataGenerator.php:
--------------------------------------------------------------------------------
1 | metricToGraph = $metricToGraph;
111 | $this->metricTranslation = $metricTranslation;
112 | }
113 |
114 | /**
115 | * Sets the name of the root node.
116 | *
117 | * @param string $name
118 | */
119 | public function setRootNodeName($name)
120 | {
121 | $this->rootName = $name;
122 | }
123 |
124 | /**
125 | * Sets the offset of the first row in the converted DataTable.
126 | *
127 | * @param int $offset
128 | */
129 | public function setInitialRowOffset($offset)
130 | {
131 | $this->firstRowOffset = (int)$offset;
132 | }
133 |
134 | /**
135 | * Configures the generator to calculate the evolution of column values and include
136 | * this data in the outputted tree structure.
137 | */
138 | public function showEvolutionValues()
139 | {
140 | $this->showEvolutionValues = true;
141 | }
142 |
143 | /**
144 | * Sets the callback used to format row labels before they are used in treemap nodes.
145 | *
146 | * @param callback $formatter
147 | */
148 | public function setLabelFormatter($formatter)
149 | {
150 | $this->labelFormatter = $formatter;
151 | }
152 |
153 | /**
154 | * Sets the available screen dimensions for this visualization.
155 | *
156 | * @param int $availableWidth The available screen width for the display.
157 | * @param int $availableHeight The available screen height for the display.
158 | */
159 | public function setAvailableDimensions($availableWidth, $availableHeight)
160 | {
161 | $this->availableWidth = $availableWidth;
162 | $this->availableHeight = $availableHeight;
163 | }
164 |
165 | /**
166 | * Generates an array that can be encoded as JSON and used w/ the JavaScript Infovis Toolkit.
167 | *
168 | * @param \Piwik\DataTable $dataTable
169 | * @return array
170 | */
171 | public function generate($dataTable)
172 | {
173 | // sanity check: if the dataTable is not a Map, we don't have the data to calculate evolution
174 | // values, so make sure we don't try
175 | if (!($dataTable instanceof Map)) {
176 | $this->showEvolutionValues = false;
177 | }
178 |
179 | // if showEvolutionValues is true, $dataTable must be a DataTable\Map w/ two child tables
180 | $pastData = false;
181 | if ($this->showEvolutionValues) {
182 | $pastData = $dataTable->getFirstRow();
183 | $dataTable = $dataTable->getLastRow();
184 |
185 | $this->pastDataDate = $pastData->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX)->getLocalizedShortString();
186 | }
187 |
188 | $root = $this->makeNode('treemap-root', $this->rootName);
189 |
190 | $tableId = Common::getRequestVar('idSubtable', '');
191 | $this->addDataTableToNode($root, $dataTable, $pastData, $tableId, $this->firstRowOffset);
192 | return $root;
193 | }
194 |
195 | /**
196 | * Computes the maximum number of elements allowed in the report to display, based on the
197 | * available screen width/height, and truncates the report data so the number of rows
198 | * will not exceed the max.
199 | *
200 | * @param DataTable $dataTable The report data. Must be sorted by the metric to graph.
201 | * @param int $availableWidth Available width in pixels.
202 | * @param int $availableHeight Available height in pixels.
203 | */
204 | public function truncateBasedOnAvailableSpace($dataTable)
205 | {
206 | $truncateAfter = self::DEFAULT_MAX_ELEMENTS - 1;
207 | if (
208 | is_numeric($this->availableWidth)
209 | && is_numeric($this->availableHeight)
210 | ) {
211 | $totalArea = $this->availableWidth * $this->availableHeight;
212 |
213 | $dataTable->filter('ReplaceColumnNames');
214 |
215 | $metricValues = $dataTable->getColumn($this->metricToGraph);
216 | $metricSum = array_sum($metricValues);
217 |
218 | if ($metricSum != 0) {
219 | // find the row index in $dataTable for which all rows after it will have treemap
220 | // nodes that are too small. this is the row from which we truncate.
221 | // Note: $dataTable is sorted at this point, so $metricValues is too
222 | $result = 0;
223 | foreach ($metricValues as $value) {
224 | $nodeArea = ($totalArea * $value) / $metricSum;
225 |
226 | if ($nodeArea < self::MIN_NODE_AREA) {
227 | break;
228 | } else {
229 | ++$result;
230 | }
231 | }
232 | $truncateAfter = $result;
233 | }
234 | }
235 |
236 | $dataTable->filter('Truncate', array($truncateAfter));
237 | }
238 |
239 | private function addDataTableToNode(&$node, $dataTable, $pastData = false, $tableId = '', $offset = 0)
240 | {
241 | foreach ($dataTable->getRows() as $rowId => $row) {
242 | $pastRow = $pastData ? $pastData->getRowFromLabel($row->getColumn('label')) : false;
243 |
244 | $childNode = $this->makeNodeFromRow($tableId, $rowId, $row, $pastRow);
245 | if (empty($childNode)) {
246 | continue;
247 | }
248 |
249 | if ($rowId == DataTable::ID_SUMMARY_ROW) {
250 | $childNode['data']['aggregate_offset'] = $offset + $dataTable->getRowsCount() - 1;
251 | } elseif ($row->getIdSubDataTable() !== null) {
252 | $childNode['data']['idSubtable'] = $row->getIdSubDataTable();
253 | }
254 |
255 | $node['children'][] = $childNode;
256 | }
257 | }
258 |
259 | private function makeNodeFromRow($tableId, $rowId, $row, $pastRow)
260 | {
261 | $label = $row->getColumn('label');
262 | if ($this->labelFormatter) {
263 | $formatter = $this->labelFormatter;
264 | $label = $formatter($row, $label);
265 | }
266 |
267 | $columnValue = $row->getColumn($this->metricToGraph) ?: 0;
268 |
269 | if ($columnValue == 0) { // avoid issues in JIT w/ 0 $area values
270 | return false;
271 | }
272 |
273 | $data = array();
274 | $data['$area'] = $columnValue;
275 |
276 | // add metadata
277 | if ($rowId !== DataTable::ID_SUMMARY_ROW) {
278 | foreach (self::$rowMetadataToCopy as $metadataName) {
279 | $metadataValue = $row->getMetadata($metadataName);
280 | if ($metadataValue !== false) {
281 | $data['metadata'][$metadataName] = $metadataValue;
282 | }
283 | }
284 | }
285 |
286 | // add evolution
287 | if (
288 | $rowId !== DataTable::ID_SUMMARY_ROW
289 | && $this->showEvolutionValues
290 | ) {
291 | if ($pastRow === false) {
292 | $data['evolution'] = 100;
293 | } else {
294 | $pastValue = $pastRow->getColumn($this->metricToGraph) ?: 0;
295 | $data['evolution'] = CalculateEvolutionFilter::calculate(
296 | $columnValue,
297 | $pastValue,
298 | $quotientPrecision = 0,
299 | $appendPercentSign = false
300 | );
301 | }
302 | }
303 |
304 | // add node tooltip
305 | $data['metadata']['tooltip'] = "\n" . $columnValue . ' ' . $this->metricTranslation;
306 | if (isset($data['evolution'])) {
307 | $plusOrMinus = $data['evolution'] >= 0 ? '+' : '-';
308 | $evolutionChange = $plusOrMinus . abs($data['evolution']) . '%';
309 |
310 | $data['metadata']['tooltip'] = Piwik::translate('General_XComparedToY', array(
311 | $data['metadata']['tooltip'] . "\n" . $evolutionChange,
312 | $this->pastDataDate
313 | ));
314 | }
315 |
316 | return $this->makeNode($this->getNodeId($tableId, $rowId), $label, $data);
317 | }
318 |
319 | private function getNodeId($tableId, $rowId)
320 | {
321 | if ($rowId == DataTable::ID_SUMMARY_ROW) {
322 | $rowId = $this->firstRowOffset . '_' . $rowId;
323 | } else {
324 | $rowId = $this->firstRowOffset += $rowId;
325 | }
326 |
327 | return $tableId . '_' . $rowId;
328 | }
329 |
330 | private function makeNode($id, $title, $data = array())
331 | {
332 | return array('id' => $id, 'name' => $title, 'data' => $data, 'children' => array());
333 | }
334 | }
335 |
--------------------------------------------------------------------------------
/TreemapVisualization.php:
--------------------------------------------------------------------------------
1 | 'getStylesheetFiles',
25 | 'AssetManager.getJavaScriptFiles' => 'getJsFiles',
26 | 'ViewDataTable.addViewDataTable' => 'getAvailableVisualizations', // Piwik 2.X
27 | 'ViewDataTable.filterViewDataTable' => 'removeTreemapVisualizationIfFlattenIsUsed' // Piwik 3.X
28 | );
29 | }
30 |
31 | public function getAvailableVisualizations(&$visualizations)
32 | {
33 | // treemap doesn't work w/ flat=1
34 | if (Common::getRequestVar('flat', 0)) {
35 | $key = array_search('Piwik\\Plugins\\TreemapVisualization\\Visualizations\\Treemap', $visualizations);
36 | if ($key !== false) {
37 | unset($visualizations[$key]);
38 | }
39 | }
40 | }
41 |
42 | public function removeTreemapVisualizationIfFlattenIsUsed(&$visualizations)
43 | {
44 | // treemap doesn't work w/ flat=1
45 | if (Common::getRequestVar('flat', 0) && isset($visualizations[Treemap::ID])) {
46 | unset($visualizations[Treemap::ID]);
47 | }
48 | }
49 |
50 | public function getStylesheetFiles(&$stylesheets)
51 | {
52 | $stylesheets[] = 'plugins/TreemapVisualization/stylesheets/treemap.less';
53 | $stylesheets[] = 'plugins/TreemapVisualization/stylesheets/treemapColors.less';
54 | }
55 |
56 | public function getJsFiles(&$jsFiles)
57 | {
58 | $jsFiles[] = 'plugins/TreemapVisualization/libs/Jit/jit-2.0.1-yc.js';
59 | $jsFiles[] = 'plugins/TreemapVisualization/javascripts/treemapViz.js';
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Visualizations/Treemap.php:
--------------------------------------------------------------------------------
1 | config->datatable_js_type = 'TreemapDataTable';
79 | $this->config->show_flatten_table = false;
80 | $this->config->show_pagination_control = false;
81 | $this->config->show_offset_information = false;
82 |
83 | if ('ExampleUI' == $this->requestConfig->getApiModuleToRequest()) {
84 | $this->config->show_evolution_values = false;
85 | }
86 |
87 | if ('Actions' === $this->requestConfig->getApiModuleToRequest()) {
88 | $this->configureForActionsReports();
89 | }
90 |
91 | $this->assignTemplateVar('generator', $this->generator);
92 | }
93 |
94 | public function configureForActionsReports()
95 | {
96 | $this->config->show_all_views_icons = true;
97 | $this->config->show_bar_chart = false;
98 | $this->config->show_pie_chart = false;
99 | $this->config->show_tag_cloud = false;
100 |
101 | $method = $this->requestConfig->getApiMethodToRequest();
102 |
103 | // for some actions reports, use all available space
104 | if (in_array($method, self::$fullWidthActionsReports)) {
105 | $this->config->datatable_css_class = 'infoviz-treemap-full-width';
106 | $this->config->max_graph_elements = 50;
107 | } else {
108 | $this->config->max_graph_elements = max(10, $this->config->max_graph_elements);
109 | }
110 |
111 | self::configureGeneratorIfActionsUrlReport($this->generator, $method);
112 | }
113 |
114 | public static function configureGeneratorIfActionsUrlReport($generator, $method)
115 | {
116 | if (in_array($method, self::$actionsUrlReports)) {
117 | $generator->setLabelFormatter(function ($row, $label) {
118 | if ($row->getIdSubDataTable() !== null) {
119 | return $label . '/';
120 | } else {
121 | return $label;
122 | }
123 | });
124 | }
125 | }
126 |
127 | public function beforeLoadDataTable()
128 | {
129 | $this->config->max_graph_elements = false;
130 |
131 | parent::beforeLoadDataTable();
132 |
133 | $metric = $this->getMetricToGraph($this->config->columns_to_display);
134 | $translation = empty($this->config->translations[$metric]) ? $metric : $this->config->translations[$metric];
135 |
136 | $this->generator = new TreemapDataGenerator($metric, $translation);
137 |
138 | $filterOffset = $this->requestConfig->filter_offset ?: 0;
139 | $this->generator->setInitialRowOffset($filterOffset);
140 |
141 | $this->handleShowEvolutionValues();
142 |
143 | $availableWidth = false;
144 | if (!empty($this->config->custom_parameters['availableWidth'])) {
145 | $availableWidth = (int)$this->config->custom_parameters['availableWidth'];
146 | }
147 |
148 | $availableHeight = false;
149 | if (!empty($this->config->custom_parameters['availableHeight'])) {
150 | $availableHeight = (int)$this->config->custom_parameters['availableHeight'];
151 | }
152 |
153 | $availableWidth = Common::getRequestVar('availableWidth', $availableWidth);
154 | $availableHeight = Common::getRequestVar('availableHeight', $availableHeight);
155 | $this->generator->setAvailableDimensions($availableWidth, $availableHeight);
156 |
157 | $this->assignTemplateVar('availableWidth', $availableWidth);
158 | $this->assignTemplateVar('availableHeight', $availableHeight);
159 | }
160 |
161 | public function afterGenericFiltersAreAppliedToLoadedDataTable()
162 | {
163 | $this->generator->truncateBasedOnAvailableSpace($this->getCurrentData($this->dataTable));
164 | }
165 |
166 | public function beforeGenericFiltersAreAppliedToLoadedDataTable()
167 | {
168 | $this->config->custom_parameters['columns'] = $this->getMetricToGraph($this->config->columns_to_display);
169 | }
170 |
171 | /**
172 | * Checks if the data obtained by ViewDataTable has data or not. Since we get the last period
173 | * when calculating evolution, we need this hook to determine if there's data in the latest
174 | * table.
175 | *
176 | * @return bool
177 | */
178 | public function isThereDataToDisplay()
179 | {
180 | return $this->getCurrentData($this->dataTable)->getRowsCount() != 0;
181 | }
182 |
183 | private function getCurrentData($dataTable)
184 | {
185 | if ($dataTable instanceof Map) { // will be true if calculating evolution values
186 | $childTables = $dataTable->getDataTables();
187 | return end($childTables);
188 | } else {
189 | return $dataTable;
190 | }
191 | }
192 |
193 | public function getMetricToGraph($columnsToDisplay)
194 | {
195 | $firstColumn = reset($columnsToDisplay);
196 | if ('label' == $firstColumn) {
197 | $firstColumn = next($columnsToDisplay);
198 | }
199 | return $firstColumn;
200 | }
201 |
202 | private function handleShowEvolutionValues()
203 | {
204 | // evolution values cannot be calculated if range period is used or subtable is being loaded
205 | $period = Common::getRequestVar('period');
206 | if (
207 | $period == 'range'
208 | || $this->requestConfig->idSubtable
209 | ) {
210 | return;
211 | }
212 |
213 | if ($this->config->show_evolution_values) {
214 | $date = Common::getRequestVar('date');
215 | list($previousDate, $ignore) = Range::getLastDate($date, $period);
216 |
217 | $this->requestConfig->request_parameters_to_modify['date'] = $previousDate . ',' . $date;
218 |
219 | $this->generator->showEvolutionValues();
220 | }
221 | }
222 | }
223 |
--------------------------------------------------------------------------------
/images/treemap-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matomo-org/plugin-TreemapVisualization/5a12b18faa0f04c02a7179f8b214448551b926ee/images/treemap-icon.png
--------------------------------------------------------------------------------
/javascripts/treemapViz.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Matomo - free/libre analytics platform
3 | *
4 | * @link https://matomo.org
5 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
6 | */
7 |
8 | (function ($, $jit, require) {
9 |
10 | var exports = require('piwik/UI'),
11 | DataTable = exports.DataTable,
12 | dataTablePrototype = DataTable.prototype,
13 |
14 | fullPageReports = {
15 | 'Actions.getPageUrls': true,
16 | 'Actions.getEntryPageUrls': true,
17 | 'Actions.getExitPageUrls': true,
18 | 'Actions.getEntryPageTitles': true,
19 | 'Actions.getExitPageTitles': true,
20 | 'Actions.getPageTitles': true,
21 | 'Actions.getOutlinks': true,
22 | 'Actions.getDownloads': true
23 | },
24 |
25 | COLOR_NAMESPACE_NORMAL = 'infoviz-treemap-colors',
26 | COLOR_NAMESPACE_EVOLUTION = 'infoviz-treemap-evolution-colors';
27 |
28 | /**
29 | * Class that handles UI behavior for the treemap visualization.
30 | */
31 | exports.TreemapDataTable = function (element) {
32 | DataTable.call(this, element);
33 | };
34 |
35 | $.extend(exports.TreemapDataTable.prototype, dataTablePrototype, {
36 |
37 | /**
38 | * Constructor.
39 | */
40 | init: function () {
41 | dataTablePrototype.init.call(this);
42 |
43 | var domElem = this.$element;
44 | var treemapContainerId = this.workingDivId + '-infoviz-treemap';
45 | var treemapContainer = $('.infoviz-treemap', domElem).attr('id', treemapContainerId);
46 |
47 | if (!treemapContainer[0]) {
48 | return;
49 | }
50 |
51 | // we need to fix the width/height, otherwise treemap is not displayed in case treemap is the default
52 | // visualization for a report eg PageUrls
53 | if (!treemapContainer.height() && this.param.availableHeight) {
54 | treemapContainer.height(this.param.availableHeight);
55 | }
56 | if (!treemapContainer.width() && this.param.availableWidth) {
57 | treemapContainer.width(this.param.availableWidth);
58 | }
59 |
60 | this._bindEventCallbacks(domElem);
61 |
62 | var self = this;
63 | setTimeout(function () { // use a timeout in case nothing in the DOM has been sized yet
64 | self.createJitTreemap(treemapContainer);
65 | }, 1);
66 | },
67 |
68 | /**
69 | * Creates the internal treemap object and renders it.
70 | */
71 | createJitTreemap: function (treemapContainer) {
72 | var treemapContainerId = treemapContainer.attr('id'),
73 | domElem = this.$element,
74 | headerColor = piwik.ColorManager.getColor(COLOR_NAMESPACE_NORMAL, 'header-background-color'),
75 | self = this;
76 |
77 | this.treemap = new $jit.TM.Squarified({
78 | injectInto: treemapContainerId,
79 | titleHeight: 24,
80 | animate: true, // TODO: disable on ipad/w/o native canvas support
81 | offset: 1,
82 | levelsToShow: 1,
83 | constrained: true,
84 | Node: {
85 | color: headerColor
86 | },
87 | Events: {
88 | enable: true,
89 | onClick: function (node, info, event) {
90 | if (event.which == 2) {
91 | self._onMiddleClick(node);
92 | } else {
93 | self._onLeftClickNode(node);
94 | }
95 | },
96 | onRightClick: function (node) {
97 | self._onRightClickNode(node);
98 | }
99 | },
100 | duration: 1000,
101 | Tips: {
102 | enable: false // TODO: show more in tooltips
103 | },
104 | onCreateLabel: function (nodeElement, node) {
105 | self._initNode(nodeElement, node);
106 | },
107 | onPlaceLabel: function (nodeElement, node) {
108 | self._toggleLabelBasedOnAvailableSpace(nodeElement, node);
109 | }
110 | });
111 |
112 | this.data = this._prepareTreemapData(treemapContainer.attr('data-data'));
113 | this._refreshTreemap({animate: true});
114 | this._addSeriesPicker(domElem);
115 | },
116 |
117 | /**
118 | * Recursively iterates over the entire data tree and executes a function with
119 | * each node.
120 | *
121 | * @param {Function} f The function to execute. Accepts one argument, the node.
122 | * @param {Object} [node] The JSON node object to start from. This defaults to the root
123 | * of the entire tree.
124 | */
125 | foreachNode: function (f, node) {
126 | node = node || this.data;
127 |
128 | f(node);
129 | for (var i = 0; i != (node.children || []).length; ++i) {
130 | this.foreachNode(f, node.children[i]);
131 | }
132 | },
133 |
134 | /**
135 | * Changes the metric the treemap displays.
136 | *
137 | * @param {String} metric The name of the metric, e.g. 'nb_visits', 'nb_actions', etc.
138 | */
139 | changeMetric: function (metric) {
140 | this.param.columns = metric;
141 | this.reloadAjaxDataTable();
142 | },
143 |
144 | /**
145 | * Handle events to make this control functional.
146 | */
147 | _bindEventCallbacks: function (domElem) {
148 | var self = this;
149 | domElem.on('click', '.infoviz-treemap-zoom-out', function (e) {
150 | e.preventDefault();
151 | self._leaveNode();
152 | return false;
153 | });
154 |
155 | this.onWidgetResize(function () {
156 | self.resize();
157 | });
158 | },
159 |
160 | resize: function () {
161 | var $treemap = this.$element.find('.infoviz-treemap');
162 | var height = $treemap.height();
163 |
164 | if (!height && this.param.availableHeight) {
165 | height = this.param.availableHeight;
166 | }
167 |
168 | var width = $treemap.width();
169 | if (!width && this.param.availableWidth) {
170 | width = this.param.availableWidth;
171 | }
172 |
173 | this.treemap.canvas.resize(width, height);
174 | },
175 |
176 | /**
177 | * Adds the SeriesPicker DataTable visualization widget to this treemap visualization.
178 | */
179 | _addSeriesPicker: function (dataTableDomElem) {
180 | var self = this;
181 | var SeriesPicker = require('piwik/DataTableVisualizations/Widgets').SeriesPicker;
182 |
183 | this._seriesPicker = new SeriesPicker(this);
184 |
185 | $(this._seriesPicker).bind('placeSeriesPicker', function () {
186 | var displayedColumn = this.getMetricTranslation(self.param.columns);
187 |
188 | var metricLabel = $('')
189 | .addClass('infoviz-treemap-colors')
190 | .attr('data-name', 'header-color')
191 | .text("— " + displayedColumn)
192 | ;
193 |
194 | var seriesPickerContainer = $('') // TODO: this behavior should probably be a part of SeriesPicker
195 | .addClass('infoviz-treemap-series-picker')
196 | .append(metricLabel)
197 | .append(this.domElem)
198 | ;
199 |
200 | dataTableDomElem.find('.infoviz-treemap').prepend(seriesPickerContainer);
201 | });
202 |
203 | $(this._seriesPicker).bind('seriesPicked', function (e, columns) {
204 | self.changeMetric(columns[0]);
205 | });
206 |
207 | this._seriesPicker.init();
208 | },
209 |
210 | /**
211 | * Initializes the display of a treemap node element.
212 | */
213 | _initNode: function (nodeElement, node) {
214 | var $nodeElement = $(nodeElement),
215 | nodeHasUrl = node.data.metadata && node.data.metadata.url,
216 | nodeHasLogo = node.data.metadata && node.data.metadata.logo;
217 |
218 | // add label (w/ logo if it exists)
219 | var $label = $('').addClass("infoviz-treemap-node-label");
220 | $label.append($('').text(node.name));
221 |
222 | var leftImage = null;
223 | if (nodeHasLogo) {
224 | leftImage = node.data.metadata.logo;
225 | } else if (nodeHasUrl) {
226 | leftImage = 'plugins/Morpheus/images/link.png';
227 | }
228 |
229 | if (leftImage) {
230 | $label.prepend($('
').attr('src', leftImage));
231 | }
232 |
233 | $nodeElement.append($label);
234 |
235 | // set node tooltip
236 | var tooltip = node.name;
237 | if (nodeHasUrl) {
238 | tooltip += ' (' + node.data.metadata.url + ')';
239 | }
240 | if (node.data.metadata
241 | && node.data.metadata.tooltip
242 | ) {
243 | tooltip += ' ' + node.data.metadata.tooltip;
244 | }
245 | $nodeElement.attr('title', tooltip);
246 |
247 | // set label color
248 | if (this.labelColor) {
249 | $label.css('color', this.labelColor);
250 | }
251 |
252 | // if the node can be clicked into, show a pointer cursor over it
253 | if (this._canEnterNode(node)
254 | || nodeHasUrl
255 | ) {
256 | $nodeElement.addClass("infoviz-treemap-enterable-node");
257 | }
258 | },
259 |
260 | /**
261 | * Shows/hides the label depending on whether there's enough vertical space in the node
262 | * to show it.
263 | */
264 | _toggleLabelBasedOnAvailableSpace: function (nodeElement, node) {
265 | var $nodeElement = $(nodeElement),
266 | $label = $nodeElement.children('span');
267 | $label.toggle($nodeElement.height() > $label.height());
268 | },
269 |
270 | /**
271 | * Prepares data obtained from Piwik server-side code to be used w/ the JIT Treemap
272 | * visualization. Will make sure each node ID is unique and has a color.
273 | */
274 | _prepareTreemapData: function (data) {
275 | if (typeof data == 'string') {
276 | data = JSON.parse(data);
277 | }
278 |
279 | this._prependDataTableIdToNodeIds(this.workingDivId, data);
280 | this._setTreemapColors(data);
281 | return data;
282 | },
283 |
284 | /**
285 | * Reloads the treemap visualization using this.data.
286 | */
287 | _refreshTreemap: function (options) {
288 | if (!options.animate) {
289 | this.treemap.config.animate = false;
290 | }
291 |
292 | this.treemap.loadJSON(this.data);
293 | this.treemap.refresh();
294 |
295 | if (!options.animate) {
296 | this.treemap.config.animate = true;
297 | }
298 | },
299 |
300 | /**
301 | * Alters the ID of each node in tree so it will be unique even if more than one treemap
302 | * is displayed.
303 | */
304 | _prependDataTableIdToNodeIds: function (idPrefix, tree) {
305 | tree.id = idPrefix + '-' + tree.id;
306 |
307 | var children = tree.children || [];
308 | for (var i = 0; i != children.length; ++i) {
309 | this._prependDataTableIdToNodeIds(idPrefix, children[i]);
310 | }
311 | },
312 |
313 | /**
314 | * Sets the color of each treemap node.
315 | */
316 | _setTreemapColors: function (root) {
317 | if (this.props.show_evolution_values) {
318 | this._setTreemapColorsFromEvolution(root);
319 | } else {
320 | this._setTreemapColorsNormal(root);
321 | }
322 | },
323 |
324 | _setTreemapColorsFromEvolution: function (root) {
325 | // get colors
326 | var colorManager = piwik.ColorManager;
327 | var colorNames = ['no-change', 'negative-change-max', 'positive-change-max', 'label'];
328 | var colors = colorManager.getColors(COLOR_NAMESPACE_EVOLUTION, colorNames);
329 |
330 | // find min-max evolution values to make colors relative to
331 | var minEvolution = -100, maxEvolution = 100;
332 | this.foreachNode(function (node) {
333 | var evolution = node.data.evolution || 0;
334 |
335 | if (evolution < 0) {
336 | minEvolution = Math.min(minEvolution, evolution);
337 | } else if (evolution > 0) {
338 | maxEvolution = Math.max(maxEvolution, evolution);
339 | }
340 | }, root);
341 |
342 | // color each node
343 | var self = this,
344 | negativeChangeColor = colorManager.getRgb(colors['negative-change-max'] || '#f00'),
345 | positiveChangeColor = colorManager.getRgb(colors['positive-change-max'] || '#0f0'),
346 | noChangeColor = colorManager.getRgb(colors['no-change'] || '#333');
347 |
348 | this.foreachNode(function (node) {
349 | var evolution = node.data.evolution || 0;
350 |
351 | var color;
352 | if (evolution < 0) {
353 | var colorPercent = (minEvolution - evolution) / minEvolution;
354 | color = colorManager.getSingleColorFromGradient(negativeChangeColor, noChangeColor, colorPercent);
355 | } else if (evolution > 0) {
356 | var colorPercent = (maxEvolution - evolution) / maxEvolution;
357 | color = colorManager.getSingleColorFromGradient(positiveChangeColor, noChangeColor, colorPercent);
358 | } else {
359 | color = colors['no-change'];
360 | }
361 |
362 | node.data.$color = color;
363 | }, root);
364 |
365 | this.labelColor = colors.label;
366 | },
367 |
368 | /**
369 | * Sets the color of treemap nodes using pie-graph-colors.
370 | */
371 | _setTreemapColorsNormal: function (root) {
372 | var normalColor = piwik.ColorManager.getColor(COLOR_NAMESPACE_NORMAL, 'normal-node-color');
373 | this.foreachNode(function (node) {
374 | node.data.$color = normalColor;
375 | }, root);
376 | },
377 |
378 | /**
379 | * Event handler for when a node is left-clicked.
380 | *
381 | * This function will enter the node if it can be entered. If it can't be entered, we try
382 | * and open the node's associated URL, if it has one.
383 | */
384 | _onLeftClickNode: function (node) {
385 | if (!node) {
386 | return;
387 | }
388 |
389 | if (this._nodeHasSubtable(node)) {
390 | this._enterSubtable(node);
391 | } else {
392 | this._openNodeUrl(node);
393 | }
394 | },
395 |
396 | /**
397 | * Event handler for when a node is middle clicked.
398 | *
399 | * If the node has a url, this function will load the URL in a new tab/window.
400 | */
401 | _onMiddleClick: function (node) {
402 | if (!node) {
403 | return;
404 | }
405 |
406 | this._openNodeUrl(node);
407 | },
408 |
409 | /**
410 | * If the given node has an associated URL, it is opened in a new tab/window.
411 | */
412 | _openNodeUrl: function (node) {
413 | if (node.data.metadata
414 | && node.data.metadata.url
415 | ) {
416 | window.open(node.data.metadata.url, '_blank');
417 | }
418 | },
419 |
420 | /**
421 | * Event handler for when a node is right clicked.
422 | *
423 | * This function will advance to the parent of the current node, if it has one.
424 | */
425 | _onRightClickNode: function (node) {
426 | this._leaveNode();
427 | },
428 |
429 | /**
430 | * Enter a treemap node that is a node for a row w/ a subtable.
431 | */
432 | _enterSubtable: function (node) {
433 | if (node.data.loading) {
434 | return;
435 | }
436 |
437 | if (!node.data.loaded) {
438 | var self = this;
439 | this._loadSubtableNodeChildren(node, function (newNode) {
440 | self._enterNode(newNode);
441 | });
442 | } else {
443 | this._enterNode(node);
444 | }
445 | },
446 |
447 | /**
448 | * Enters a node and toggles the zoom out link.
449 | */
450 | _enterNode: function (node) {
451 | this.treemap.enter(node);
452 | this._toggleZoomOut(true);
453 | },
454 |
455 | /**
456 | * Leaves a node and toggles the zoom out link if at the root node.
457 | */
458 | _leaveNode: function () {
459 | this.treemap.out();
460 | this._toggleZoomOut();
461 | },
462 |
463 | /**
464 | * Show/hide the zoom out button based on the currently selected node.
465 | */
466 | _toggleZoomOut: function (toggle) {
467 | var toggle = toggle || (this.treemap.clickedNode && !this._isFirstLevelNode(this.treemap.clickedNode));
468 | $('.infoviz-treemap-zoom-out', this.$element).css('visibility', toggle ? 'visible' : 'hidden');
469 | },
470 |
471 | /**
472 | * Returns true if node is a child of the root node, false if it represents a subtable row.
473 | */
474 | _isFirstLevelNode: function (node) {
475 | var parents = node.getParents();
476 |
477 | if (!parents || !parents.length) {
478 | return true;
479 | }
480 |
481 | var parent = parents[0];
482 | return !parent || parent.id.indexOf('treemap-root') != -1;
483 | },
484 |
485 | /**
486 | * Loads data for a node's subtable without reloading the datatable view.
487 | */
488 | _loadSubtableNodeChildren: function (node, callback) {
489 | var ajax = this._getNodeChildrenAjax({
490 | idSubtable: node.data.idSubtable
491 |
492 | }, node, callback);
493 | ajax.send();
494 | },
495 |
496 | /**
497 | * Loads a node's children via AJAX and updates w/o reloading the datatable view.
498 | */
499 | _getNodeChildrenAjax: function (overrideParams, node, callback) {
500 | var self = this,
501 | dataNode = self._findNodeWithId(node.id),
502 | params = $.extend({}, self.param, overrideParams, {
503 | module: 'API',
504 | method: 'TreemapVisualization.getTreemapData',
505 | action: 'index',
506 | apiMethod: self.param.module + '.' + self.props.subtable_controller_action,
507 | format: 'json',
508 | column: self.param.columns,
509 | show_evolution_values: self.props.show_evolution_values || 0
510 | });
511 |
512 | // make sure parallel load data requests aren't made
513 | node.data.loading = dataNode.data.loading = true;
514 |
515 | var ajax = new ajaxHelper();
516 | ajax.addParams(params, 'get');
517 | ajax.setLoadingElement('#' + self.workingDivId + ' .loadingPiwikBelow');
518 | ajax.setCallback(function (response) {
519 | dataNode.data.loaded = true;
520 | delete dataNode.data.loading;
521 |
522 | var repsonse = self._prepareTreemapData(response);
523 | dataNode.children = response.children;
524 |
525 | self._refreshTreemap({animate: false});
526 |
527 | callback(self.treemap.graph.getNode(node.id));
528 | });
529 | ajax.setFormat('json');
530 | return ajax;
531 | },
532 |
533 | /**
534 | * Returns true if the given node is the node of an aggregate row, false if otherwise.
535 | */
536 | _isOthersNode: function (node) {
537 | return this._getRowIdFromNode(node) == -1;
538 | },
539 |
540 | /**
541 | * Returns true if the given node has a subtable, false if otherwise.
542 | */
543 | _nodeHasSubtable: function (node) {
544 | return !!node.data.idSubtable;
545 | },
546 |
547 | /**
548 | * Returns true if the given node can be entered, false if otherwise.
549 | *
550 | * A node can be entered if it has a subtable.
551 | */
552 | _canEnterNode: function (node) {
553 | return this._nodeHasSubtable(node);
554 | },
555 |
556 | /**
557 | * Returns the ID of the DataTable row associated with a node.
558 | */
559 | _getRowIdFromNode: function (node) {
560 | return node.id.substring(node.id.lastIndexOf('_') + 1);
561 | },
562 |
563 | /**
564 | * Find node in the JSON data used to initialize the Treemap by its ID.
565 | */
566 | _findNodeWithId: function (id, node) {
567 | if (!node) {
568 | node = this.data;
569 | }
570 |
571 | if (node.id == id) {
572 | return node;
573 | }
574 |
575 | for (var i = 0; i != node.children.length; ++i) {
576 | var result = this._findNodeWithId(id, node.children[i]);
577 | if (result) {
578 | return result;
579 | }
580 | }
581 | }
582 | });
583 |
584 | DataTable.registerFooterIconHandler('infoviz-treemap', function (dataTable, viewDataTableId) {
585 | var filters = dataTable.resetAllFilters();
586 |
587 | // make sure only one column is used
588 | var columns = filters.columns || 'nb_visits';
589 | if (columns.indexOf(',') != -1) {
590 | columns = columns.split(',')[0];
591 | }
592 | dataTable.param.columns = columns;
593 |
594 | // determine what the width of a treemap will be, by inserting a dummy infoviz-treemap element
595 | // into the DOM
596 | var $wrapper = dataTable.$element.find('.dataTableWrapper'),
597 | $reportHeader = dataTable._findReportHeader(dataTable.$element),
598 | $dummyTreemap = $('').addClass('infoviz-treemap').css({'visibility': 'hidden', 'position': 'absolute'});
599 |
600 | $wrapper.prepend($dummyTreemap);
601 | var width = $dummyTreemap.width(), height = $dummyTreemap.height();
602 |
603 | var report = dataTable.$element.attr('data-report'),
604 | isFullpage = fullPageReports[report];
605 | if (isFullpage) {
606 | height = $(window).height() - dataTable.$element.find('.dataTableFeatures').height() - $reportHeader.height() - 20;
607 | }
608 |
609 | // send available width & height so we can pick the best number of elements to display
610 | dataTable.param.availableWidth = width;
611 | dataTable.param.availableHeight = height;
612 |
613 | dataTable.param.viewDataTable = viewDataTableId;
614 | dataTable.reloadAjaxDataTable(true, function (response) {
615 | dataTable.dataTableLoaded(response, dataTable.workingDivId);
616 |
617 | if (isFullpage) {
618 | piwikHelper.lazyScrollTo($reportHeader || dataTable.$element, 400, true);
619 | }
620 | });
621 | dataTable.notifyWidgetParametersChange(dataTable.$element, {
622 | viewDataTable: viewDataTableId,
623 | availableWidth: width,
624 | availableHeight: height,
625 | columns: columns
626 | });
627 | });
628 |
629 | }(jQuery, $jit, require));
--------------------------------------------------------------------------------
/lang/am.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/ar.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/az.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/be.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/bg.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Визуализирайте всеки отчет в Matomo като Treemap. Кликнете върху иконата Treemap във всеки отчет, за да заредите визуализацията.",
4 | "Treemap": "Дървовидна карта"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/bn.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/bs.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/ca.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Visualitza qualsevol informe a Matomo com un mapa d'arbre. Feu clic a la icona del mapa d'arbre de cada informe per carregar la visualització.",
4 | "Treemap": "Mapa d'arbre"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/cs.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Vizualizujte libovolnou sestavu v aplikaci Matomo jako mapu stromů. Kliknutím na ikonu mapy stromů v každé sestavě načtete vizualizaci.",
4 | "Treemap": "Mapa stromů"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/cy.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/da.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/de.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Visualisieren Sie jeden Bericht in Matomo als Treemap. Klicken Sie auf das Treemap-Symbol in einem Bericht, um die Visualisierung zu laden.",
4 | "Treemap": "Verzeichnisbaum"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/dv.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/el.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Οπτικοποιήστε οποιαδήποτε αναφορά στο Matomo ως Χάρτης δέντρου. Κάντε κλικ στο εικονίδιο του Χάρτη δέντρου για να φορτωθεί η οπτικοποίηση.",
4 | "Treemap": "Χάρτης δέντρου"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Visualise any report in Matomo as a Treemap. Click on the Treemap icon in each report to load the visualisation.",
4 | "Treemap": "Treemap"
5 | }
6 | }
--------------------------------------------------------------------------------
/lang/eo.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/es-ar.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/es.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Visualice cualquier informe en Matomo como un diagrama de árbol. Haga clic en el icono de Treemap en cada informe para cargar la visualización.",
4 | "Treemap": "Mapa de árbol"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/et.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/eu.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Bistaratu Matomoko edozein txosten laukizuzen moduko diagrama bezala. Egin klik txosten bakoitzeko Laukizuzen modukoa ikonoan bisualizazioa kargatzeko.",
4 | "Treemap": "Laukizuzen modukoa"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/fa.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/fi.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/fr.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Visualisez n'importe quel rapport dans Matomo sous forme de Treemap. Cliquez sur l'icône Treemap dans chaque rapport pour charger la visualisation.",
4 | "Treemap": "Treemp"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/ga.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Amharc ar aon tuairisc in Matomo mar Threapchlár. Cliceáil ar an deilbhín Treemap i ngach tuairisc chun an léirshamhlú a luchtú.",
4 | "Treemap": "Mapa crainn"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/gl.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/gu.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Matomo માં કોઈપણ અહેવાલને ટ્રીમેપ તરીકે વિઝ્યુઅલાઈઝ કરો. વિઝ્યુલાઇઝેશન લોડ કરવા માટે દરેક રિપોર્ટમાં ટ્રીમેપ આઇકોન પર ક્લિક કરો.",
4 | "Treemap": "ટ્રીમેપ"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/he.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/hi.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "माटोमो में किसी भी रिपोर्ट को ट्रीमैप के रूप में विज़ुअलाइज़ करें। विज़ुअलाइज़ेशन लोड करने के लिए प्रत्येक रिपोर्ट में ट्रीमैप आइकन पर क्लिक करें।",
4 | "Treemap": "ट्रीमैप"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/hr.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/hu.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/hy.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/id.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Memvisualisasikan laporan apa pun di Matomo sebagai Peta Hierarki. Klik ikon Peta Hierarki di setiap laporan untuk memuat visualisasi.",
4 | "Treemap": "Peta Hierarki"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/is.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/it.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Visualizza qualsiasi report in Matomo come mappa ad albero. Clicca sull'icona della mappa ad albero in ciascun report per caricarne la visualizzazione.",
4 | "Treemap": "Mappa ad albero"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/ja.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Matomo のレポートをツリーマップとして視覚化します。 各レポートのツリーマップ アイコンをクリックして、視覚化を読み込みます。",
4 | "Treemap": "ツリーマップ"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/ka.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/ko.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Matomo의 모든 보고서를 트리맵으로 시각화합니다. 각 보고서에서 트리맵 아이콘을 클릭하여 비주얼리제이션을 불러옵니다.",
4 | "Treemap": "트리맵"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/ku.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/lb.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/lt.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/lv.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Vizualizējiet jebkuru Matomo ziņojumu kā koku diagrammu. Klikšķiet uz koku diagrammas ikonas katrā ziņojumā, lai ielādētu vizualizāciju.",
4 | "Treemap": "Koku diagramma"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/ms.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/nb.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Klikk på blokkdiagramsikonet i hvilken som helst rapport i Matomo for å visualisere den som et blokkdiagram.",
4 | "Treemap": "Blokkdiagram"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/nl.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Visualiseer elk rapport in Matomo als een Treemap. Klik in elk rapport op het Treemap-pictogram om de visualisatie te laden.",
4 | "Treemap": "Boomdiagram"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/nn.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/pl.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Wizualizacja dowolnego raportu w Matomo jako mapy drzewa. Kliknij na ikonę Mapy drzewa w każdym raporcie, aby załadować wizualizację.",
4 | "Treemap": "Mapa drzewa"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/pt-br.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Visualize qualquer relatório no Matomo como um Treemap. Clique no ícone Treemap em cada relatório para carregar a visualização.",
4 | "Treemap": "Treemap"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/pt.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Visualize qualquer relatório no Matomo como um Treemap (árvore). Clique no ícone Treemap em cada relatório para carregar a visualização.",
4 | "Treemap": "Treemap (árvore)"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/ro.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/ru.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/si.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/sk.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/sl.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/sq.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Shfaqeni çfarëdo raporti në Matomo në trajtën e një peme. Që të ngarkohet ajo paraqitje, klikoni mbi ikonën e Pemës te secili raport.",
4 | "Treemap": "Pemë"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/sr.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/sv.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Visualisera alla rapporter i Matomo som en trädkarta. Klicka på Treemap-ikonen i varje rapport för att ladda visualiseringen.",
4 | "Treemap": "Trädkarta"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/ta.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "மாடோமோவில் எந்தவொரு அறிக்கையையும் ஒரு ட்ரீமாப் என்று காட்சிப்படுத்துங்கள். காட்சிப்படுத்தலை ஏற்ற ஒவ்வொரு அறிக்கையிலும் உள்ள TREEMAP ஐகானைக் சொடுக்கு செய்க.",
4 | "Treemap": "ட்ரீமாப்"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/te.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/th.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/tl.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/tr.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Matomo üzerindeki herhangi bir raporu ağaç biçiminde görselleştirin. Görselleştirmeyi yüklemek için her rapordaki Ağaç simgesine tıklayabilirsiniz.",
4 | "Treemap": "Ağaç"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/tzm.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/uk.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "Візуалізуйте будь-який звіт в Matomo у вигляді карти-схеми. Клацніть на піктограму карти в кожному звіті, щоб завантажити візуалізацію.",
4 | "Treemap": "Карта-схема"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/ur.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/vi.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/zh-cn.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/lang/zh-tw.json:
--------------------------------------------------------------------------------
1 | {
2 | "TreemapVisualization": {
3 | "PluginDescription": "在 Matomo 中以樹狀圖視覺化任何報表。在報表中點擊樹狀圖圖示,來載入此視覺化圖。",
4 | "Treemap": "樹狀圖"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/phpcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Matomo Coding Standard for TreemapVisualization plugin
5 |
6 |
7 |
8 | .
9 |
10 | tests/javascript/*
11 | */vendor/*
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | tests/*
20 |
21 |
22 |
23 |
24 | Updates/*
25 |
26 |
27 |
28 |
29 | tests/*
30 |
31 |
32 |
33 |
34 | tests/*
35 |
36 |
--------------------------------------------------------------------------------
/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "TreemapVisualization",
3 | "version": "5.0.3",
4 | "description": "Visualise any report in Matomo as a Treemap. Click on the Treemap icon in each report to load the visualisation.",
5 | "keywords": ["treemap", "graph", "visualization", "infovis", "jit"],
6 | "license": "GPL v3+",
7 | "homepage": "https://matomo.org",
8 | "require": {
9 | "matomo": ">=5.0.0-b1,<6.0.0-b1"
10 | },
11 | "support": {
12 | "email": "hello@matomo.org",
13 | "issues": "https://github.com/matomo-org/plugin-TreemapVisualization/issues",
14 | "forum": "https://forum.matomo.org",
15 | "source": "https://github.com/matomo-org/plugin-TreemapVisualization",
16 | "docs": "https://matomo.org/docs/",
17 | "rss": "https://matomo.org/feed/"
18 | },
19 | "authors": [
20 | {
21 | "name": "Matomo",
22 | "email": "hello@matomo.org",
23 | "homepage": "https://matomo.org"
24 | }
25 | ],
26 | "category": "insights"
27 | }
28 |
--------------------------------------------------------------------------------
/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ## Description
2 |
5 |
6 | ## Issue No
7 |
13 |
14 | ## Steps to Replicate the Issue
15 | 1.
16 | 2.
17 | 3.
18 |
19 |
20 |
21 | ## Checklist
22 | - [✔/✖] Tested locally or on demo2/demo3?
23 | - [✔/✖/NA] New test case added/updated?
24 | - [✔/✖/NA] Are all newly added texts included via translation?
25 | - [✔/✖/NA] Are text sanitized properly? (Eg use of v-text v/s v-html for vue)
26 | - [✔/✖/NA] Version bumped?
--------------------------------------------------------------------------------
/screenshots/Screen_Resolution_Treemap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matomo-org/plugin-TreemapVisualization/5a12b18faa0f04c02a7179f8b214448551b926ee/screenshots/Screen_Resolution_Treemap.png
--------------------------------------------------------------------------------
/screenshots/Social_Network_Treemap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matomo-org/plugin-TreemapVisualization/5a12b18faa0f04c02a7179f8b214448551b926ee/screenshots/Social_Network_Treemap.png
--------------------------------------------------------------------------------
/screenshots/Treemap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matomo-org/plugin-TreemapVisualization/5a12b18faa0f04c02a7179f8b214448551b926ee/screenshots/Treemap.png
--------------------------------------------------------------------------------
/stylesheets/treemap.less:
--------------------------------------------------------------------------------
1 | .infoviz-treemap-node-label {
2 | margin: 3px 6px 0 6px;
3 | display: block;
4 |
5 | > img {
6 | margin: 2px 6px 0 0;
7 | display: inline-block;
8 | vertical-align: top;
9 | float: left;
10 | }
11 |
12 | > span {
13 | white-space: nowrap;
14 | text-overflow: ellipsis;
15 | overflow: hidden;
16 | vertical-align: top;
17 | display: block;
18 | }
19 | }
20 |
21 | .infoviz-treemap-zoom-out {
22 | position: absolute;
23 | right: 6px;
24 | z-index: 1000;
25 | top: 30px;
26 | background-color: #e9e8e1;
27 | display: none;
28 | padding: 3px 1px 2px 3px;
29 | border-radius: 3px;
30 | opacity: .6;
31 | cursor: pointer;
32 | }
33 |
34 | .infoviz-treemap:hover .infoviz-treemap-zoom-out {
35 | display: inline;
36 | }
37 |
38 | .infoviz-treemap-zoom-out:hover {
39 | opacity: .7;
40 | }
41 |
42 | .infoviz-treemap-enterable-node {
43 | cursor: pointer;
44 | }
45 |
46 | .infoviz-treemap-enterable-node:hover {
47 | .infoviz-treemap-node-label {
48 | text-decoration:underline;
49 | }
50 | }
51 |
52 | .infoviz-treemap {
53 | width: 450px;
54 | height: 320px;
55 | position: relative;
56 |
57 | .node {
58 | overflow: hidden;
59 | }
60 | }
61 |
62 | .infoviz-treemap-full-width > .dataTableWrapper {
63 | width: 100%;
64 |
65 | .infoviz-treemap {
66 | width: 100%;
67 | height:auto;
68 | }
69 | }
70 |
71 | .widget .infoviz-treemap {
72 | width: 100% !important;
73 | }
74 |
75 | .infoviz-treemap-series-picker {
76 | display: inline-block;
77 | position: absolute;
78 | right: 0;
79 | z-index: 1000;
80 |
81 | > span {
82 | vertical-align: top;
83 | line-height: 23px;
84 | height: 23px;
85 | }
86 |
87 | > .jqplot-seriespicker {
88 | display: inline-block;
89 | position: relative;
90 | margin-left: 4px;
91 | }
92 | }
--------------------------------------------------------------------------------
/stylesheets/treemapColors.less:
--------------------------------------------------------------------------------
1 | .infoviz-treemap-evolution-colors[data-name=no-change] {
2 | color: #444;
3 | }
4 |
5 | .infoviz-treemap-evolution-colors[data-name=negative-change-max] {
6 | color: red;
7 | }
8 |
9 | .infoviz-treemap-evolution-colors[data-name=positive-change-max] {
10 | color: green;
11 | }
12 |
13 | .infoviz-treemap-evolution-colors[data-name=label] {
14 | color: white;
15 | }
16 |
17 | .infoviz-treemap-colors[data-name=header-color] {
18 | color: white;
19 | }
20 |
21 | .infoviz-treemap-colors[data-name=header-background-color] {
22 | color: #6a6a6a;
23 | }
24 |
25 | .infoviz-treemap-colors[data-name=normal-node-color] {
26 | color: #ccc;
27 | }
--------------------------------------------------------------------------------
/templates/_dataTableViz_treemap.twig:
--------------------------------------------------------------------------------
1 |
2 |

3 |
--------------------------------------------------------------------------------