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
e7634c64
Commit
e7634c64
authored
May 04, 2012
by
David Schnur
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5 from smashedpumpkin/fix-issue-520
Added a 'right' option for bar alignment.
parents
ad02cfbe
40d886f9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
7 deletions
+38
-7
API.txt
API.txt
+4
-4
jquery.flot.js
jquery.flot.js
+34
-3
No files found.
API.txt
View file @
e7634c64
...
...
@@ -564,7 +564,7 @@ Customizing the data series
bars: {
barWidth: number
align: "left" or "center"
align: "left"
, "right"
or "center"
horizontal: boolean
}
...
...
@@ -615,9 +615,9 @@ the y axis if "horizontal" is true), contrary to most other measures
that are specified in pixels. For instance, for time series the unit
is milliseconds so 24 * 60 * 60 * 1000 produces bars with the width of
a day. "align" specifies whether a bar should be left-aligned
(default)
or centered on top of the value it represents. When
"horizontal" is on, the bars are drawn horizontally, i.e. from the y
axis instead of the x axis; note that the bar end points are still
(default)
, right-aligned or centered on top of the value it represents.
When "horizontal" is on, the bars are drawn horizontally, i.e. from the
y
axis instead of the x axis; note that the bar end points are still
defined in the same way so you'll probably want to swap the
coordinates if you've been plotting vertical bars first.
...
...
jquery.flot.js
View file @
e7634c64
...
...
@@ -110,7 +110,7 @@
barWidth
:
1
,
// in units of the x axis
fill
:
true
,
fillColor
:
null
,
align
:
"left"
,
//
or "center"
align
:
"left"
,
//
"left", "right", or "center"
horizontal
:
false
},
shadowSize
:
3
...
...
@@ -668,7 +668,22 @@
if
(
s
.
bars
.
show
)
{
// make sure we got room for the bar on the dancing floor
var
delta
=
s
.
bars
.
align
==
"left"
?
0
:
-
s
.
bars
.
barWidth
/
2
;
var
delta
;
switch
(
s
.
bars
.
align
)
{
case
'left'
:
delta
=
0
;
break
;
case
'right'
:
delta
=
-
s
.
bars
.
barWidth
;
break
;
case
'center'
:
delta
=
-
s
.
bars
.
barWidth
/
2
;
break
;
default
:
throw
'Invalid bar alignment: '
+
s
.
bars
.
align
;
}
if
(
s
.
bars
.
horizontal
)
{
ymin
+=
delta
;
ymax
+=
delta
+
s
.
bars
.
barWidth
;
...
...
@@ -2210,7 +2225,23 @@
// FIXME: figure out a way to add shadows (for instance along the right edge)
ctx
.
lineWidth
=
series
.
bars
.
lineWidth
;
ctx
.
strokeStyle
=
series
.
color
;
var
barLeft
=
series
.
bars
.
align
==
"left"
?
0
:
-
series
.
bars
.
barWidth
/
2
;
var
barLeft
;
switch
(
series
.
bars
.
align
)
{
case
'left'
:
barLeft
=
0
;
break
;
case
'right'
:
barLeft
=
-
series
.
bars
.
barWidth
;
break
;
case
'center'
:
barLeft
=
-
series
.
bars
.
barWidth
/
2
;
break
;
default
:
throw
'Invalid bar alignment: '
+
series
.
bars
.
align
;
}
var
fillStyleCallback
=
series
.
bars
.
fill
?
function
(
bottom
,
top
)
{
return
getFillStyle
(
series
.
bars
,
series
.
color
,
bottom
,
top
);
}
:
null
;
plotBars
(
series
.
datapoints
,
barLeft
,
barLeft
+
series
.
bars
.
barWidth
,
0
,
fillStyleCallback
,
series
.
xaxis
,
series
.
yaxis
);
ctx
.
restore
();
...
...
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