Commit 40a80674 authored by Marc Duez's avatar Marc Duez Committed by Mathieu Giraud

graph.js : graph_menu (work in progress)

- possibilty to put away a point by drag and drop over label "others"
- TODO a menu to take them back
parent f26e7db3
......@@ -204,6 +204,21 @@ max-height: calc(~"100%" - @margin)
fill : @select;
}
.graph_menu{
position: absolute;
top: 2px;
right: 2px;
width: 45px;
height: 20px;
text-align: center;
border: solid;
border-color: @border;
background : @background;
}
.graph_menu:hover{
background : @highlight;
}
/*style scatterPlot element*/
.background_sp{
......
......@@ -57,7 +57,9 @@ Graph.prototype = {
init: function () {
document.getElementById(this.id)
.innerHTML = "";
this.build_menu()
var self = this;
this.vis = d3.select("#" + this.id)
.append("svg:svg")
......@@ -181,6 +183,27 @@ Graph.prototype = {
this.resize();
},
build_menu : function() {
var self = this;
var parent = document.getElementById(this.id)
var div = document.createElement('div')
div.id = "" + this.id + "_menu"
div.className = "graph_menu"
div.appendChild(document.createTextNode("others"))
parent.appendChild(div)
this.vis = d3.select("#" + this.id + "_menu")
.on("mouseup", function () {
self.stopDrag2()
})
.on("mousemove", function () {
self.dragTimePoint()
})
},
initAxis: function () {
......@@ -528,7 +551,7 @@ Graph.prototype = {
/*
*
* */
stopDrag: function (time_point) {
stopDrag: function () {
if (this.drag_on) {
this.drag_on = false;
......@@ -559,6 +582,27 @@ Graph.prototype = {
this.m.changeTimeOrder(result)
}
},
/*
*
* */
stopDrag2: function () {
console.log("plop!!!!")
if (this.drag_on) {
this.drag_on = false;
var result = []
for (var i=0; i<this.m.time_order.length; i++){
if (this.m.time_order[i] != this.draged_time_point){
result.push(this.m.time_order[i])
}
}
console.log(result)
this.m.t = result[0]
this.m.changeTimeOrder(result)
}
},
/*
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment