Skip to content

Commit

Permalink
fixes speced#562 - hook issues with new processed min and max x
Browse files Browse the repository at this point in the history
  • Loading branch information
hamilton committed Dec 9, 2015
1 parent 2b080d6 commit 5c0e40a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions dist/metricsgraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -1824,8 +1824,7 @@ function mg_find_min_max_x_from_data (args) {
function mg_find_min_max_x (args) {
mg_find_min_max_x_from_data(args);
mg_select_xax_format(args);
MG.call_hook('x_axis.process_min_max', args, args.min_x, args.max_x);

MG.call_hook('x_axis.process_min_max', args, args.processed.min_x, args.processed.max_x);
if (!args.time_series) {
if (args.processed.min_x < 0) {
args.processed.min_x = args.processed.min_x - (args.processed.max_x * (args.inflator - 1));
Expand Down Expand Up @@ -3104,7 +3103,6 @@ MG.button_layout = function(target) {
mg_add_single_line_rollover(args, svg, graph.rolloverOn(args), graph.rolloverOff(args), graph.rolloverMove(args));
}

MG.call_hook('line.after_rollover', args);
}

function lineChart (args) {
Expand Down Expand Up @@ -3150,6 +3148,7 @@ MG.button_layout = function(target) {
this.rollover = function () {
var that = this;
mg_line_rollover_setup(args, that);
MG.call_hook('line.after_rollover', args);

return this;
};
Expand Down
4 changes: 2 additions & 2 deletions dist/metricsgraphics.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion examples/charts/addons.htm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
for (var i = 0; i < data.length; i++) {
data[i] = MG.convert.date(data[i], 'date');
}

MG.data_graphic({
title: "Brushing Addon by Dan De Havilland",
description: "Drag the crosshair over the chart to zoom. For further details about this addon, take a look at its <a href='https://github.com/dandehavilland/mg-line-brushing'>GitHub repo</a>.",
Expand Down
1 change: 1 addition & 0 deletions examples/js/addons/mg_line_brushing.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ MG.add_hook('line.after_init', function(lineChart) {
});

function processXAxis(args, min_x, max_x) {

if (args.brushing) {
args.processed.min_x = args.brushed_min_x ? Math.max(args.brushed_min_x, min_x) : min_x;
args.processed.max_x = args.brushed_max_x ? Math.min(args.brushed_max_x, max_x) : max_x;
Expand Down
2 changes: 1 addition & 1 deletion src/js/charts/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@
mg_add_single_line_rollover(args, svg, graph.rolloverOn(args), graph.rolloverOff(args), graph.rolloverMove(args));
}

MG.call_hook('line.after_rollover', args);
}

function lineChart (args) {
Expand Down Expand Up @@ -669,6 +668,7 @@
this.rollover = function () {
var that = this;
mg_line_rollover_setup(args, that);
MG.call_hook('line.after_rollover', args);

return this;
};
Expand Down
3 changes: 1 addition & 2 deletions src/js/common/x_axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,7 @@ function mg_find_min_max_x_from_data (args) {
function mg_find_min_max_x (args) {
mg_find_min_max_x_from_data(args);
mg_select_xax_format(args);
MG.call_hook('x_axis.process_min_max', args, args.min_x, args.max_x);

MG.call_hook('x_axis.process_min_max', args, args.processed.min_x, args.processed.max_x);
if (!args.time_series) {
if (args.processed.min_x < 0) {
args.processed.min_x = args.processed.min_x - (args.processed.max_x * (args.inflator - 1));
Expand Down

0 comments on commit 5c0e40a

Please sign in to comment.