001 #!/usr/local/bin/perl -w
002 use strict;
003 use Google::Chart;
004 use Google::Chart::Marker;
005
006 my $data = {};
007
008 open PIPE, "./data-normalize |" or die;
009 while(<PIPE>) {
010 chomp;
011 my($symbol, $x, $y) = split ' ', $_;
012 next unless $y;
013 push @{ $data->{ $symbol }->{x} }, $x;
014 push @{ $data->{ $symbol }->{y} }, $y;
015 }
016 close PIPE or die;
017
018 my $graph = Google::Chart->new(
019 type => 'XY',
020
021 data => [$data->{"0.5gb"}->{x},
022 $data->{"0.5gb"}->{y},
023 $data->{"2gb"}->{x},
024 $data->{"2gb"}->{y},
025 ],
026
027 size => '750x400',
028
029 title => {
030 text => "Dell Mini Standby Discharge"
031 },
032
033 fill => {
034 module => "LinearGradient",
035 args => {
036 target => "c",
037 angle => 45,
038 color1 => "abbaab",
039 offset1 => 1,
040 color2 => "FFFFFF",
041 offset2 => 0,
042 }
043 },
044
045 grid => {
046 x_step_size => 33,
047 y_step_size => 20,
048 },
049
050 axis => [
051 { location => 'x',
052 labels => [1..36],
053 },
054 { location => 'y',
055 labels => [0,25,50,75,100],
056 },
057 ],
058
059 color => ['E6E9FD', '4D89F9'],
060
061 legend => ['0.5gb', '2gb'],
062
063 margin => [50, 50, 50, 50, 100, 100],
064
065 marker => Google::Chart::Marker->new(
066 markerset => [
067 { marker_type => 'x',
068 color => 'FFCC33',
069 dataset => 0,
070 datapoint => -1,
071 size => 15,
072 priority => 1,
073 },
074 { marker_type => 'x',
075 color => 'FF0000',
076 dataset => 1,
077 datapoint => -1,
078 size => 15,
079 priority => 1,
080 },
081 { marker_type => 'D',
082 color => 'E6E9FD', # light blue
083 dataset => 0,
084 datapoint => -1,
085 size => 4,
086 priority => -1,
087 },
088 { marker_type => 'D',
089 color => '4D89F9', # blue
090 dataset => 1,
091 datapoint => -1,
092 size => 4,
093 priority => -1,
094 },
095 ]),
096 );
097
098 $graph->render_to_file(filename =>
099 "chart.png");
100 system("xv chart.png");
101
|