mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Scatterplot: use named data provider, fix encoding of ids; pack scripts
This commit is contained in:
@@ -328,7 +328,6 @@ class Tabular( data.Text ):
|
||||
"""
|
||||
Returns a list of visualizations for datatype.
|
||||
"""
|
||||
|
||||
# Can visualize tabular data as scatterplot if there are 2+ numerical
|
||||
# columns.
|
||||
num_numerical_cols = 0
|
||||
|
||||
@@ -67,11 +67,14 @@ class ColumnDataProvider( BaseDataProvider ):
|
||||
# allow throttling
|
||||
self.max_lines_returned = max_lines_returned
|
||||
|
||||
def get_data( self, columns, start_val=0, max_vals=None, skip_comments=True, **kwargs ):
|
||||
def get_data( self, columns=None, start_val=0, max_vals=None, skip_comments=True, **kwargs ):
|
||||
"""
|
||||
Returns data from specified columns in dataset. Format is list of lists
|
||||
where each list is a line of data.
|
||||
"""
|
||||
if not columns:
|
||||
raise TypeError( 'parameter required: columns' )
|
||||
|
||||
#TODO: validate kwargs
|
||||
try:
|
||||
max_vals = int( max_vals )
|
||||
@@ -88,11 +91,10 @@ class ColumnDataProvider( BaseDataProvider ):
|
||||
# skip comment lines (if any/avail)
|
||||
# pre: should have original_dataset and
|
||||
if( skip_comments
|
||||
and start_val == 0
|
||||
and self.original_dataset.metadata.comment_lines ):
|
||||
start_val = int( self.original_dataset.metadata.comment_lines ) + 1
|
||||
and self.original_dataset.metadata.comment_lines
|
||||
and start_val < self.original_dataset.metadata.comment_lines ):
|
||||
start_val = int( self.original_dataset.metadata.comment_lines )
|
||||
|
||||
#TODO bail if columns None, not parsable, not within meta.columns
|
||||
# columns is an array of ints for now (should handle column names later)
|
||||
columns = from_json_string( columns )
|
||||
for column in columns:
|
||||
|
||||
@@ -562,6 +562,7 @@ var ScatterplotControlForm = BaseView.extend( LoggableMixin ).extend({
|
||||
|
||||
var params = {
|
||||
data_type : 'raw_data',
|
||||
provider : 'column',
|
||||
columns : '[' + columns + ']'
|
||||
};
|
||||
this.log( '\t data settings (url params):', params );
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -138,16 +138,16 @@ function TwoVarScatterplot( config ){
|
||||
bottom = bottom || 0;
|
||||
left = left || 0;
|
||||
this.svg
|
||||
.attr( "width", this.config.width + ( this.config.marginRight + right ) +
|
||||
( this.config.marginLeft + left ) )
|
||||
.attr( "height", this.config.height + ( this.config.marginTop + top ) +
|
||||
( this.config.marginBottom + bottom ) )
|
||||
.attr( "width", this.config.width + ( this.config.marginRight + right )
|
||||
+ ( this.config.marginLeft + left ) )
|
||||
.attr( "height", this.config.height + ( this.config.marginTop + top )
|
||||
+ ( this.config.marginBottom + bottom ) )
|
||||
// initial is hidden - show it
|
||||
.style( 'display', 'block' );
|
||||
|
||||
// move content group away from margins
|
||||
//TODO: allow top, right axis
|
||||
this.content = this.svg.select( "g.content" )
|
||||
this.content = this.svg.select( "g.content" )
|
||||
.attr( "transform", this.translateStr( this.config.marginLeft + left, this.config.marginTop + top ) );
|
||||
};
|
||||
|
||||
@@ -260,7 +260,7 @@ function TwoVarScatterplot( config ){
|
||||
.attr( 'text-anchor', 'middle' )
|
||||
.attr( 'transform', this.rotateStr( -90, this.config.yAxisLabelBumpX, this.config.height / 2 ) )
|
||||
.text( this.config.yLabel );
|
||||
//this.log( 'yAxisLabel:', this.yAxisLabel );
|
||||
//this.log( 'yAxisLabel:', this.yAxisLabel );
|
||||
};
|
||||
|
||||
// ........................................................ grid lines
|
||||
@@ -284,7 +284,7 @@ function TwoVarScatterplot( config ){
|
||||
|
||||
// remove unneeded (less ticks)
|
||||
this.vGridLines.exit().remove();
|
||||
//this.log( 'vGridLines:', this.vGridLines );
|
||||
//this.log( 'vGridLines:', this.vGridLines );
|
||||
|
||||
// HORIZONTAL
|
||||
this.hGridLines = this.content.selectAll( 'line.h-grid-line' )
|
||||
|
||||
@@ -222,8 +222,7 @@ ${h.js(
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
var hda = ${h.to_json_string( hda.get_api_value() )},
|
||||
historyID = '${trans.security.encode_id( hda.history.id )}',
|
||||
var hda = ${h.to_json_string( trans.security.encode_dict_ids( hda.get_api_value() ) )},
|
||||
querySettings = ${h.to_json_string( query_args )},
|
||||
chartConfig = _.extend( querySettings, {
|
||||
containerSelector : '#chart',
|
||||
|
||||
Reference in New Issue
Block a user