carbon-addons-data-viz-react
Advanced tools
Comparing version 1.25.0 to 1.26.0
@@ -101,3 +101,5 @@ 'use strict'; | ||
*/ | ||
isXTime: _propTypes2.default.bool | ||
isXTime: _propTypes2.default.bool, | ||
yAxisTickFormat: _propTypes2.default.func, | ||
yAxisTickSize: _propTypes2.default.number | ||
}; | ||
@@ -359,4 +361,7 @@ | ||
this.yAxis = d3.axisLeft().ticks(4).tickSize(-this.width).scale(this.y.nice()); | ||
this.yAxis = d3.axisLeft().ticks(this.props.yAxisTickSize ? this.props.yAxisTickSize : 4).tickSize(-this.width).scale(this.y.nice()); | ||
if (this.props.yAxisTickFormat) { | ||
this.yAxis = this.yAxis.tickFormat(this.props.yAxisTickFormat); | ||
} | ||
this.renderAxes(); | ||
@@ -363,0 +368,0 @@ this.renderLabels(); |
@@ -197,2 +197,22 @@ 'use strict'; | ||
}); | ||
}).addWithInfo('Static Custom Y Axis', ' Static Custom Y Axis\' Example. ', function () { | ||
return _react2.default.createElement(_LineGraph2.default, { | ||
datasets: [[[1, 1507563000000], [-1, 1507563900000], [0, 1507564800000]], [[-1, 1507563004000], [0, 1507563900140], [1, 1507564830000]]], | ||
yAxisTickSize: 2, | ||
yAxisTickFormat: function yAxisTickFormat(val) { | ||
if (val === 1) { | ||
return 'running'; | ||
} | ||
if (val === -1) { | ||
return 'stopped'; | ||
} | ||
if (val === 0) { | ||
return 'unknown'; | ||
} | ||
return ''; | ||
}, | ||
onHover: (0, _react3.action)('Hover'), | ||
onMouseOut: (0, _react3.action)('Mouseout'), | ||
onBlur: (0, _react3.action)('Blur') | ||
}); | ||
}).addWithInfo('Number values for X', ' Static Example. ', function () { | ||
@@ -199,0 +219,0 @@ return _react2.default.createElement(_LineGraph2.default, { |
@@ -59,3 +59,5 @@ import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of'; | ||
*/ | ||
isXTime: PropTypes.bool | ||
isXTime: PropTypes.bool, | ||
yAxisTickFormat: PropTypes.func, | ||
yAxisTickSize: PropTypes.number | ||
}; | ||
@@ -318,4 +320,7 @@ | ||
this.yAxis = d3.axisLeft().ticks(4).tickSize(-this.width).scale(this.y.nice()); | ||
this.yAxis = d3.axisLeft().ticks(this.props.yAxisTickSize ? this.props.yAxisTickSize : 4).tickSize(-this.width).scale(this.y.nice()); | ||
if (this.props.yAxisTickFormat) { | ||
this.yAxis = this.yAxis.tickFormat(this.props.yAxisTickFormat); | ||
} | ||
this.renderAxes(); | ||
@@ -322,0 +327,0 @@ this.renderLabels(); |
@@ -173,2 +173,22 @@ import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of'; | ||
}); | ||
}).addWithInfo('Static Custom Y Axis', ' Static Custom Y Axis\' Example. ', function () { | ||
return React.createElement(LineGraph, { | ||
datasets: [[[1, 1507563000000], [-1, 1507563900000], [0, 1507564800000]], [[-1, 1507563004000], [0, 1507563900140], [1, 1507564830000]]], | ||
yAxisTickSize: 2, | ||
yAxisTickFormat: function yAxisTickFormat(val) { | ||
if (val === 1) { | ||
return 'running'; | ||
} | ||
if (val === -1) { | ||
return 'stopped'; | ||
} | ||
if (val === 0) { | ||
return 'unknown'; | ||
} | ||
return ''; | ||
}, | ||
onHover: action('Hover'), | ||
onMouseOut: action('Mouseout'), | ||
onBlur: action('Blur') | ||
}); | ||
}).addWithInfo('Number values for X', ' Static Example. ', function () { | ||
@@ -175,0 +195,0 @@ return React.createElement(LineGraph, { |
{ | ||
"name": "carbon-addons-data-viz-react", | ||
"version": "1.25.0", | ||
"version": "1.26.0", | ||
"description": "Carbon Data Visualization", | ||
@@ -5,0 +5,0 @@ "main": "cjs/index.js", |
188964
4377