From e1d5664f696a2f33a34a63e62aa8de05388f8574 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 26 Feb 2015 19:57:19 +0100 Subject: plot messages by anything --- index.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'index.pl') diff --git a/index.pl b/index.pl index 5ad92f5..6fb9832 100644 --- a/index.pl +++ b/index.pl @@ -28,6 +28,13 @@ app->attr( helper barplot_args => sub { my ( $self ) = @_; + my %translation = Travel::Status::DE::IRIS::Result::dump_message_codes(); + my $messages; + + for my $key (keys %translation) { + $messages->{$key} = { desc => $translation{$key} }; + } + return { x => { hour => { @@ -80,6 +87,7 @@ helper barplot_args => sub { yformat => '.1%', }, }, + msg => $messages, }; }; @@ -304,9 +312,16 @@ get '/bar' => sub { my $xsource = $self->param('xsource'); my $ysource = $self->param('ysource'); + my $msgnum = $self->param('msgnum'); my %args = %{$self->barplot_args}; + if ($self->param('want_msg')) { + $self->param(ysource => 'message_rate'); + $self->param(ylabel => $args{msg}{$msgnum}{desc}); + $self->param(yformat => '.1%'); + } + if (not $self->param('xlabel')) { $self->param(xlabel => $args{x}{$xsource}{label} // $args{x}{$xsource}{desc}); } -- cgit v1.2.3