Skip to content

Commit

Permalink
Sparkline view bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
slinnarsson committed Jan 23, 2016
1 parent 66dd805 commit 201107e
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 19 deletions.
5 changes: 4 additions & 1 deletion css/loom.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ code {
a {
cursor: pointer;
}

.sparkline-label {
vertical-align: super;
margin-left: 5px;
}
.scrollable-menu {
height: auto;
max-height: 200px;
Expand Down
4 changes: 2 additions & 2 deletions js/heatmap-sidepanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export class HeatmapSidepanel extends Component {
rowAttr: name
})}>{name}</a></li>;
});
var showOptionsForRows = ["Text", "Bars", "Quantitative", "Categorical"].map((name)=> {
var showOptionsForRows = ["Text", "Bars", "Heatmap", "Categorical"].map((name)=> {
return <li key={name}><a onClick={(event)=>dispatch({
type: 'SET_HEATMAP_PROPS',
rowMode: name
})}>{name}</a></li>;
});
var showOptionsForCols = ["Text", "Bars", "Quantitative", "Categorical"].map((name)=> {
var showOptionsForCols = ["Text", "Bars", "Heatmap", "Categorical"].map((name)=> {
return <li key={name}><a onClick={(event)=>dispatch({
type: 'SET_HEATMAP_PROPS',
colMode: name
Expand Down
2 changes: 1 addition & 1 deletion js/landscape-sidepanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class LandscapeSidepanel extends Component {
</button>
<ul className="dropdown-menu">
<li key="Categorical"><a onClick={(event)=>{this.props.onColorModeChange("Categorical");}}>Categorical</a></li>
<li key="Quantitative"><a onClick={(event)=>{this.props.onColorModeChange("Quantitative");}}>Quantitative</a></li>
<li key="Heatmap"><a onClick={(event)=>{this.props.onColorModeChange("Heatmap");}}>Quantitative</a></li>
</ul>
</div>
<div className="btn-group btn-block">
Expand Down
9 changes: 5 additions & 4 deletions js/loom.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class App extends Component {
render() {
// Injected by connect() call:
const dispatch = this.props.dispatch;

const ds = this.props.dataState;

var view = <div></div>;

switch(this.props.viewState.view) {
Expand Down Expand Up @@ -53,15 +54,15 @@ class App extends Component {
onColorModeChange={(mode)=>dispatch({type: 'SET_LANDSCAPE_COLOR_MODE', mode: mode})}
onColorGeneChange={(gene)=>{
dispatch({type: 'SET_LANDSCAPE_COLOR_GENE', gene: gene});
dispatch(fetchGene(this.props.fileInfo.rowAttrs, gene));
dispatch(fetchGene(this.props.fileInfo.rowAttrs, gene, ds.genes));
}}
onXGeneChange={(gene)=>{
dispatch({type: 'SET_LANDSCAPE_X_GENE', gene: gene});
dispatch(fetchGene(this.props.fileInfo.rowAttrs, gene));
dispatch(fetchGene(this.props.fileInfo.rowAttrs, gene, ds.genes));
}}
onYGeneChange={(gene)=>{
dispatch({type: 'SET_LANDSCAPE_Y_GENE', gene: gene});
dispatch(fetchGene(this.props.fileInfo.rowAttrs, gene));
dispatch(fetchGene(this.props.fileInfo.rowAttrs, gene, ds.genes));
}}
/>
break;
Expand Down
10 changes: 5 additions & 5 deletions js/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ function viewState(state=initialViewState, action) {
const initialSparklineState = {
type: "SET_SPARKLINE_PROPS", // This will be set to the last action type

colAttr: "Tissue",
colMode: "Categorical",
colAttr: "CellID",
colMode: "Text",
orderByAttr: "(unordered)", // meaning, original order
geneMode: "Quantitative",
geneMode: "Heatmap",
genes: ""
}

Expand All @@ -40,8 +40,8 @@ const initialLandscapeState = {
xGene: "",
yCoordinate: "_tSNE2",
yGene: "",
colorAttr: "Tissue",
colorMode: "Categorical",
colorAttr: "CellID",
colorMode: "Heatmap",
colorGene: ""
}

Expand Down
2 changes: 1 addition & 1 deletion js/scatterplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Scatterplot extends React.Component {
var ymin = Math.min(...y);
var ymax = Math.max(...y);
var color = this.props.color;
var palette = (this.props.colorMode == "Quantitative" ? colors.solar9 : colors.category20);
var palette = (this.props.colorMode == "Heatmap" ? colors.solar9 : colors.category20);

// Calculate the color scale
if(color.length == 0) {
Expand Down
4 changes: 2 additions & 2 deletions js/sparkline-sidepanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class SparklineSidepanel extends Component {
</li>
);
});
var optionsForCols = ["Text", "Bars", "Quantitative", "Categorical"].map((name)=> {
var optionsForCols = ["Text", "Bars", "Heatmap", "Categorical"].map((name)=> {
return (
<li key={name}>
<a onClick={(event)=>dispatch({
Expand All @@ -48,7 +48,7 @@ export class SparklineSidepanel extends Component {
</li>
);
});
var optionsForGenes = ["Bars", "Quantitative"].map((name)=> {
var optionsForGenes = ["Bars", "Heatmap"].map((name)=> {
return (
<li key={name}>
<a onClick={(event)=>dispatch({
Expand Down
4 changes: 2 additions & 2 deletions js/sparkline-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class SparklineView extends Component {
screenRange={[0,600]}
mode={ss.geneMode}
/>
{gene}
<span className="sparkline-label">{gene}</span>
</div>
);
} else {
Expand Down Expand Up @@ -85,7 +85,7 @@ export class SparklineView extends Component {
screenRange={[0,600]}
mode={ss.colMode}
/>
{ss.colAttr}
<span className="sparkline-label">{ss.colAttr}</span>
<div>
{geneSparklines}
</div>
Expand Down
2 changes: 1 addition & 1 deletion js/sparkline.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class Sparkline extends React.Component {
if(this.props.mode == 'Bars') {
painter = new BarPainter(this.props.data, width/10);
}
if(this.props.mode == 'Quantitative') {
if(this.props.mode == 'Heatmap') {
painter = new QuantitativePainter();
}
painter.paint(context, width, height, Math.max(Math.floor(pixelsPer), 1), yoffset, data);
Expand Down

0 comments on commit 201107e

Please sign in to comment.