-
Notifications
You must be signed in to change notification settings - Fork 32
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
Showing
18 changed files
with
383 additions
and
407 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 { TimeGraphComponent, TimeGraphRect } from "./time-graph-component"; | ||
|
||
export class TimeGraphAxisScale extends TimeGraphComponent { | ||
|
||
constructor(id: string, protected options: TimeGraphRect) { | ||
super(id); | ||
} | ||
|
||
render() { | ||
this.rect({ | ||
color: 0xFF0000, | ||
height: this.options.height, | ||
width: this.options.width, | ||
position: this.options.position | ||
}); | ||
console.log("render axis", this.options.width); | ||
} | ||
|
||
} |
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,34 @@ | ||
import { TimeGraphAxisScale } from "./time-graph-axis-scale"; | ||
import { TimeGraphContainer, TimeGraphContainerOptions } from "./time-graph-container"; | ||
import { TimeGraphRange } from "./time-graph-model"; | ||
import { TimeGraphStateController } from "./time-graph-state-controller"; | ||
|
||
export class TimeGraphAxis extends TimeGraphContainer { | ||
|
||
constructor(protected canvasOpts: TimeGraphContainerOptions, protected range: TimeGraphRange, protected controller: TimeGraphStateController) { | ||
super({ | ||
id: canvasOpts.id, | ||
height: canvasOpts.height, | ||
width: canvasOpts.width, | ||
backgroundColor: 0xAA30f0 | ||
}, controller); | ||
|
||
this.update(); | ||
this.controller.zoomAndPanController.addMousewheelZoomAndPan(this.canvas); | ||
} | ||
|
||
update() { | ||
this.stage.removeChildren(); | ||
const scaleComponent = new TimeGraphAxisScale(this.canvasOpts.id + '_scale', { | ||
height: 30, | ||
width: (this.range.end - this.range.start) * this._controller.zoomFactor, | ||
position: { | ||
x: this._controller.positionOffset.x, | ||
y: 0 | ||
} | ||
}); | ||
|
||
this.addChild(scaleComponent); | ||
this.controller.zoomAndPanController.addDnDZoomAndPan(scaleComponent.displayObject); | ||
} | ||
} |
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,59 @@ | ||
import { TimeGraphContainer, TimeGraphContainerOptions } from "./time-graph-container"; | ||
import { TimeGraphRowElement } from "./time-graph-row-element"; | ||
import { TimeGraphRow } from "./time-graph-row"; | ||
import { TimeGraphRowModel, TimeGraphRowElementModel, TimeGraphRange } from "./time-graph-model"; | ||
import { TimeGraphStateController } from "./time-graph-state-controller"; | ||
|
||
export class TimeGraphChart extends TimeGraphContainer { | ||
|
||
protected rows: TimeGraphRowModel[]; | ||
|
||
constructor(canvasOpts: TimeGraphContainerOptions, protected range: TimeGraphRange, controller: TimeGraphStateController) { | ||
super({ | ||
id: canvasOpts.id, | ||
height: canvasOpts.height, | ||
width: canvasOpts.width, | ||
backgroundColor: 0xFFFFFF | ||
}, controller); | ||
this.rows = []; | ||
} | ||
|
||
addRow(row: TimeGraphRowModel) { | ||
const height = 20; | ||
const rowId = 'row_' + this._stage.children.length; | ||
const rowComponent = new TimeGraphRow(rowId, { | ||
position: { | ||
x: 0, // TODO must be calculated by zoom and pan | ||
y: (height * this.rows.length) + height / 2 | ||
}, | ||
width: this.range.end | ||
}); | ||
this.addChild(rowComponent); | ||
this.rows.push(row); | ||
|
||
row.states.forEach((rowElement: TimeGraphRowElementModel, idx: number) => { | ||
const newRowElement: TimeGraphRowElementModel = { | ||
label: rowElement.label, | ||
range: { | ||
start: (rowElement.range.start * this._controller.zoomFactor) + this._controller.positionOffset.x, | ||
end: (rowElement.range.end * this._controller.zoomFactor) + this._controller.positionOffset.x | ||
} | ||
} | ||
const el = new TimeGraphRowElement(rowId + '_el_' + idx, newRowElement, rowComponent); | ||
this.addChild(el); | ||
}); | ||
} | ||
|
||
addRows(rows: TimeGraphRowModel[]) { | ||
this.rows = []; | ||
rows.forEach(row => { | ||
this.addRow(row); | ||
}) | ||
} | ||
|
||
update() { | ||
this.stage.removeChildren(); | ||
this.addRows(this.rows); | ||
} | ||
|
||
} |
Oops, something went wrong.