Skip to content

Commit

Permalink
'log' label added to the legend when logarithmic scale is applied.
Browse files Browse the repository at this point in the history
  • Loading branch information
sryazanov committed May 12, 2015
1 parent 95d2569 commit bf2e367
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<text id="current-map-label" x="100" y="20" fill="black" text-anchor="middle" cursor="pointer" font-size="14" />
<rect x="10" y="30" width="180" height="20" style="fill:url(#colorMapGradient)"/>
<text id="minLabel" x="10" y="70" fill="black" text-anchor="start" font-size="14" />
<text id="scaleLabel" x="100" y="70" fill="black" text-anchor="middle" font-size="14" />
<text id="maxLabel" x="190" y="70" fill="black" text-anchor="end" font-size="14" />
</svg>
</div>
Expand Down
1 change: 1 addition & 0 deletions js/ViewLegend.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ ViewLegend.prototype = Object.create(null, {
var workspace = this._workspace;
this._svg.getElementById('minLabel').textContent = format(workspace.minValue);
this._svg.getElementById('maxLabel').textContent = format(workspace.maxValue);
this._svg.getElementById('scaleLabel').textContent = workspace.scale.legend;

function format(x) {
return workspace.scale.function(Number(x)).toFixed(3);
Expand Down
2 changes: 2 additions & 0 deletions js/Workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Workspace.Scale = {
id: 'log',
function: Math.log10,
filter: function(x) { return x > 0.0 && x < Infinity; },
legend: 'log',
},

LINEAR: {
Expand All @@ -67,6 +68,7 @@ Workspace.Scale = {
return x;
},
filter: function(x) { return x > -Infinity && x < Infinity; },
legend: '',
}
};

Expand Down

2 comments on commit bf2e367

@theodev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something went wrong here, "log" and log-ed values are staying on the legend after switching back to linear mode

See screenshot for "example_2D_Jeramie/other/coordinates_testintensities_50percent.csv", map "order"

ili

@theodev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that changing scale only updates the rendering, does not update dat.gui (min/max) and legend. After changing scale, both dat.gui and legend are updated only when smth else is changed, e.g. hs-quantile

Please sign in to comment.