antialiasing in generated graphics (ZBXNEXT-447)

[ZBXNEXT-1659] Support of antialiased lines for generated graphs and maps Created: 2013 Mar 11  Updated: 2024 Apr 10  Resolved: 2013 Mar 18

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Change Request (Sub-task) Priority: Trivial
Reporter: Alexei Vladishev Assignee: Natalja Cernohajeva (Inactive)
Resolution: Fixed Votes: 2
Labels: graphs, maps, usability
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File antialised graph1.png     PNG File graphafter1.png     PNG File graphafter2.png     PNG File graphbefore1.png     PNG File graphbefore2.png     PNG File mapafter1.png     PNG File mapbefore1.png    
Team: Team A
Sprint: Sprint 21, Sprint 22, Sprint 23
Story Points: 0.1

 Description   

This sub-task is for straight lines only. Support of circles, pie graphs, etc is out of scope.



 Comments   
Comment by Noah Leaman [ 2013 Mar 11 ]

This would indeed be a nice enhancement to the current GD based approach.

It's worth mentioning that another approach would be to move towards already developed web client based solutions:

http://www.amcharts.com
http://www.highcharts.com
http://processingjs.org

Comment by richlv [ 2013 Mar 12 ]

will this include links in maps ?

Comment by Alexei Vladishev [ 2013 Mar 13 ]

Implemented under development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1659, revision 34312. Ready to test.

The change includes support of normal and bold anti-aliased lines lines for:

  • graphs
  • map connectors
  • graph X/Y axis triangles are anti-aliased as well

See attached screenshots.

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(1) Regarding

define('LINE_TYPE_NORMAL',	'0');
define('LINE_TYPE_BOLD',	'1');

in draw.inc.php

All constants should be defined in defines.inc.php.

Existing constants should be considered: GRAPH_ITEM_DRAWTYPE_BOLD_LINE and GRAPH_ITEM_DRAWTYPE_LINE

+ if constant value is intended to be integer, then shouldn't be in ''

alexei FIXED in revision 34402

tomtom CLOSED

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(2) Regarding function lip() in draw.inc.php

  • some more descriptive name should be used;
  • PHPDoc misleading, function does not change anything, rather it returns new color ... lower index means color more close to background;
  • missing return for PHPDoc;
  • $p = round($p, 1); should be commented, why it is necessary;
  • function parameters could be more descriptive $f could be $bgColor, $t could be $fgColor, $p could be $alpha.

alexei FIXED in revision 34402

tomtom CLOSED

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(3) Regarding function aline() in draw.inc.php

  • typo "antialised" in PHPDoc
  • name should be in camelCase, I propose as well something more descriptive like imageAntiAliasLine

alexei FIXED in revision 34402

tomtom CLOSED

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(4) antialised graph1.png
Line displayed some pixels lower to actual values.

<richlv> and notice that axis arrows show a regression

alexei It appeared that standard imageline() function incorrectly rounds X/Y coordinates by silently dropping fraction part. It was replaced by a wrapper function everywhere in the code. Also fixed dashedLine() and empty right-most vertical line in graph area. FIXED in revision 34416.

tomtom CLOSED

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(5) Division by zero for aline() function if x1=x2 and y1=y2

alexei FIXED in revision 34402

tomtom CLOSED

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(6) practically duplicate code in aline() lines: 67 - 96 and lines: 99 - 129

alexei Decided to leave as it is. CLOSED

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(7) for swapping variables I propose using one-liner: list($a, $b) = array($b, $a); in draw.inc.php lines:69, 70

alexei FIXED in revision 34402

tomtom CLOSED

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(8)

$yfrac = $y - floor($y);
$yint = round($y) - round($yfrac); 

$yint is the same as floor($y);

alexei FIXED in revision 34402

tomtom CLOSED

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(9)
$tmp = $y2; $y2 = $y1; $y1 = $tmp;
$y2 unused, no need for swapping;

in draw.inc.php line: 70 and same in line: 101 for $x2

alexei FIXED in revision 34402

tomtom CLOSED

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(10) no need for:
$dx = -$dx; $dy = -$dy;
as afterwards they are used in division.

alexei FIXED in revision 34402

tomtom CLOSED

Comment by Toms (Inactive) [ 2013 Mar 14 ]

(11) $gbcolor should be in camelCase in class.cbar line: 377

alexei FIXED in revision 34402

tomtom CLOSED

Comment by Toms (Inactive) [ 2013 Mar 18 ]

TESTED

See my changes in r34435, if OK merge

alexei CLOSED

Comment by Alexei Vladishev [ 2013 Mar 18 ]

Fixed in version pre-2.1.0, revision 34438.

Comment by richlv [ 2013 Mar 18 ]

(12) to be documented in whatsnew with nice, small before-after screenshots

natalja.cernohajeva : Necessary documentation update has been executed, please review:
2.2
p.s. linked: ZBXNEXT-447
RESOLVED

sasha CLOSED

Generated at Fri Apr 26 09:51:55 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.