1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ed6525e54828/ Changeset: ed6525e54828 User: jgoecks Date: 2013-04-17 21:10:03 Summary: Trackster: add summary and sample labels to variant track + small style adjustments. Affected #: 2 files diff -r 9e49d3b25e1b7cc2172f09ae59d93bd173f56d6c -r ed6525e548289cb9ca2675dc3bc0530e8dad3345 static/scripts/viz/trackster/painters.js --- a/static/scripts/viz/trackster/painters.js +++ b/static/scripts/viz/trackster/painters.js @@ -1616,7 +1616,7 @@ // Draw divider between summary and samples. if (this.prefs.show_sample_data) { - ctx.fillStyle = '#DDDDDD'; + ctx.fillStyle = '#F3F3F3'; ctx.globalAlpha = 1; ctx.fillRect(0, this.prefs.summary_height - this.divider_height, width, this.divider_height); } @@ -1636,7 +1636,7 @@ char_x_start = Math.floor( Math.max(0, (pos - this.view_start) * w_scale) ); // Draw summary. - ctx.fillStyle = '#AAAAAA'; + ctx.fillStyle = '#999999'; // Draw background for summary. ctx.fillRect(draw_x_start, 0, base_px, this.prefs.summary_height); draw_y_start = this.prefs.summary_height; diff -r 9e49d3b25e1b7cc2172f09ae59d93bd173f56d6c -r ed6525e548289cb9ca2675dc3bc0530e8dad3345 static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -4166,6 +4166,7 @@ params: [ { key: 'name', label: 'Name', type: 'text', default_value: this.name }, { key: 'show_sample_data', label: 'Show sample data', type: 'bool', default_value: true }, + { key: 'show_labels', label: 'Show summary and sample labels', type: 'bool', default_value: true }, { key: 'summary_height', label: 'Locus summary height', type: 'float', default_value: 20 }, { key: 'mode', type: 'string', default_value: this.mode, hidden: true } ], @@ -4224,6 +4225,61 @@ before_draw: function() { // Clear because this is set when drawing. this.max_height_px = 0; + }, + + /** + * Actions to be taken after draw has been completed. Draw is completed when all tiles have been + * drawn/fetched and shown. + */ + postdraw_actions: function(tiles, width, w_scale, clear_after) { + TiledTrack.prototype.postdraw_actions.call(this, tiles, width, w_scale, clear_after); + + // Add labels if needed and not already included. + if (this.prefs.show_labels) { + // Add and/or style labels. + if (this.container_div.find('.yaxislabel').length === 0) { + // Add summary and sample labels. + + // FIXME: label attributes could be cleaner by using CSS classes. + + // Add summary label. + var summary_div_font_size = 10, + summary_div = $("<div/>").text('Summary').addClass('yaxislabel top').css({ + 'font-size': summary_div_font_size + 'px' + }); + this.container_div.prepend(summary_div); + + // Adjust summary label to middle of summary. + var base_offset = summary_div.position().top; + summary_div.css('top', base_offset + (this.prefs.summary_height - summary_div_font_size) / 2 + 'px'); + + // Show sample labels. + if (this.prefs.show_sample_data) { + var samples_div_html = ''; + _.each(this.dataset.get('metadata').get('sample_names'), function(name) { + samples_div_html += (name + '<br>'); + }); + + var samples_div = $("<div/>").html(samples_div_html).addClass('yaxislabel top sample').css({ + // +2 for padding + 'top': base_offset + this.prefs.summary_height + 2, + }); + this.container_div.prepend(samples_div); + } + } + + // Style labels. + + // Match sample font size to mode. + $(this.container_div).find('.sample').css('font-size', (this.mode === 'Squish' ? 5 : 10) + 'px'); + // Color labels to preference color. + $(this.container_div).find('.yaxislabel').css('color', this.prefs.label_color); + + } + else { + // Remove all labels. + this.container_div.find('.yaxislabel').remove(); + } } }); Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.