Skip to content
Snippets Groups Projects
Commit a3c1e160 authored by Ibrahim Roshan Kunnakkattu's avatar Ibrahim Roshan Kunnakkattu
Browse files

use only single circles

parent eccd6be6
No related branches found
No related tags found
No related merge requests found
......@@ -154,38 +154,42 @@ class Depiction {
})
const data = this.atoms.filter(x => x.value >0);
const intxWeights = weights.map(x => x.value);
const gradient = new Model.Gradient(intxWeights, colorScheme).getScales();
const q1 = d3.quantile(intxWeights, 0.25);
const q3 = d3.quantile(intxWeights, 0.75);
const color = d3[`scheme${colorScheme}`][9];
const weightMax = Number(d3.max(intxWeights));
const scale = new Model.Scale(d3.scaleLinear([0, weightMax], [10, 30]),
d3.scaleLinear([0,weightMax], ["#FFFFFF", color[7]]));
// const gradient = new Model.Gradient(intxWeights, colorScheme).getScales();
// const q1 = d3.quantile(intxWeights, 0.25);
// const q3 = d3.quantile(intxWeights, 0.75);
const firstScale = gradient.firstScale;
const secondScale = gradient.secondScale;
const thirdScale = gradient.thirdScale;
this.weight.selectAll("*").remove();
this.weight.selectAll()
.data(data)
.enter()
.each(function(x: any){
if(x.value >= q1){
d3.select(this)
.append('circle')
.attr('cx', x.position.x)
.attr('cy', x.position.y)
.attr('r', secondScale.radiusScale(x.value))
.attr('fill', secondScale.colorScale(x.value))
.attr("fill-opacity", "0.5")
if(x.value >= q3){
d3.select(this)
.append('circle')
.attr('cx', x.position.x)
.attr('cy', x.position.y)
.attr('r', thirdScale.radiusScale(x.value))
.attr('fill', thirdScale.colorScale(x.value))
.attr("fill-opacity", "0.5")
}
}
});
// const firstScale = gradient.firstScale;
// const secondScale = gradient.secondScale;
// const thirdScale = gradient.thirdScale;
// this.weight.selectAll("*").remove();
// this.weight.selectAll()
// .data(data)
// .enter()
// .each(function(x: any){
// if(x.value >= q1){
// d3.select(this)
// .append('circle')
// .attr('cx', x.position.x)
// .attr('cy', x.position.y)
// .attr('r', secondScale.radiusScale(x.value))
// .attr('fill', secondScale.colorScale(x.value))
// .attr("fill-opacity", "0.5")
// if(x.value >= q3){
// d3.select(this)
// .append('circle')
// .attr('cx', x.position.x)
// .attr('cy', x.position.y)
// .attr('r', thirdScale.radiusScale(x.value))
// .attr('fill', thirdScale.colorScale(x.value))
// .attr("fill-opacity", "0.5")
// }
// }
// });
this.weight.selectAll()
.data(data)
......@@ -194,8 +198,8 @@ class Depiction {
.attr("class", x => `${x.name}_Circles weightCircles`)
.attr("cx", x => x.position.x)
.attr("cy", x => x.position.y)
.attr("r", x => firstScale.radiusScale(x.value))
.attr("fill", x=> firstScale.colorScale(x.value))
.attr("r", x => scale.radiusScale(x.value))
.attr("fill", x=> scale.colorScale(x.value))
.attr("fill-opacity", "0.5")
.on('mouseenter', (x:Atom, i:number, g:any) => {
this.atomMouseEnterEventHandler(x, g[i], false);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment