Skip to content

Commit

Permalink
added option "markerTooltip" with default true
Browse files Browse the repository at this point in the history
  • Loading branch information
mojoaxel committed Mar 6, 2015
1 parent 2955623 commit 37ef73f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ This plugin is based on [Joel Oughtons](https://github.com/oughton) ["Event Grap

## Versions

### 0.2.3
* added option "markerTooltip" with default `true`

### 0.2.2
* added option "markerShow" with default `true`
* added option "lineWidth" with default `1`

### 0.2.1
* registered with bower

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flot-events",
"version": "0.2.2",
"version": "0.2.3",
"homepage": "http://mojoaxel.github.io/flot-events",
"authors": [
"Alexander Wunschik",
Expand Down
5 changes: 3 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@
markerShow: false, // [true], false
}, {
eventType: "CriticalPoint",
color: "green", // e.g red, #F00, #FF0000
color: "black", // e.g red, #F00, #FF0000
markerSize: 10, //[5]px
markerShow: true, // [true], false
position: 'BOTTOM', //[TOP], BOTTOM
lineStyle: 'solid', //dotted, [dashed], solid
lineWidth: 2 //[1]px
}, {
eventType: "InflectionPoint",
color: "gray"
color: "gray",
markerTooltip: false
}];

var events = [{
Expand Down
17 changes: 13 additions & 4 deletions jquery.flot.events.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* jquery.flot.events
*
* description: Flot plugin for adding events/markers to the plot
* version: 0.2.2
* version: 0.2.3
* authors:
* Alexander Wunschik <alex@wunschik.net>
* Joel Oughton <joeloughton@gmail.com>
Expand Down Expand Up @@ -232,6 +232,12 @@
markerShow = this._types[eventTypeId].markerShow;
}

if (this._types == null || !this._types[eventTypeId] || this._types[eventTypeId].markerTooltip === undefined) {
markerTooltip = true;
} else {
markerTooltip = this._types[eventTypeId].markerTooltip;
}

if (this._types == null || !this._types[eventTypeId] || !this._types[eventTypeId].lineStyle) {
lineStyle = 'dashed'; //default line style
} else {
Expand Down Expand Up @@ -266,7 +272,6 @@
marker = $('<div class="events_marker"></div>').css({
"position": "absolute",
"left": (-markerSize-Math.round(lineWidth/2)) + "px",
"cursor": "help",
"font-size": 0,
"line-height": 0,
"width": 0,
Expand All @@ -293,6 +298,7 @@
marker.data({
"event": event
});
console.log(marker);

var mouseenter = function(){
var pos = $(this).offset();
Expand Down Expand Up @@ -323,7 +329,10 @@
that._plot.clearSelection();
};

marker.hover(mouseenter, mouseleave);
if (markerTooltip) {
marker.css({ "cursor": "help" });
marker.hover(mouseenter, mouseleave);
}
}

var drawableEvent = new DrawableEvent(
Expand Down Expand Up @@ -420,6 +429,6 @@
init: init,
options: defaultOptions,
name: "events",
version: "0.2.2"
version: "0.2.3"
});
})(jQuery);

0 comments on commit 37ef73f

Please sign in to comment.