Skip to content

Commit

Permalink
fixes #610 - aggregate rollover rollover doesn't break on single line
Browse files Browse the repository at this point in the history
  • Loading branch information
hamilton committed Mar 31, 2016
1 parent bdcaf45 commit 276b4ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 63 deletions.
33 changes: 3 additions & 30 deletions dist/metricsgraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3552,7 +3552,7 @@ MG.button_layout = function(target) {

plot.data_median = 0;
plot.update_transition_duration = (args.transition_on_update) ? 1000 : 0;
plot.display_area = args.area && !args.use_data_y_min && args.data.length <= 1;
plot.display_area = args.area && !args.use_data_y_min && args.data.length <= 1 && args.aggregate_rollover === false;
plot.legend_text = '';
mg_line_graph_generators(args, plot, svg);
plot.existing_band = svg.selectAll('.mg-confidence-band');
Expand Down Expand Up @@ -3758,11 +3758,10 @@ MG.button_layout = function(target) {

// update rollover text
if (args.show_rollover_text) {

var mouseover = mg_mouseover_text(args, {svg:svg});
var row = mouseover.mouseover_row();
if (args.aggregate_rollover) row.text((args.aggregate_rollover ? mg_format_x_aggregate_mouseover : mg_format_x_mouseover)(args, d));
var pts = args.aggregate_rollover ? d.values : [d];
if (args.aggregate_rollover) row.text((args.aggregate_rollover && args.data.length > 1 ? mg_format_x_aggregate_mouseover : mg_format_x_mouseover)(args, d));
var pts = args.aggregate_rollover && args.data.length > 1 ? d.values : [d];
pts.forEach(function(di){
if (args.aggregate_rollover) row = mouseover.mouseover_row();
if(args.legend) mg_line_color_text(row.text(args.legend[di.line_id-1] + ' ').bold().elem(), di, args);
Expand All @@ -3771,32 +3770,6 @@ MG.button_layout = function(target) {

row.text(mg_format_y_mouseover(args, di, args.time_series === false));
})
// if aggregate rollover, iterate through each one of these.

// var mouseover = mg_mouseover_text(args, {svg: svg});
// if (args.aggregate_rollover) {

// var row = mouseover.mouseover_row();
// row.text(mg_format_x_aggregate_mouseover(args, d));

// d.values.forEach(function(di){
// var y_row = mouseover.mouseover_row();
// mg_line_color_text(y_row.text('\u2014 ').elem(), di, args);
// y_row.text(mg_format_y_mouseover(args, di, args.time_series === false));
// })
// } else {

// var row = mouseover.mouseover_row();
// if (args.legend) {
// mg_line_color_text(row.text(args.legend[d.line_id-1] + ' ').bold().elem(), d, args);
// }
// var shape = mg_line_color_text(row.text('\u2014 ').elem(), d, args)
// // .classed('mg-hover-line' + d.line_id + '-color', args.colors === null)
// // .attr('fill', args.colors === null ? '' : args.colors[d.line_id - 1]);

// row.text(mg_format_x_mouseover(args, d)); // x
// row.text(mg_format_y_mouseover(args, d, args.time_series === false));
// }
}

if (args.mouseover) {
Expand Down
Loading

0 comments on commit 276b4ca

Please sign in to comment.