Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
CurvedLines
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
CurvedLines
Commits
27ea9749
Commit
27ea9749
authored
Jul 21, 2013
by
michael
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added a test / example for tool tips
parent
84d7785c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
0 deletions
+105
-0
testTooltip.htm
tests/testTooltip.htm
+105
-0
No files found.
tests/testTooltip.htm
0 → 100644
View file @
27ea9749
<hmtl>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=iso-8859-1"
/>
<title>
CurvedLines Plugin for flot
</title>
<script
type=
"text/javascript"
src=
"jquery-1.5.1.min.js"
></script>
<script
type=
"text/javascript"
src=
"jquery-ui-1.8.12.custom.min.js"
></script>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="flot/excanvas.min.js"></script><![endif]-->
<script
language=
"javascript"
type=
"text/javascript"
src=
"flot/jquery.flot.js"
></script>
<script
language=
"JavaScript"
type=
"text/javascript"
src=
"curvedLines.js"
></script>
</head>
<body>
<div
id=
"placeholder"
style=
"width: 800;height: 400;"
></div>
<script
language=
"javascript"
type=
"text/javascript"
>
$
(
function
()
{
var
data
=
[
{
label
:
[[
"Label 1"
],
[
"Label 2"
],
[
"Label 3"
]],
data
:
[[
10
,
10
],
[
20
,
14
],
[
30
,
12
]],
},
{
label
:
[[
"Label 1_2"
],
[
"Label 2_2"
],
[
"Label 3_2"
]],
data
:
[[
8
,
12
],
[
22
,
18
],
[
25
,
12
]],
}
];
var
series
=
[
{
data
:
data
[
0
].
data
,
label
:
data
[
0
].
label
,
curvedLines
:
{
apply
:
true
},
clickable
:
false
,
hoverable
:
false
},
{
data
:
data
[
0
].
data
,
label
:
data
[
0
].
label
,
points
:
{
show
:
true
}
},
{
data
:
data
[
1
].
data
,
label
:
data
[
1
].
label
,
lines
:
{
show
:
true
},
points
:
{
show
:
true
}
}
];
//general options
var
options
=
{
series
:
{
curvedLines
:
{
active
:
true
},
lines
:
{
lineWidth
:
5
},
points
:
{
radius
:
4
}
},
legend
:
{
show
:
false
},
grid
:
{
borderWidth
:
2
,
clickable
:
true
,
hoverable
:
true
,
autoHighlight
:
true
}
};
var
placeholder
=
$
(
"#placeholder"
);
var
plot
=
$
.
plot
(
placeholder
,
series
,
options
);
function
showTooltip
(
x
,
y
,
contents
)
{
$
(
'<div id="tooltip">'
+
contents
+
'</div>'
).
css
(
{
position
:
'absolute'
,
display
:
'none'
,
top
:
y
-
32
,
left
:
x
,
border
:
'none'
,
padding
:
'4px'
,
'background-color'
:
'#000'
,
'color'
:
'#fff'
,
opacity
:
0.80
}).
appendTo
(
"body"
).
fadeIn
(
20
);
}
var
previousPoint
=
null
;
$
(
"#placeholder"
).
bind
(
"plothover"
,
function
(
event
,
pos
,
item
)
{
$
(
"#x"
).
text
(
pos
.
x
.
toFixed
(
2
));
$
(
"#y"
).
text
(
pos
.
y
.
toFixed
(
2
));
if
(
item
)
{
if
(
previousPoint
!=
item
.
datapoint
)
{
previousPoint
=
item
.
datapoint
;
$
(
"#tooltip"
).
remove
();
var
x
=
item
.
datapoint
[
0
].
toFixed
(
2
),
y
=
item
.
datapoint
[
1
].
toFixed
(
2
);
showTooltip
(
item
.
pageX
,
item
.
pageY
,
item
.
series
.
label
[
item
.
dataIndex
]);
}
}
else
{
$
(
"#tooltip"
).
remove
();
previousPoint
=
null
;
}
});
});
</script>
</body>
</hmtl>
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