mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-01 11:28:11 +08:00
more lint - components (#336)
* more lint * fix typo introduced in delinting * more lint * remove dead code * lint fixes * lint
This commit is contained in:
@@ -7,10 +7,10 @@ https://bl.ocks.org/SpaceActuary/2f004899ea1b2bd78d6f1dbb2febf771
|
||||
import React from "react";
|
||||
import _ from "lodash";
|
||||
import { connect } from "react-redux";
|
||||
import { kvCache } from "../../util/stateManager/";
|
||||
import { FaPaintBrush } from "react-icons/fa";
|
||||
import * as d3 from "d3";
|
||||
import memoize from "memoize-one";
|
||||
import { kvCache } from "../../util/stateManager";
|
||||
import * as globals from "../../globals";
|
||||
import actions from "../../actions";
|
||||
|
||||
@@ -33,7 +33,6 @@ class HistogramBrush extends React.Component {
|
||||
histogramCache.y = d3
|
||||
.scaleLinear()
|
||||
.range([this.height - this.marginBottom, 0]);
|
||||
// .range([height - margin.bottom, margin.top]);
|
||||
|
||||
if (obsAnnotations[0][field]) {
|
||||
// recalculate expensive stuff
|
||||
@@ -116,6 +115,7 @@ class HistogramBrush extends React.Component {
|
||||
|
||||
drawHistogram(svgRef) {
|
||||
const { obsAnnotations, field, ranges } = this.props;
|
||||
const { brush, axis } = this.state;
|
||||
const histogramCache = this.calcHistogramCache(
|
||||
obsAnnotations,
|
||||
field,
|
||||
@@ -140,8 +140,8 @@ class HistogramBrush extends React.Component {
|
||||
.attr("width", d => Math.abs(x(d.x1) - x(d.x0) - 1))
|
||||
.attr("height", d => y(0) - y(d.length / numValues));
|
||||
|
||||
if (!this.state.brush && !this.state.axis) {
|
||||
const brush = d3
|
||||
if (!brush && !axis) {
|
||||
const newBrush = d3
|
||||
.select(svgRef)
|
||||
.append("g")
|
||||
.attr("class", "brush")
|
||||
@@ -153,12 +153,6 @@ class HistogramBrush extends React.Component {
|
||||
.attr("class", "axis axis--x")
|
||||
.attr("transform", `translate(0,${this.height - this.marginBottom})`)
|
||||
.call(d3.axisBottom(x).ticks(5));
|
||||
// .append("text")
|
||||
// .attr("x", this.width - 2)
|
||||
// .attr("y", -6)
|
||||
// .attr("fill", "#000")
|
||||
// // .attr("text-anchor", "end")
|
||||
// // .text(field);
|
||||
|
||||
d3.select(svgRef)
|
||||
.selectAll(".axis--x text")
|
||||
@@ -173,14 +167,13 @@ class HistogramBrush extends React.Component {
|
||||
.selectAll(".axis--x line")
|
||||
.style("stroke", "rgb(230,230,230)");
|
||||
|
||||
this.setState({ brush, xAxis });
|
||||
this.setState({ brush: newBrush, xAxis }); // eslint-disable-line react/no-unused-state
|
||||
}
|
||||
}
|
||||
|
||||
handleColorAction() {
|
||||
const {
|
||||
obsAnnotations,
|
||||
ranges,
|
||||
dispatch,
|
||||
field,
|
||||
world,
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import * as globals from "../../globals";
|
||||
import _ from "lodash";
|
||||
import * as constants from "./constants";
|
||||
|
||||
export const calcHistogram = (ranges, allValuesForContinuousFieldAsArray) => {
|
||||
const histogramData = {};
|
||||
|
||||
histogramData.x = d3
|
||||
.scaleLinear()
|
||||
.domain([ranges.min, ranges.max])
|
||||
.range([0, constants.width]);
|
||||
|
||||
histogramData.y = d3
|
||||
.scaleLinear()
|
||||
.range([constants.height - constants.marginBottom, 0]);
|
||||
// .range([height - margin.bottom, margin.top]);
|
||||
|
||||
histogramData.bins = d3
|
||||
.histogram()
|
||||
.domain(histogramData.x.domain())
|
||||
.thresholds(40)(allValuesForContinuousFieldAsArray);
|
||||
|
||||
histogramData.numValues = allValuesForContinuousFieldAsArray.length;
|
||||
|
||||
return histogramData;
|
||||
};
|
||||
Reference in New Issue
Block a user