Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
flot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HS-public
flot
Commits
fe27116b
Commit
fe27116b
authored
Mar 01, 2013
by
David Schnur
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #963 from rlinehan/selection_plugin_options
Added selection plugin options.
parents
b8b3b9cb
458656f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
jquery.flot.selection.js
jquery.flot.selection.js
+22
-6
No files found.
jquery.flot.selection.js
100644 → 100755
View file @
fe27116b
...
@@ -7,14 +7,27 @@ The plugin supports these options:
...
@@ -7,14 +7,27 @@ The plugin supports these options:
selection: {
selection: {
mode: null or "x" or "y" or "xy",
mode: null or "x" or "y" or "xy",
color: color
color: color,
shape: "round" or "miter" or "bevel",
minSize: number of pixels
}
}
Selection support is enabled by setting the mode to one of "x", "y" or "xy".
Selection support is enabled by setting the mode to one of "x", "y" or "xy".
In "x" mode, the user will only be able to specify the x range, similarly for
In "x" mode, the user will only be able to specify the x range, similarly for
"y" mode. For "xy", the selection becomes a rectangle where both ranges can be
"y" mode. For "xy", the selection becomes a rectangle where both ranges can be
specified. "color" is color of the selection (if you need to change the color
specified. "color" is color of the selection (if you need to change the color
later on, you can get to it with plot.getOptions().selection.color).
later on, you can get to it with plot.getOptions().selection.color). "shape"
is the shape of the corners of the selection.
"minSize" is the minimum size a selection can be in pixels. This value can
be customized to determine the smallest size a selection can be and still
have the selection rectangle be displayed. When customizing this value, the
fact that it refers to pixels, not axis units must be taken into account.
Thus, for example, if there is a bar graph in time mode with BarWidth set to 1
minute, setting "minSize" to 1 will not make the minimum selection size 1
minute, but rather 1 pixel. Note also that setting "minSize" to 0 will prevent
"plotunselected" events from being fired when the user clicks the mouse without
dragging.
When selection support is enabled, a "plotselected" event will be emitted on
When selection support is enabled, a "plotselected" event will be emitted on
the DOM element you passed into the plot function. The event handler gets a
the DOM element you passed into the plot function. The event handler gets a
...
@@ -32,7 +45,8 @@ parameters as the "plotselected" event, in case you want to know what's
...
@@ -32,7 +45,8 @@ parameters as the "plotselected" event, in case you want to know what's
happening while it's happening,
happening while it's happening,
A "plotunselected" event with no arguments is emitted when the user clicks the
A "plotunselected" event with no arguments is emitted when the user clicks the
mouse to remove the selection.
mouse to remove the selection. As stated above, setting "minSize" to 0 will
destroy this behavior.
The plugin allso adds the following methods to the plot object:
The plugin allso adds the following methods to the plot object:
...
@@ -274,7 +288,7 @@ The plugin allso adds the following methods to the plot object:
...
@@ -274,7 +288,7 @@ The plugin allso adds the following methods to the plot object:
}
}
function
selectionIsSane
()
{
function
selectionIsSane
()
{
var
minSize
=
5
;
var
minSize
=
plot
.
getOptions
().
selection
.
minSize
;
return
Math
.
abs
(
selection
.
second
.
x
-
selection
.
first
.
x
)
>=
minSize
&&
return
Math
.
abs
(
selection
.
second
.
x
-
selection
.
first
.
x
)
>=
minSize
&&
Math
.
abs
(
selection
.
second
.
y
-
selection
.
first
.
y
)
>=
minSize
;
Math
.
abs
(
selection
.
second
.
y
-
selection
.
first
.
y
)
>=
minSize
;
}
}
...
@@ -305,7 +319,7 @@ The plugin allso adds the following methods to the plot object:
...
@@ -305,7 +319,7 @@ The plugin allso adds the following methods to the plot object:
ctx
.
strokeStyle
=
c
.
scale
(
'a'
,
0.8
).
toString
();
ctx
.
strokeStyle
=
c
.
scale
(
'a'
,
0.8
).
toString
();
ctx
.
lineWidth
=
1
;
ctx
.
lineWidth
=
1
;
ctx
.
lineJoin
=
"round"
;
ctx
.
lineJoin
=
o
.
selection
.
shape
;
ctx
.
fillStyle
=
c
.
scale
(
'a'
,
0.4
).
toString
();
ctx
.
fillStyle
=
c
.
scale
(
'a'
,
0.4
).
toString
();
var
x
=
Math
.
min
(
selection
.
first
.
x
,
selection
.
second
.
x
)
+
0.5
,
var
x
=
Math
.
min
(
selection
.
first
.
x
,
selection
.
second
.
x
)
+
0.5
,
...
@@ -335,7 +349,9 @@ The plugin allso adds the following methods to the plot object:
...
@@ -335,7 +349,9 @@ The plugin allso adds the following methods to the plot object:
options
:
{
options
:
{
selection
:
{
selection
:
{
mode
:
null
,
// one of null, "x", "y" or "xy"
mode
:
null
,
// one of null, "x", "y" or "xy"
color
:
"#e8cfac"
color
:
"#e8cfac"
,
shape
:
"round"
,
// one of "round", "miter", or "bevel"
minSize
:
5
// minimum number of pixels
}
}
},
},
name
:
'selection'
,
name
:
'selection'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment