-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44c4b75
commit 6e14cc1
Showing
14 changed files
with
121 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import * as d3 from 'd3'; | ||
import {Axis} from 'd3-axis'; | ||
|
||
import {Scale} from './scale'; | ||
import {Scale} from '../scales/scale'; | ||
|
||
export interface Axis { | ||
create(scale: Scale): void; | ||
get(): d3.svg.Axis; | ||
get(): Axis; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export {DataAxis} from './data'; | ||
export {LevelAxisLine, LevelAxisText} from './level'; | ||
export {TimeAxis} from './time'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {scaleLinear} from 'd3-scale'; | ||
|
||
import {config} from '../config'; | ||
import {Scale} from './scale'; | ||
|
||
export class DataScale implements Scale { | ||
private scale; | ||
|
||
create() { | ||
this.scale = scaleLinear().domain([0, 30000]).range([config.graphHeight, 0]); | ||
} | ||
|
||
get() { | ||
return this.scale; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export {DataScale} from './data'; | ||
export {LevelScale} from './level'; | ||
export {TimeScale} from './time'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {scaleLinear} from 'd3-scale'; | ||
|
||
import {Samples} from '../../samples'; | ||
import {config} from '../config'; | ||
import {Scale} from './scale'; | ||
|
||
export class LevelScale implements Scale { | ||
private scale; | ||
|
||
create() { | ||
this.scale = scaleLinear().range([0, config.graphWidth]); | ||
} | ||
|
||
get() { | ||
return this.scale; | ||
} | ||
|
||
update(samples: Samples) { | ||
let lastXpMark = samples.xp[samples.xp.length - 1]; | ||
this.scale.domain([0, lastXpMark]); | ||
} | ||
} |
2 changes: 0 additions & 2 deletions
2
src/client/build/graph/axes/scale.ts → src/client/build/graph/scales/scale.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import * as d3 from 'd3'; | ||
|
||
export interface Scale { | ||
create(): void; | ||
get(): any; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {scaleLinear} from 'd3-scale'; | ||
|
||
import {settings} from '../../../../../config/settings'; | ||
import {config} from '../config'; | ||
import {Scale} from './scale'; | ||
|
||
export class TimeScale implements Scale { | ||
private scale; | ||
|
||
constructor() {} | ||
|
||
create() { | ||
this.scale = scaleLinear().domain([0, settings.gameTime]).range([0, config.graphWidth]); | ||
} | ||
|
||
get() { | ||
return this.scale; | ||
} | ||
} |
Oops, something went wrong.