@nivo/core
Advanced tools
Comparing version 0.32.0 to 0.33.0-5
@@ -20,3 +20,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import { withMotion } from '../../hocs'; | ||
import { computeAxisTicks } from '../../lib/axes'; | ||
import { computeAxisTicks } from '../../lib/cartesian/axes'; | ||
import AxisTick from './AxisTick'; | ||
@@ -23,0 +23,0 @@ |
@@ -16,13 +16,5 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import GridLines from './GridLines'; | ||
import { computeGridLines } from '../../lib/cartesian/axes'; | ||
import { motionPropTypes } from '../../props'; | ||
var center = function center(scale) { | ||
var offset = scale.bandwidth() / 2; | ||
if (scale.round()) offset = Math.round(offset); | ||
return function (d) { | ||
return scale(d) + offset; | ||
}; | ||
}; | ||
var Grid = function Grid(_ref) { | ||
@@ -38,44 +30,16 @@ var width = _ref.width, | ||
var xLines = void 0; | ||
if (xScale) { | ||
var xValues = void 0; | ||
if (xScale.ticks) { | ||
xValues = xScale.ticks(); | ||
} else { | ||
xValues = xScale.domain(); | ||
} | ||
var xLines = xScale ? computeGridLines({ | ||
width: width, | ||
height: height, | ||
scale: xScale, | ||
axis: 'x' | ||
}) : false; | ||
var xPosition = xScale.bandwidth ? center(xScale) : xScale; | ||
var yLines = yScale ? computeGridLines({ | ||
width: width, | ||
height: height, | ||
scale: yScale, | ||
axis: 'y' | ||
}) : false; | ||
xLines = xValues.map(function (v) { | ||
return { | ||
key: '' + v, | ||
x1: xPosition(v), | ||
x2: xPosition(v), | ||
y2: height | ||
}; | ||
}); | ||
} | ||
var yLines = void 0; | ||
if (yScale) { | ||
var yValues = void 0; | ||
if (yScale.ticks) { | ||
yValues = yScale.ticks(); | ||
} else { | ||
yValues = yScale.domain(); | ||
} | ||
var yPosition = yScale.bandwidth ? center(yScale) : yScale; | ||
yLines = yValues.map(function (v) { | ||
return { | ||
key: '' + v, | ||
x2: width, | ||
y1: yPosition(v), | ||
y2: yPosition(v) | ||
}; | ||
}); | ||
} | ||
return React.createElement( | ||
@@ -82,0 +46,0 @@ 'g', |
@@ -44,3 +44,3 @@ 'use strict'; | ||
var _axes = require('../../lib/axes'); | ||
var _axes = require('../../lib/cartesian/axes'); | ||
@@ -47,0 +47,0 @@ var _AxisTick = require('./AxisTick'); |
@@ -33,2 +33,4 @@ 'use strict'; | ||
var _axes = require('../../lib/cartesian/axes'); | ||
var _props = require('../../props'); | ||
@@ -38,11 +40,2 @@ | ||
var center = function center(scale) { | ||
var offset = scale.bandwidth() / 2; | ||
if (scale.round()) offset = Math.round(offset); | ||
return function (d) { | ||
return scale(d) + offset; | ||
}; | ||
}; | ||
var Grid = function Grid(_ref) { | ||
@@ -58,44 +51,16 @@ var width = _ref.width, | ||
var xLines = void 0; | ||
if (xScale) { | ||
var xValues = void 0; | ||
if (xScale.ticks) { | ||
xValues = xScale.ticks(); | ||
} else { | ||
xValues = xScale.domain(); | ||
} | ||
var xLines = xScale ? (0, _axes.computeGridLines)({ | ||
width: width, | ||
height: height, | ||
scale: xScale, | ||
axis: 'x' | ||
}) : false; | ||
var xPosition = xScale.bandwidth ? center(xScale) : xScale; | ||
var yLines = yScale ? (0, _axes.computeGridLines)({ | ||
width: width, | ||
height: height, | ||
scale: yScale, | ||
axis: 'y' | ||
}) : false; | ||
xLines = xValues.map(function (v) { | ||
return { | ||
key: '' + v, | ||
x1: xPosition(v), | ||
x2: xPosition(v), | ||
y2: height | ||
}; | ||
}); | ||
} | ||
var yLines = void 0; | ||
if (yScale) { | ||
var yValues = void 0; | ||
if (yScale.ticks) { | ||
yValues = yScale.ticks(); | ||
} else { | ||
yValues = yScale.domain(); | ||
} | ||
var yPosition = yScale.bandwidth ? center(yScale) : yScale; | ||
yLines = yValues.map(function (v) { | ||
return { | ||
key: '' + v, | ||
x2: width, | ||
y1: yPosition(v), | ||
y2: yPosition(v) | ||
}; | ||
}); | ||
} | ||
return _react2.default.createElement( | ||
@@ -102,0 +67,0 @@ 'g', |
{ | ||
"name": "@nivo/core", | ||
"version": "0.32.0", | ||
"version": "0.33.0-5", | ||
"license": "MIT", | ||
@@ -21,3 +21,3 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@nivo/babel-preset": "0.32.0", | ||
"@nivo/babel-preset": "0.33.0-5", | ||
"babel-cli": "^6.26.0", | ||
@@ -24,0 +24,0 @@ "babel-jest": "^20.0.3", |
# `@nivo/core` | ||
[![version](https://img.shields.io/npm/v/@nivo/core.svg?style=flat-square)](https://www.npmjs.com/package/@nivo/core) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
443690
128
7035
4