From: Dobrica Pavlinusic Date: Sun, 12 Aug 2012 16:52:44 +0000 (+0200) Subject: hide columns from gnuplot graph X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=b95de01e54797f572dc19cfa1f976f52948e2586;p=MojoFacets.git hide columns from gnuplot graph --- diff --git a/lib/MojoFacets/Gnuplot.pm b/lib/MojoFacets/Gnuplot.pm index 961220b..fc79de5 100644 --- a/lib/MojoFacets/Gnuplot.pm +++ b/lib/MojoFacets/Gnuplot.pm @@ -16,6 +16,12 @@ sub index { my $path = $self->session('path') || return $self->redirect_to('/data/load'); my $with = $self->param('with') || 'points'; + my $hide_columns; + if ( $self->param('gnuplot_hide') ) { + $hide_columns->{$_}++ foreach $self->param('gnuplot_hide'); + warn "## hide_columns ", dump $hide_columns; + } + # my $name = join('.', 'items', map { my $n = unac_string($_); $n =~ s/\W+/_/g; $n } @$columns ); my $name = MojoFacets::Data::__export_path_name( $path, 'items', @$columns ); @@ -28,8 +34,9 @@ sub index { my @plot; foreach ( 1 .. $#$columns ) { + my $title = $columns->[$_]; my $n = $_ + 1; - push @plot, qq|"$dir/$url" using 1:$n title "$columns->[$_]" with $with|; + push @plot, qq|"$dir/$url" using 1:$n title "$title" with $with| unless $hide_columns->{ $title }; } my $g = qq| diff --git a/templates/data/items.html.ep b/templates/data/items.html.ep index 9a885d8..8a73e01 100644 --- a/templates/data/items.html.ep +++ b/templates/data/items.html.ep @@ -57,7 +57,18 @@ timefmt: &with=<%= param('with') %>"> + +
+Hide from graph: + +
+ +% my @hide = map { ( gnuplot_hide => $_ ) } param('gnuplot_hide'); + % }