Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

refactor(components.axis) Renamed type to axisType for consistency. (ready) #80

Merged
merged 1 commit into from

2 participants

@sym3tri

Since type has special meaning and is used to dynamically create components.

@amrutac
Owner

:+1:

@sym3tri sym3tri merged commit c21c3e0 into from
@sym3tri sym3tri deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 27, 2013
This page is out of date. Refresh to see the latest.
View
8 src/components/axis.js
@@ -22,7 +22,8 @@ function(obj, config, string, mixins, d3util) {
config_ = {};
defaults_ = {
- type: 'x',
+ type: 'axis',
+ axisType: 'x',
gap: 0,
target: null,
color: '#333',
@@ -54,7 +55,7 @@ function(obj, config, string, mixins, d3util) {
});
//Apply padding to the first tick on Y axis
- if (config_.type === 'y') {
+ if (config_.axisType === 'y') {
var zeroTick, transform, zeroTickLabel;
zeroTick = root_.select('g');
@@ -149,7 +150,8 @@ function(obj, config, string, mixins, d3util) {
root_.attr({
'font-family': config_.fontFamily,
'font-size': config_.fontSize,
- 'class': string.classes('component', 'axis', config_.type + '-axis '),
+ 'class': string.classes('component',
+ 'axis', config_.axisType + '-axis '),
'stroke': config_.color,
'opacity': config_.opacity
});
View
8 src/graphs/graph.js
@@ -81,7 +81,7 @@ function(obj, config, array, assetLoader, format, components, layoutManager,
* Components that do not require a default color
* @type {Array}
*/
- NO_COLORED_COMPONENTS = ['x', 'y', 'legend', 'label'];
+ NO_COLORED_COMPONENTS = ['axis', 'legend', 'label'];
config_ = {};
@@ -447,12 +447,14 @@ function(obj, config, array, assetLoader, format, components, layoutManager,
xAxis_.config({
scale: config_.xScale,
ticks: config_.xTicks,
- unit: config_.xAxisUnit
+ unit: config_.xAxisUnit,
+ axisType: 'x'
});
yAxis_.config({
scale: config_.yScale,
ticks: config_.yTicks,
- unit: config_.yAxisUnit
+ unit: config_.yAxisUnit,
+ axisType: 'y'
});
};
View
24 test/unit/components/axis.spec.js
@@ -35,7 +35,7 @@ function(axisComponent) {
it('handles defaults', function() {
axis.config({
- type: 'x',
+ axisType: 'x',
scale: d3.time.scale(),
orient: 'bottom'
});
@@ -57,7 +57,7 @@ function(axisComponent) {
it('renders x axis', function() {
axis.config({
- type: 'x',
+ axisType: 'x',
scale: d3.time.scale(),
orient: 'bottom'
});
@@ -76,7 +76,7 @@ function(axisComponent) {
it('sets tickSize to 0 by default', function() {
axis.config({
- type: 'x',
+ axisType: 'x',
scale: d3.time.scale(),
orient: 'bottom'
});
@@ -86,7 +86,7 @@ function(axisComponent) {
it('sets tickSize to configured value', function() {
axis.config({
- type: 'x',
+ axisType: 'x',
scale: d3.time.scale(),
orient: 'bottom',
tickSize: 5
@@ -97,7 +97,7 @@ function(axisComponent) {
it('sets ticks if configured axis', function() {
axis.config({
- type: 'x',
+ axisType: 'x',
scale: d3.scale.linear().domain([5,10]),
orient: 'left',
ticks: 3
@@ -108,7 +108,7 @@ function(axisComponent) {
it('renders y axis', function() {
axis.config({
- type: 'y',
+ axisType: 'y',
scale: d3.scale.linear(),
orient: 'right'
});
@@ -118,7 +118,7 @@ function(axisComponent) {
it('does not position y axis', function() {
axis.config({
- type: 'y',
+ axisType: 'y',
scale: d3.scale.linear(),
orient: 'right',
height: 200
@@ -130,7 +130,7 @@ function(axisComponent) {
it('it applies padding 0 tick', function() {
var zeroTick, transform;
axis.config({
- type: 'y',
+ axisType: 'y',
scale: d3.scale.linear()
});
axis.render(container);
@@ -142,7 +142,7 @@ function(axisComponent) {
it('it applies unit to 0 tick', function() {
var zeroTick;
axis.config({
- type: 'y',
+ axisType: 'y',
scale: d3.scale.linear(),
unit: 'ms'
});
@@ -156,7 +156,7 @@ function(axisComponent) {
it('is inserted into the d3 svg axis component', function() {
var axisGroups;
axis.config({
- type: 'x',
+ axisType: 'x',
scale: d3.scale.linear().domain([0, 100]).range([0,100]),
orient: 'right'
});
@@ -177,7 +177,7 @@ function(axisComponent) {
it('has the right defaults applied in the dom', function() {
var axisGroups;
axis.config({
- type: 'x',
+ axisType: 'x',
scale: d3.scale.linear(),
orient: 'right',
textBgColor: 'green',
@@ -220,7 +220,7 @@ function(axisComponent) {
beforeEach(function() {
container.selectAll('*').remove();
axis.config({
- type: 'x',
+ axisType: 'x',
scale: d3.time.scale(),
orient: 'bottom'
});
Something went wrong with that request. Please try again.