Commit 11662eedfb038b4937daf86b2393a64814f12f07
1 parent
355ac509
Exists in
master
and in
3 other branches
Add Y axis label on the orbits graph.
Showing
2 changed files
with
22 additions
and
7 deletions
Show diff stats
web/static/js/swapp.js
... | ... | @@ -195,7 +195,7 @@ |
195 | 195 | this.margin = { |
196 | 196 | top: 30, |
197 | 197 | right: 20, |
198 | - bottom: 40, | |
198 | + bottom: 42, | |
199 | 199 | left: 60 |
200 | 200 | }; |
201 | 201 | this.extremum = 1.11 * d3.max(this.data, function(d){ |
... | ... | @@ -213,8 +213,14 @@ |
213 | 213 | this.xAxisTitle = this.xAxisLine.append('text').attr('fill', '#000'); |
214 | 214 | this.xAxisTitle.style("text-anchor", "middle"); |
215 | 215 | this.xAxisTitle.append('tspan').text('X'); |
216 | - this.xAxisTitle.append('tspan').attr('dy', '3px').text('HEE').attr('font-size', '0.618em'); | |
216 | + this.xAxisTitle.append('tspan').attr('dy', '3px').text('HEE').attr('font-size', '8px'); | |
217 | 217 | this.xAxisTitle.append('tspan').attr('dy', '-3px').text(' (AU)'); |
218 | + this.yAxisTitle = this.yAxisLine.append('text').attr('fill', '#000'); | |
219 | + this.yAxisTitle.style("text-anchor", "middle"); | |
220 | + this.yAxisTitle.append('tspan').text('Y'); | |
221 | + this.yAxisTitle.append('tspan').attr('dy', '3px').text('HEE').attr('font-size', '8px'); | |
222 | + this.yAxisTitle.append('tspan').attr('dy', '-3px').text(' (AU)'); | |
223 | + this.yAxisTitle.attr('transform', 'rotate(-90)'); | |
218 | 224 | this.sun = this.plotWrapper.append("svg:circle"); |
219 | 225 | this.sun.append('svg:title').text("Sol"); |
220 | 226 | this.sun.attr("r", 17).style("fill", "yellow"); |
... | ... | @@ -263,8 +269,8 @@ |
263 | 269 | this.yAxis.scale(this.yScale); |
264 | 270 | this.svg.select('.x.axis').attr('transform', 'translate(0,' + height + ')').call(this.xAxis); |
265 | 271 | this.svg.select('.y.axis').call(this.yAxis); |
266 | - this.xAxisTitle.attr("x", width / 2); | |
267 | - this.xAxisTitle.attr("y", 30); | |
272 | + this.xAxisTitle.attr("x", width / 2).attr("y", 37); | |
273 | + this.yAxisTitle.attr("x", -1 * height / 2).attr("y", -30); | |
268 | 274 | return this; |
269 | 275 | }; |
270 | 276 | Orbits.prototype.resizeOrbiter = function(slug, config){ | ... | ... |
web/static/js/swapp.ls
... | ... | @@ -245,7 +245,7 @@ export class Orbits |
245 | 245 | @margin = { |
246 | 246 | top: 30, |
247 | 247 | right: 20, |
248 | - bottom: 40, | |
248 | + bottom: 42, | |
249 | 249 | left: 60 |
250 | 250 | } |
251 | 251 | |
... | ... | @@ -273,9 +273,16 @@ export class Orbits |
273 | 273 | # No : https://bugzilla.mozilla.org/show_bug.cgi?id=308338 |
274 | 274 | # @xAxisTitle.append('tspan').attr('baseline-shift', 'sub').text('HEE') |
275 | 275 | # Also, don't use em as dy units |
276 | - @xAxisTitle.append('tspan').attr('dy', '3px').text('HEE').attr('font-size', '0.618em') | |
276 | + @xAxisTitle.append('tspan').attr('dy', '3px').text('HEE').attr('font-size', '8px') | |
277 | 277 | @xAxisTitle.append('tspan').attr('dy', '-3px').text(' (AU)') |
278 | 278 | |
279 | + @yAxisTitle = @yAxisLine.append('text').attr('fill', '#000') | |
280 | + @yAxisTitle.style("text-anchor", "middle") | |
281 | + @yAxisTitle.append('tspan').text('Y') | |
282 | + @yAxisTitle.append('tspan').attr('dy', '3px').text('HEE').attr('font-size', '8px') | |
283 | + @yAxisTitle.append('tspan').attr('dy', '-3px').text(' (AU)') | |
284 | + @yAxisTitle.attr('transform', 'rotate(-90)') | |
285 | + | |
279 | 286 | @sun = @plotWrapper.append("svg:circle") |
280 | 287 | @sun.append('svg:title').text("Sol") |
281 | 288 | @sun.attr("r", 17).style("fill", "yellow") |
... | ... | @@ -340,7 +347,9 @@ export class Orbits |
340 | 347 | .call(@yAxis) |
341 | 348 | |
342 | 349 | @xAxisTitle.attr("x", width / 2) |
343 | - @xAxisTitle.attr("y", 30) | |
350 | + .attr("y", 37) | |
351 | + @yAxisTitle.attr("x", -1 * height / 2) | |
352 | + .attr("y", -30) | |
344 | 353 | |
345 | 354 | this |
346 | 355 | ... | ... |