Opened 3 years ago

Closed 20 months ago

Last modified 16 months ago

#2704 closed New feature (fixed)

Graphs should support Unicode characters & other improvements

Reported by: matt Owned by: JulienM
Priority: normal Milestone: 1.12.x - Piwik 1.12.x
Component: Core Keywords:
Cc: arni Sensitive: no

Description (last modified by JulienM)

Here is the current list of requests to improve ImageGraph plugin (#1721)

  • Fatter line on graphs

Maybe add 2 pixels to make it more visible in all devices?

  • Graph line has too many vertical lines in the background

The standard piwik displays the grey vertical line in the background every 5 label. see screenshot.

Also, the horizontal grey line in this screenshot is too thick, can we make it slightly smaller (1 pixel?)?

  • Show more labels on X Axis
    • Example with 2 vertical bars 148.png, only one label is shown. When there are only 2 elements to plot we should display both labels on X Axis. Then it would stop the legend text after half of the axis. Important in case for example the Keyword for the first plot has a very long string, should not overlap but cut.
    • Also when there are 5 values, only the first is displayed in Screenshot_150. However on screenshot 151 all labels are displayed, which then looks amazing!! In the algorithm that decides how often you plot, could you also truncate the text after 15 characters for example, then we can safely plot one label every two plots.

What are your thoughts guys?

  • Support for all fonts (chinese, arabic, japanese, etc.)

I thought we could use the PDF fonts, but they are in a raw format (see http://dev.piwik.org/trac/browser/trunk/libs/tcpdf/fonts)

however the graph library pcharts is using GD freetype imagettf functions which require a .ttf file (currently tahoma.ttf at http://dev.piwik.org/trac/browser/trunk/libs/pChart.1.27d/Fonts

Is there a way we can reuse the tcpdf fonts on the graphs, to automatically handle all languages?
Or should we bundle extra .ttf to support all existing languages (potentially adding a lot of bytes to the Piwik download since these fonts are heavy...)

Would anyone know how to solve this problem? :)

Attachments (9)

Screenshot_148.png (32.9 KB) - added by matt 3 years ago.
Screenshot_150.png (36.9 KB) - added by matt 3 years ago.
too many vertcial line in the background - and also horizontal line in the background is too thick.png (16.6 KB) - added by matt 3 years ago.
Graphs legends not often.pdf (563.7 KB) - added by matt 2 years ago.
PDF Reports with graphs, showing that the legends is not frequent enough
Wishlist graphs horizontal bars.jpg (40.3 KB) - added by matt 2 years ago.
unifont.jpeg (30.9 KB) - added by JulienM 2 years ago.
unifont demo
tahoma.jpeg (31.8 KB) - added by JulienM 2 years ago.
tahoma demo
unifont.png (5.4 KB) - added by JulienM 2 years ago.
unifont demo
tahoma.png (5.9 KB) - added by JulienM 2 years ago.
tahoma demo (png seems to be better for comparison, maybe there is an even better format?)

Download all attachments as: .zip

Change History (42)

Changed 3 years ago by matt (mattab)

Changed 3 years ago by matt (mattab)

comment:1 Changed 3 years ago by matt (mattab)

  • Description modified (diff)

comment:2 Changed 3 years ago by matt (mattab)

  • Description modified (diff)

comment:3 Changed 3 years ago by matt (mattab)

  • Description modified (diff)

comment:4 Changed 3 years ago by matt (mattab)

See also #2706 Support graphs in Email reports

comment:5 Changed 3 years ago by vipsoft (robocoder)

Trunk has a license conflict. From http://dev.piwik.org/trac/ticket/1721#comment:13:

The pChart library contains Microsoft fonts (i.e., tahoma.ttf in pChart 1.27d and verdana.ttf in pChart 2) that don't allow for this form of redistribution. The font should be removed from the package. (The user can be instructed to install the missing font, if required.)

comment:6 Changed 3 years ago by vipsoft (robocoder)

If the tahoma font is required, please see if the LGPL tahoma.ttf font from the Wine project works as a replacement. (Supposedly has similar/same kerning to Microsoft's.)

http://source.winehq.org/git/wine.git/tree/HEAD:/fonts

comment:7 Changed 3 years ago by vipsoft (robocoder)

Take a look at GNU Unifont: http://unifoundry.com/unifont.html -- it's a pan-unicode font with lots of coverage and is included with Debian.

It's supposedly GPL v2 or higher, but there's an unanswered question in the Debian bugs database. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584672

comment:8 Changed 3 years ago by matt (mattab)

Looks interesting, but very big font, as expected :)

Is there a TTF version?

Changed 2 years ago by matt (mattab)

PDF Reports with graphs, showing that the legends is not frequent enough

comment:9 Changed 2 years ago by matt (mattab)

  • Cc arni added

When we create the PDF reports with all reports as vertical bar graph, unfortunately the report is not useful because the graphs do not show enough legends. We should, for the Keywords, Countries, Referrers, Pages, etc. show the X legend for EACH data point. The legends text would have to be vertical or diagonal to fit, and we could display maybe 10-15 maximum?

This is I believe the most urgent item to tackle to improve the Graphs :)

comment:10 Changed 2 years ago by JulienM (JulienMoumne)

I'm currently investigating the comment:9 legend issue.

comment:11 Changed 2 years ago by JulienM (JulienMoumne)

The best way to go forward with comment:9 is to introduce a new type of graph: horizontal bars.

I'm currently refactoring the whole ImageGraph Plugin code.

comment:12 Changed 2 years ago by JulienM (JulienMoumne)

  • Owner set to JulienM
  • Status changed from new to assigned

comment:13 Changed 2 years ago by JulienM (JulienMoumne)

Per Anthon's suggestions, I'd like to:

  • remove licensed font
  • select fonts according to locale (like in the PDFReport plugin)

However,

  • the fonts from the tcpdf plugin doesn't seem to be in the same format as the ones from the pChart library
  • the pChart library doesn't have the fonts we need to be consistent with the PDFReport plugin
  • pChart 2 doesn't have the font that is currently in use by the ImageGraph plugin (tahoma)

How do you suggest we deal with this ?

comment:14 Changed 2 years ago by arni

Maybe we should write the chart drawing on our own. If you also think so, I could start with this task...

comment:15 Changed 2 years ago by JulienM (JulienMoumne)

I've actually almost finished updating the ImageGraph plugin to use pChart 2.1.3.

I don't think writing our own charting library is wise considering pChart has almost all we need.

comment:16 Changed 2 years ago by matt (mattab)

Re: Fonts. Yes this is a known problem, see ticket description. Fonts from tcpdf seem to not be reusable for graphs (since not in ttf format)...

You can plug the free tahoma font in the imagegraph plugin, sure, it should just work like the other tahoma.

good luck, looking forward to seeing the result!

comment:17 Changed 2 years ago by vipsoft (robocoder)

Wine's tahoma font has the same kerning as Microsoft's, but doesn't lacks many anti-aliasing hints, so it looks kind of ugly.

Unifont is a ttf, but font width and kerning is different.

Changed 2 years ago by JulienM (JulienMoumne)

unifont demo

Changed 2 years ago by JulienM (JulienMoumne)

tahoma demo

Changed 2 years ago by JulienM (JulienMoumne)

unifont demo

Changed 2 years ago by JulienM (JulienMoumne)

tahoma demo (png seems to be better for comparison, maybe there is an even better format?)

comment:18 Changed 2 years ago by JulienM (JulienMoumne)

Please discard all the tahoma examples. I used the Microsoft file.

I'm close to fixing this ticket and the two related ones (#2788 #2706).

What's stalling the progress is that we may need to modify pChart 2 source code to fix the following issue : http://sourceforge.net/tracker/?func=detail&aid=3443890&group_id=227755&atid=1071632

Also, I have yet to find a way to display icons and percentages as specified in http://dev.piwik.org/trac/attachment/ticket/2704/Wishlist%20graphs%20horizontal%20bars.jpg

comment:19 Changed 2 years ago by matt (mattab)

I have contacted pCharts dev by email - not sure what is the best way to get things moving faster?

Did you take a shot yourself, maybe the bug can be cracked in a few minutes ;-)

Icons & percentages, probably not possible now, would require new features in the lib. If not easy, it will be no problem committing without it!

comment:20 Changed 2 years ago by JulienM (JulienMoumne)

I'll try and fix it.

Concerning LEGALNOTICE, does the wine font belong to section THIRD-PARTY CONTENT ?

Also, the pChart 2 readme mention the font files we decided to remove :

  The provided font files are licensed under their own terms :

   │
   ├─ dvent_light.ttf	Copyright Andreas K. inde
   ├─ Bedizen.ttf	Copyright Tepid Monkey Fonts
   ├─ calibri.ttf	Copyright Microsoft
   ├─ Forgotte.ttf	Copyright Ray Larabie
   ├─ GeosansLight.ttf	Copyright Manfred Klein
   ├─ MankSans.ttf	Copyright Manfred  Klein
   ├─ pf_arma_five.ttf	Copyright Yusuke Kamiyamane
   ├─ Silkscreen.ttf	Copyright Jason Aleksandr Kottke
   └─ verdana.ttf	Copyright Microsoft

Do we leave it that way ?

comment:21 Changed 2 years ago by vipsoft (robocoder)

THIRD-PARTY CONTENT: yes, that's the appropriate section for non-code.

Leave pChart's readme as is. Just add a note to piwik/libs/README_LIBS mentioning the font removal.

comment:22 Changed 2 years ago by matt (mattab)

(In [5549]) Refs #2704 Restoring _GET parameters to original values, even when an exception is thrown. This might fix some bugs in scheduled reports when
1) reports contains several graphs
2) one or several graphs have "no data"
3) the following graph wouldn't start with the correct value of _GET causing maybe problems?

comment:23 Changed 2 years ago by JulienM (JulienMoumne)

New graph type Horizontal Bar requirement moved to #2828 for changelog clarity.

comment:24 Changed 2 years ago by JulienM (JulienMoumne)

Percentage values in static graphs deferred to #2829

comment:25 Changed 2 years ago by JulienM (JulienMoumne)

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [5582]) * fixes #2706, #2828, #2704, refs #1721, #2637, #2711, #2318, #71 : horizontal static graph implemented

  • fixes #2788, refs #2670, #1721, #2637, #2711 : default graph type logic moved to ImageGraph API, improved date/period logic, new parameter graphs_default_period_to_plot_when_period_range
  • fixes #2704, #2804, refs #1721 : pChart updated to 2.1.3, pChart code removed from Piwik code, OOP refactoring, support for unifont.ttf if present in ImageGraph/fonts, testAllSizes now uses report metadata ImageGraphUrl
  • refs #71 : space between report title and report table reduced to avoid page overflow
  • refs #2829 : TODO display percentages
  • r5544, r5547, r5549 merged

comment:27 Changed 2 years ago by matt (mattab)

(In [5736]) Refs #2704 svn clean up unused directories

comment:28 Changed 2 years ago by matt (mattab)

  • Priority changed from normal to major
  • Summary changed from ImageGraph list of improvements to Graphs should support Unicode characters & other improvements

comment:29 Changed 21 months ago by matt (mattab)

see #3304 UX: Automatically download the unicode font when it is needed the first time.

comment:30 Changed 20 months ago by JulienM (JulienMoumne)

  • Description modified (diff)
  • Priority changed from major to normal
  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:31 Changed 20 months ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from reopened to closed

I think this ticket is closed . please create new ticket for "horizontal and vertical bars should have a maximum width to avoid drawing huge bars when few of them are displayed " if necessary :) % was moved to #2829

comment:32 Changed 20 months ago by JulienM (JulienMoumne)

  • Description modified (diff)

comment:33 Changed 16 months ago by matt (mattab)

  • Milestone changed from 1.8.x Piwik 1.8.x to 1.9.x - Piwik 1.9.x

Milestone 1.8.x Piwik 1.8.x deleted

Note: See TracTickets for help on using tickets.