-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abi li - more graph types #59
base: master
Are you sure you want to change the base?
Changes from all commits
a5cfeba
1dd83c6
0da16a0
256494a
00dc81e
5c7f79b
618cc0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"files.associations": { | ||
"*.ipp": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"complex": "cpp", | ||
"deque": "cpp", | ||
"list": "cpp", | ||
"string": "cpp", | ||
"unordered_map": "cpp", | ||
"unordered_set": "cpp", | ||
"vector": "cpp", | ||
"iterator": "cpp", | ||
"memory_resource": "cpp", | ||
"optional": "cpp", | ||
"string_view": "cpp", | ||
"rope": "cpp", | ||
"slist": "cpp", | ||
"initializer_list": "cpp", | ||
"stop_token": "cpp", | ||
"type_traits": "cpp", | ||
"utility": "cpp", | ||
"valarray": "cpp" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ import uuidv4 from "uuid"; | |
|
||
// the valid types | ||
import Graph from "./Graph.vue"; | ||
import GraphMinMax from "./GraphMinMax.vue"; | ||
import ControlPanel from "./ControlPanel.vue"; | ||
import Placeholder from "./Placeholder.vue"; | ||
|
||
|
@@ -54,6 +55,7 @@ export default { | |
components: { | ||
ControlPanel, | ||
Graph, | ||
GraphMinMax, | ||
Placeholder, | ||
GridLayout: VueGridLayout.GridLayout, | ||
GridItem: VueGridLayout.GridItem, | ||
|
@@ -115,6 +117,8 @@ export default { | |
this.dragOver = false; | ||
}) | ||
.on("drop", (event) => { | ||
// if (event.target.type) | ||
console.log(event.target); | ||
Comment on lines
+120
to
+121
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove debug statement |
||
var x = parseFloat(event.relatedTarget.getAttribute("data-x")); | ||
var y = parseFloat(event.relatedTarget.getAttribute("data-y")); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,13 @@ | |
icon="clock" | ||
:class="{ controlActive: useTimespan }" | ||
@click="useTimespan = !useTimespan" | ||
title="Use Timespan" | ||
/> | ||
<FlatButton | ||
icon="play" | ||
:class="{ controlActive: live }" | ||
@click="live = !live" | ||
@click="toggleLive" | ||
title="Play/Pause" | ||
/> | ||
</div> | ||
</template> | ||
|
@@ -31,6 +33,7 @@ import FlatButton from "../components/FlatButton.vue"; | |
import NumberField from "../components/NumberField.vue"; | ||
import { NamespaceQuery, Variable } from "telegraph"; | ||
import TimeChart from 'timechart' | ||
import interact from "interactjs"; | ||
|
||
|
||
export default { | ||
|
@@ -44,8 +47,10 @@ export default { | |
data() { | ||
return { | ||
variables: [], | ||
history: [], | ||
history: [[]], | ||
chart: null, | ||
srs: [], | ||
currColor: 'blue', | ||
|
||
timespan: 20, | ||
useTimespan: true, | ||
|
@@ -64,7 +69,7 @@ export default { | |
}, | ||
nodeQuery() { | ||
return this.nsQuery.contexts | ||
.extract((x) => x.name == this.history.ctx) | ||
.extract((x) => x.name == this.history[0].ctx) | ||
.fetch() | ||
.fromPath(this.data.node); | ||
}, | ||
|
@@ -80,12 +85,29 @@ export default { | |
this.width = this.$refs["chart-container"].offsetWidth; | ||
this.height = this.$refs["chart-container"].offsetHeight; | ||
this.setup(); | ||
interact(this.$refs["chart-container"]) | ||
.dropzone({ | ||
overlap: "pointer", | ||
accept: ".node-bubble", | ||
}) | ||
.on("dragenter", (event) => { | ||
this.dragOver = true; | ||
}) | ||
.on("dragleave", (event) => { | ||
this.dragOver = false; | ||
}) | ||
.on("drop", (event) => { | ||
this.drop(event.interaction.data); | ||
}); | ||
}, | ||
unmounted() {}, | ||
methods: { | ||
setup() { | ||
this.srs.push({ name : 'Series 1', data: this.history[0], color: 'blue' }); | ||
this.chart = new TimeChart(this.$refs["chart"], { | ||
series: [{ name : 'Series 1', data: this.history, color: 'blue' }], | ||
// series: [ | ||
// { name : 'Series 1', data: this.history[0], color: 'blue' }], | ||
series: this.srs, | ||
realTime: true, | ||
baseTime: Date.now() - performance.now(), | ||
xRange: { min: 0, max: 20 * 1000 }, | ||
|
@@ -95,13 +117,51 @@ export default { | |
this.chart.model.resize(this.width, this.height); | ||
}, | ||
toggleLive() { | ||
this.live = !this.live; | ||
}, | ||
updateTimespan() { | ||
}, | ||
updateScale() { | ||
}, | ||
updateVariable(v) { | ||
}, | ||
drop(data) { | ||
this.chart.dispose(); | ||
this.history.push([]); | ||
// console.log(this.history.length); | ||
this.nextColor(); | ||
|
||
this.srs.push({ | ||
name : ('Series '+(this.history.length)), | ||
data: this.history[this.history.length-1], | ||
color: this.currColor}); | ||
|
||
|
||
this.chart = new TimeChart(this.$refs["chart"], { | ||
series: this.srs, | ||
realTime: true, | ||
baseTime: Date.now() - performance.now(), | ||
xRange: { min: 0, max: 20 * 1000 }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this range hardcoded? |
||
}); | ||
|
||
this.chart.update(); | ||
}, | ||
nextColor() { | ||
switch (this.currColor) { | ||
case 'blue': | ||
this.currColor = 'red'; | ||
break; | ||
case 'red': | ||
this.currColor = 'yellow'; | ||
break; | ||
case 'yellow': | ||
this.currColor = 'blue'; | ||
break; | ||
default: | ||
this.currColor = 'red'; | ||
} | ||
} | ||
|
||
}, | ||
watch: { | ||
nodeQuery(n, o) { | ||
|
@@ -113,7 +173,13 @@ export default { | |
// callback for adding data | ||
setInterval(() => { | ||
const time = performance.now(); | ||
this.history.push({x: time, y: Math.sin(time * 0.002)}); | ||
var yVal = Math.sin(time * 0.002); | ||
// this.history[0].push({x: time, y: yVal}); | ||
if (this.live) { | ||
for (let i = 0; i < this.history.length; i++) { | ||
this.history[i].push({x : time, y : (yVal + i)}); | ||
} | ||
} | ||
Comment on lines
+176
to
+182
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use real subscription data by attaching a subscriber instead of generating data? |
||
this.chart.update(); | ||
}, 100); | ||
this.nodeQuery.register(this.updateVariable); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done via a class attribute for booleans rather than hardcoding the style