preparing for color scales

This commit is contained in:
Colin Megill
2017-11-02 12:55:34 -07:00
parent cead683368
commit d5bcfbef18
+8 -6
View File
@@ -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]]
)); // ));
}); });
} }