Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the SVG-TT-Graph CPAN distribution.

Report information
The Basics
Id: 3846
Status: resolved
Priority: 0/
Queue: SVG-TT-Graph

People
Owner: Nobody in particular
Requestors: David.Meibusch [...] adc.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.03
Fixed in: (no value)



Subject: Line graph: bad z-order, clips key, non-vertical fill stroke to x-axis, no stacked data
SVG-TT-Graph 0.03 perl, v5.8.0 built for i386-linux-thread-multi Linux zooter 2.4.19-16mdk Adobe SVG Viewer 2.0 A few fixes in this offered patch. I've rejigged the render order for data series such that the data values (front), data points, line and fill (back) are rendered for each series together to ensure that they all have the same z-order relative to other series. The calculations for key size was a little rough, clipping the key when on the bottom. Fixed this. Fill strokes included an oblique line from the last point to the end of the x-axis rather than vertically down to the x-axis, which is more aesthetically pleasing, IMHO. Bit subjective that one. Finally, I've added a 'stacked' option (1 | 0) that accumulates each data set (ie. each point increased by sum of all previous series at same point). Looks nice with opaque fill styles.
329a330,331 > > 'stacked' => 0, 622a625,637 > [% IF config.stacked %] > <!-- pre-stack the data --> > [% FOREACH field = config.fields %] > [% cumulative = 0 %] > [% FOREACH dataset = data %] > [% IF dataset.data.$field != '' %] > [% cumulative = cumulative + dataset.data.$field %] > [% END %] > [% dataset.data.$field = cumulative %] > [% END %] > [% END %] > [% END %] > 641,643d655 < < < 669a682 > [% key_padding = 5 %] 672c685,690 < [% ELSIF config.key && config.key_position == 'bottom' %][% h = h - 50 %] --- > [% ELSIF config.key && config.key_position == 'bottom' %] > [% IF data.size < 4 %] > [% h = h - ((data.size + 1) * (key_box_size + key_padding))%] > [% ELSE %] > [% h = h - (4 * (key_box_size + key_padding))%] > [% END %] 837,855c855,856 < <!-- data points on graph --> < [% IF config.show_data_points || config.show_data_values%] < [% xcount = 0 %] < < [% FOREACH field = config.fields %] < [% dcount = 1 %] < [% FOREACH dataset = data %] < [% IF config.show_data_points %] < <circle cx="[% (dw * xcount) + x %]" cy="[% base_line - (dataset.data.$field * divider) %]" r="2.5" class="dataPoint[% dcount %]"/> < [% END %] < < [% IF config.show_data_values %] < <text x="[% (dw * xcount) + x %]" y="[% base_line - (dataset.data.$field * divider) - 6 %]" class="dataPointLabel">[% dataset.data.$field %]</text> < [% END %] < [% dcount = dcount + 1 %] < [% END %] < [% xcount = xcount + 1 %] < [% END %] < [% END %] --- > [% line = data.size %] > [% FOREACH dataset = data.reverse %] 857,870c858,894 < < [% IF config.area_fill %] < <!-- copy data line(s) (but close it) to give control of fill to css --> < [% fill = 1 %] < [% FOREACH dataset = data %] < <path d="M[% x %] [% base_line %] < L < [% xcount = 0 %] < [% FOREACH field = config.fields %] < [% (dw * xcount) + x %] [% base_line - (dataset.data.$field * divider) %], < [% xcount = xcount + 1 %] < [% END %] < [% w + x %] [% base_line %] Z" class="fill[% fill %]"/> < [% fill = fill + 1 %] --- > [% IF config.area_fill %] > <!--- create alternate fill first (so line can overwrite if necessary) --> > <path d="M[% x %] [% base_line %] L > [% xcount = 0 %] > [% FOREACH field = config.fields %] > [% (dw * xcount) + x %] [% base_line - (dataset.data.$field * divider) %], > [% xcount = xcount + 1 %] > [% END %] > [% (dw * (xcount - 1)) + x %] [% base_line %] Z" class="fill[% line %]"/> > [% END %] > > <!--- create line --> > <path d="M > [% xcount = 0 %] > [% FOREACH field = config.fields %] > [% IF xcount == 1 %] L [% END %] > [% (dw * xcount) + x %] [% base_line - (dataset.data.$field * divider) %], > [% xcount = xcount + 1 %] > [% END %]" class="line[% line %]"/> > > [% IF config.show_data_points || config.show_data_values%] > [% xcount = 0 %] > [% FOREACH field = config.fields %] > [% IF config.show_data_points %] > <!-- datapoint shown --> > <circle cx="[% (dw * xcount) + x %]" cy="[% base_line - (dataset.data.$field * divider) %]" r="2.5" class="dataPoint[% line %]"/> > [% END %] > > [% IF config.show_data_values %] > <!-- datavalue shown --> > <text x="[% (dw * xcount) + x %]" y="[% base_line - (dataset.data.$field * divider) - 6 %]" class="dataPointLabel">[% dataset.data.$field %]</text> > [% END %] > [% xcount = xcount + 1 %] > [% END %] > [% END %] > > [% line = line - 1 %] 872,888d895 < [% END %] < < <!-- join the dots (for each line if applicable)... --> < [% line = 1 %] < [% FOREACH dataset = data %] < <path d="M < [% xcount = 0 %] < [% FOREACH field = config.fields %] < [% IF xcount == 1 %] < L < [% END %] < [% (dw * xcount) + x %] [% base_line - (dataset.data.$field * divider) %], < [% xcount = xcount + 1 %] < [% END %]" class="line[% line %]"/> < [% line = line + 1 %] < [% END %] < 891d897 < [% key_box_size = 12 %] 893d898 < [% key_padding = 5 %]