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
f5efa0d4
Commit
f5efa0d4
authored
May 13, 2011
by
Ole Laursen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework interacting example slightly to make DOM text update optional
parent
d60f0d47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
interacting.html
examples/interacting.html
+11
-6
No files found.
examples/interacting.html
View file @
f5efa0d4
...
...
@@ -16,13 +16,16 @@
<p>
One of the goals of Flot is to support user interactions. Try
pointing and clicking on the points.
</p>
<p
id=
"hoverdata"
>
Mouse hovers at
(
<span
id=
"x"
>
0
</span>
,
<span
id=
"y"
>
0
</span>
).
<span
id=
"clickdata"
></span></p>
<p>
<label><input
id=
"enablePosition"
type=
"checkbox"
>
Show mouse position
</label>
<span
id=
"hoverdata"
></span>
<span
id=
"clickdata"
></span>
</p>
<p>
A tooltip is easy to build with a bit of jQuery code and the
data returned from the plot.
</p>
<p><
input
id=
"enableTooltip"
type=
"checkbox"
>
Enable tooltip
</p>
<p><
label><input
id=
"enableTooltip"
type=
"checkbox"
>
Enable tooltip
</label>
</p>
<script
type=
"text/javascript"
>
$
(
function
()
{
...
...
@@ -57,8 +60,10 @@ $(function () {
var
previousPoint
=
null
;
$
(
"#placeholder"
).
bind
(
"plothover"
,
function
(
event
,
pos
,
item
)
{
$
(
"#x"
).
text
(
pos
.
x
.
toFixed
(
2
));
$
(
"#y"
).
text
(
pos
.
y
.
toFixed
(
2
));
if
(
$
(
"#enablePosition:checked"
).
length
>
0
)
{
var
str
=
"("
+
pos
.
x
.
toFixed
(
2
)
+
", "
+
pos
.
y
.
toFixed
(
2
)
+
")"
;
$
(
"#hoverdata"
).
text
(
str
);
}
if
(
$
(
"#enableTooltip:checked"
).
length
>
0
)
{
if
(
item
)
{
...
...
@@ -82,7 +87,7 @@ $(function () {
$
(
"#placeholder"
).
bind
(
"plotclick"
,
function
(
event
,
pos
,
item
)
{
if
(
item
)
{
$
(
"#clickdata"
).
text
(
"
You clicked point "
+
item
.
dataIndex
+
" in "
+
item
.
series
.
label
+
"."
);
$
(
"#clickdata"
).
text
(
"
- click point "
+
item
.
dataIndex
+
" in "
+
item
.
series
.
label
);
plot
.
highlight
(
item
.
series
,
item
.
datapoint
);
}
});
...
...
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