Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
almossawi committed Jul 19, 2016
1 parent 4d7c9f0 commit 8282295
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/js/charts/point.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function mg_color_point_mouseover(args, elem, d) {

testPoint = testPoint[0][args[ns + '_accessor']];
return typeof testPoint === 'string' ? 'categorical' : 'numerical';

}

function pointChart(args) {
Expand All @@ -57,7 +56,6 @@ function mg_color_point_mouseover(args, elem, d) {

raw_data_transformation(args);


process_point(args);
init(args);

Expand Down
18 changes: 13 additions & 5 deletions src/js/common/x_axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ function x_axis(args) {
mg_selectAll_and_remove(svg, '.mg-x-axis');

if (!args.x_axis) {
return this; }
var g = mg_add_g(svg, 'mg-x-axis');
return this;
}

var g = mg_add_g(svg, 'mg-x-axis');

mg_add_x_ticks(g, args);
mg_add_x_tick_labels(g, args);
Expand Down Expand Up @@ -71,8 +72,13 @@ function x_axis_categorical(args) {
}

function mg_add_x_axis_categorical_labels(g, args, additional_buffer) {
var labels = g.selectAll('text').data(args.categorical_variables).enter().append('svg:text');
labels.attr('x', function(d) {
var labels = g.selectAll('text')
.data(args.categorical_variables)
.enter()
.append('text');

labels
.attr('x', function(d) {
return args.scales.X(d) + args.scales.X.bandwidth() / 2 + (args.buffer) * args.bar_outer_padding_percentage + (additional_buffer / 2);
})
.attr('y', mg_get_plot_bottom(args))
Expand Down Expand Up @@ -105,7 +111,9 @@ function mg_point_add_color_scale(args) {
.range(color_range)
.clamp(true);
} else {
args.scales.color = args.color_range !== null ? d3.scaleOrdinal().range(color_range) : (color_domain.length > 10 ? d3.scaleOrdinal(d3.schemeCategory20) : d3.scaleOrdinal(d3.schemeCategory10));
args.scales.color = args.color_range !== null
? d3.scaleOrdinal().range(color_range)
: (color_domain.length > 10 ? d3.scaleOrdinal(d3.schemeCategory20) : d3.scaleOrdinal(d3.schemeCategory10));

args.scales.color.domain(color_domain);
}
Expand Down
6 changes: 3 additions & 3 deletions src/js/common/y_axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,6 @@ function categoricalGuides(args, axisArgs) {

grs.forEach(function(group) {
scale.domain().forEach(function(cat) {

if (position === 'left' || position === 'right') {
x1 = mg_get_plot_left(args);
x2 = mg_get_plot_right(args);
Expand Down Expand Up @@ -578,6 +577,7 @@ function categoricalGuides(args, axisArgs) {
y12 = first;
y22 = last;
}

if (position === 'bottom' || position === 'top') {
x11 = first;
x21 = last;
Expand All @@ -597,14 +597,14 @@ function categoricalGuides(args, axisArgs) {
.attr('y2', y21)
.attr('stroke-dasharray', '2,1')
.attr('stroke', 'lightgray');

svg.append('line')
.attr('x1', x12)
.attr('x2', x22)
.attr('y1', y12)
.attr('y2', y22)
.attr('stroke-dasharray', '2,1')
.attr('stroke', 'lightgray');

})
}

Expand Down Expand Up @@ -650,7 +650,7 @@ var mgDrawAxis = {};

mgDrawAxis.categorical = function(args, axisArgs) {
var ns = axisArgs.namespace;
//mg_add_categorical_labels(args, axisArgs);

categoricalLabels(args, axisArgs);
categoricalGuides(args, axisArgs);
}
Expand Down

0 comments on commit 8282295

Please sign in to comment.