PairedTTest.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. /* eslint-disable react/no-array-index-key */
  20. import PropTypes from 'prop-types';
  21. import React from 'react';
  22. import TTestTable, { dataPropType } from './TTestTable';
  23. import './PairedTTest.css';
  24. const propTypes = {
  25. alpha: PropTypes.number,
  26. className: PropTypes.string,
  27. data: PropTypes.objectOf(dataPropType).isRequired,
  28. groups: PropTypes.arrayOf(PropTypes.string).isRequired,
  29. liftValPrec: PropTypes.number,
  30. metrics: PropTypes.arrayOf(PropTypes.string).isRequired,
  31. pValPrec: PropTypes.number
  32. };
  33. const defaultProps = {
  34. alpha: 0.05,
  35. className: '',
  36. liftValPrec: 4,
  37. pValPrec: 6
  38. };
  39. class PairedTTest extends React.PureComponent {
  40. render() {
  41. const {
  42. className,
  43. metrics,
  44. groups,
  45. data,
  46. alpha,
  47. pValPrec,
  48. liftValPrec
  49. } = this.props;
  50. return React.createElement("div", {
  51. className: "superset-legacy-chart-paired-t-test " + className
  52. }, React.createElement("div", {
  53. className: "paired-ttest-table scrollbar-container"
  54. }, React.createElement("div", {
  55. className: "scrollbar-content"
  56. }, metrics.map((metric, i) => React.createElement(TTestTable, {
  57. key: i,
  58. metric: metric,
  59. groups: groups,
  60. data: data[metric],
  61. alpha: alpha,
  62. pValPrec: Math.min(pValPrec, 32),
  63. liftValPrec: Math.min(liftValPrec, 32)
  64. })))));
  65. }
  66. }
  67. PairedTTest.propTypes = propTypes;
  68. PairedTTest.defaultProps = defaultProps;
  69. export default PairedTTest;