Skip to content

Commit 1d3ae2d

Browse files
committed
Merge branches 'master' and 'master' of github.com:esnet/react-timeseries-charts
# Conflicts: # package.json
2 parents a55d96c + 0fb4716 commit 1d3ae2d

File tree

22 files changed

+4909
-4165
lines changed

22 files changed

+4909
-4165
lines changed

CHANGES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
## v0.12.5
44
> Jun 15, 2017
55
6-
* Fixes propType warnings by using prop-types package(([@aruntk](https://github.com/aruntka) in [#152](https://github.com/esnet/react-timeseries-charts/pull/152))
7-
* Fixes an issue with ScatterChart prop type (([@christian-acuna](https://github.com/christian-acuna) in [#155](https://github.com/esnet/react-timeseries-charts/pull/155))
8-
* Pointer events allowing on ScatterChart (([@samford100](https://github.com/samford100) in [#137](https://github.com/esnet/react-timeseries-charts/pull/137))
6+
* Fixes React propType warnings by using prop-types package ([@aruntk](https://github.com/aruntka) in [#152](https://github.com/esnet/react-timeseries-charts/pull/152))
7+
* Fixes an issue with ScatterChart prop type ([@christian-acuna](https://github.com/christian-acuna) in [#155](https://github.com/esnet/react-timeseries-charts/pull/155))
8+
* Pointer events allowing on ScatterChart ([@samford100](https://github.com/samford100) in [#137](https://github.com/esnet/react-timeseries-charts/pull/137))
99

1010
## v0.12.3
1111
> Feb 24, 2017

lib/components/Baseline.js

Lines changed: 172 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
"use strict";
22

33
Object.defineProperty(exports, "__esModule", {
4-
value: true
4+
value: true
55
});
66

7-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
7+
var _createClass = (function() {
8+
function defineProperties(target, props) {
9+
for (var i = 0; i < props.length; i++) {
10+
var descriptor = props[i];
11+
descriptor.enumerable = descriptor.enumerable || false;
12+
descriptor.configurable = true;
13+
if ("value" in descriptor) descriptor.writable = true;
14+
Object.defineProperty(target, descriptor.key, descriptor);
15+
}
16+
}
17+
return function(Constructor, protoProps, staticProps) {
18+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
19+
if (staticProps) defineProperties(Constructor, staticProps);
20+
return Constructor;
21+
};
22+
})();
823

924
var _merge = require("merge");
1025

@@ -22,13 +37,37 @@ var _underscore = require("underscore");
2237

2338
var _underscore2 = _interopRequireDefault(_underscore);
2439

25-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26-
27-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
40+
function _interopRequireDefault(obj) {
41+
return obj && obj.__esModule ? obj : { default: obj };
42+
}
2843

29-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
44+
function _classCallCheck(instance, Constructor) {
45+
if (!(instance instanceof Constructor)) {
46+
throw new TypeError("Cannot call a class as a function");
47+
}
48+
}
3049

31-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
50+
function _possibleConstructorReturn(self, call) {
51+
if (!self) {
52+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
53+
}
54+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
55+
}
56+
57+
function _inherits(subClass, superClass) {
58+
if (typeof superClass !== "function" && superClass !== null) {
59+
throw new TypeError(
60+
"Super expression must either be null or a function, not " + typeof superClass
61+
);
62+
}
63+
subClass.prototype = Object.create(superClass && superClass.prototype, {
64+
constructor: { value: subClass, enumerable: false, writable: true, configurable: true }
65+
});
66+
if (superClass)
67+
Object.setPrototypeOf
68+
? Object.setPrototypeOf(subClass, superClass)
69+
: (subClass.__proto__ = superClass);
70+
} /**
3271
* Copyright (c) 2015-present, The Regents of the University of California,
3372
* through Lawrence Berkeley National Laboratory (subject to receipt
3473
* of any required approvals from the U.S. Dept. of Energy).
@@ -39,18 +78,18 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
3978
*/
4079

4180
var defaultStyle = {
42-
label: {
43-
fill: "#8B7E7E", // Default label color
44-
fontWeight: 100,
45-
fontSize: 11,
46-
pointerEvents: "none"
47-
},
48-
line: {
49-
stroke: "#626262",
50-
strokeWidth: 1,
51-
strokeDasharray: "5,3",
52-
pointerEvents: "none"
53-
}
81+
label: {
82+
fill: "#8B7E7E", // Default label color
83+
fontWeight: 100,
84+
fontSize: 11,
85+
pointerEvents: "none"
86+
},
87+
line: {
88+
stroke: "#626262",
89+
strokeWidth: 1,
90+
strokeDasharray: "5,3",
91+
pointerEvents: "none"
92+
}
5493
};
5594

5695
/**
@@ -80,114 +119,126 @@ var defaultStyle = {
80119
* ```
81120
*/
82121

83-
var Baseline = function (_React$Component) {
84-
_inherits(Baseline, _React$Component);
85-
86-
function Baseline() {
87-
_classCallCheck(this, Baseline);
88-
89-
return _possibleConstructorReturn(this, (Baseline.__proto__ || Object.getPrototypeOf(Baseline)).apply(this, arguments));
90-
}
91-
92-
_createClass(Baseline, [{
93-
key: "render",
94-
value: function render() {
95-
if (!this.props.yScale || _underscore2.default.isUndefined(this.props.value)) {
96-
return null;
97-
}
98-
99-
var y = this.props.yScale(this.props.value);
100-
var transform = "translate(0 " + y + ")";
101-
var textAnchor = void 0;
102-
var textPositionX = void 0;
103-
var pts = [];
104-
105-
var textPositionY = -3;
106-
107-
if (this.props.position === "left") {
108-
textAnchor = "start";
109-
textPositionX = 5;
110-
}
111-
if (this.props.position === "right") {
112-
textAnchor = "end";
113-
textPositionX = this.props.width - 5;
114-
}
115-
116-
pts.push("0 0");
117-
pts.push(this.props.width + " 0");
118-
var points = pts.join(" ");
119-
120-
//
121-
// Style
122-
//
123-
124-
var labelStyle = (0, _merge2.default)(true, defaultStyle.label, this.props.style.label ? this.props.style.label : {});
125-
var lineStyle = (0, _merge2.default)(true, defaultStyle.line, this.props.style.line ? this.props.style.line : {});
126-
127-
return _react2.default.createElement(
128-
"g",
129-
{ className: "baseline", transform: transform },
130-
_react2.default.createElement("polyline", { points: points, style: lineStyle }),
131-
_react2.default.createElement(
132-
"text",
133-
{
134-
style: labelStyle,
135-
x: textPositionX,
136-
y: textPositionY,
137-
textAnchor: textAnchor
138-
},
139-
this.props.label
140-
)
141-
);
122+
var Baseline = (function(_React$Component) {
123+
_inherits(Baseline, _React$Component);
124+
125+
function Baseline() {
126+
_classCallCheck(this, Baseline);
127+
128+
return _possibleConstructorReturn(
129+
this,
130+
(Baseline.__proto__ || Object.getPrototypeOf(Baseline)).apply(this, arguments)
131+
);
142132
}
143-
}]);
144133

145-
return Baseline;
146-
}(_react2.default.Component);
134+
_createClass(Baseline, [
135+
{
136+
key: "render",
137+
value: function render() {
138+
if (!this.props.yScale || _underscore2.default.isUndefined(this.props.value)) {
139+
return null;
140+
}
141+
142+
var y = this.props.yScale(this.props.value);
143+
var transform = "translate(0 " + y + ")";
144+
var textAnchor = void 0;
145+
var textPositionX = void 0;
146+
var pts = [];
147+
148+
var textPositionY = -3;
149+
150+
if (this.props.position === "left") {
151+
textAnchor = "start";
152+
textPositionX = 5;
153+
}
154+
if (this.props.position === "right") {
155+
textAnchor = "end";
156+
textPositionX = this.props.width - 5;
157+
}
158+
159+
pts.push("0 0");
160+
pts.push(this.props.width + " 0");
161+
var points = pts.join(" ");
162+
163+
//
164+
// Style
165+
//
166+
167+
var labelStyle = (0, _merge2.default)(
168+
true,
169+
defaultStyle.label,
170+
this.props.style.label ? this.props.style.label : {}
171+
);
172+
var lineStyle = (0, _merge2.default)(
173+
true,
174+
defaultStyle.line,
175+
this.props.style.line ? this.props.style.line : {}
176+
);
177+
178+
return _react2.default.createElement(
179+
"g",
180+
{ className: "baseline", transform: transform },
181+
_react2.default.createElement("polyline", { points: points, style: lineStyle }),
182+
_react2.default.createElement(
183+
"text",
184+
{
185+
style: labelStyle,
186+
x: textPositionX,
187+
y: textPositionY,
188+
textAnchor: textAnchor
189+
},
190+
this.props.label
191+
)
192+
);
193+
}
194+
}
195+
]);
196+
197+
return Baseline;
198+
})(_react2.default.Component);
147199

148200
exports.default = Baseline;
149201

150-
151202
Baseline.defaultProps = {
152-
value: 0,
153-
label: "",
154-
position: "left",
155-
style: defaultStyle
203+
value: 0,
204+
label: "",
205+
position: "left",
206+
style: defaultStyle
156207
};
157208

158209
Baseline.propTypes = {
159-
/**
160-
* Reference to the axis which provides the vertical scale for drawing. e.g.
161-
* specifying axis="trafficRate" would refer the y-scale to the YAxis of id="trafficRate".
162-
*/
163-
axis: _propTypes2.default.string.isRequired, // eslint-disable-line
164-
/**
165-
* An object describing the style of the baseline of the form
166-
* { label, line }. "label" and "line" are both objects containing
167-
* the inline CSS for that part of the baseline.
168-
*/
169-
style: _propTypes2.default.shape({
170-
label: _propTypes2.default.object, // eslint-disable-line
171-
line: _propTypes2.default.object // eslint-disable-line
172-
}),
173-
/**
174-
* The y-value to display the line at.
175-
*/
176-
value: _propTypes2.default.number,
177-
/**
178-
* The label to display with the axis.
179-
*/
180-
label: _propTypes2.default.string,
181-
/**
182-
* Whether to display the label on the "left" or "right".
183-
*/
184-
position: _propTypes2.default.oneOf(["left", "right"]),
185-
/**
186-
* [Internal] The yScale supplied by the associated YAxis
187-
*/
188-
yScale: _propTypes2.default.func,
189-
/**
190-
* [Internal] The width supplied by the surrounding ChartContainer
191-
*/
192-
width: _propTypes2.default.number
193-
};
210+
/**
211+
* Reference to the axis which provides the vertical scale for drawing. e.g.
212+
* specifying axis="trafficRate" would refer the y-scale to the YAxis of id="trafficRate".
213+
*/
214+
axis: _propTypes2.default.string.isRequired, // eslint-disable-line
215+
/**
216+
* An object describing the style of the baseline of the form
217+
* { label, line }. "label" and "line" are both objects containing
218+
* the inline CSS for that part of the baseline.
219+
*/
220+
style: _propTypes2.default.shape({
221+
label: _propTypes2.default.object, // eslint-disable-line
222+
line: _propTypes2.default.object // eslint-disable-line
223+
}),
224+
/**
225+
* The y-value to display the line at.
226+
*/
227+
value: _propTypes2.default.number,
228+
/**
229+
* The label to display with the axis.
230+
*/
231+
label: _propTypes2.default.string,
232+
/**
233+
* Whether to display the label on the "left" or "right".
234+
*/
235+
position: _propTypes2.default.oneOf(["left", "right"]),
236+
/**
237+
* [Internal] The yScale supplied by the associated YAxis
238+
*/
239+
yScale: _propTypes2.default.func,
240+
/**
241+
* [Internal] The width supplied by the surrounding ChartContainer
242+
*/
243+
width: _propTypes2.default.number
244+
};

0 commit comments

Comments
 (0)