Skip to content

Commit

Permalink
export selVarColor from plots into app #3
Browse files Browse the repository at this point in the history
  • Loading branch information
raprasad committed Aug 14, 2017
1 parent 195f4ed commit 90178e1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
6 changes: 3 additions & 3 deletions build/app.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import m from 'mithril';

import {bars, barsNode, barsSubset, density, densityNode} from './plots.js';
import {bars, barsNode, barsSubset, density, densityNode, selVarColor} from './plots.js';

// hostname default - the app will use it to obtain the variable metadata
// (ddi) and pre-processed data info if the file id is supplied as an
Expand Down Expand Up @@ -34,7 +34,7 @@ var dvColor = '#28a4c9';
var grayColor = '#c0c0c0';
var nomColor = '#ff6600';
export let varColor = '#f0f8ff'; // d3.rgb("aliceblue");
export let selVarColor = '#fa8072'; // d3.rgb("salmon");
//export let selVarColor = '#fa8072'; // d3.rgb("salmon");
var taggedColor = '#f5f5f5'; // d3.rgb("whitesmoke");
var timeColor = '#2d6ca2';

Expand Down
19 changes: 10 additions & 9 deletions src/plots.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
let d3Color = '#1f77b4'; // d3's default blue
export let selVarColor = '#fa8072'; // d3.rgb("salmon");

// function to use d3 to graph density plots with preprocessed data
export function density(node, div, priv) {
Expand Down Expand Up @@ -276,7 +277,7 @@ export function density(node, div, priv) {
brush2.extent([value, value]);
}

// set x position of slider center
// set x position of slider center
var xpos = x(value);
if (value > d3.max(xVals)) { // dragged past max
xpos = x(d3.max(xVals));
Expand All @@ -301,7 +302,7 @@ export function density(node, div, priv) {

export function bars(node, div, priv) {
// Histogram spacing
var barPadding = .015; // Space between bars
var barPadding = .015; // Space between bars
var topScale = 1.2; // Multiplicative factor to assign space at top within graph - currently removed from implementation
var plotXaxis = true;

Expand Down Expand Up @@ -471,7 +472,7 @@ export function bars(node, div, priv) {
.attr("x", (d, i) => x(xVals[i] - 0.5 + barPadding))
.attr("y", d => y(maxY - d))
.attr("width", rectWidth)
.attr("height", y)
.attr("height", y)
.attr("fill", "#1f77b4");

// draw error bars, threshold line and extra bin
Expand Down Expand Up @@ -742,7 +743,7 @@ export function bars(node, div, priv) {
brush.extent([value, value]);
}

// set x position of slider center
// set x position of slider center
var xpos = x(value);
if (value > maxX) { // dragged past max
xpos = x(maxX);
Expand Down Expand Up @@ -785,7 +786,7 @@ export function bars(node, div, priv) {
brush2.extent([value, value]);
}

// set x position of slider center
// set x position of slider center
var xpos = x(value);
if (value > maxX) { // dragged past max
xpos = x(maxX);
Expand Down Expand Up @@ -1004,7 +1005,7 @@ export function barsSubset(node) {
.on("mouseout", function() {
var i = this.getAttribute("name");
plotsvg.select("text#mymouseover")
.text(() => "Value: Frequency");
.text(() => "Value: Frequency");
});

if (plotXaxis) {
Expand All @@ -1017,7 +1018,7 @@ export function barsSubset(node) {
.attr("id", "mymouseover")
.attr("x", 25)
.attr("y", height + 20)
.text(() => "Value: Frequency");
.text(() => "Value: Frequency");
}

plotsvg.append("text")
Expand Down Expand Up @@ -1165,7 +1166,7 @@ export function barsNode(node, obj) {
.insert("svg", ":first-child")
.attr("x", -40)
.attr("y", -45)
.attr("id", () => myname)
.attr("id", () => myname)
.style("width", width) // set height to the height of #main.left
.style("height", height)
.append("g")
Expand All @@ -1178,6 +1179,6 @@ export function barsNode(node, obj) {
.attr("x", (d, i) => x(xVals[i] - 0.5 + barPadding))
.attr("y", d => y(maxY - d))
.attr("width", x(minX + 0.5 - 2 * barPadding)) // the "width" is the coordinate of the end of the first bar
.attr("height", y)
.attr("height", y)
.attr("fill", "#1f77b4");
}
2 changes: 1 addition & 1 deletion src/views/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function addlistener(nodes){
tagColors(myNode, nomColor);
return hexToRgba(nomColor);
}
else return hexToRgba(selVarColor);
else return hexToRgba(app.selVarColor);
} else { // dropping a variable
nodes.splice(findNode(myText)["index"], 1);
spliceLinksForNode(findNode(myText));
Expand Down

0 comments on commit 90178e1

Please sign in to comment.