HTML-D3

 view release on metacpan or  search on metacpan

examples/interactive  view on Meta::CPAN

#!/usr/bin/env perl

use lib 'lib';
use HTML::D3;

my $chart = HTML::D3->new(
    width  => 800,
    height => 600,
    title  => 'Monthly Revenue Trends by Product (With Legends)',
);

my $data = [
    {
        name => 'Product A',
        data => [
            { label => 'January', value => 1000 },
            { label => 'February', value => 1200 },
            { label => 'March', value => 950 },
        ],
    },
    {
        name => 'Product B',
        data => [
            { label => 'January', value => 800 },
            { label => 'February', value => 1150 },
            { label => 'March', value => 1000 },
        ],
    },
];

my $html_output = $chart->render_multi_series_line_chart_with_interactive_legends($data);

# Save the output as an HTML file
open my $fh, '>', 'chart.html' or die $!;
print $fh $html_output;
close $fh;

print "Chart with legends saved as 'chart.html'. Open it in a browser.\n";



( run in 1.591 second using v1.01-cache-2.11-cpan-39bf76dae61 )