mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-04 05:48:11 +08:00
preparing for color scales
This commit is contained in:
@@ -56,13 +56,15 @@ export const drawGraph = (data, context, expressionsCountsMap) => {
|
|||||||
context.clearRect(0, 0, width, height);
|
context.clearRect(0, 0, width, height);
|
||||||
|
|
||||||
/* ! create a scale to map between expression values and colors, remove to somewhere else */
|
/* ! create a scale to map between expression values and colors, remove to somewhere else */
|
||||||
const expressionToColorScale = d3.scaleLinear()
|
// const expressionToColorScale = d3.scaleLinear()
|
||||||
.domain([0, expressionsCountsMap.maxValue])
|
// .domain([0, expressionsCountsMap.maxValue])
|
||||||
.range([1,0])
|
// .range([1,0])
|
||||||
|
|
||||||
/* shuffle the data to overcome render order hiding cells */
|
/* shuffle the data to overcome render order hiding cells */
|
||||||
data = d3.shuffle(data);
|
data = d3.shuffle(data);
|
||||||
|
|
||||||
|
console.log('drawing', data, context, expressionsCountsMap)
|
||||||
|
|
||||||
/* loop */
|
/* loop */
|
||||||
data.forEach((p, i) => {
|
data.forEach((p, i) => {
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
@@ -84,8 +86,8 @@ export const drawGraph = (data, context, expressionsCountsMap) => {
|
|||||||
// ))
|
// ))
|
||||||
// )
|
// )
|
||||||
// }
|
// }
|
||||||
context.fillStyle = d3.interpolateViridis(expressionToColorScale(
|
// context.fillStyle = d3.interpolateViridis(expressionToColorScale(
|
||||||
expressionsCountsMap[p[0]]
|
// expressionsCountsMap[p[0]]
|
||||||
));
|
// ));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user