@pie-lib/charting 4.5.11-next.434 → 4.5.11-next.457
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/lib/axes.js +32 -59
- package/lib/axes.js.map +1 -1
- package/lib/bars/bar.js +19 -30
- package/lib/bars/bar.js.map +1 -1
- package/lib/bars/common/bars.js +29 -45
- package/lib/bars/common/bars.js.map +1 -1
- package/lib/bars/histogram.js +19 -30
- package/lib/bars/histogram.js.map +1 -1
- package/lib/chart-setup.js +49 -30
- package/lib/chart-setup.js.map +1 -1
- package/lib/chart-type.js +2 -2
- package/lib/chart-type.js.map +1 -1
- package/lib/chart-types.js +2 -2
- package/lib/chart-types.js.map +1 -1
- package/lib/chart.js +38 -64
- package/lib/chart.js.map +1 -1
- package/lib/common/drag-handle.js +26 -41
- package/lib/common/drag-handle.js.map +1 -1
- package/lib/common/styles.js +7 -5
- package/lib/common/styles.js.map +1 -1
- package/lib/grid.js +19 -31
- package/lib/grid.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/line/common/drag-handle.js +24 -38
- package/lib/line/common/drag-handle.js.map +1 -1
- package/lib/line/common/line.js +39 -70
- package/lib/line/common/line.js.map +1 -1
- package/lib/line/line-cross.js +25 -39
- package/lib/line/line-cross.js.map +1 -1
- package/lib/line/line-dot.js +24 -38
- package/lib/line/line-dot.js.map +1 -1
- package/lib/mark-label.js +10 -20
- package/lib/mark-label.js.map +1 -1
- package/lib/plot/common/plot.js +29 -45
- package/lib/plot/common/plot.js.map +1 -1
- package/lib/plot/dot.js +20 -31
- package/lib/plot/dot.js.map +1 -1
- package/lib/plot/line.js +21 -32
- package/lib/plot/line.js.map +1 -1
- package/lib/tool-menu.js +19 -32
- package/lib/tool-menu.js.map +1 -1
- package/lib/utils.js +5 -3
- package/lib/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/chart-setup.jsx +42 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.js","names":["log","debug","RawPlot","props","dragValue","setState","label","onChangeCategory","state","undefined","value","setDragValue","existing","next","graphProps","classes","xBand","index","CustomBarElement","interactive","correctness","scale","range","size","max","v","Number","isFinite","barWidth","bandwidth","barHeight","y","barX","bandKey","values","i","push","pointHeight","height","pointDiameter","Component","DraggableHandle","DragHandle","map","dragStop","React","PropTypes","func","number","object","string","isRequired","types","GraphPropsType","bool","shape","Bar","withStyles","theme","dot","fill","color","primaryLight","correct","incorrect","line","stroke","Plot","data","defineChart","d","category","array"],"sources":["../../../src/plot/common/plot.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { Group } from '@vx/group';\nimport { withStyles } from '@material-ui/core/styles/index';\nimport DraggableHandle, { DragHandle } from '../../common/drag-handle';\nimport debug from 'debug';\nimport { color } from '@pie-lib/render-ui';\nimport { bandKey } from '../../utils';\nimport { correct, incorrect } from '../../common/styles';\n\nconst log = debug('pie-lib:chart:bars');\n\nexport class RawPlot extends React.Component {\n static propTypes = {\n onChangeCategory: PropTypes.func,\n value: PropTypes.number,\n classes: PropTypes.object,\n label: PropTypes.string,\n xBand: PropTypes.func,\n index: PropTypes.number.isRequired,\n graphProps: types.GraphPropsType.isRequired,\n CustomBarElement: PropTypes.func,\n interactive: PropTypes.bool,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string\n })\n };\n\n constructor(props) {\n super(props);\n this.state = {\n dragValue: undefined\n };\n }\n\n setDragValue = dragValue => this.setState({ dragValue });\n\n dragStop = () => {\n const { label, onChangeCategory } = this.props;\n const { dragValue } = this.state;\n log('[dragStop]', dragValue);\n\n if (dragValue !== undefined) {\n onChangeCategory({ label, value: dragValue });\n }\n\n this.setDragValue(undefined);\n };\n\n dragValue = (existing, next) => {\n log('[dragValue] next:', next);\n\n this.setDragValue(next);\n };\n\n render() {\n const {\n graphProps,\n value,\n label,\n classes,\n xBand,\n index,\n CustomBarElement,\n interactive,\n correctness\n } = this.props;\n\n const { scale, range, size } = graphProps;\n const { max } = range || {};\n const { dragValue } = this.state;\n\n const v = Number.isFinite(dragValue) ? dragValue : value;\n const barWidth = xBand.bandwidth();\n const barHeight = scale.y(range.max - v);\n const barX = xBand(bandKey({ label }, index));\n\n log('label:', label, 'barX:', barX, 'v: ', v, 'barHeight:', barHeight, 'barWidth: ', barWidth);\n\n const values = [];\n\n for (let i = 0; i < v; i++) {\n values.push(i);\n }\n\n const pointHeight = size.height / max;\n const pointDiameter = (pointHeight > barWidth ? barWidth : pointHeight) * 0.8;\n const Component = interactive ? DraggableHandle : DragHandle;\n\n return (\n <React.Fragment>\n {values.map(index =>\n CustomBarElement({\n index,\n pointDiameter,\n barX,\n barWidth,\n pointHeight,\n label,\n value,\n classes,\n scale\n })\n )}\n <Component\n x={barX}\n y={v}\n interactive={interactive}\n width={barWidth}\n onDrag={v => this.dragValue(value, v)}\n onDragStop={this.dragStop}\n graphProps={graphProps}\n correctness={correctness}\n />\n </React.Fragment>\n );\n }\n}\n\nconst Bar = withStyles(theme => ({\n dot: {\n fill: color.primaryLight(),\n '&.correct': correct('stroke'),\n '&.incorrect': incorrect('stroke')\n },\n line: {\n stroke: color.primaryLight(),\n '&.correct': correct('stroke'),\n '&.incorrect': incorrect('stroke')\n }\n}))(RawPlot);\n\nexport class Plot extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChangeCategory: PropTypes.func,\n xBand: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired,\n defineChart: PropTypes.bool,\n CustomBarElement: PropTypes.func\n };\n\n render() {\n const { data, graphProps, xBand, CustomBarElement, onChangeCategory, defineChart } = this.props;\n\n return (\n <Group>\n {(data || []).map((d, index) => (\n <Bar\n value={d.value}\n label={d.label}\n interactive={defineChart ? true : d.interactive}\n xBand={xBand}\n index={index}\n key={`bar-${d.label}-${d.value}-${index}`}\n onChangeCategory={category => onChangeCategory(index, category)}\n graphProps={graphProps}\n CustomBarElement={CustomBarElement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;UAKE,KAAK,EAAEC,KALT;UAME,GAAG,gBAASqD,CAAC,CAAChE,KAAX,cAAoBgE,CAAC,CAAC5D,KAAtB,cAA+BO,KAA/B,CANL;UAOE,gBAAgB,EAAE,0BAAAsD,QAAQ;YAAA,OAAIhE,iBAAgB,CAACU,KAAD,EAAQsD,QAAR,CAApB;UAAA,CAP5B;UAQE,UAAU,EAAEzD,UARd;UASE,gBAAgB,EAAEI,gBATpB;UAUE,WAAW,EAAEoD,CAAC,CAAClD;QAVjB,EADgB;MAAA,CAAjB,CADH,CADF;IAkBD;;;;EA/BuByB,iBAAA,CAAML,S;;;;gBAAnB2B,I,eACQ;EACjBC,IAAI,EAAEtB,qBAAA,CAAU0B,KADC;EAEjBjE,gBAAgB,EAAEuC,qBAAA,CAAUC,IAFX;EAGjB/B,KAAK,EAAE8B,qBAAA,CAAUC,IAHA;EAIjBjC,UAAU,EAAEsC,WAAA,CAAMC,cAAN,CAAqBF,UAJhB;EAKjBkB,WAAW,EAAEvB,qBAAA,CAAUQ,IALN;EAMjBpC,gBAAgB,EAAE4B,qBAAA,CAAUC;AANX,C;;eAiCNoB,I"}
|
|
1
|
+
{"version":3,"file":"plot.js","names":["log","debug","RawPlot","props","dragValue","setState","label","onChangeCategory","state","undefined","value","setDragValue","existing","next","graphProps","classes","xBand","index","CustomBarElement","interactive","correctness","scale","range","size","max","v","Number","isFinite","barWidth","bandwidth","barHeight","y","barX","bandKey","values","i","push","pointHeight","height","pointDiameter","Component","DraggableHandle","DragHandle","map","dragStop","React","PropTypes","func","number","object","string","isRequired","types","GraphPropsType","bool","shape","Bar","withStyles","theme","dot","fill","color","primaryLight","correct","incorrect","line","stroke","Plot","data","defineChart","d","category","array"],"sources":["../../../src/plot/common/plot.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { Group } from '@vx/group';\nimport { withStyles } from '@material-ui/core/styles/index';\nimport DraggableHandle, { DragHandle } from '../../common/drag-handle';\nimport debug from 'debug';\nimport { color } from '@pie-lib/render-ui';\nimport { bandKey } from '../../utils';\nimport { correct, incorrect } from '../../common/styles';\n\nconst log = debug('pie-lib:chart:bars');\n\nexport class RawPlot extends React.Component {\n static propTypes = {\n onChangeCategory: PropTypes.func,\n value: PropTypes.number,\n classes: PropTypes.object,\n label: PropTypes.string,\n xBand: PropTypes.func,\n index: PropTypes.number.isRequired,\n graphProps: types.GraphPropsType.isRequired,\n CustomBarElement: PropTypes.func,\n interactive: PropTypes.bool,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string\n })\n };\n\n constructor(props) {\n super(props);\n this.state = {\n dragValue: undefined\n };\n }\n\n setDragValue = dragValue => this.setState({ dragValue });\n\n dragStop = () => {\n const { label, onChangeCategory } = this.props;\n const { dragValue } = this.state;\n log('[dragStop]', dragValue);\n\n if (dragValue !== undefined) {\n onChangeCategory({ label, value: dragValue });\n }\n\n this.setDragValue(undefined);\n };\n\n dragValue = (existing, next) => {\n log('[dragValue] next:', next);\n\n this.setDragValue(next);\n };\n\n render() {\n const {\n graphProps,\n value,\n label,\n classes,\n xBand,\n index,\n CustomBarElement,\n interactive,\n correctness\n } = this.props;\n\n const { scale, range, size } = graphProps;\n const { max } = range || {};\n const { dragValue } = this.state;\n\n const v = Number.isFinite(dragValue) ? dragValue : value;\n const barWidth = xBand.bandwidth();\n const barHeight = scale.y(range.max - v);\n const barX = xBand(bandKey({ label }, index));\n\n log('label:', label, 'barX:', barX, 'v: ', v, 'barHeight:', barHeight, 'barWidth: ', barWidth);\n\n const values = [];\n\n for (let i = 0; i < v; i++) {\n values.push(i);\n }\n\n const pointHeight = size.height / max;\n const pointDiameter = (pointHeight > barWidth ? barWidth : pointHeight) * 0.8;\n const Component = interactive ? DraggableHandle : DragHandle;\n\n return (\n <React.Fragment>\n {values.map(index =>\n CustomBarElement({\n index,\n pointDiameter,\n barX,\n barWidth,\n pointHeight,\n label,\n value,\n classes,\n scale\n })\n )}\n <Component\n x={barX}\n y={v}\n interactive={interactive}\n width={barWidth}\n onDrag={v => this.dragValue(value, v)}\n onDragStop={this.dragStop}\n graphProps={graphProps}\n correctness={correctness}\n />\n </React.Fragment>\n );\n }\n}\n\nconst Bar = withStyles(theme => ({\n dot: {\n fill: color.primaryLight(),\n '&.correct': correct('stroke'),\n '&.incorrect': incorrect('stroke')\n },\n line: {\n stroke: color.primaryLight(),\n '&.correct': correct('stroke'),\n '&.incorrect': incorrect('stroke')\n }\n}))(RawPlot);\n\nexport class Plot extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChangeCategory: PropTypes.func,\n xBand: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired,\n defineChart: PropTypes.bool,\n CustomBarElement: PropTypes.func\n };\n\n render() {\n const { data, graphProps, xBand, CustomBarElement, onChangeCategory, defineChart } = this.props;\n\n return (\n <Group>\n {(data || []).map((d, index) => (\n <Bar\n value={d.value}\n label={d.label}\n interactive={defineChart ? true : d.interactive}\n xBand={xBand}\n index={index}\n key={`bar-${d.label}-${d.value}-${index}`}\n onChangeCategory={category => onChangeCategory(index, category)}\n graphProps={graphProps}\n CustomBarElement={CustomBarElement}\n correctness={d.correctness}\n />\n ))}\n </Group>\n );\n }\n}\n\nexport default Plot;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,IAAAC,iBAAA,EAAM,oBAAN,CAAZ;;IAEaC,O;;;;;EAiBX,iBAAYC,KAAZ,EAAmB;IAAA;;IAAA;IACjB,0BAAMA,KAAN;IADiB,iGAOJ,UAAAC,SAAS;MAAA,OAAI,MAAKC,QAAL,CAAc;QAAED,SAAS,EAATA;MAAF,CAAd,CAAJ;IAAA,CAPL;IAAA,6FASR,YAAM;MACf,kBAAoC,MAAKD,KAAzC;MAAA,IAAQG,KAAR,eAAQA,KAAR;MAAA,IAAeC,gBAAf,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HA;EAIjBjC,UAAU,EAAEsC,WAAA,CAAMC,cAAN,CAAqBF,UAJhB;EAKjBkB,WAAW,EAAEvB,qBAAA,CAAUQ,IALN;EAMjBpC,gBAAgB,EAAE4B,qBAAA,CAAUC;AANX,C;eAiCNoB,I"}
|
package/lib/plot/dot.js
CHANGED
|
@@ -1,50 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = exports.DotPlot = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
var _plot = require("@pie-lib/plot");
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
11
|
|
|
16
|
-
var
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
13
|
|
|
18
|
-
var
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
15
|
|
|
20
|
-
var
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
19
|
|
|
24
|
-
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
21
|
|
|
26
|
-
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
var _react = _interopRequireDefault(require("react"));
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
var _plot = require("@pie-lib/plot");
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
var _utils = require("../utils");
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
var _plot2 = _interopRequireDefault(require("./common/plot"));
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
var _shape = require("@vx/shape");
|
|
39
35
|
|
|
40
|
-
function
|
|
36
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
41
37
|
|
|
42
38
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
39
|
|
|
44
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
|
-
|
|
46
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
47
|
-
|
|
48
40
|
var CustomBarElement = function CustomBarElement(props) {
|
|
49
41
|
var index = props.index,
|
|
50
42
|
pointDiameter = props.pointDiameter,
|
|
@@ -80,17 +72,16 @@ CustomBarElement.propTypes = {
|
|
|
80
72
|
};
|
|
81
73
|
|
|
82
74
|
var DotPlot = /*#__PURE__*/function (_React$Component) {
|
|
83
|
-
|
|
75
|
+
(0, _inherits2["default"])(DotPlot, _React$Component);
|
|
84
76
|
|
|
85
77
|
var _super = _createSuper(DotPlot);
|
|
86
78
|
|
|
87
79
|
function DotPlot() {
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
(0, _classCallCheck2["default"])(this, DotPlot);
|
|
90
81
|
return _super.apply(this, arguments);
|
|
91
82
|
}
|
|
92
83
|
|
|
93
|
-
|
|
84
|
+
(0, _createClass2["default"])(DotPlot, [{
|
|
94
85
|
key: "render",
|
|
95
86
|
value: function render() {
|
|
96
87
|
var props = this.props;
|
|
@@ -104,19 +95,17 @@ var DotPlot = /*#__PURE__*/function (_React$Component) {
|
|
|
104
95
|
size = _ref$size === void 0 ? {} : _ref$size;
|
|
105
96
|
|
|
106
97
|
var xBand = (0, _utils.dataToXBand)(scale.x, data, size.width, 'dotPlot');
|
|
107
|
-
return /*#__PURE__*/_react["default"].createElement(_plot2["default"],
|
|
98
|
+
return /*#__PURE__*/_react["default"].createElement(_plot2["default"], (0, _extends2["default"])({}, props, {
|
|
108
99
|
xBand: xBand,
|
|
109
100
|
CustomBarElement: CustomBarElement
|
|
110
101
|
}));
|
|
111
102
|
}
|
|
112
103
|
}]);
|
|
113
|
-
|
|
114
104
|
return DotPlot;
|
|
115
105
|
}(_react["default"].Component);
|
|
116
106
|
|
|
117
107
|
exports.DotPlot = DotPlot;
|
|
118
|
-
|
|
119
|
-
_defineProperty(DotPlot, "propTypes", {
|
|
108
|
+
(0, _defineProperty2["default"])(DotPlot, "propTypes", {
|
|
120
109
|
data: _propTypes["default"].array,
|
|
121
110
|
onChange: _propTypes["default"].func,
|
|
122
111
|
graphProps: _plot.types.GraphPropsType.isRequired
|
package/lib/plot/dot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dot.js","names":["CustomBarElement","props","index","pointDiameter","barX","barWidth","pointHeight","label","value","classes","scale","r","cx","cy","y","dot","propTypes","PropTypes","number","string","object","DotPlot","data","graphProps","size","xBand","dataToXBand","x","width","React","Component","array","onChange","func","types","GraphPropsType","isRequired","type","name"],"sources":["../../src/plot/dot.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { dataToXBand } from '../utils';\nimport Plot from './common/plot';\nimport { Circle } from '@vx/shape';\n\nconst CustomBarElement = props => {\n const { index, pointDiameter, barX, barWidth, pointHeight, label, value, classes, scale } = props;\n\n const r = pointDiameter / 2;\n const cx = barX + (barWidth - pointDiameter) / 2 + r;\n const cy = scale.y(index) - (pointHeight - pointDiameter) / 2 - r;\n\n return (\n <Circle\n key={`point-${label}-${value}-${index}`}\n className={classes.dot}\n cx={cx}\n cy={cy}\n r={r}\n />\n );\n};\n\nCustomBarElement.propTypes = {\n index: PropTypes.number,\n pointDiameter: PropTypes.number,\n barX: PropTypes.number,\n barWidth: PropTypes.number,\n pointHeight: PropTypes.number,\n value: PropTypes.number,\n label: PropTypes.string,\n classes: PropTypes.object,\n scale: PropTypes.object\n};\n\nexport class DotPlot extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired\n };\n\n render() {\n const props = this.props;\n const { data, graphProps } = props;\n const { scale = {}, size = {} } = graphProps || {};\n const xBand = dataToXBand(scale.x, data, size.width, 'dotPlot');\n\n return <Plot {...props} xBand={xBand} CustomBarElement={CustomBarElement} />;\n }\n}\n\nexport default () => ({\n type: 'dotPlot',\n Component: DotPlot,\n name: 'Dot Plot'\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dot.js","names":["CustomBarElement","props","index","pointDiameter","barX","barWidth","pointHeight","label","value","classes","scale","r","cx","cy","y","dot","propTypes","PropTypes","number","string","object","DotPlot","data","graphProps","size","xBand","dataToXBand","x","width","React","Component","array","onChange","func","types","GraphPropsType","isRequired","type","name"],"sources":["../../src/plot/dot.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { dataToXBand } from '../utils';\nimport Plot from './common/plot';\nimport { Circle } from '@vx/shape';\n\nconst CustomBarElement = props => {\n const { index, pointDiameter, barX, barWidth, pointHeight, label, value, classes, scale } = props;\n\n const r = pointDiameter / 2;\n const cx = barX + (barWidth - pointDiameter) / 2 + r;\n const cy = scale.y(index) - (pointHeight - pointDiameter) / 2 - r;\n\n return (\n <Circle\n key={`point-${label}-${value}-${index}`}\n className={classes.dot}\n cx={cx}\n cy={cy}\n r={r}\n />\n );\n};\n\nCustomBarElement.propTypes = {\n index: PropTypes.number,\n pointDiameter: PropTypes.number,\n barX: PropTypes.number,\n barWidth: PropTypes.number,\n pointHeight: PropTypes.number,\n value: PropTypes.number,\n label: PropTypes.string,\n classes: PropTypes.object,\n scale: PropTypes.object\n};\n\nexport class DotPlot extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired\n };\n\n render() {\n const props = this.props;\n const { data, graphProps } = props;\n const { scale = {}, size = {} } = graphProps || {};\n const xBand = dataToXBand(scale.x, data, size.width, 'dotPlot');\n\n return <Plot {...props} xBand={xBand} CustomBarElement={CustomBarElement} />;\n }\n}\n\nexport default () => ({\n type: 'dotPlot',\n Component: DotPlot,\n name: 'Dot Plot'\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,CAAAC,KAAK,EAAI;EAChC,IAAQC,KAAR,GAA4FD,KAA5F,CAAQC,KAAR;EAAA,IAAeC,aAAf,GAA4FF,KAA5F,CAAeE,aAAf;EAAA,IAA8BC,IAA9B,GAA4FH,KAA5F,CAA8BG,IAA9B;EAAA,IAAoCC,QAApC,GAA4FJ,KAA5F,CAAoCI,QAApC;EAAA,IAA8CC,WAA9C,GAA4FL,KAA5F,CAA8CK,WAA9C;EAAA,IAA2DC,KAA3D,GAA4F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,UAAd,GAA6BtB,KAA7B,CAAcsB,UAAd;;MACA,WAAkCA,UAAU,IAAI,EAAhD;MAAA,sBAAQb,KAAR;MAAA,IAAQA,KAAR,2BAAgB,EAAhB;MAAA,qBAAoBc,IAApB;MAAA,IAAoBA,IAApB,0BAA2B,EAA3B;;MACA,IAAMC,KAAK,GAAG,IAAAC,kBAAA,EAAYhB,KAAK,CAACiB,CAAlB,EAAqBL,IAArB,EAA2BE,IAAI,CAACI,KAAhC,EAAuC,SAAvC,CAAd;MAEA,oBAAO,gCAAC,iBAAD,gCAAU3B,KAAV;QAAiB,KAAK,EAAEwB,KAAxB;QAA+B,gBAAgB,EAAEzB;MAAjD,GAAP;IACD;;;EAd0B6B,iBAAA,CAAMC,S;;;iCAAtBT,O,eACQ;EACjBC,IAAI,EAAEL,qBAAA,CAAUc,KADC;EAEjBC,QAAQ,EAAEf,qBAAA,CAAUgB,IAFH;EAGjBV,UAAU,EAAEW,WAAA,CAAMC,cAAN,CAAqBC;AAHhB,C;;eAgBN;EAAA,OAAO;IACpBC,IAAI,EAAE,SADc;IAEpBP,SAAS,EAAET,OAFS;IAGpBiB,IAAI,EAAE;EAHc,CAAP;AAAA,C"}
|
package/lib/plot/line.js
CHANGED
|
@@ -1,52 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = exports.LinePlot = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
21
|
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
-
|
|
26
|
-
function _extends() { _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; }; return _extends.apply(this, arguments); }
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
var _react = _interopRequireDefault(require("react"));
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
var _plot = require("@pie-lib/plot");
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
var _utils = require("../utils");
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
var _plot2 = _interopRequireDefault(require("./common/plot"));
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
var _shape = require("@vx/shape");
|
|
39
35
|
|
|
40
|
-
|
|
36
|
+
var _group = require("@vx/group");
|
|
41
37
|
|
|
42
|
-
function
|
|
38
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
43
39
|
|
|
44
40
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
41
|
|
|
46
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
|
-
|
|
48
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
49
|
-
|
|
50
42
|
var CustomBarElement = function CustomBarElement(props) {
|
|
51
43
|
var index = props.index,
|
|
52
44
|
pointDiameter = props.pointDiameter,
|
|
@@ -109,17 +101,16 @@ CustomBarElement.propTypes = {
|
|
|
109
101
|
};
|
|
110
102
|
|
|
111
103
|
var LinePlot = /*#__PURE__*/function (_React$Component) {
|
|
112
|
-
|
|
104
|
+
(0, _inherits2["default"])(LinePlot, _React$Component);
|
|
113
105
|
|
|
114
106
|
var _super = _createSuper(LinePlot);
|
|
115
107
|
|
|
116
108
|
function LinePlot() {
|
|
117
|
-
|
|
118
|
-
|
|
109
|
+
(0, _classCallCheck2["default"])(this, LinePlot);
|
|
119
110
|
return _super.apply(this, arguments);
|
|
120
111
|
}
|
|
121
112
|
|
|
122
|
-
|
|
113
|
+
(0, _createClass2["default"])(LinePlot, [{
|
|
123
114
|
key: "render",
|
|
124
115
|
value: function render() {
|
|
125
116
|
var props = this.props;
|
|
@@ -133,19 +124,17 @@ var LinePlot = /*#__PURE__*/function (_React$Component) {
|
|
|
133
124
|
size = _ref$size === void 0 ? {} : _ref$size;
|
|
134
125
|
|
|
135
126
|
var xBand = (0, _utils.dataToXBand)(scale.x, data, size.width, 'linePlot');
|
|
136
|
-
return /*#__PURE__*/_react["default"].createElement(_plot2["default"],
|
|
127
|
+
return /*#__PURE__*/_react["default"].createElement(_plot2["default"], (0, _extends2["default"])({}, props, {
|
|
137
128
|
xBand: xBand,
|
|
138
129
|
CustomBarElement: CustomBarElement
|
|
139
130
|
}));
|
|
140
131
|
}
|
|
141
132
|
}]);
|
|
142
|
-
|
|
143
133
|
return LinePlot;
|
|
144
134
|
}(_react["default"].Component);
|
|
145
135
|
|
|
146
136
|
exports.LinePlot = LinePlot;
|
|
147
|
-
|
|
148
|
-
_defineProperty(LinePlot, "propTypes", {
|
|
137
|
+
(0, _defineProperty2["default"])(LinePlot, "propTypes", {
|
|
149
138
|
data: _propTypes["default"].array,
|
|
150
139
|
onChange: _propTypes["default"].func,
|
|
151
140
|
graphProps: _plot.types.GraphPropsType.isRequired
|
package/lib/plot/line.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.js","names":["CustomBarElement","props","index","pointDiameter","barX","barWidth","pointHeight","label","value","classes","scale","x","y","line","d","propTypes","PropTypes","number","string","object","LinePlot","data","graphProps","size","xBand","dataToXBand","width","React","Component","array","onChange","func","types","GraphPropsType","isRequired","type","name"],"sources":["../../src/plot/line.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { dataToXBand } from '../utils';\nimport Plot from './common/plot';\nimport { LinePath } from '@vx/shape';\nimport { Group } from '@vx/group';\n\nconst CustomBarElement = props => {\n const { index, pointDiameter, barX, barWidth, pointHeight, label, value, classes, scale } = props;\n\n const x = barX + (barWidth - pointDiameter) / 2;\n const y = scale.y(index) - (pointHeight - pointDiameter) / 2;\n\n return (\n <Group>\n <LinePath\n data={[{ x, y }, { x: x + pointDiameter, y: y - pointDiameter }]}\n key={`point-${label}-${value}-${index}-1`}\n className={classes.line}\n x={d => d.x}\n y={d => d.y}\n strokeWidth={pointDiameter / 5}\n />\n <LinePath\n data={[{ x, y: y - pointDiameter }, { x: x + pointDiameter, y }]}\n key={`point-${label}-${value}-${index}-2`}\n className={classes.line}\n x={d => d.x}\n y={d => d.y}\n strokeWidth={pointDiameter / 5}\n />\n </Group>\n );\n};\n\nCustomBarElement.propTypes = {\n index: PropTypes.number,\n pointDiameter: PropTypes.number,\n barX: PropTypes.number,\n barWidth: PropTypes.number,\n pointHeight: PropTypes.number,\n value: PropTypes.number,\n label: PropTypes.string,\n classes: PropTypes.object,\n scale: PropTypes.object\n};\n\nexport class LinePlot extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired\n };\n\n render() {\n const props = this.props;\n const { data, graphProps } = props;\n const { scale = {}, size = {} } = graphProps || {};\n const xBand = dataToXBand(scale.x, data, size.width, 'linePlot');\n\n return <Plot {...props} xBand={xBand} CustomBarElement={CustomBarElement} />;\n }\n}\n\nexport default () => ({\n type: 'linePlot',\n Component: LinePlot,\n name: 'Line Plot'\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"line.js","names":["CustomBarElement","props","index","pointDiameter","barX","barWidth","pointHeight","label","value","classes","scale","x","y","line","d","propTypes","PropTypes","number","string","object","LinePlot","data","graphProps","size","xBand","dataToXBand","width","React","Component","array","onChange","func","types","GraphPropsType","isRequired","type","name"],"sources":["../../src/plot/line.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { dataToXBand } from '../utils';\nimport Plot from './common/plot';\nimport { LinePath } from '@vx/shape';\nimport { Group } from '@vx/group';\n\nconst CustomBarElement = props => {\n const { index, pointDiameter, barX, barWidth, pointHeight, label, value, classes, scale } = props;\n\n const x = barX + (barWidth - pointDiameter) / 2;\n const y = scale.y(index) - (pointHeight - pointDiameter) / 2;\n\n return (\n <Group>\n <LinePath\n data={[{ x, y }, { x: x + pointDiameter, y: y - pointDiameter }]}\n key={`point-${label}-${value}-${index}-1`}\n className={classes.line}\n x={d => d.x}\n y={d => d.y}\n strokeWidth={pointDiameter / 5}\n />\n <LinePath\n data={[{ x, y: y - pointDiameter }, { x: x + pointDiameter, y }]}\n key={`point-${label}-${value}-${index}-2`}\n className={classes.line}\n x={d => d.x}\n y={d => d.y}\n strokeWidth={pointDiameter / 5}\n />\n </Group>\n );\n};\n\nCustomBarElement.propTypes = {\n index: PropTypes.number,\n pointDiameter: PropTypes.number,\n barX: PropTypes.number,\n barWidth: PropTypes.number,\n pointHeight: PropTypes.number,\n value: PropTypes.number,\n label: PropTypes.string,\n classes: PropTypes.object,\n scale: PropTypes.object\n};\n\nexport class LinePlot extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired\n };\n\n render() {\n const props = this.props;\n const { data, graphProps } = props;\n const { scale = {}, size = {} } = graphProps || {};\n const xBand = dataToXBand(scale.x, data, size.width, 'linePlot');\n\n return <Plot {...props} xBand={xBand} CustomBarElement={CustomBarElement} />;\n }\n}\n\nexport default () => ({\n type: 'linePlot',\n Component: LinePlot,\n name: 'Line Plot'\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,CAAAC,KAAK,EAAI;EAChC,IAAQC,KAAR,GAA4FD,KAA5F,CAAQC,KAAR;EAAA,IAAeC,aAAf,GAA4FF,KAA5F,CAAeE,aAAf;EAAA,IAA8BC,IAA9B,GAA4FH,KAA5F,CAA8BG,IAA9B;EAAA,IAAoCC,QAApC,GAA4FJ,KAA5F,CAAoCI,QAApC;EAAA,IAA8CC,WAA9C,GAA4FL,KAA5F,CAA8CK,WAA9C;EAAA,IAA2DC,KAA3D,GAA4FN,KAA5F,CAA2DM,KAA3D;EAAA,IAAkEC,KAAlE,GAA4FP,KAA5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AGjBT,UAAU,EAAEU,WAAA,CAAMC,cAAN,CAAqBC;AAHhB,C;;eAgBN;EAAA,OAAO;IACpBC,IAAI,EAAE,UADc;IAEpBP,SAAS,EAAER,QAFS;IAGpBgB,IAAI,EAAE;EAHc,CAAP;AAAA,C"}
|
package/lib/tool-menu.js
CHANGED
|
@@ -1,48 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = exports.ToolMenu = exports.MiniButton = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
|
-
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); } }
|
|
22
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
var _styles = require("@material-ui/core/styles");
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
37
33
|
|
|
38
|
-
function
|
|
34
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
39
35
|
|
|
40
36
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
37
|
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
|
-
|
|
44
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
45
|
-
|
|
46
38
|
var buttonStyles = function buttonStyles(theme) {
|
|
47
39
|
return {
|
|
48
40
|
root: {
|
|
@@ -107,17 +99,16 @@ MiniButton.propTypes = {
|
|
|
107
99
|
};
|
|
108
100
|
|
|
109
101
|
var ToolMenu = /*#__PURE__*/function (_React$Component) {
|
|
110
|
-
|
|
102
|
+
(0, _inherits2["default"])(ToolMenu, _React$Component);
|
|
111
103
|
|
|
112
104
|
var _super = _createSuper(ToolMenu);
|
|
113
105
|
|
|
114
106
|
function ToolMenu() {
|
|
115
|
-
|
|
116
|
-
|
|
107
|
+
(0, _classCallCheck2["default"])(this, ToolMenu);
|
|
117
108
|
return _super.apply(this, arguments);
|
|
118
109
|
}
|
|
119
110
|
|
|
120
|
-
|
|
111
|
+
(0, _createClass2["default"])(ToolMenu, [{
|
|
121
112
|
key: "render",
|
|
122
113
|
value: function render() {
|
|
123
114
|
var _this$props = this.props,
|
|
@@ -132,20 +123,16 @@ var ToolMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
132
123
|
}));
|
|
133
124
|
}
|
|
134
125
|
}]);
|
|
135
|
-
|
|
136
126
|
return ToolMenu;
|
|
137
127
|
}(_react["default"].Component);
|
|
138
128
|
|
|
139
129
|
exports.ToolMenu = ToolMenu;
|
|
140
|
-
|
|
141
|
-
_defineProperty(ToolMenu, "propTypes", {
|
|
130
|
+
(0, _defineProperty2["default"])(ToolMenu, "propTypes", {
|
|
142
131
|
className: _propTypes["default"].string,
|
|
143
132
|
addCategory: _propTypes["default"].func,
|
|
144
133
|
disabled: _propTypes["default"].bool
|
|
145
134
|
});
|
|
146
|
-
|
|
147
|
-
_defineProperty(ToolMenu, "defaultProps", {});
|
|
148
|
-
|
|
135
|
+
(0, _defineProperty2["default"])(ToolMenu, "defaultProps", {});
|
|
149
136
|
var _default = ToolMenu;
|
|
150
137
|
exports["default"] = _default;
|
|
151
138
|
//# sourceMappingURL=tool-menu.js.map
|
package/lib/tool-menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-menu.js","names":["buttonStyles","theme","root","backgroundColor","color","background","text","border","secondary","secondaryLight","fontSize","typography","selected","primaryDark","notSelected","primary","disabled","MiniButton","withStyles","props","classes","className","value","onClick","cn","propTypes","PropTypes","bool","string","disabledClassName","func","ToolMenu","addCategory","classNames","React","Component"],"sources":["../src/tool-menu.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { color } from '@pie-lib/render-ui';\n\nimport { withStyles } from '@material-ui/core/styles';\nimport cn from 'classnames';\nimport Button from '@material-ui/core/Button';\n\nconst buttonStyles = theme => ({\n root: {\n backgroundColor: color.background(),\n color: color.text(),\n border: `1px solid ${color.secondary()}`,\n '&:hover': {\n backgroundColor: color.secondaryLight()\n },\n fontSize: theme.typography.fontSize\n },\n selected: {\n backgroundColor: color.background(),\n '& span': {\n color: color.primaryDark()\n }\n },\n notSelected: {\n '& span': {\n color: color.primary()\n },\n backgroundColor: color.background()\n },\n disabled: {\n '& span': {\n color: color.primary()\n },\n backgroundColor: color.disabled()\n }\n});\n\nexport const MiniButton = withStyles(buttonStyles)(props => {\n const { disabled, classes, className, selected, value, onClick } = props;\n return (\n <Button\n size=\"small\"\n disabled={disabled}\n color={selected ? 'secondary' : 'default'}\n className={cn(classes.root, selected && classes.selected, className)}\n classes={{ disabled: cn(disabled && classes.disabled) }}\n value={value}\n key={value}\n variant=\"outlined\"\n onClick={onClick}\n >\n {value}\n </Button>\n );\n});\nMiniButton.propTypes = {\n disabled: PropTypes.bool,\n className: PropTypes.string,\n disabledClassName: PropTypes.string,\n selected: PropTypes.bool,\n value: PropTypes.string,\n onClick: PropTypes.func\n};\n\nexport class ToolMenu extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n addCategory: PropTypes.func,\n disabled: PropTypes.bool\n };\n\n static defaultProps = {};\n\n render() {\n const { className, disabled, addCategory } = this.props;\n\n return (\n <div className={classNames(className)}>\n {!disabled && <MiniButton value={'Add Category'} onClick={addCategory} />}\n </div>\n );\n }\n}\n\nexport default ToolMenu;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-menu.js","names":["buttonStyles","theme","root","backgroundColor","color","background","text","border","secondary","secondaryLight","fontSize","typography","selected","primaryDark","notSelected","primary","disabled","MiniButton","withStyles","props","classes","className","value","onClick","cn","propTypes","PropTypes","bool","string","disabledClassName","func","ToolMenu","addCategory","classNames","React","Component"],"sources":["../src/tool-menu.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { color } from '@pie-lib/render-ui';\n\nimport { withStyles } from '@material-ui/core/styles';\nimport cn from 'classnames';\nimport Button from '@material-ui/core/Button';\n\nconst buttonStyles = theme => ({\n root: {\n backgroundColor: color.background(),\n color: color.text(),\n border: `1px solid ${color.secondary()}`,\n '&:hover': {\n backgroundColor: color.secondaryLight()\n },\n fontSize: theme.typography.fontSize\n },\n selected: {\n backgroundColor: color.background(),\n '& span': {\n color: color.primaryDark()\n }\n },\n notSelected: {\n '& span': {\n color: color.primary()\n },\n backgroundColor: color.background()\n },\n disabled: {\n '& span': {\n color: color.primary()\n },\n backgroundColor: color.disabled()\n }\n});\n\nexport const MiniButton = withStyles(buttonStyles)(props => {\n const { disabled, classes, className, selected, value, onClick } = props;\n return (\n <Button\n size=\"small\"\n disabled={disabled}\n color={selected ? 'secondary' : 'default'}\n className={cn(classes.root, selected && classes.selected, className)}\n classes={{ disabled: cn(disabled && classes.disabled) }}\n value={value}\n key={value}\n variant=\"outlined\"\n onClick={onClick}\n >\n {value}\n </Button>\n );\n});\nMiniButton.propTypes = {\n disabled: PropTypes.bool,\n className: PropTypes.string,\n disabledClassName: PropTypes.string,\n selected: PropTypes.bool,\n value: PropTypes.string,\n onClick: PropTypes.func\n};\n\nexport class ToolMenu extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n addCategory: PropTypes.func,\n disabled: PropTypes.bool\n };\n\n static defaultProps = {};\n\n render() {\n const { className, disabled, addCategory } = this.props;\n\n return (\n <div className={classNames(className)}>\n {!disabled && <MiniButton value={'Add Category'} onClick={addC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vBJ,Q,eACQ;EACjBV,SAAS,EAAEK,qBAAA,CAAUE,MADJ;EAEjBI,WAAW,EAAEN,qBAAA,CAAUI,IAFN;EAGjBd,QAAQ,EAAEU,qBAAA,CAAUC;AAHH,C;iCADRI,Q,kBAOW,E;eAaTA,Q"}
|
package/lib/utils.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.tickCount = exports.point = exports.getTopPadding = exports.getTickValues = exports.getRotateAngle = exports.getGridLinesAndAxisByChartType = exports.getDomainAndRangeByChartType = exports.dataToXBand = exports.customLabelStep = exports.crowdedTicks = exports.bounds = exports.bandKey = void 0;
|
|
7
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
8
12
|
var _scale = require("@vx/scale");
|
|
9
13
|
|
|
10
14
|
var _plot = require("@pie-lib/plot");
|
|
11
15
|
|
|
12
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
17
|
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
15
|
-
|
|
16
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
19
|
|
|
18
20
|
var tickCount = _plot.utils.tickCount;
|
|
19
21
|
exports.tickCount = tickCount;
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["tickCount","utils","bounds","point","bandKey","d","index","label","dataToXBand","scaleX","data","width","type","scaleBand","rangeRound","domain","map","padding","scalePoint","range","getTickValues","prop","tickValues","tickVal","min","max","push","Math","round","step","customLabelStep","rangeMax","size","labelFontSize","ceilMax","ceil","segmentLength","height","ticksToFitInOneSegment","tickWidthPerSegment","rawLabelStep","roundedStep","labelStep","crowdedTicks","numberOfSegments","modulo","a","b","Number","isInteger","decimals","toString","split","pop","length","aux","pow","getDomainAndRangeByChartType","chartType","isNaN","crowded","intMin","intMax","getGridLinesAndAxisByChartType","verticalLines","undefined","horizontalLines","leftAxis","getRotateAngle","fontSize","getTopPadding","barWidth"],"sources":["../src/utils.js"],"sourcesContent":["import { scaleBand, scalePoint } from '@vx/scale';\nimport { utils } from '@pie-lib/plot';\n\nexport const tickCount = utils.tickCount;\nexport const bounds = utils.bounds;\nexport const point = utils.point;\n\nexport const bandKey = (d, index) => `${index}-${d.label || '-'}`;\n\nexport const dataToXBand = (scaleX, data, width, type) => {\n switch (type) {\n case 'bar':\n case 'dotPlot':\n case 'linePlot':\n return scaleBand({\n rangeRound: [0, width],\n domain: data && data.map(bandKey),\n padding: 0.2\n });\n case 'histogram':\n return scaleBand({\n rangeRound: [0, width],\n domain: data && data.map(bandKey),\n padding: 0\n });\n case 'lineCross':\n case 'lineDot':\n return scalePoint({\n domain: data && data.map(bandKey),\n rangeRound: [0, width]\n });\n default:\n return scaleBand({\n range: [0, width],\n domain: data && data.map(bandKey),\n padding: 0\n });\n }\n};\n\nexport const getTickValues = (prop = {}) => {\n const tickValues = [];\n let tickVal = prop.min;\n\n while (tickVal <= prop.max) {\n tickValues.push(tickVal);\n tickVal = Math.round((tickVal + prop.step) * 100) / 100;\n }\n\n return tickValues;\n};\n\nexport const customLabelStep = (rangeMax, size, labelFontSize) => {\n const ceilMax = Math.ceil(rangeMax);\n const segmentLength = size.height / ceilMax;\n const ticksToFitInOneSegment = 2;\n\n // how many ticksWidth fit in a segment\n const tickWidthPerSegment = segmentLength / labelFontSize;\n const rawLabelStep = ticksToFitInOneSegment / tickWidthPerSegment;\n const roundedStep = Math.ceil((rawLabelStep * 10) / 10);\n\n let labelStep;\n\n if (rawLabelStep > 0.15) {\n labelStep = roundedStep;\n } else if (rawLabelStep < 0.05) {\n labelStep = 0.1;\n } else {\n labelStep = 0.5;\n }\n\n return labelStep;\n};\n\nexport const crowdedTicks = (rangeMax, customLabelStep, size, labelFontSize) => {\n const ceilMax = Math.ceil(rangeMax);\n\n const numberOfSegments = ceilMax * customLabelStep;\n\n return size.height / numberOfSegments < labelFontSize && size.height / numberOfSegments > 0.5;\n};\n\n// multiply values with 10^number_of_decimals if needed because modulo function(%) is only defined for integers\nconst modulo = (a, b) => {\n if (Number.isInteger(b)) {\n return a % b;\n }\n\n const decimals = b\n .toString()\n .split('.')\n .pop().length;\n const aux = Math.pow(10, decimals);\n\n return (a * aux) % (b * aux);\n};\n\nexport const getDomainAndRangeByChartType = (domain, range, size, chartType, labelFontSize) => {\n let { step, labelStep, min, max } = range || {};\n\n if (!min) {\n min = 0;\n }\n\n if (!max || max < 0) {\n max = range.min + 1;\n }\n\n if (labelStep && !step) {\n step = labelStep;\n }\n if (!labelStep || (isNaN(labelStep) && step)) {\n let customLabelStep = step;\n let crowded = crowdedTicks(max, customLabelStep, size, labelFontSize);\n\n if (crowded) {\n customLabelStep = customLabelStep * 2;\n }\n\n labelStep = customLabelStep;\n }\n\n if (!step || (isNaN(step) && !labelStep) || isNaN(labelStep)) {\n labelStep = customLabelStep(max, size, labelFontSize);\n\n if (labelStep <= 1) {\n step = labelStep;\n } else if (labelStep <= 4) {\n step = 1;\n } else if (labelStep > 4 && labelStep < 10) {\n step = labelStep / 2;\n } else {\n step = labelStep / 3;\n }\n }\n\n if (modulo(max, step) !== 0) {\n max = max + step;\n }\n\n range.max = max;\n\n switch (chartType) {\n // if chart is dot plot or line plot, we should ignore step and make sure that min & max are integer values\n case 'dotPlot':\n case 'linePlot': {\n const intMin = Math.round(min);\n const intMax = Math.round(max);\n\n return {\n domain: {\n ...domain,\n step: 1,\n labelStep: 1,\n min: 0,\n max: 1\n },\n range: {\n ...range,\n min: intMin,\n max: intMin === intMax ? intMin + 1 : intMax,\n labelStep,\n step: 1\n }\n };\n }\n default:\n return {\n domain: {\n ...domain,\n step: 1,\n labelStep: 1,\n min: 0,\n max: 1\n },\n range: {\n ...range,\n labelStep,\n step\n }\n };\n }\n};\n\nexport const getGridLinesAndAxisByChartType = (range, chartType) => {\n switch (chartType) {\n case 'lineDot':\n case 'lineCross':\n return {\n verticalLines: undefined,\n horizontalLines: getTickValues(range),\n leftAxis: true\n };\n case 'dotPlot':\n case 'linePlot':\n return {\n verticalLines: [],\n horizontalLines: [],\n leftAxis: false\n };\n default:\n return {\n verticalLines: [],\n horizontalLines: getTickValues(range),\n leftAxis: true\n };\n }\n};\n\nexport const getRotateAngle = (fontSize, height) => {\n if (height >= fontSize * 2) {\n return 25;\n }\n\n return 0;\n};\n\nexport const getTopPadding = barWidth => {\n if (barWidth < 30) {\n return 50;\n }\n\n if (barWidth < 40) {\n return 30;\n }\n\n if (barWidth < 60) {\n return 15;\n }\n\n return 0;\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;AAEO,IAAMA,SAAS,GAAGC,WAAA,CAAMD,SAAxB;;AACA,IAAME,MAAM,GAAGD,WAAA,CAAMC,MAArB;;AACA,IAAMC,KA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C,aAAa,GAAG,SAAhBA,aAAgB,CAAAC,QAAQ,EAAI;EACvC,IAAIA,QAAQ,GAAG,EAAf,EAAmB;IACjB,OAAO,EAAP;EACD;;EAED,IAAIA,QAAQ,GAAG,EAAf,EAAmB;IACjB,OAAO,EAAP;EACD;;EAED,IAAIA,QAAQ,GAAG,EAAf,EAAmB;IACjB,OAAO,EAAP;EACD;;EAED,OAAO,CAAP;AACD,CAdM"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":["tickCount","utils","bounds","point","bandKey","d","index","label","dataToXBand","scaleX","data","width","type","scaleBand","rangeRound","domain","map","padding","scalePoint","range","getTickValues","prop","tickValues","tickVal","min","max","push","Math","round","step","customLabelStep","rangeMax","size","labelFontSize","ceilMax","ceil","segmentLength","height","ticksToFitInOneSegment","tickWidthPerSegment","rawLabelStep","roundedStep","labelStep","crowdedTicks","numberOfSegments","modulo","a","b","Number","isInteger","decimals","toString","split","pop","length","aux","pow","getDomainAndRangeByChartType","chartType","isNaN","crowded","intMin","intMax","getGridLinesAndAxisByChartType","verticalLines","undefined","horizontalLines","leftAxis","getRotateAngle","fontSize","getTopPadding","barWidth"],"sources":["../src/utils.js"],"sourcesContent":["import { scaleBand, scalePoint } from '@vx/scale';\nimport { utils } from '@pie-lib/plot';\n\nexport const tickCount = utils.tickCount;\nexport const bounds = utils.bounds;\nexport const point = utils.point;\n\nexport const bandKey = (d, index) => `${index}-${d.label || '-'}`;\n\nexport const dataToXBand = (scaleX, data, width, type) => {\n switch (type) {\n case 'bar':\n case 'dotPlot':\n case 'linePlot':\n return scaleBand({\n rangeRound: [0, width],\n domain: data && data.map(bandKey),\n padding: 0.2\n });\n case 'histogram':\n return scaleBand({\n rangeRound: [0, width],\n domain: data && data.map(bandKey),\n padding: 0\n });\n case 'lineCross':\n case 'lineDot':\n return scalePoint({\n domain: data && data.map(bandKey),\n rangeRound: [0, width]\n });\n default:\n return scaleBand({\n range: [0, width],\n domain: data && data.map(bandKey),\n padding: 0\n });\n }\n};\n\nexport const getTickValues = (prop = {}) => {\n const tickValues = [];\n let tickVal = prop.min;\n\n while (tickVal <= prop.max) {\n tickValues.push(tickVal);\n tickVal = Math.round((tickVal + prop.step) * 100) / 100;\n }\n\n return tickValues;\n};\n\nexport const customLabelStep = (rangeMax, size, labelFontSize) => {\n const ceilMax = Math.ceil(rangeMax);\n const segmentLength = size.height / ceilMax;\n const ticksToFitInOneSegment = 2;\n\n // how many ticksWidth fit in a segment\n const tickWidthPerSegment = segmentLength / labelFontSize;\n const rawLabelStep = ticksToFitInOneSegment / tickWidthPerSegment;\n const roundedStep = Math.ceil((rawLabelStep * 10) / 10);\n\n let labelStep;\n\n if (rawLabelStep > 0.15) {\n labelStep = roundedStep;\n } else if (rawLabelStep < 0.05) {\n labelStep = 0.1;\n } else {\n labelStep = 0.5;\n }\n\n return labelStep;\n};\n\nexport const crowdedTicks = (rangeMax, customLabelStep, size, labelFontSize) => {\n const ceilMax = Math.ceil(rangeMax);\n\n const numberOfSegments = ceilMax * customLabelStep;\n\n return size.height / numberOfSegments < labelFontSize && size.height / numberOfSegments > 0.5;\n};\n\n// multiply values with 10^number_of_decimals if needed because modulo function(%) is only defined for integers\nconst modulo = (a, b) => {\n if (Number.isInteger(b)) {\n return a % b;\n }\n\n const decimals = b\n .toString()\n .split('.')\n .pop().length;\n const aux = Math.pow(10, decimals);\n\n return (a * aux) % (b * aux);\n};\n\nexport const getDomainAndRangeByChartType = (domain, range, size, chartType, labelFontSize) => {\n let { step, labelStep, min, max } = range || {};\n\n if (!min) {\n min = 0;\n }\n\n if (!max || max < 0) {\n max = range.min + 1;\n }\n\n if (labelStep && !step) {\n step = labelStep;\n }\n if (!labelStep || (isNaN(labelStep) && step)) {\n let customLabelStep = step;\n let crowded = crowdedTicks(max, customLabelStep, size, labelFontSize);\n\n if (crowded) {\n customLabelStep = customLabelStep * 2;\n }\n\n labelStep = customLabelStep;\n }\n\n if (!step || (isNaN(step) && !labelStep) || isNaN(labelStep)) {\n labelStep = customLabelStep(max, size, labelFontSize);\n\n if (labelStep <= 1) {\n step = labelStep;\n } else if (labelStep <= 4) {\n step = 1;\n } else if (labelStep > 4 && labelStep < 10) {\n step = labelStep / 2;\n } else {\n step = labelStep / 3;\n }\n }\n\n if (modulo(max, step) !== 0) {\n max = max + step;\n }\n\n range.max = max;\n\n switch (chartType) {\n // if chart is dot plot or line plot, we should ignore step and make sure that min & max are integer values\n case 'dotPlot':\n case 'linePlot': {\n const intMin = Math.round(min);\n const intMax = Math.round(max);\n\n return {\n domain: {\n ...domain,\n step: 1,\n labelStep: 1,\n min: 0,\n max: 1\n },\n range: {\n ...range,\n min: intMin,\n max: intMin === intMax ? intMin + 1 : intMax,\n labelStep,\n step: 1\n }\n };\n }\n default:\n return {\n domain: {\n ...domain,\n step: 1,\n labelStep: 1,\n min: 0,\n max: 1\n },\n range: {\n ...range,\n labelStep,\n step\n }\n };\n }\n};\n\nexport const getGridLinesAndAxisByChartType = (range, chartType) => {\n switch (chartType) {\n case 'lineDot':\n case 'lineCross':\n return {\n verticalLines: undefined,\n horizontalLines: getTickValues(range),\n leftAxis: true\n };\n case 'dotPlot':\n case 'linePlot':\n return {\n verticalLines: [],\n horizontalLines: [],\n leftAxis: false\n };\n default:\n return {\n verticalLines: [],\n horizontalLines: getTickValues(range),\n leftAxis: true\n };\n }\n};\n\nexport const getRotateAngle = (fontSize, height) => {\n if (height >= fontSize * 2) {\n return 25;\n }\n\n return 0;\n};\n\nexport const getTopPadding = barWidth => {\n if (barWidth < 30) {\n return 50;\n }\n\n if (barWidth < 40) {\n return 30;\n }\n\n if (barWidth < 60) {\n return 15;\n }\n\n return 0;\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;;;;;AAEO,IAAMA,SAAS,GAAGC,WAAA,CAAMD,SAAxB;;AACA,IAAME,MAAM,GAAGD,WAAA,CAAMC,MAArB;;AACA,IAAMC,KAAK,GAAGF,WAAA,CAAME,KAApB;;;AAEA,IAAMC,OAAO,GAAG,SAAVA,OA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AQ,GAAG,EAAf,EAAmB;IACjB,OAAO,EAAP;EACD;;EAED,IAAIA,QAAQ,GAAG,EAAf,EAAmB;IACjB,OAAO,EAAP;EACD;;EAED,IAAIA,QAAQ,GAAG,EAAf,EAAmB;IACjB,OAAO,EAAP;EACD;;EAED,OAAO,CAAP;AACD,CAdM"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "4.5.11-next.
|
|
6
|
+
"version": "4.5.11-next.457+af6f4d76",
|
|
7
7
|
"description": "charting",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^16.8.1"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "af6f4d76ab7a6dfc670448bf0ccac6b86b6f5704"
|
|
47
47
|
}
|