* Query String Parser * * Original from: * http://stackoverflow.com/questions/901115/get-querystring-values-in-javascript/2880929#2880929
(query: string)
| 318 | const scale = scaleFromExtent(range[i], boxSize); |
| 319 | const gridStep = gridStepFromTickStep(step[i], scale); |
| 320 | return gridStep; |
| 321 | }); |
| 322 | } |
| 323 | |
| 324 | function snapStepFromGridStep(gridStep: [number, number]): [number, number] { |
| 325 | return [gridStep[0] / 2, gridStep[1] / 2]; |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * Given the tickStep and the graph's scale, find a |
| 330 | * grid step. |
| 331 | * Example: |
| 332 | * gridStepFromTickStep(200, 0.2) // returns 100 |
| 333 | */ |
| 334 | function gridStepFromTickStep( |
| 335 | tickStep: number, |
| 336 | scale: number, |
| 337 | ): number | null | undefined { |
| 338 | const tickWidth = tickStep * scale; |
| 339 | const x = tickStep; |
| 340 | const y = Math.pow(10, Math.floor(Math.log(x) / Math.LN10)); |