Renames the class
This commit is contained in:
parent
7301fea889
commit
7c76b1c46a
|
@ -1,7 +1,7 @@
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { useSize } from 'react-use';
|
import { useSize } from 'react-use';
|
||||||
|
|
||||||
import chart from './cdfChartd3';
|
import chart from './cdfChartD3';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param min
|
* @param min
|
||||||
|
@ -14,8 +14,16 @@ function getRandomInt(min, max) {
|
||||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param props
|
||||||
|
* @returns {*}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
function CdfChart(props) {
|
function CdfChart(props) {
|
||||||
const id = "chart-" + getRandomInt(0, 100000);
|
const id = "chart-" + getRandomInt(0, 100000);
|
||||||
|
const scale = props.scale || 'linear';
|
||||||
|
const style = !!props.width ? { width: props.width + "px" } : {};
|
||||||
|
|
||||||
const [sized, { width }] = useSize(() => {
|
const [sized, { width }] = useSize(() => {
|
||||||
return React.createElement("div", {
|
return React.createElement("div", {
|
||||||
key: "resizable-div",
|
key: "resizable-div",
|
||||||
|
@ -40,13 +48,10 @@ function CdfChart(props) {
|
||||||
.showVerticalLine(props.showVerticalLine)
|
.showVerticalLine(props.showVerticalLine)
|
||||||
.container("#" + id)
|
.container("#" + id)
|
||||||
.data({ primary: props.primaryDistribution })
|
.data({ primary: props.primaryDistribution })
|
||||||
.scale('linear')
|
.scale(scale)
|
||||||
.render();
|
.render();
|
||||||
});
|
});
|
||||||
|
|
||||||
const style = !!props.width ? { width: props.width + "px" } : {};
|
|
||||||
const key = id;
|
|
||||||
|
|
||||||
return React.createElement("div", {
|
return React.createElement("div", {
|
||||||
style: {
|
style: {
|
||||||
paddingLeft: "10px",
|
paddingLeft: "10px",
|
||||||
|
@ -54,7 +59,7 @@ function CdfChart(props) {
|
||||||
},
|
},
|
||||||
}, [
|
}, [
|
||||||
sized,
|
sized,
|
||||||
React.createElement("div", { id, style, key }),
|
React.createElement("div", { id, style, key: id }),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user