add tab-separated (.tsv) format to csv importer
[MojoFacets.git] / lib / MojoFacets / Gnuplot.pm
index 5040e7c..14a39ed 100644 (file)
@@ -14,6 +14,13 @@ sub index {
 
        my $columns = $self->session('columns') || return $self->redirect_to('/data/columns');
        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 );
@@ -21,14 +28,15 @@ sub index {
        warn "# name $name\n";
 
        my $url = "/export/$path/$name";
-       my $dir = $self->app->home->rel_dir('public');
+       my $dir = $self->app->home->rel_file('public');
 
        if ( -e "$dir/$url" ) {
 
                my @plot;
                foreach ( 1 .. $#$columns ) {
+                       my $title = $columns->[$_];
                        my $n = $_ + 1;
-                       push @plot, qq|"$dir/$url" using 1:$n title "$columns->[$_]" with points|;
+                       push @plot, qq|"$dir/$url" using 1:$n title "$title" with $with| unless $hide_columns->{ $title };
                }
 
                my $g = qq|