Commit d49a163c5816edfad03ba94e4369ca00407c40ca
1 parent
4cf497e0
Exists in
master
and in
3 other branches
Fix the resize and try to tweak the ticks some more.
Showing
2 changed files
with
14 additions
and
12 deletions
Show diff stats
web/static/js/swapp.js
... | ... | @@ -63,7 +63,12 @@ |
63 | 63 | }; |
64 | 64 | SpaceWeather.prototype.resize = function(){ |
65 | 65 | var ref$; |
66 | - return (ref$ = this.orbits) != null ? ref$.resize() : void 8; | |
66 | + if ((ref$ = this.orbits) != null) { | |
67 | + ref$.resize(); | |
68 | + } | |
69 | + return timeSeries.forEach(function(ts){ | |
70 | + return ts.resize(); | |
71 | + }); | |
67 | 72 | }; |
68 | 73 | SpaceWeather.prototype.init = function(){ |
69 | 74 | var active_sources, res$, k, this$ = this; |
... | ... | @@ -165,7 +170,6 @@ |
165 | 170 | if (!(parameter_slug in this.parameters)) { |
166 | 171 | console.error("Unknown parameter " + parameter_slug + "."); |
167 | 172 | } |
168 | - console.info("Enabling parameter " + parameter_slug + "...", $("#time_series ." + parameter_slug)); | |
169 | 173 | this.parameters[parameter_slug].active = true; |
170 | 174 | timeSeries.forEach(function(ts){ |
171 | 175 | if (ts.parameter === parameter_slug && this$.sources[ts.source.slug].active) { |
... | ... | @@ -178,7 +182,6 @@ |
178 | 182 | if (!(parameter_slug in this.parameters)) { |
179 | 183 | console.error("Unknown parameter " + parameter_slug + "."); |
180 | 184 | } |
181 | - console.info("Disabling parameter " + parameter_slug + "..."); | |
182 | 185 | this.parameters[parameter_slug].active = false; |
183 | 186 | timeSeries.forEach(function(ts){ |
184 | 187 | if (ts.parameter === parameter_slug) { |
... | ... | @@ -238,7 +241,7 @@ |
238 | 241 | this.yScale = d3.scaleLinear().domain(d3.extent(this.data, function(d){ |
239 | 242 | return d.y; |
240 | 243 | })); |
241 | - this.xAxis = d3.axisBottom().ticks(7, ",f").tickFormat(d3.timeFormat("%Y-%m-%d")); | |
244 | + this.xAxis = d3.axisBottom().tickFormat(d3.timeFormat("%Y-%m-%d")).ticks(7); | |
242 | 245 | this.yAxis = d3.axisLeft().ticks(10); |
243 | 246 | this.line = d3.line().x(function(d){ |
244 | 247 | return this$.xScale(d.x); |
... | ... | @@ -278,8 +281,8 @@ |
278 | 281 | this.path.attr('d', this.line); |
279 | 282 | this.xAxis.scale(this.xScale); |
280 | 283 | this.yAxis.scale(this.yScale); |
281 | - this.xAxis.ticks(Math.floor(width / 60)); | |
282 | - this.yAxis.ticks(Math.floor(height / 18)); | |
284 | + this.xAxis.ticks(Math.floor(width / 90.0)); | |
285 | + this.yAxis.ticks(Math.floor(height / 18.0)); | |
283 | 286 | this.svg.select('.x.axis').attr('transform', 'translate(0,' + height + ')').call(this.xAxis); |
284 | 287 | this.svg.select('.y.axis').call(this.yAxis); |
285 | 288 | this.yAxisText.attr("y", 20 - this.margin.left).attr("x", 0 - height / 2); | ... | ... |
web/static/js/swapp.ls
... | ... | @@ -58,6 +58,7 @@ export class SpaceWeather |
58 | 58 | |
59 | 59 | resize: -> |
60 | 60 | @orbits?.resize(); |
61 | + timeSeries.forEach((ts) -> ts.resize()) | |
61 | 62 | |
62 | 63 | init: -> |
63 | 64 | active_sources = [ @sources[k] for k of @sources when @sources[k].config.active ] |
... | ... | @@ -118,15 +119,12 @@ export class SpaceWeather |
118 | 119 | |
119 | 120 | enableParameter: (parameter_slug) -> |
120 | 121 | if parameter_slug not of @parameters then console.error("Unknown parameter #{parameter_slug}.") |
121 | - console.info("Enabling parameter #{parameter_slug}...", $("\#time_series .#parameter_slug")) | |
122 | 122 | @parameters[parameter_slug].active = true |
123 | 123 | timeSeries.forEach((ts) ~> $(ts.svg.node()).show() if ts.parameter == parameter_slug && @sources[ts.source.slug].active) |
124 | -# console.log("Assertion", @sources[ts.source.slug].active == ts.source.active) | |
125 | 124 | this |
126 | 125 | |
127 | 126 | disableParameter: (parameter_slug) -> |
128 | 127 | if parameter_slug not of @parameters then console.error("Unknown parameter #{parameter_slug}.") |
129 | - console.info("Disabling parameter #{parameter_slug}...") | |
130 | 128 | @parameters[parameter_slug].active = false |
131 | 129 | timeSeries.forEach((ts) -> $(ts.svg.node()).hide() if ts.parameter == parameter_slug) |
132 | 130 | this |
... | ... | @@ -171,8 +169,9 @@ export class TimeSeries |
171 | 169 | #console.info("Y domain #{@title}", d3.extent(@data, (d) -> d.y)) |
172 | 170 | |
173 | 171 | @xAxis = d3.axisBottom() |
174 | - .ticks(7, ",f") | |
175 | 172 | .tickFormat(d3.timeFormat("%Y-%m-%d")) |
173 | + .ticks(7) | |
174 | +# .ticks(7, ",f") | |
176 | 175 | @yAxis = d3.axisLeft() |
177 | 176 | .ticks(10) |
178 | 177 | |
... | ... | @@ -263,8 +262,8 @@ export class TimeSeries |
263 | 262 | @yAxis.scale(@yScale) |
264 | 263 | |
265 | 264 | #if width < 600 then @xAxis.ticks(3) else @xAxis.ticks(7, ",f") |
266 | - @xAxis.ticks(Math.floor(width / 60)) | |
267 | - @yAxis.ticks(Math.floor(height / 18)) | |
265 | + @xAxis.ticks(Math.floor(width / 90.0)) # not working as expected | |
266 | + @yAxis.ticks(Math.floor(height / 18.0)) | |
268 | 267 | |
269 | 268 | @svg.select('.x.axis') |
270 | 269 | .attr('transform', 'translate(0,' + height + ')') | ... | ... |