@windborne/grapher 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.js +1 -1
- package/bundle.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +3 -1
- package/src/components/vertical_lines.js +7 -1
- package/src/helpers/custom_prop_types.js +2 -0
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
# Grapher
|
|
2
|
+
# WindBorne Grapher
|
|
3
3
|
Powerful, performant graphing.
|
|
4
4
|
|
|
5
5
|
Grapher is designed primarily for internal infrastructure with lots of data and lots of axes.
|
|
@@ -300,6 +300,8 @@ Array of vertical line objects to display on the graph with properties:
|
|
|
300
300
|
- `text`: Optional text to display alongside the line
|
|
301
301
|
- `textTop`: Optional value to specify the vertical position of the text
|
|
302
302
|
- `textStyle`: Optional styling object for the text
|
|
303
|
+
- `minPixelX`: Optional number. If the x position of the line in pixels is less than this value, the line will be hidden
|
|
304
|
+
- `maxPixelX`: Optional number. If the x position of the line in pixels is greater than this value, the line will be hidden
|
|
303
305
|
- `onRangeGraph`: If true, will show the line on the range graph as well. This may also be an object with any of the above options to adjust the styling
|
|
304
306
|
- `onRangeGraphOnly`: If true, the vertical line will only appear on the range graph and not the primary graph
|
|
305
307
|
|
|
@@ -42,7 +42,6 @@ function VerticalLines({ stateController, verticalLines, isRangeGraph, bounds, e
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
45
|
const xT = (line.x - bounds.minX)/(bounds.maxX - bounds.minX);
|
|
47
46
|
|
|
48
47
|
if (xT < 0 || xT > 1) {
|
|
@@ -50,6 +49,13 @@ function VerticalLines({ stateController, verticalLines, isRangeGraph, bounds, e
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
const pixelX = xT * (elementWidth || sizing.elementWidth);
|
|
52
|
+
if (typeof line.minPixelX === 'number' && pixelX < line.minPixelX) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (typeof line.maxPixelX === 'number' && pixelX > line.maxPixelX) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
53
59
|
|
|
54
60
|
const lineStyle = {
|
|
55
61
|
stroke: line.color,
|
|
@@ -142,6 +142,8 @@ const VerticalLine = PropTypes.shape({
|
|
|
142
142
|
text: PropTypes.string,
|
|
143
143
|
textTop: PropTypes.number,
|
|
144
144
|
textStyle: PropTypes.object,
|
|
145
|
+
minPixelX: PropTypes.number,
|
|
146
|
+
maxPixelX: PropTypes.number,
|
|
145
147
|
onRangeGraph: PropTypes.oneOfType([
|
|
146
148
|
PropTypes.bool,
|
|
147
149
|
PropTypes.object // anything that can be passed into the overall vertical line
|