carbon-addons-data-viz-react
Advanced tools
Comparing version 1.24.0 to 1.25.0
@@ -136,2 +136,12 @@ 'use strict'; | ||
var getYDomainMin = function getYDomainMin(data) { | ||
var dataMin = d3.min(data, function (d) { | ||
return d3.min(d.slice(0, d.length - 1)); | ||
}); | ||
if (dataMin > 0) { | ||
return 0; | ||
} | ||
return dataMin; | ||
}; | ||
var LineGraph = function (_Component) { | ||
@@ -197,6 +207,5 @@ (0, _inherits3.default)(LineGraph, _Component); | ||
})); | ||
this.y.domain([0, d3.max(data, function (d) { | ||
this.y.domain([getYDomainMin(data), d3.max(data, function (d) { | ||
return d3.max(d.slice(0, d.length - 1)); | ||
})]); | ||
this.updateEmptyState(nextProps.data.length > 0 ? nextProps.data : nextProps.datasets); | ||
@@ -332,6 +341,5 @@ this.updateData(nextProps); | ||
this.y = d3.scaleLinear().range([this.height, 0]).domain([0, d3.max(flatData, function (d) { | ||
this.y = d3.scaleLinear().range([this.height, 0]).domain([getYDomainMin(flatData), d3.max(flatData, function (d) { | ||
return d3.max(d.slice(0, d.length - 1)); | ||
}) || 10]); | ||
this.line = d3.line().x(function (d) { | ||
@@ -338,0 +346,0 @@ return _this2.x(d[d.length - 1]); |
@@ -192,3 +192,3 @@ 'use strict'; | ||
return _react2.default.createElement(_LineGraph2.default, { | ||
datasets: [[[43, 1507563000000], [27, 1507563900000], [33, 1507564800000]], [[48.633333333333, 1507563004000], [21, 1507563900140], [38, 1507564830000]]], | ||
datasets: [[[43, 1507563000000], [-27, 1507563900000], [33, 1507564800000]], [[-48.633333333333, 1507563004000], [21, 1507563900140], [-38, 1507564830000]]], | ||
onHover: (0, _react3.action)('Hover'), | ||
@@ -195,0 +195,0 @@ onMouseOut: (0, _react3.action)('Mouseout'), |
@@ -94,2 +94,12 @@ import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of'; | ||
var getYDomainMin = function getYDomainMin(data) { | ||
var dataMin = d3.min(data, function (d) { | ||
return d3.min(d.slice(0, d.length - 1)); | ||
}); | ||
if (dataMin > 0) { | ||
return 0; | ||
} | ||
return dataMin; | ||
}; | ||
var LineGraph = function (_Component) { | ||
@@ -156,6 +166,5 @@ _inherits(LineGraph, _Component); | ||
})); | ||
this.y.domain([0, d3.max(data, function (d) { | ||
this.y.domain([getYDomainMin(data), d3.max(data, function (d) { | ||
return d3.max(d.slice(0, d.length - 1)); | ||
})]); | ||
this.updateEmptyState(nextProps.data.length > 0 ? nextProps.data : nextProps.datasets); | ||
@@ -291,6 +300,5 @@ this.updateData(nextProps); | ||
this.y = d3.scaleLinear().range([this.height, 0]).domain([0, d3.max(flatData, function (d) { | ||
this.y = d3.scaleLinear().range([this.height, 0]).domain([getYDomainMin(flatData), d3.max(flatData, function (d) { | ||
return d3.max(d.slice(0, d.length - 1)); | ||
}) || 10]); | ||
this.line = d3.line().x(function (d) { | ||
@@ -297,0 +305,0 @@ return _this2.x(d[d.length - 1]); |
@@ -168,3 +168,3 @@ import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of'; | ||
return React.createElement(LineGraph, { | ||
datasets: [[[43, 1507563000000], [27, 1507563900000], [33, 1507564800000]], [[48.633333333333, 1507563004000], [21, 1507563900140], [38, 1507564830000]]], | ||
datasets: [[[43, 1507563000000], [-27, 1507563900000], [33, 1507564800000]], [[-48.633333333333, 1507563004000], [21, 1507563900140], [-38, 1507564830000]]], | ||
onHover: action('Hover'), | ||
@@ -171,0 +171,0 @@ onMouseOut: action('Mouseout'), |
{ | ||
"name": "carbon-addons-data-viz-react", | ||
"version": "1.24.0", | ||
"version": "1.25.0", | ||
"description": "Carbon Data Visualization", | ||
@@ -5,0 +5,0 @@ "main": "cjs/index.js", |
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
187109
4327