dce-reactkit 1.0.18 → 2.0.0

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.
Files changed (106) hide show
  1. package/.eslintrc.js +95 -0
  2. package/lib/components/LoadingSpinner.d.ts +7 -0
  3. package/lib/components/LoadingSpinner.js +39 -0
  4. package/lib/components/LoadingSpinner.js.map +1 -0
  5. package/lib/components/Modal.d.ts +69 -0
  6. package/lib/components/Modal.js +311 -0
  7. package/lib/components/Modal.js.map +1 -0
  8. package/lib/helpers/abbreviate.d.ts +9 -0
  9. package/lib/helpers/abbreviate.js +21 -0
  10. package/lib/helpers/abbreviate.js.map +1 -0
  11. package/lib/helpers/avg.d.ts +8 -0
  12. package/lib/helpers/avg.js +24 -0
  13. package/lib/helpers/avg.js.map +1 -0
  14. package/lib/helpers/ceilToNumDecimals.d.ts +9 -0
  15. package/lib/helpers/ceilToNumDecimals.js +15 -0
  16. package/lib/helpers/ceilToNumDecimals.js.map +1 -0
  17. package/lib/helpers/floorToNumDecimals.d.ts +9 -0
  18. package/lib/helpers/floorToNumDecimals.js +15 -0
  19. package/lib/helpers/floorToNumDecimals.js.map +1 -0
  20. package/lib/helpers/forceNumIntoBounds.d.ts +10 -0
  21. package/lib/helpers/forceNumIntoBounds.js +15 -0
  22. package/lib/helpers/forceNumIntoBounds.js.map +1 -0
  23. package/lib/helpers/padDecimalZeros.d.ts +10 -0
  24. package/lib/helpers/padDecimalZeros.js +30 -0
  25. package/lib/helpers/padDecimalZeros.js.map +1 -0
  26. package/lib/helpers/padZerosLeft.d.ts +9 -0
  27. package/lib/helpers/padZerosLeft.js +21 -0
  28. package/lib/helpers/padZerosLeft.js.map +1 -0
  29. package/lib/helpers/roundToNumDecimals.d.ts +9 -0
  30. package/lib/helpers/roundToNumDecimals.js +15 -0
  31. package/lib/helpers/roundToNumDecimals.js.map +1 -0
  32. package/lib/helpers/sum.d.ts +8 -0
  33. package/lib/helpers/sum.js +15 -0
  34. package/lib/helpers/sum.js.map +1 -0
  35. package/lib/helpers/waitMs.d.ts +7 -0
  36. package/lib/helpers/waitMs.js +55 -0
  37. package/lib/helpers/waitMs.js.map +1 -0
  38. package/lib/types/Variant.d.ts +15 -0
  39. package/lib/types/Variant.js +19 -0
  40. package/lib/types/Variant.js.map +1 -0
  41. package/package.json +22 -39
  42. package/src/components/LoadingSpinner.scss +50 -0
  43. package/src/components/LoadingSpinner.tsx +50 -0
  44. package/src/components/Modal.scss +48 -0
  45. package/src/components/Modal.tsx +391 -0
  46. package/src/helpers/abbreviate.tsx +23 -0
  47. package/src/helpers/avg.tsx +22 -0
  48. package/src/helpers/ceilToNumDecimals.tsx +13 -0
  49. package/src/helpers/floorToNumDecimals.tsx +13 -0
  50. package/src/helpers/forceNumIntoBounds.tsx +19 -0
  51. package/src/helpers/padDecimalZeros.tsx +32 -0
  52. package/src/helpers/padZerosLeft.tsx +21 -0
  53. package/src/helpers/roundToNumDecimals.tsx +13 -0
  54. package/src/helpers/sum.tsx +16 -0
  55. package/src/helpers/waitMs.tsx +12 -0
  56. package/src/types/Variant.tsx +16 -0
  57. package/tsconfig.json +24 -0
  58. package/Bar.js +0 -169
  59. package/Donut.js +0 -145
  60. package/DownloadButton.js +0 -81
  61. package/Histogram.js +0 -193
  62. package/Scatter.js +0 -162
  63. package/common/chart/Holder/index.js +0 -182
  64. package/common/chart/Holder/style.css +0 -41
  65. package/common/chart/colors.js +0 -12
  66. package/common/csvToString.js +0 -23
  67. package/common/isFloat.js +0 -14
  68. package/common/isInteger.js +0 -24
  69. package/common/math.js +0 -21
  70. package/common/validators.js +0 -18
  71. package/glyph/Adjust.js +0 -13
  72. package/glyph/Angle.js +0 -44
  73. package/glyph/Archive.js +0 -13
  74. package/glyph/Arrow.js +0 -49
  75. package/glyph/ArrowsHorizontal.js +0 -13
  76. package/glyph/ArrowsVertical.js +0 -13
  77. package/glyph/Award.js +0 -13
  78. package/glyph/Ban.js +0 -13
  79. package/glyph/Barcode.js +0 -13
  80. package/glyph/Bed.js +0 -13
  81. package/glyph/Bell.js +0 -35
  82. package/glyph/Bolt.js +0 -13
  83. package/glyph/Bookmark.js +0 -37
  84. package/glyph/Bug.js +0 -13
  85. package/glyph/Calendar.js +0 -13
  86. package/glyph/Check.js +0 -36
  87. package/glyph/Checkbox.js +0 -40
  88. package/glyph/Chevron.js +0 -63
  89. package/glyph/Circle.js +0 -15
  90. package/glyph/Cog.js +0 -13
  91. package/glyph/DoubleAngle.js +0 -45
  92. package/glyph/Download.js +0 -13
  93. package/glyph/Ellipsis.js +0 -36
  94. package/glyph/Envelope.js +0 -13
  95. package/glyph/File.js +0 -37
  96. package/glyph/IdCard.js +0 -13
  97. package/glyph/Menu.js +0 -13
  98. package/glyph/Minus.js +0 -13
  99. package/glyph/Move.js +0 -13
  100. package/glyph/Plus.js +0 -13
  101. package/glyph/Square.js +0 -47
  102. package/glyph/Teacher.js +0 -13
  103. package/glyph/TextAlign.js +0 -53
  104. package/glyph/Times.js +0 -36
  105. package/glyph/WarningTriangle.js +0 -13
  106. package/index.js +0 -1
package/Bar.js DELETED
@@ -1,169 +0,0 @@
1
- import React, { Component } from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- // Import rechart components
5
- import { ResponsiveContainer, BarChart as BarChartRechart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend } from 'recharts';
6
-
7
- // Import other components
8
- import Holder from './common/chart/Holder';
9
-
10
- // Import default colors
11
- import colors from './common/chart/colors';
12
-
13
- // Import helpers
14
- import csvToString from './common/csvToString';
15
-
16
- /* Bar Chart Component */
17
- class BarChart extends Component {
18
- render() {
19
- // Deconstruct props (see propTypes below for detailed information)
20
- const {
21
- title,
22
- color,
23
- width,
24
- height,
25
- nameLabel,
26
- nameUnit,
27
- valueLabel,
28
- valueUnit,
29
- data,
30
- horizontal,
31
- noTooltipOnHover,
32
- noDownload,
33
- showLegend
34
- } = this.props;
35
-
36
- // Generate csv contents if they weren't included
37
- let { csvContents } = this.props;
38
- if (!noDownload && !csvContents) {
39
- // Create the name column using the label and unit (if it's included)
40
- const nameField = `${nameLabel}${nameUnit ? ' (' + nameUnit + ')' : ''}`;
41
- // Create the value column using the label and unit (if it's included)
42
- const valueField = `${valueLabel}${valueUnit ? ' (' + valueUnit + ')' : ''}`;
43
- // Build the csv data object
44
- const csv = {
45
- fields: [nameField, valueField],
46
- data: data.map(datum => {
47
- return [datum.name, datum.value];
48
- })
49
- };
50
- // Turn the csv object into a string
51
- csvContents = csvToString(csv);
52
- }
53
-
54
- // Render the component
55
- return React.createElement(
56
- Holder,
57
- {
58
- title: title,
59
- width: width,
60
- height: height,
61
- xLabel: horizontal ? valueLabel : nameLabel,
62
- xUnit: horizontal ? valueUnit : nameUnit,
63
- yLabel: horizontal ? nameLabel : valueLabel,
64
- yUnit: horizontal ? nameUnit : valueUnit,
65
- csvContents: csvContents
66
- },
67
- React.createElement(
68
- ResponsiveContainer,
69
- {
70
- width: '100%',
71
- height: '100%'
72
- },
73
- React.createElement(
74
- BarChartRechart,
75
- {
76
- data: data.map(datum => {
77
- return {
78
- name: datum.name,
79
- [valueLabel]: datum.value
80
- };
81
- }),
82
- layout: horizontal ? 'vertical' : 'horizontal'
83
- },
84
- React.createElement(CartesianGrid, { strokeDasharray: '3 3' }),
85
- React.createElement(XAxis, {
86
- type: horizontal ? 'number' : 'category',
87
- dataKey: horizontal ? null : 'name'
88
- }),
89
- React.createElement(YAxis, {
90
- type: horizontal ? 'category' : 'number',
91
- dataKey: horizontal ? 'name' : null
92
- }),
93
- !noTooltipOnHover && React.createElement(Tooltip, null),
94
- showLegend && React.createElement(Legend, null),
95
- React.createElement(Bar, { dataKey: valueLabel, fill: color })
96
- )
97
- )
98
- );
99
- }
100
- }
101
-
102
- BarChart.propTypes = {
103
- // Title of the chart
104
- title: PropTypes.string,
105
- // Default CSS color (#123456 or 'white') for bars (can be overridden)
106
- color: PropTypes.string,
107
- // Width ('100%' or 50)
108
- width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
109
- // Height ('100%' or 50)
110
- height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
111
- // Label for the name axis
112
- nameLabel: PropTypes.string,
113
- // Unit for the name axis
114
- nameUnit: PropTypes.string,
115
- // Label for the value axis
116
- valueLabel: PropTypes.string,
117
- // Unit for the value axis
118
- valueUnit: PropTypes.string,
119
- // The data/bars
120
- data: PropTypes.arrayOf(PropTypes.shape({
121
- // Name of the bar
122
- name: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
123
- // Value of the slice (size)
124
- value: PropTypes.number.isRequired,
125
- // Color of the slice (overrides props.color)
126
- color: PropTypes.string
127
- })).isRequired,
128
- // If true, bar chart is a horizontal bar chart
129
- horizontal: PropTypes.bool,
130
- // If true, no tooltip is shown on hover
131
- noTooltipOnHover: PropTypes.bool,
132
- // If true, legend is included
133
- showLegend: PropTypes.bool,
134
- // If true, no download button is shown
135
- noDownload: PropTypes.bool,
136
- // The contents of the csv file to download (auto-generated if not included)
137
- csvContents: PropTypes.string
138
- };
139
-
140
- BarChart.defaultProps = {
141
- // No title for chart by default
142
- title: null,
143
- // Bars are a neutral blue by default
144
- color: colors.defaultBlue,
145
- // Chart takes up whole parent width by default
146
- width: '100%',
147
- // Chart is 500 pixels tall by default
148
- height: '500px',
149
- // Name axis is labeled 'Name' by default
150
- nameLabel: 'Name',
151
- // Name axis has no label by default
152
- nameUnit: null,
153
- // Value axis is labeled 'Value' by default
154
- valueLabel: 'Value',
155
- // Value axis has no label by default
156
- valueUnit: null,
157
- // The bar chart is a vertical bar chart by default
158
- horizontal: false,
159
- // Tooltips are displayed by defaults
160
- noTooltipOnHover: false,
161
- // No legend is shown by default
162
- showLegend: false,
163
- // A download button is added by default
164
- noDownload: false,
165
- // We auto-generate the csv contents by default
166
- csvContents: null
167
- };
168
-
169
- export default BarChart;
package/Donut.js DELETED
@@ -1,145 +0,0 @@
1
- import React, { Component } from 'react';
2
- import PropTypes from 'prop-types';
3
- import genUUID from 'uuid/v1';
4
-
5
- // Import rechart components
6
- import { ResponsiveContainer, PieChart, Pie, Cell, Legend, Tooltip } from 'recharts';
7
-
8
- // Import other components
9
- import Holder from './common/chart/Holder';
10
-
11
- // Import default colors
12
- import colors from './common/chart/colors';
13
-
14
- // Import helpers
15
- import csvToString from './common/csvToString';
16
-
17
- /* Donut Chart Component */
18
- class DonutChart extends Component {
19
- render() {
20
- // Deconstruct props (see propTypes below for detailed information)
21
- const {
22
- title,
23
- color,
24
- width,
25
- height,
26
- data,
27
- noTooltipOnHover,
28
- noDownload,
29
- showLegend
30
- } = this.props;
31
-
32
- // Generate csv contents for the download
33
- let csvContents;
34
- if (!noDownload) {
35
- const csv = {
36
- fields: ['Name', 'Value'],
37
- data: data.map(datum => {
38
- return [datum.name, datum.value];
39
- })
40
- };
41
- csvContents = csvToString(csv);
42
- }
43
-
44
- return React.createElement(
45
- Holder,
46
- {
47
- title: title,
48
- width: width,
49
- height: height,
50
- csvContents: csvContents
51
- },
52
- React.createElement(
53
- ResponsiveContainer,
54
- {
55
- width: '100%',
56
- height: '100%'
57
- },
58
- React.createElement(
59
- PieChart,
60
- null,
61
- showLegend && React.createElement(Legend, null),
62
- React.createElement(
63
- Pie,
64
- {
65
- data: data,
66
- dataKey: 'value',
67
- innerRadius: '60%',
68
- outerRadius: '100%',
69
- fill: color
70
- },
71
- data.map((item, index) => {
72
- // Get the item's default color
73
- let itemColor = item.color ? item.color : color;
74
-
75
- // If individual item doesn't have an override color and we
76
- // are using a color assortment, choose the next color
77
- if (itemColor === 'assortment' && !item.color) {
78
- itemColor = colors.assortment[index % colors.assortment.length];
79
- // Don't let two adjacent slices have the same color
80
- // (this math ensures that if the first and last slice are
81
- // not the same color)
82
- if ((data.length - 1) % colors.assortment.length === 0 && index === data.length - 1) {
83
- itemColor = colors.assortment[(index + Math.floor(colors.assortment.length / 2)) % colors.assortment.length];
84
- }
85
- }
86
-
87
- // Return the cell corresponding to this donut slice
88
- return React.createElement(Cell, {
89
- key: genUUID(),
90
- fill: itemColor
91
- });
92
- })
93
- ),
94
- !noTooltipOnHover && React.createElement(Tooltip, null)
95
- )
96
- )
97
- );
98
- }
99
- }
100
-
101
- DonutChart.propTypes = {
102
- // Title of the chart
103
- title: PropTypes.string,
104
- // Default CSS color (#123456 or 'white') for slices (can be overridden)
105
- // OR 'assortment' for random colors
106
- color: PropTypes.string,
107
- // Width ('100%' or 50)
108
- width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
109
- // Height ('100%' or 50)
110
- height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
111
- // The data/slices
112
- data: PropTypes.arrayOf(PropTypes.shape({
113
- // Name of the slice
114
- name: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
115
- // Value of the slice (size)
116
- value: PropTypes.number.isRequired,
117
- // Color of the slice (overrides props.color)
118
- color: PropTypes.string
119
- })).isRequired,
120
- // If true, no tooltip is shown on hover
121
- noTooltipOnHover: PropTypes.bool,
122
- // If true, legend is included
123
- showLegend: PropTypes.bool,
124
- // If true, no download button is shown
125
- noDownload: PropTypes.bool
126
- };
127
-
128
- DonutChart.defaultProps = {
129
- // Chart has no title by default
130
- title: null,
131
- // Donut slices get an assortment of colors by default
132
- color: 'assortment',
133
- // Chart takes up full parent width by default
134
- width: '100%',
135
- // Chart's height is 500px by default
136
- height: '500px',
137
- // Tooltips are displayed by default
138
- noTooltipOnHover: false,
139
- // No legend is included by default
140
- showLegend: false,
141
- // A download button is added by default
142
- noDownload: false
143
- };
144
-
145
- export default DonutChart;
package/DownloadButton.js DELETED
@@ -1,81 +0,0 @@
1
- import React, { Component } from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- // Import file download button
5
- import DownloadLink from 'react-download-link';
6
-
7
- // Import glyphs
8
- import Download from './glyph/Download';
9
-
10
- // Import bootstrap stylesheet
11
- import 'bootstrap/dist/css/bootstrap.min.css';
12
-
13
- /* Download Button Component */
14
- class DownloadButton extends Component {
15
- // Deconstruct props (see propTypes below for detailed information)
16
- render() {
17
- const {
18
- text,
19
- filename,
20
- contents,
21
- large,
22
- marginLeft,
23
- marginRight,
24
- marginTop,
25
- marginBottom
26
- } = this.props;
27
-
28
- // Render the component
29
- return React.createElement(DownloadLink, {
30
- filename: filename,
31
- exportFile: () => {
32
- return contents;
33
- },
34
- label: React.createElement(
35
- 'span',
36
- null,
37
- React.createElement(Download, { className: 'mr-2' }),
38
- text
39
- ),
40
- tagName: 'div',
41
- className: `btn btn-dark text-white${large ? ' btn-lg' : ''}`,
42
- style: {
43
- textDecoration: 'none !important',
44
- marginLeft,
45
- marginRight,
46
- marginTop,
47
- marginBottom
48
- }
49
- });
50
- }
51
- }
52
-
53
- DownloadButton.propTypes = {
54
- // The title of the button
55
- text: PropTypes.string,
56
- // The filename of the download (the name the contents are downloaded as)
57
- filename: PropTypes.string.isRequired,
58
- // The contents of the file
59
- contents: PropTypes.string.isRequired,
60
- // If true, the button is a bootstrap large button
61
- large: PropTypes.bool,
62
- // Margins for the button
63
- marginLeft: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
64
- marginRight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
65
- marginTop: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
66
- marginBottom: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
67
- };
68
-
69
- DownloadButton.defaultProps = {
70
- // Title of the button is 'Download' by default
71
- text: 'Download',
72
- // Button is a normal sized bootstrap button by default
73
- large: false,
74
- // Button has no margins by default
75
- marginLeft: null,
76
- marginRight: null,
77
- marginTop: null,
78
- marginBottom: null
79
- };
80
-
81
- export default DownloadButton;
package/Histogram.js DELETED
@@ -1,193 +0,0 @@
1
- import React, { Component } from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- // Import other components
5
- import BarChart from './Bar';
6
-
7
- // Import default colors
8
- import colors from './common/chart/colors';
9
-
10
- // Import helpers
11
- import csvToString from './common/csvToString';
12
-
13
- /* Histogram Chart Component */
14
- class Histogram extends Component {
15
- render() {
16
- // Deconstruct props (see propTypes below for detailed information)
17
- const {
18
- title,
19
- color,
20
- width,
21
- height,
22
- startValue,
23
- numBuckets,
24
- numDecimals,
25
- bucketLabel,
26
- bucketUnit,
27
- valueLabel,
28
- valueUnit,
29
- data,
30
- noTooltipOnHover,
31
- noDownload,
32
- showLegend
33
- } = this.props;
34
-
35
- // Choose end value (if none included, use largest value)
36
- let { endValue } = this.props;
37
- if (endValue === undefined || endValue === null) {
38
- endValue = Math.max(...data);
39
- }
40
-
41
- // Divide data into buckets
42
- const buckets = [];
43
- const epsilon = numDecimals === 0 ? 1 : parseFloat(`0.${'0'.repeat(numDecimals - 1)}1`);
44
- // Dynamically choose the bucket width
45
- const bucketWidth = (endValue - startValue) / numBuckets;
46
- // Set up each bucket
47
- for (let i = 0; i < numBuckets; i++) {
48
- // Define bucket start and end
49
- const bucketStart = startValue + bucketWidth * i; // inclusive
50
- const bucketEnd = startValue + bucketWidth * (i + 1); // exclusive
51
-
52
- // Generate start/end labels for the bucket
53
- const lastBucket = i === numBuckets - 1;
54
- let bucketStartName = bucketStart.toFixed(numDecimals);
55
- if (bucketStartName === '0.0') {
56
- bucketStartName = '0';
57
- } else if (bucketStartName.startsWith('0.')) {
58
- bucketStartName = bucketStartName.substring(1);
59
- }
60
- let bucketEndName = lastBucket ? bucketEnd.toFixed(numDecimals) : (parseFloat(bucketEnd.toFixed(numDecimals)) - epsilon).toFixed(numDecimals);
61
- if (bucketEndName === '0.0') {
62
- bucketEndName = '0';
63
- } else if (bucketEndName.startsWith('0.')) {
64
- bucketEndName = bucketEndName.substring(1);
65
- }
66
-
67
- // Create a bucket object {name, start, end}
68
- buckets.push({
69
- name: `${bucketStartName}-${bucketEndName}`,
70
- start: bucketStart,
71
- end: bucketEnd,
72
- value: 0
73
- });
74
- }
75
-
76
- // Put data into buckets
77
- data.forEach(value => {
78
- for (let i = 0; i < buckets.length; i++) {
79
- // If this is the last bucket, allow value to equal the end value
80
- // (inclusive)
81
- const lastBucket = i === buckets.length - 1;
82
-
83
- // Check if this value falls in this bucket
84
- if (value >= buckets[i].start && (lastBucket ? value <= buckets[i].end : value < buckets[i].end)) {
85
- // Found the correct bucket! Add another item to this bucket
86
- buckets[i].value += 1;
87
- break;
88
- }
89
- }
90
- });
91
-
92
- // Generate the downloadable csv if we have a download button
93
- let csvContents;
94
- if (!noDownload) {
95
- const bucketField = `${bucketLabel}${bucketUnit ? ' (' + bucketUnit + ')' : ''}`;
96
- const valueField = `${valueLabel}${valueUnit ? ' (' + valueUnit + ')' : ''}`;
97
- const csv = {
98
- fields: [bucketField, valueField],
99
- data: buckets.map(bucket => {
100
- return [bucket.name, bucket.value];
101
- })
102
- };
103
- csvContents = csvToString(csv);
104
- }
105
-
106
- // Render the component (it's just a bar chart)
107
- return React.createElement(BarChart, {
108
- title: title,
109
- color: color,
110
- width: width,
111
- height: height,
112
- nameLabel: bucketLabel,
113
- nameUnit: bucketUnit,
114
- valueLabel: valueLabel,
115
- valueUnit: valueUnit,
116
- noTooltipOnHover: noTooltipOnHover,
117
- showLegend: showLegend,
118
- noDownload: noDownload,
119
- csvContents: csvContents,
120
- data: buckets
121
- });
122
- }
123
- }
124
-
125
- Histogram.propTypes = {
126
- // Title of the chart
127
- title: PropTypes.string,
128
- // Default CSS color (#123456 or 'white') for slices (can be overridden)
129
- color: PropTypes.string,
130
- // Width ('100%' or 50)
131
- width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
132
- // Height ('100%' or 50)
133
- height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
134
- // The lowest value to start at (beginning of first bucket)
135
- startValue: PropTypes.number,
136
- // The highest value to count (ending of the last bucket)
137
- endValue: PropTypes.number,
138
- // The number of buckets
139
- numBuckets: PropTypes.number,
140
- // The number of decimals to display on the bucket axis
141
- numDecimals: PropTypes.number,
142
- // Label for the bucket axis
143
- bucketLabel: PropTypes.string,
144
- // Unit for the bucket axis
145
- bucketUnit: PropTypes.string,
146
- // Label for the value axis
147
- valueLabel: PropTypes.string,
148
- // Unit for the value axis
149
- valueUnit: PropTypes.string,
150
- // The numbers to chart in the histogram
151
- data: PropTypes.arrayOf(PropTypes.number).isRequired,
152
- // If true, no tooltip is shown on hover
153
- noTooltipOnHover: PropTypes.bool,
154
- // If true, legend is included
155
- showLegend: PropTypes.bool,
156
- // If true, no download button is shown
157
- noDownload: PropTypes.bool
158
- };
159
-
160
- Histogram.defaultProps = {
161
- // Chart has no title by default
162
- title: null,
163
- // Bars are neutral blue by default
164
- color: colors.defaultBlue,
165
- // Chart takes up full parent width by default
166
- width: '100%',
167
- // Chart's height is 500px by default
168
- height: '500px',
169
- // First bucket starts at 0 by default
170
- startValue: 0,
171
- // Last bucket takes on the highest value in the dataset by default
172
- endValue: null,
173
- // The data is divided into 10 buckets by default
174
- numBuckets: 10,
175
- // The bucket labels include one decimal
176
- numDecimals: 1,
177
- // The bucket axis is called 'Bucket' by default
178
- bucketLabel: 'Bucket',
179
- // The bucket axis has no unit by default
180
- bucketUnit: null,
181
- // The value axis is called 'Num in Bucket' by default
182
- valueLabel: 'Num in Bucket',
183
- // The value axis has no unit by default
184
- valueUnit: null,
185
- // Tooltips are shown by default
186
- noTooltipOnHover: false,
187
- // No legend is included by default
188
- showLegend: false,
189
- // A download button is included by default
190
- noDownload: false
191
- };
192
-
193
- export default Histogram;