Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#862 Broken OS chart with GoogleChartAPI

7.0
closed
5
2014-08-22
2011-03-22
Evil.2000
No

The pie chart is not displayed for the OS Top10 chart if a hyperlink is present in the OS table (i.e. for Symbian OS).
To avoid this the HTML tags must be stripped out of the label before sending the data to the Google chart API.

I've added two lines in the Get_Labels() subroutine in the file plugins/graphgooglechartapi.pm to strip HTML tags and entities:

-------------------------------------------------------

PLUGIN FUNCTION: Get_Labels

Returns a CHXL string with labels to send to the Google chart API. Long labels

are shortened to $labellength

TODO - better shortening method instead of just lopping off the end of strings

Edit by David Schueler: Strip HTML Tags and entities.

Parameters: None

Input: @blocklabel, $labellength

Output: None

Return: A pipe delimited string of labels. REQUIRES the "chxl=" prepended

-------------------------------------------------------

sub Get_Labels(){
my $chxl = "";
foreach my $i (1..(scalar @$blocklabel)) {
$temp = @$blocklabel[$i-1];
$temp =~ s/<[^>]+>//g;
$temp =~ s/&[^;]+;//g;
if (length($temp) > $labellength){
$temp = (substr($temp,0,$labellength));
}
$chxl .= "$temp|";
}
$chxl =~ s/&//;
return $chxl;
}

The full file is attached below.
Please add this bugfix to the next release. Some other improvements (like UTF8 support for chart labels) have also been submitted by some users and should be implemented also.

Discussion

  • Evil.2000
    Evil.2000
    2011-03-22

    Full perl module file .

     
  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).