mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-10 01:20:56 +08:00
colors
This commit is contained in:
@@ -20,20 +20,21 @@ const drawLinesCanvas = (
|
|||||||
) => {
|
) => {
|
||||||
return (d) => {
|
return (d) => {
|
||||||
|
|
||||||
|
ctx.globalAlpha = .1;
|
||||||
|
|
||||||
if (colorAccessor && colorScale) {
|
if (colorAccessor && colorScale && d["__selected__"]) {
|
||||||
ctx.strokeStyle = d3.interpolateViridis(colorScale(d[colorAccessor]));
|
ctx.strokeStyle = d3.interpolateViridis(colorScale(d[colorAccessor]));
|
||||||
} else {
|
} else {
|
||||||
ctx.strokeStyle = "rgba(0,0,0,1)";
|
ctx.strokeStyle = "rgba(0,0,0,.1)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d["__selected__"]) {
|
// if () {
|
||||||
ctx.strokeStyle = "rgb(255,0,0)";
|
// ctx.strokeStyle = "rgb(0,0,0)";
|
||||||
}
|
// }
|
||||||
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
var coords = project(d, dimensions, xscale);
|
var coords = project(d, dimensions, xscale);
|
||||||
coords.forEach((p,i) => {
|
coords.forEach((p, i) => {
|
||||||
// this tricky bit avoids rendering null values as 0
|
// this tricky bit avoids rendering null values as 0
|
||||||
if (p === null) {
|
if (p === null) {
|
||||||
// this bit renders horizontal lines on the previous/next
|
// this bit renders horizontal lines on the previous/next
|
||||||
|
|||||||
@@ -98,32 +98,18 @@ export const drawGraph = (
|
|||||||
2 * Math.PI /* eAngle */
|
2 * Math.PI /* eAngle */
|
||||||
);
|
);
|
||||||
|
|
||||||
let pointIsInsideBrushBounds;
|
|
||||||
|
|
||||||
if (graphBrushSelection) {
|
|
||||||
|
|
||||||
pointIsInsideBrushBounds = (
|
|
||||||
globals.graphXScale(p[1]) >= graphBrushSelection.northwestX &&
|
|
||||||
globals.graphXScale(p[1]) <= graphBrushSelection.southeastX &&
|
|
||||||
globals.graphYScale(p[2]) >= graphBrushSelection.northwestY &&
|
|
||||||
globals.graphYScale(p[2]) <= graphBrushSelection.southeastY
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
context.globalAlpha = !graphBrushSelection || pointIsInsideBrushBounds ? 1 : .2;
|
|
||||||
|
|
||||||
if (colorAccessor && colorScale) {
|
if (colorAccessor && colorScale) {
|
||||||
context.fillStyle = d3.interpolateViridis(colorScale(
|
context.fillStyle = d3.interpolateViridis(colorScale(
|
||||||
_currentCellSelectionMap[p[0]][colorAccessor]
|
_currentCellSelectionMap[p[0]][colorAccessor]
|
||||||
));
|
));
|
||||||
|
} else {
|
||||||
|
context.fillStyle = "rgb(0,0,0)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_currentCellSelectionMap[p[0]]["__selected__"]) {
|
if (_currentCellSelectionMap[p[0]]["__selected__"]) {
|
||||||
context.fillStyle = "rgb(255,0,0)";
|
context.globalAlpha = 1;
|
||||||
} else {
|
} else {
|
||||||
context.fillStyle = "rgb(0,0,0)";
|
context.globalAlpha = .2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (i < 20) {
|
// if (i < 20) {
|
||||||
@@ -140,9 +126,7 @@ export const drawGraph = (
|
|||||||
// ));
|
// ));
|
||||||
|
|
||||||
context.fill();
|
context.fill();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const setupGraphBrush = (
|
const setupGraphBrush = (
|
||||||
|
|||||||
Vendored
+2
-1
@@ -52,7 +52,8 @@ const Controls = (state = {
|
|||||||
})
|
})
|
||||||
case "graph brush deselect":
|
case "graph brush deselect":
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
graphBrushSelection: null
|
graphBrushSelection: null,
|
||||||
|
currentCellSelection: action.newSelection
|
||||||
})
|
})
|
||||||
case "color changed":
|
case "color changed":
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
|
|||||||
Reference in New Issue
Block a user