#!/usr/bin/env perl

use strict;
use warnings;

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

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

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 },
		],
	}, {
		name => 'Product C',
		data => [
			{ label => 'January', value => 900 },
			{ label => 'February', value => 1050 },
			{ label => 'March', value => 1100 },
		],
	},
];

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

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

print "Interactive multi-series line chart saved as 'multiple.html'. Open it in a browser.\n";
